diff options
author | Peter Zhu <[email protected]> | 2024-08-08 12:19:35 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-08 12:19:35 -0400 |
commit | 0bff07644ba5aff9c844b6cf75a0e1365c35c6a3 (patch) | |
tree | 8f21e77683eb74e6ae2c2563907ab68f99d94f2e /yjit.c | |
parent | 868d63f0a3a2f63cfc0d5a1a3e6f073722c4fb8e (diff) |
Make YJIT a GC root rather than an object (#11343)
YJIT currently uses the YJIT root object to mark objects during GC and
update references during compaction. This object otherwise serves no
purpose.
This commit changes it YJIT to be step when marking the GC root. This
saves some memory from being allocated from the system and the GC.
Notes
Notes:
Merged-By: maximecb <[email protected]>
Diffstat (limited to 'yjit.c')
-rw-r--r-- | yjit.c | 27 |
1 files changed, 0 insertions, 27 deletions
@@ -1156,24 +1156,6 @@ struct yjit_root_struct { bool unused; // empty structs are not legal in C99 }; -static size_t -yjit_root_memsize(const void *ptr) -{ - // Count off-gc-heap allocation size of the dependency table - return 0; // TODO: more accurate accounting -} - -void rb_yjit_root_mark(void *ptr); // in Rust -void rb_yjit_root_update_references(void *ptr); // in Rust - -// Custom type for interacting with the GC -// TODO: make this write barrier protected -static const rb_data_type_t yjit_root_type = { - "yjit_root", - {rb_yjit_root_mark, RUBY_DEFAULT_FREE, yjit_root_memsize, rb_yjit_root_update_references}, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY -}; - // For dealing with refinements void rb_yjit_invalidate_all_method_lookup_assumptions(void) @@ -1256,12 +1238,3 @@ VALUE rb_yjit_enable(rb_execution_context_t *ec, VALUE self, VALUE gen_stats, VA // Preprocessed yjit.rb generated during build #include "yjit.rbinc" - -// Initialize the GC hooks -void -rb_yjit_init_gc_hooks(void) -{ - struct yjit_root_struct *root; - VALUE yjit_root = TypedData_Make_Struct(0, struct yjit_root_struct, &yjit_root_type, root); - rb_vm_register_global_object(yjit_root); -} |