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 /internal | |
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 'internal')
-rw-r--r-- | internal/gc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/gc.h b/internal/gc.h index 7e0942a76a..be40a7a2f7 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -274,6 +274,7 @@ void rb_gc_verify_internal_consistency(void); size_t rb_obj_gc_flags(VALUE, ID[], size_t); void rb_gc_mark_values(long n, const VALUE *values); void rb_gc_mark_vm_stack_values(long n, const VALUE *values); +void rb_gc_update_values(long n, VALUE *values); void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2)); void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3)); void ruby_sized_xfree(void *x, size_t size); |