diff options
author | Peter Zhu <[email protected]> | 2025-02-07 11:10:18 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2025-02-10 08:47:44 -0500 |
commit | 3fb455adabc26a978f3bf42aa0bf42f10f64ae31 (patch) | |
tree | 9d73ce4a3cf9e339801b8c8a577d1a4c012c6012 | |
parent | 8d0416ae0b6e725c855a3afb1225fe892d42dd4e (diff) |
Move global symbol reference updating to rb_sym_global_symbols_update_references
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12711
-rw-r--r-- | gc.c | 3 | ||||
-rw-r--r-- | internal/symbol.h | 1 | ||||
-rw-r--r-- | symbol.c | 9 |
3 files changed, 11 insertions, 2 deletions
@@ -3618,8 +3618,7 @@ rb_gc_update_vm_references(void *objspace) rb_vm_update_references(vm); rb_gc_update_global_tbl(); - global_symbols.ids = gc_location_internal(objspace, global_symbols.ids); - global_symbols.dsymbol_fstr_hash = gc_location_internal(objspace, global_symbols.dsymbol_fstr_hash); + rb_sym_global_symbols_update_references(); #if USE_YJIT void rb_yjit_root_update_references(void); // in Rust diff --git a/internal/symbol.h b/internal/symbol.h index 87128658ab..1a066af0e7 100644 --- a/internal/symbol.h +++ b/internal/symbol.h @@ -18,6 +18,7 @@ /* symbol.c */ void rb_sym_global_symbols_mark(void); +void rb_sym_global_symbols_update_references(void); VALUE rb_to_symbol_type(VALUE obj); VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc); VALUE rb_sym_intern_ascii(const char *ptr, long len); @@ -113,6 +113,15 @@ rb_sym_global_symbols_mark(void) rb_gc_mark_movable(symbols->dsymbol_fstr_hash); } +void +rb_sym_global_symbols_update_references(void) +{ + rb_symbols_t *symbols = &ruby_global_symbols; + + symbols->ids = rb_gc_location(symbols->ids); + symbols->dsymbol_fstr_hash = rb_gc_location(symbols->dsymbol_fstr_hash); +} + WARN_UNUSED_RESULT(static VALUE dsymbol_alloc(rb_symbols_t *symbols, const VALUE klass, const VALUE str, rb_encoding *const enc, const ID type)); WARN_UNUSED_RESULT(static VALUE dsymbol_check(rb_symbols_t *symbols, const VALUE sym)); WARN_UNUSED_RESULT(static ID lookup_str_id(VALUE str)); |