diff options
author | John Hawthorn <[email protected]> | 2024-06-02 23:40:24 -0700 |
---|---|---|
committer | John Hawthorn <[email protected]> | 2024-06-03 11:02:49 -0700 |
commit | 520ab22725124ef3d588c9ec664b1adfc98da905 (patch) | |
tree | 8e57c5e48dd549784136d7fd90b2de3b041e8b51 /imemo.c | |
parent | 9d6b8806a4e0801c260f628e48a21ae94cb3fc91 (diff) |
Avoid unnecessary writes to imemo_env during GC
Similar to the previous commit, to avoid unnecessary Copy-on-Write
memory use we should only set this flag when it has not previously been
set.
Diffstat (limited to 'imemo.c')
-rw-r--r-- | imemo.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -357,7 +357,9 @@ rb_imemo_mark_and_move(VALUE obj, bool reference_updating) ((VALUE *)env->ep)[VM_ENV_DATA_INDEX_ENV] = rb_gc_location(env->ep[VM_ENV_DATA_INDEX_ENV]); } else { - VM_ENV_FLAGS_SET(env->ep, VM_ENV_FLAG_WB_REQUIRED); + if (!VM_ENV_FLAGS(env->ep, VM_ENV_FLAG_WB_REQUIRED)) { + VM_ENV_FLAGS_SET(env->ep, VM_ENV_FLAG_WB_REQUIRED); + } rb_gc_mark_movable( (VALUE)rb_vm_env_prev_env(env)); } } |