diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2023-10-18 13:34:51 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2023-10-19 14:56:35 -0400 |
commit | cdc2a18541a42e63a8a0a3c2c5b72978ace01afa (patch) | |
tree | 9098bb3dc9103f4592e4467bbb24b1715359eea8 /yjit/src/invariants.rs | |
parent | 6beb09c2c99a2575027bdbc60a6fbb099416f74d (diff) |
YJIT: Return Option from asm.compile() for has_dropped_bytes()
So that we get a reminder to check CodeBlock::has_dropped_bytes().
Internally, asm.compile() already checks it, and this patch just
propagates it out to the caller with a `#[must_use]`.
Code GC logic moved out one level in entry_stub_hit(), so the body
can freely use `?`
Diffstat (limited to 'yjit/src/invariants.rs')
-rw-r--r-- | yjit/src/invariants.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/yjit/src/invariants.rs b/yjit/src/invariants.rs index 17a7152d8b..26c15b692e 100644 --- a/yjit/src/invariants.rs +++ b/yjit/src/invariants.rs @@ -89,7 +89,9 @@ pub fn assume_bop_not_redefined( bop: ruby_basic_operators, ) -> bool { if unsafe { BASIC_OP_UNREDEFINED_P(bop, klass) } { - jit_ensure_block_entry_exit(jit, asm, ocb); + if jit_ensure_block_entry_exit(jit, asm, ocb).is_none() { + return false; + } jit.bop_assumptions.push((klass, bop)); return true; @@ -153,7 +155,9 @@ pub fn assume_single_ractor_mode(jit: &mut JITState, asm: &mut Assembler, ocb: & if unsafe { rb_yjit_multi_ractor_p() } { false } else { - jit_ensure_block_entry_exit(jit, asm, ocb); + if jit_ensure_block_entry_exit(jit, asm, ocb).is_none() { + return false; + } jit.block_assumes_single_ractor = true; true @@ -527,7 +531,7 @@ pub extern "C" fn rb_yjit_tracing_invalidate_all() { cb.set_write_ptr(patch.inline_patch_pos); cb.set_dropped_bytes(false); - asm.compile(cb, None); + asm.compile(cb, None).expect("can rewrite existing code"); last_patch_end = cb.get_write_ptr().raw_ptr(); } cb.set_pos(old_pos); |