diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-24 22:02:03 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-24 22:02:03 +0000 |
commit | beb26e1b491f8d9fd20a2d944f036100cd1abac3 (patch) | |
tree | 55827b3594aa69f0c294e464598685630b161b78 /vm.c | |
parent | 72107daf0e9b35d28ae75c728134b64d2383cb65 (diff) |
* vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:
Manage a redefinition of special methods for each classes.
A patch from Joel Gouly <[email protected]>. Thanks!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -976,12 +976,23 @@ rb_iter_break(void) static st_table *vm_opt_method_table = 0; static void -rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me) +rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass) { st_data_t bop; if (!me->def || me->def->type == VM_METHOD_TYPE_CFUNC) { if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) { - ruby_vm_redefined_flag[bop] = 1; + int flag = 0; + + if (klass == rb_cFixnum) flag = FIXNUM_REDEFINED_OP_FLAG; + else if (klass == rb_cFloat) flag = FLOAT_REDEFINED_OP_FLAG; + else if (klass == rb_cString) flag = STRING_REDEFINED_OP_FLAG; + else if (klass == rb_cArray) flag = ARRAY_REDEFINED_OP_FLAG; + else if (klass == rb_cHash) flag = HASH_REDEFINED_OP_FLAG; + else if (klass == rb_cBignum) flag = BIGNUM_REDEFINED_OP_FLAG; + else if (klass == rb_cSymbol) flag = SYMBOL_REDEFINED_OP_FLAG; + else if (klass == rb_cTime) flag = TIME_REDEFINED_OP_FLAG; + + ruby_vm_redefined_flag[bop] |= flag; } } } |