5 #define CACHE_SIZE 0x800
6 #define CACHE_MASK 0x7ff
7 #define EXPR1(c,m) ((((c)>>3)^(m))&CACHE_MASK)
11 #define NOEX_NOREDEF NOEX_RESPONDS
29 #define ruby_running (GET_VM()->running)
103 ume->
next =
GET_VM()->unlinked_method_entry_list;
104 GET_VM()->unlinked_method_entry_list = ume;
233 int make_refined = 0;
245 (mid == idInitialize || mid == idInitialize_copy ||
246 mid == idInitialize_clone || mid == idInitialize_dup ||
256 VALUE refined_class =
295 switch (old_def->
type) {
308 "previous definition of %s was here",
328 if (klass ==
rb_cObject && mid == idInitialize) {
329 rb_warn(
"redefining Object#initialize may cause infinite loop");
332 if (mid ==
object_id || mid == id__send__) {
347 #define CALL_METHOD_HOOK(klass, hook, mid) do { \
348 const VALUE arg = ID2SYM(mid); \
349 VALUE recv_class = (klass); \
350 ID hook_id = (hook); \
351 if (FL_TEST((klass), FL_SINGLETON)) { \
352 recv_class = rb_ivar_get((klass), attached); \
353 hook_id = singleton_##hook; \
355 rb_funcall2(recv_class, hook_id, 1, &arg); \
389 rb_bug(
"call_cfunc_func: unsupported length: %d", argc);
455 rb_bug(
"rb_add_method: unsupported method type (%d)\n", type);
472 #define UNDEF_ALLOC_FUNC ((rb_alloc_func_t)-1)
495 if (allocator)
return allocator;
509 if (defined_class_ptr)
510 *defined_class_ptr = klass;
522 VALUE *defined_class_ptr)
545 if (defined_class_ptr)
553 #if OPT_GLOBAL_METHOD_CACHE
558 ent->
mid ==
id && ent->
klass == klass) {
559 if (defined_class_ptr)
571 VALUE *defined_class_ptr)
587 VALUE *defined_class_ptr)
594 if (
NIL_P(refinement)) {
615 VALUE *defined_class_ptr)
622 VALUE refinements = cref ? cref->nd_refinements :
Qnil;
626 if (defined_class_ptr)
633 VALUE *defined_class_ptr)
641 if (defined_class_ptr)
661 if (mid ==
object_id || mid == id__send__ || mid == idInitialize) {
706 for (i = 0; i <
argc; i++) {
718 #undef rb_disable_super
719 #undef rb_enable_super
752 if (me->
flag != noex) {
755 if (klass == defined_class ||
780 if (!me->
def)
return 0;
782 if (ex & NOEX_RESPONDS)
return 2;
805 "attribute accessor as module_function" :
806 "private attribute?");
849 if (
id ==
object_id ||
id == id__send__ ||
id == idInitialize) {
856 const char *s0 =
" class";
926 for (i = 0; i <
argc; i++) {
974 #define VISI_CHECK(x,f) (((x)&NOEX_MASK) == (f))
1099 if (d1 == d2)
return 1;
1100 if (!d1 || !d2)
return 0;
1125 rb_bug(
"rb_method_entry_eq: unsupported method type (%d)\n", d1->
type);
1135 switch (def->
type) {
1163 rb_bug(
"rb_hash_method_definition: unsupported method type (%d)\n", def->
type);
1203 flag = orig_me->
flag;
1249 "Insecure: can't change method visibility");
1263 for (i = 0; i <
argc; i++) {
1466 for (i = 0; i <
argc; i++) {
1538 " old fashion which takes only one parameter",
1542 if (!
NIL_P(location)) {
1547 "respond_to? is defined here");
1621 #define rb_intern(str) rb_intern_const(str)
1656 #define REPLICATE_METHOD(klass, id, noex) \
1657 rb_method_entry_set((klass), (id), \
1658 rb_method_entry((klass), (id), 0), \
1659 (rb_method_flag_t)(noex | NOEX_BASIC | NOEX_NOREDEF))