aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-08-10 18:19:17 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2020-08-17 17:17:47 -0400
commit264e4cd04fbcdcb739a1ff9a84e19afe66005cb2 (patch)
tree4c6f96983327df97576f4bde498e96ef9b7dc9fd /eval.c
parent1b347534904e9c8d85d1c025d0ba7b179fee82d7 (diff)
downloadruby-264e4cd04fbcdcb739a1ff9a84e19afe66005cb2.tar.gz
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]
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 237d9acaa7..e4fec3d6e1 100644
--- a/eval.c
+++ b/eval.c
@@ -1420,8 +1420,7 @@ rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
c = iclass = rb_include_class_new(module, superclass);
RB_OBJ_WRITE(c, &RCLASS_REFINED_CLASS(c), klass);
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) =
- RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: check unprotecting */
+ RCLASS_M_TBL(c) = RCLASS_M_TBL(module);
module = RCLASS_SUPER(module);
while (module && module != klass) {