diff options
author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-08-31 15:35:56 +0100 |
---|---|---|
committer | Matt Valentine-House <matt@eightbitraptor.com> | 2023-08-31 19:31:18 +0100 |
commit | 322548180d01ce99dcb8ecb3c36f2a9261554657 (patch) | |
tree | d8d5df55533cce301eecffd60a2a6f070a52bad4 /gc.c | |
parent | 84fa8ae84eeb20a35ff2040dbf107c6d9babfdec (diff) |
Prevent rb_gc_mark_values from pinning objects
This is an internal only function not exposed to the C extension API.
It's only use so far is from rb_vm_mark, where it's used to mark the
values in the vm->trap_list.cmd array.
There shouldn't be any reason why these cannot move.
This commit allows them to move by updating their references during the
reference updating step of compaction.
To do this we've introduced another internal function
rb_gc_update_values as a partner to rb_gc_mark_values.
This allows us to refactor rb_gc_mark_values to not pin
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8341
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -6348,7 +6348,7 @@ rb_gc_mark_values(long n, const VALUE *values) rb_objspace_t *objspace = &rb_objspace; for (i=0; i<n; i++) { - gc_mark_and_pin(objspace, values[i]); + gc_mark(objspace, values[i]); } } @@ -10135,6 +10135,12 @@ gc_update_values(rb_objspace_t *objspace, long n, VALUE *values) } } +void +rb_gc_update_values(long n, VALUE *values) +{ + gc_update_values(&rb_objspace, n, values); +} + static bool moved_or_living_object_strictly_p(rb_objspace_t *objspace, VALUE obj) { |