method.h File Reference

#include "internal.h"

Go to the source code of this file.

Data Structures

struct  rb_method_cfunc_struct
struct  rb_method_attr_struct
struct  rb_method_definition_struct
struct  rb_method_entry_struct
struct  unlinked_method_entry_list_entry

Defines

#define END_OF_ENUMERATION(key)   END_OF_##key##_PLACEHOLDER = 0
#define NOEX_SAFE(n)   ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)
#define NOEX_WITH(n, s)   (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))
#define NOEX_WITH_SAFE(n)   NOEX_WITH((n), rb_safe_level())
#define UNDEFINED_METHOD_ENTRY_P(me)   (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)

Typedefs

typedef rb_method_cfunc_struct rb_method_cfunc_t
typedef rb_method_attr_struct rb_method_attr_t
typedef rb_iseq_struct rb_iseq_t
typedef rb_method_definition_struct rb_method_definition_t
typedef rb_method_entry_struct rb_method_entry_t

Enumerations

enum  rb_method_flag_t {
  NOEX_PUBLIC = 0x00, NOEX_NOSUPER = 0x01, NOEX_PRIVATE = 0x02, NOEX_PROTECTED = 0x04,
  NOEX_MASK = 0x06, NOEX_BASIC = 0x08, NOEX_UNDEF = NOEX_NOSUPER, NOEX_MODFUNC = 0x12,
  NOEX_SUPER = 0x20, NOEX_VCALL = 0x40, NOEX_RESPONDS = 0x80, NOEX_BIT_WIDTH = 8,
  NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4
}
enum  rb_method_type_t {
  VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_IVAR,
  VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_ZSUPER, VM_METHOD_TYPE_UNDEF, VM_METHOD_TYPE_NOTIMPLEMENTED,
  VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_MISSING, VM_METHOD_TYPE_REFINED
}

Functions

void rb_add_method_cfunc (VALUE klass, ID mid, VALUE(*func)(ANYARGS), int argc, rb_method_flag_t noex)
rb_method_entry_trb_add_method (VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex)
rb_method_entry_trb_method_entry (VALUE klass, ID id, VALUE *define_class_ptr)
rb_method_entry_trb_method_entry_at (VALUE obj, ID id)
void rb_add_refined_method_entry (VALUE refined_class, ID mid)
rb_method_entry_trb_resolve_refined_method (VALUE refinements, const rb_method_entry_t *me, VALUE *defined_class_ptr)
rb_method_entry_trb_method_entry_with_refinements (VALUE klass, ID id, VALUE *defined_class_ptr)
rb_method_entry_trb_method_entry_without_refinements (VALUE klass, ID id, VALUE *defined_class_ptr)
rb_method_entry_trb_method_entry_get_without_cache (VALUE klass, ID id, VALUE *define_class_ptr)
rb_method_entry_trb_method_entry_set (VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex)
int rb_method_entry_arity (const rb_method_entry_t *me)
int rb_method_entry_eq (const rb_method_entry_t *m1, const rb_method_entry_t *m2)
st_index_t rb_hash_method_entry (st_index_t hash, const rb_method_entry_t *me)
VALUE rb_method_entry_location (rb_method_entry_t *me)
VALUE rb_mod_method_location (VALUE mod, ID id)
VALUE rb_obj_method_location (VALUE obj, ID id)
void rb_mark_method_entry (const rb_method_entry_t *me)
void rb_free_method_entry (rb_method_entry_t *me)
void rb_sweep_method_entry (void *vm)
void rb_free_m_tbl (st_table *tbl)
void rb_free_m_tbl_wrapper (struct method_table_wrapper *wrapper)


Define Documentation

#define END_OF_ENUMERATION ( key   )     END_OF_##key##_PLACEHOLDER = 0

Definition at line 20 of file method.h.

#define NOEX_SAFE (  )     ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)

Definition at line 41 of file method.h.

Referenced by rb_method_call_status(), and vm_call_method().

#define NOEX_WITH ( n,
 )     (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))

