summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-03-29 21:05:13 +0100
committerMatt Valentine-House <matt@eightbitraptor.com>2023-07-13 09:21:36 +0100
commitd426343418aab6148706860bd1678ac309dc12c0 (patch)
treeb3124c1583f71f5513a7ef5fe9919a7a8ca7c82d /proc.c
parent7524675330eaf96caba155852bb06b34b809b2a9 (diff)
Store object age in a bitmap
Closes [Feature #19729] Previously 2 bits of the flags on each RVALUE are reserved to store the number of GC cycles that each object has survived. This commit introduces a new bit array on the heap page, called age_bits, to store that information instead. This patch still reserves one of the age bits in the flags (the old FL_PROMOTED0 bit, now renamed FL_PROMOTED). This is set to 0 for young objects and 1 for old objects, and is used as a performance optimisation for the write barrier. Fetching the age_bits from the heap page and doing the required math to calculate if the object was old or not would slow down the write barrier. So we keep this bit synced in the flags for fast access.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7938
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index 17c837d164..08474506ac 100644
--- a/proc.c
+++ b/proc.c
@@ -70,7 +70,7 @@ CLONESETUP(VALUE clone, VALUE obj)
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj));
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(clone));
- const VALUE flags = RUBY_FL_PROMOTED0 | RUBY_FL_PROMOTED1 | RUBY_FL_FINALIZE;
+ const VALUE flags = RUBY_FL_PROMOTED | RUBY_FL_FINALIZE;
rb_obj_setup(clone, rb_singleton_class_clone(obj),
RB_FL_TEST_RAW(obj, ~flags));
rb_singleton_class_attached(RBASIC_CLASS(clone), clone);