aboutsummaryrefslogtreecommitdiffstats
path: root/yjit/src
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maximechevalierb@gmail.com>2022-08-04 16:46:36 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2022-08-29 08:47:06 -0700
commitb024b18f56df7e18bc744905f6d2e3888fc3900f (patch)
treed14db959ab5e3dc0b6a265554eeeda8d280a337c /yjit/src
parentd63b3e43bd0a2dac5447855e3fae2c3de3499e53 (diff)
downloadruby-b024b18f56df7e18bc744905f6d2e3888fc3900f.tar.gz
Fix block invalidation with new backend. Enable more btests on x86 (https://github.com/Shopify/ruby/pull/359)
Diffstat (limited to 'yjit/src')
-rw-r--r--yjit/src/core.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/yjit/src/core.rs b/yjit/src/core.rs
index 3b33360b90..1bc3d738ef 100644
--- a/yjit/src/core.rs
+++ b/yjit/src/core.rs
@@ -2021,7 +2021,7 @@ pub fn invalidate_block_version(blockref: &BlockRef) {
// machine code that some other thread is running.
let block = blockref.borrow();
- let cb = CodegenGlobals::get_inline_cb();
+ let mut cb = CodegenGlobals::get_inline_cb();
let ocb = CodegenGlobals::get_outlined_cb();
verify_blockid(block.blockid);
@@ -2069,11 +2069,13 @@ pub fn invalidate_block_version(blockref: &BlockRef) {
// if (block.start_addr >= cb_get_ptr(cb, yjit_codepage_frozen_bytes)) // Don't patch frozen code region
// Patch in a jump to block.entry_exit.
+
let cur_pos = cb.get_write_ptr();
cb.set_write_ptr(block_start);
- //jmp_ptr(cb, block_entry_exit);
- todo!("jmp_ptr with new assembler");
+ let mut asm = Assembler::new();
+ asm.jmp(block_entry_exit.into());
+ asm.compile(&mut cb);
assert!(
cb.get_write_ptr() < block_end,
@@ -2154,13 +2156,12 @@ pub fn invalidate_block_version(blockref: &BlockRef) {
// change this in the future when we support optional parameters because
// they enter the function with a non-zero PC
if block.blockid.idx == 0 {
+ // TODO:
+ // We could reset the exec counter to zero in rb_iseq_reset_jit_func()
+ // so that we eventually compile a new entry point when useful
unsafe { rb_iseq_reset_jit_func(block.blockid.iseq) };
}
- // TODO:
- // May want to recompile a new entry point (for interpreter entry blocks)
- // This isn't necessary for correctness
-
// FIXME:
// Call continuation addresses on the stack can also be atomically replaced by jumps going to the stub.