Definition at line 42 of file method.h.

#define NOEX_WITH_SAFE (  )     NOEX_WITH((n), rb_safe_level())

Definition at line 43 of file method.h.

Referenced by make_method_entry_refined(), and rb_method_entry_make().

#define UNDEFINED_METHOD_ENTRY_P ( me   )     (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)

Definition at line 110 of file method.h.

Referenced by method_entry_i(), mnew_from_me(), rb_alias(), rb_export_method(), rb_method_call_status(), rb_method_entry_get_without_cache(), rb_method_entry_without_refinements(), rb_mod_modfunc(), rb_undef(), and vm_call_method().


Typedef Documentation

typedef struct rb_iseq_struct rb_iseq_t

Definition at line 76 of file method.h.

typedef struct rb_method_attr_struct rb_method_attr_t

typedef struct rb_method_cfunc_struct rb_method_cfunc_t

typedef struct rb_method_definition_struct rb_method_definition_t

typedef struct rb_method_entry_struct rb_method_entry_t


Enumeration Type Documentation

enum rb_method_flag_t

Enumerator:
NOEX_PUBLIC 
NOEX_NOSUPER 
NOEX_PRIVATE 
NOEX_PROTECTED 
NOEX_MASK 
NOEX_BASIC 
NOEX_UNDEF 
NOEX_MODFUNC 
NOEX_SUPER 
NOEX_VCALL 
NOEX_RESPONDS 
NOEX_BIT_WIDTH 
NOEX_SAFE_SHIFT_OFFSET 

Definition at line 24 of file method.h.

enum rb_method_type_t

Enumerator:
VM_METHOD_TYPE_ISEQ 
VM_METHOD_TYPE_CFUNC 
VM_METHOD_TYPE_ATTRSET 
VM_METHOD_TYPE_IVAR 
VM_METHOD_TYPE_BMETHOD 
VM_METHOD_TYPE_ZSUPER 
VM_METHOD_TYPE_UNDEF 
VM_METHOD_TYPE_NOTIMPLEMENTED 
VM_METHOD_TYPE_OPTIMIZED 
VM_METHOD_TYPE_MISSING 
VM_METHOD_TYPE_REFINED 

Definition at line 47 of file method.h.


Function Documentation

rb_method_entry_t* rb_add_method ( VALUE  klass,
ID  mid,
rb_method_type_t  type,
void *  option,
rb_method_flag_t  noex 
)

Definition at line 428 of file vm_method.c.

References rb_method_definition_struct::alias_count, ALLOC, rb_method_cfunc_struct::argc, rb_method_definition_struct::attr, rb_method_definition_struct::body, rb_thread_struct::cfp, rb_method_definition_struct::cfunc, rb_method_entry_struct::def, rb_method_cfunc_struct::func, GET_THREAD(), rb_method_attr_struct::id, INT2FIX, rb_method_definition_struct::iseq, rb_control_frame_struct::iseq, rb_method_attr_struct::location, rb_iseq_struct::location, unlinked_method_entry_list_entry::me, method_added(), rb_method_definition_struct::optimize_type, rb_method_definition_struct::orig_me, rb_method_definition_struct::original_id, rb_iseq_location_struct::path, rb_method_definition_struct::proc, Qfalse, Qundef, rb_ary_freeze(), rb_ary_new3, rb_bug(), rb_f_notimplement(), rb_method_entry_make(), RB_OBJ_WRITE, RB_OBJ_WRITTEN, rb_vm_get_ruby_level_next_cfp(), rb_vm_get_sourceline(), rb_iseq_struct::self, setup_method_cfunc_struct(), rb_method_definition_struct::type, VALUE, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_REFINED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.

Referenced by clone_method(), Init_Proc(), Init_vm_eval(), rb_add_method_cfunc(), rb_add_refined_method_entry(), rb_attr(), rb_define_notimplement_method_id(), rb_export_method(), rb_mod_define_method(), rb_undef(), rb_undef_method(), and vm_define_method().

