mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Define PREV_CLASS_SERIAL
Avoids genereating a "throwaway" sentinel class serial. There wasn't any read harm in doing so (we're at no risk of exhaustion and there'd be no measurable performance impact), but if feels cleaner that all class serials actually end up assigned and used (especially now that we won't overwrite them in a single method definition).
This commit is contained in:
parent
d7a50a5cc6
commit
8e56d3a6ab
Notes:
git
2019-12-18 02:19:27 +09:00
2 changed files with 2 additions and 1 deletions
|
@ -184,6 +184,7 @@ CC_SET_ME(CALL_CACHE cc, const rb_callable_method_entry_t *me)
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
#define PREV_CLASS_SERIAL() (ruby_vm_class_serial)
|
||||
#define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
|
||||
#define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state)
|
||||
#define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)
|
||||
|
|
|
@ -104,7 +104,7 @@ rb_clear_method_cache_by_class(VALUE klass)
|
|||
INC_GLOBAL_METHOD_STATE();
|
||||
}
|
||||
else {
|
||||
rb_serial_t old_serial = rb_next_class_serial();
|
||||
rb_serial_t old_serial = PREV_CLASS_SERIAL();
|
||||
rb_class_clear_method_cache(klass, (VALUE)&old_serial);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue