symbol.c: use rb_gc_mark_and_move over rb_gc_location

The `p->field = rb_gc_location(p->field)` isn't ideal because it means all
references are rewritten on compaction, regardless of whether the referenced
object has moved. This isn't good for caches nor for Copy-on-Write.

`rb_gc_mark_and_move` avoid needless writes, and most of the time allow to
have a single function for both marking and updating references.
This commit is contained in:
Jean Boussier 2025-08-07 14:47:37 +02:00
parent 5bcfc53d6f
commit 1986d775cd
3 changed files with 6 additions and 16 deletions

View file

@ -17,8 +17,7 @@
#endif
/* symbol.c */
void rb_sym_global_symbols_mark(void);
void rb_sym_global_symbols_update_references(void);
void rb_sym_global_symbols_mark_and_move(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);