void rb_add_method_cfunc ( VALUE  klass,
ID  mid,
VALUE(*)(ANYARGS)  func,
int  argc,
rb_method_flag_t  noex 
)

Definition at line 99 of file vm_method.c.

References rb_method_cfunc_struct::argc, rb_method_cfunc_struct::func, rb_add_method(), rb_define_notimplement_method_id(), rb_eArgError, rb_f_notimplement(), rb_raise(), and VM_METHOD_TYPE_CFUNC.

Referenced by rb_define_method(), rb_define_method_id(), rb_define_private_method(), and rb_define_protected_method().

void rb_add_refined_method_entry ( VALUE  refined_class,
ID  mid 
)

Definition at line 221 of file vm_method.c.

References lookup_method_table(), make_method_entry_refined(), unlinked_method_entry_list_entry::me, NOEX_PUBLIC, rb_add_method(), rb_clear_method_cache_by_class(), and VM_METHOD_TYPE_REFINED.

Referenced by add_refined_method_entry_i(), and rb_method_entry_make().

void rb_free_m_tbl ( st_table tbl  ) 

Definition at line 1443 of file gc.c.

References free_method_entry_i(), st_foreach(), and st_free_table().

Referenced by rb_free_m_tbl_wrapper().

void rb_free_m_tbl_wrapper ( struct method_table_wrapper wrapper  ) 

Definition at line 1450 of file gc.c.

References rb_free_m_tbl(), method_table_wrapper::tbl, and xfree.

Referenced by obj_free(), and rb_mod_init_copy().

void rb_free_method_entry ( rb_method_entry_t me  ) 

Definition at line 178 of file vm_method.c.

References rb_method_entry_struct::def, unlinked_method_entry_list_entry::me, release_method_definition(), and xfree.

Referenced by free_method_entry_i(), and rb_sweep_method_entry().

st_index_t rb_hash_method_entry ( st_index_t  hash,
const rb_method_entry_t me 
)

Definition at line 1238 of file vm_method.c.

References rb_method_entry_struct::def, cache_entry::me, and rb_hash_method_definition().

Referenced by method_hash().

void rb_mark_method_entry ( const rb_method_entry_t me  ) 

Definition at line 3417 of file gc.c.

References mark_method_entry(), and rb_objspace.

Referenced by bm_mark(), rb_gc_mark_unlinked_live_method_entries(), and rb_thread_mark().

rb_method_entry_t* rb_method_entry ( VALUE  klass,
ID  id,
VALUE *  define_class_ptr 
)

Definition at line 617 of file vm_method.c.

References cache_entry::class_serial, cache_entry::defined_class, GET_GLOBAL_METHOD_STATE, GLOBAL_METHOD_CACHE, cache_entry::me, cache_entry::method_state, cache_entry::mid, rb_method_entry_get_without_cache(), and RCLASS_EXT.

Referenced by check_definition(), check_funcall_respond_to(), check_redefined_method(), get_original_method_entry(), original_method_entry(), rb_method_basic_definition_p(), rb_method_entry_with_refinements(), rb_method_entry_without_refinements(), rb_obj_basic_to_s_p(), rb_resolve_refined_method(), rb_search_method_entry(), vm_call0_body(), vm_call_method(), vm_call_method_missing(), vm_call_super(), vm_search_method(), and vm_search_super_method().

int rb_method_entry_arity ( const rb_method_entry_t me  ) 

Definition at line 2020 of file proc.c.

References max(), METHOD::me, and rb_method_entry_min_max_arity().

Referenced by check_funcall_respond_to(), method_arity(), and rb_mod_method_arity().

rb_method_entry_t* rb_method_entry_at ( VALUE  obj,
ID  id 
)

Definition at line 552 of file vm_method.c.

References lookup_method_table().

Referenced by rb_obj_singleton_method().

int rb_method_entry_eq ( const rb_method_entry_t m1,
const rb_method_entry_t m2 
)

