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/src | |
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/src')
-rw-r--r-- | yjit/src/invariants.rs | 4 | ||||
-rw-r--r-- | yjit/src/yjit.rs | 6 |
2 files changed, 2 insertions, 8 deletions
diff --git a/yjit/src/invariants.rs b/yjit/src/invariants.rs index b1da603b27..98516aa400 100644 --- a/yjit/src/invariants.rs +++ b/yjit/src/invariants.rs @@ -345,7 +345,7 @@ pub extern "C" fn rb_yjit_constant_state_changed(id: ID) { /// Callback for marking GC objects inside [Invariants]. /// See `struct yjijt_root_struct` in C. #[no_mangle] -pub extern "C" fn rb_yjit_root_mark(_: *mut c_void) { +pub extern "C" fn rb_yjit_root_mark() { // Call rb_gc_mark on exit location's raw_samples to // wrap frames in a GC allocated object. This needs to be called // at the same time as root mark. @@ -374,7 +374,7 @@ pub extern "C" fn rb_yjit_root_mark(_: *mut c_void) { } #[no_mangle] -pub extern "C" fn rb_yjit_root_update_references(_: *mut c_void) { +pub extern "C" fn rb_yjit_root_update_references() { if unsafe { INVARIANTS.is_none() } { return; } diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index 5de9d17624..c2647d55f7 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -75,12 +75,6 @@ fn yjit_init() { let _ = std::fs::remove_file(&perf_map); println!("YJIT perf map: {perf_map}"); } - - // Initialize the GC hooks. Do this at last as some code depend on Rust initialization. - extern "C" { - fn rb_yjit_init_gc_hooks(); - } - unsafe { rb_yjit_init_gc_hooks() } } /// At the moment, we abort in all cases we panic. |