diff options
author | Peter Zhu <peter@peterzhu.ca> | 2022-01-04 13:54:21 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2022-01-04 14:46:20 -0500 |
commit | 44379805b0859179ed4c9fb68bb2e5e95720cc3a (patch) | |
tree | 6b09de5e18c27afb24a86a498d6c6de72aab7048 | |
parent | 9c15da0fd4f9092f6b1b18191a0714932b20ef5b (diff) | |
download | ruby-44379805b0859179ed4c9fb68bb2e5e95720cc3a.tar.gz |
Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stress
We need to unshare the array loaded_features because the shared root
could be old gen (while loaded_features is young) which causes a WB
miss.
-rw-r--r-- | ruby.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2062,7 +2062,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) for (long i = loaded_before_enc; i < RARRAY_LEN(loaded_features); ++i) { VALUE path = RARRAY_AREF(loaded_features, i); if (!(path = copy_str(path, IF_UTF8_PATH(uenc, lenc), true))) continue; - modified = true; + if (!modified) { + rb_ary_modify(loaded_features); + modified = true; + } RARRAY_ASET(loaded_features, i, path); } if (modified) { |