Definition at line 1156 of file vm_method.c.

References rb_method_entry_struct::def, and rb_method_definition_eq().

Referenced by method_eq().

rb_method_entry_t* rb_method_entry_get_without_cache ( VALUE  klass,
ID  id,
VALUE *  define_class_ptr 
)

Definition at line 564 of file vm_method.c.

References BUILTIN_TYPE, cache_entry::class_serial, cache_entry::defined_class, FL_SINGLETON, GET_GLOBAL_METHOD_STATE, GLOBAL_METHOD_CACHE, rb_method_entry_struct::klass, unlinked_method_entry_list_entry::me, cache_entry::me, cache_entry::method_state, cache_entry::mid, RBASIC, RCLASS_EXT, ruby_running, search_method(), T_CLASS, T_ICLASS, UNDEFINED_METHOD_ENTRY_P, and VALUE.

Referenced by rb_method_entry().

VALUE rb_method_entry_location ( rb_method_entry_t me  ) 

Definition at line 2153 of file proc.c.

References rb_method_entry_struct::def, METHOD::me, method_def_location(), and Qnil.

Referenced by rb_mod_method_location().

rb_method_entry_t* rb_method_entry_set ( VALUE  klass,
ID  mid,
const rb_method_entry_t ,
rb_method_flag_t  noex 
)

Definition at line 504 of file vm_method.c.

References unlinked_method_entry_list_entry::me, and method_entry_set().

Referenced by clone_method(), rb_mod_define_method(), and rb_mod_modfunc().

rb_method_entry_t* rb_method_entry_with_refinements ( VALUE  klass,
ID  id,
VALUE *  defined_class_ptr 
)

Definition at line 683 of file vm_method.c.

References rb_method_entry_struct::def, cache_entry::me, Qnil, rb_method_entry(), rb_resolve_refined_method(), rb_vm_cref(), rb_method_definition_struct::type, VALUE, and VM_METHOD_TYPE_REFINED.

Referenced by check_match().

rb_method_entry_t* rb_method_entry_without_refinements ( VALUE  klass,
ID  id,
VALUE *  defined_class_ptr 
)

Definition at line 701 of file vm_method.c.

References rb_method_entry_struct::def, cache_entry::me, Qnil, rb_method_entry(), rb_resolve_refined_method(), rb_method_definition_struct::type, UNDEFINED_METHOD_ENTRY_P, VALUE, and VM_METHOD_TYPE_REFINED.

Referenced by mnew(), mnew_from_me(), rb_method_boundp(), and vm_call_opt_send().

VALUE rb_mod_method_location ( VALUE  mod,
ID  id 
)

Definition at line 2160 of file proc.c.

References METHOD::me, original_method_entry(), and rb_method_entry_location().

Referenced by rb_obj_method_location(), and rb_obj_respond_to().

VALUE rb_obj_method_location ( VALUE  obj,
ID  id 
)

Definition at line 2167 of file proc.c.

References CLASS_OF, and rb_mod_method_location().

rb_method_entry_t* rb_resolve_refined_method ( VALUE  refinements,
const rb_method_entry_t me,
VALUE *  defined_class_ptr 
)

Definition at line 655 of file vm_method.c.

References rb_method_entry_struct::called_id, rb_method_entry_struct::def, find_refinement(), get_original_method_entry(), rb_method_entry_struct::klass, cache_entry::me, NIL_P, rb_method_entry(), rb_method_definition_struct::type, VALUE, and VM_METHOD_TYPE_REFINED.

Referenced by get_original_method_entry(), method_entry_i(), rb_method_entry_with_refinements(), and rb_method_entry_without_refinements().

void rb_sweep_method_entry ( void *  vm  ) 

Definition at line 137 of file vm_method.c.

References rb_method_entry_struct::mark, unlinked_method_entry_list_entry::me, unlinked_method_entry_list_entry::next, rb_free_method_entry(), rb_vm_struct::unlinked_method_entry_list, and xfree.

Referenced by gc_before_sweep().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7