Skip to content

Commit 3fb455a

Browse files
committed
Move global symbol reference updating to rb_sym_global_symbols_update_references
1 parent 8d0416a commit 3fb455a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

gc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,8 +3618,7 @@ rb_gc_update_vm_references(void *objspace)
36183618

36193619
rb_vm_update_references(vm);
36203620
rb_gc_update_global_tbl();
3621-
global_symbols.ids = gc_location_internal(objspace, global_symbols.ids);
3622-
global_symbols.dsymbol_fstr_hash = gc_location_internal(objspace, global_symbols.dsymbol_fstr_hash);
3621+
rb_sym_global_symbols_update_references();
36233622

36243623
#if USE_YJIT
36253624
void rb_yjit_root_update_references(void); // in Rust

internal/symbol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
/* symbol.c */
2020
void rb_sym_global_symbols_mark(void);
21+
void rb_sym_global_symbols_update_references(void);
2122
VALUE rb_to_symbol_type(VALUE obj);
2223
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
2324
VALUE rb_sym_intern_ascii(const char *ptr, long len);

symbol.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ rb_sym_global_symbols_mark(void)
113113
rb_gc_mark_movable(symbols->dsymbol_fstr_hash);
114114
}
115115

116+
void
117+
rb_sym_global_symbols_update_references(void)
118+
{
119+
rb_symbols_t *symbols = &ruby_global_symbols;
120+
121+
symbols->ids = rb_gc_location(symbols->ids);
122+
symbols->dsymbol_fstr_hash = rb_gc_location(symbols->dsymbol_fstr_hash);
123+
}
124+
116125
WARN_UNUSED_RESULT(static VALUE dsymbol_alloc(rb_symbols_t *symbols, const VALUE klass, const VALUE str, rb_encoding *const enc, const ID type));
117126
WARN_UNUSED_RESULT(static VALUE dsymbol_check(rb_symbols_t *symbols, const VALUE sym));
118127
WARN_UNUSED_RESULT(static ID lookup_str_id(VALUE str));

0 commit comments

Comments
 (0)