diff options
author | Alan Wu <[email protected]> | 2020-08-10 18:19:17 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2020-08-17 17:17:47 -0400 |
commit | 264e4cd04fbcdcb739a1ff9a84e19afe66005cb2 (patch) | |
tree | 4c6f96983327df97576f4bde498e96ef9b7dc9fd /method.h | |
parent | 1b347534904e9c8d85d1c025d0ba7b179fee82d7 (diff) |
Remove write barrier exemption for T_ICLASS
Before this commit, iclasses were "shady", or not protected by write
barriers. Because of that, the GC needs to spend more time marking these
objects than otherwise.
Applications that make heavy use of modules should see reduction in GC
time as they have a significant number of live iclasses on the heap.
- Put logic for iclass method table ownership into a function
- Remove calls to WB_UNPROTECT and insert write barriers for iclasses
This commit relies on the following invariant: for any non oirigin
iclass `I`, `RCLASS_M_TBL(I) == RCLASS_M_TBL(RBasic(I)->klass)`. This
invariant did not hold prior to 98286e9 for classes and modules that
have prepended modules.
[Feature #16984]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3410
Diffstat (limited to 'method.h')
-rw-r--r-- | method.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -188,6 +188,8 @@ struct rb_method_definition_struct { uintptr_t method_serial; }; +struct rb_id_table; + typedef struct rb_method_definition_struct rb_method_definition_t; STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8); @@ -230,6 +232,8 @@ const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me); const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class); void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src); +void rb_method_table_insert(VALUE klass, struct rb_id_table *table, ID method_id, const rb_method_entry_t *me); + void rb_scope_visibility_set(rb_method_visibility_t); VALUE rb_unnamed_parameters(int arity); |