summaryrefslogtreecommitdiff
path: root/yjit/src/core.rs
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-11-08 07:21:04 -0800
committerGitHub <[email protected]>2023-11-08 10:21:04 -0500
commit50402db5a7d3bb2a9a93d63a63295b4d85a68088 (patch)
tree58a9fdf8a019046fd3bc8d93809d82a7156ec717 /yjit/src/core.rs
parent32e89b7f9cdd29d553be7f0e55eed1c21fc79184 (diff)
YJIT: Disable code GC (#8865)
Co-authored-by: Alan Wu <[email protected]> Co-authored-by: Maxime Chevalier-Boisvert <[email protected]>
Diffstat (limited to 'yjit/src/core.rs')
-rw-r--r--yjit/src/core.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/yjit/src/core.rs b/yjit/src/core.rs
index a091272470..61661e1a2c 100644
--- a/yjit/src/core.rs
+++ b/yjit/src/core.rs
@@ -2234,7 +2234,9 @@ pub fn gen_entry_point(iseq: IseqPtr, ec: EcPtr, jit_exception: bool) -> Option<
// Compilation failed
None => {
// Trigger code GC. This entry point will be recompiled later.
- cb.code_gc(ocb);
+ if get_option!(code_gc) {
+ cb.code_gc(ocb);
+ }
return None;
}
@@ -2300,7 +2302,9 @@ c_callable! {
.unwrap_or_else(|| {
// Trigger code GC (e.g. no space).
// This entry point will be recompiled later.
- cb.code_gc(ocb);
+ if get_option!(code_gc) {
+ cb.code_gc(ocb);
+ }
CodegenGlobals::get_stub_exit_code().raw_ptr(cb)
});
@@ -2548,6 +2552,11 @@ fn branch_stub_hit_body(branch_ptr: *const c_void, target_idx: u32, ec: EcPtr) -
// So we do it here instead.
rb_set_cfp_sp(cfp, reconned_sp);
+ // Bail if code GC is disabled and we've already run out of spaces.
+ if !get_option!(code_gc) && (cb.has_dropped_bytes() || ocb.unwrap().has_dropped_bytes()) {
+ return CodegenGlobals::get_stub_exit_code().raw_ptr(cb);
+ }
+
// Bail if we're about to run out of native stack space.
// We've just reconstructed interpreter state.
if rb_ec_stack_check(ec as _) != 0 {
@@ -2564,7 +2573,6 @@ fn branch_stub_hit_body(branch_ptr: *const c_void, target_idx: u32, ec: EcPtr) -
if block.is_none() {
let branch_old_shape = branch.gen_fn.get_shape();
-
// If the new block can be generated right after the branch (at cb->write_pos)
if cb.get_write_ptr() == branch.end_addr.get() {
// This branch should be terminating its block
@@ -2622,7 +2630,9 @@ fn branch_stub_hit_body(branch_ptr: *const c_void, target_idx: u32, ec: EcPtr) -
// because incomplete code could be used when cb.dropped_bytes is flipped
// by code GC. So this place, after all compilation, is the safest place
// to hook code GC on branch_stub_hit.
- cb.code_gc(ocb);
+ if get_option!(code_gc) {
+ cb.code_gc(ocb);
+ }
// Failed to service the stub by generating a new block so now we
// need to exit to the interpreter at the stubbed location. We are