зеркало из https://github.com/github/ruby.git
Invalidate i-cache after link_labels (#6388)
This commit is contained in:
Родитель
a28e7871e5
Коммит
5b735d0beb
|
@ -971,17 +971,6 @@ impl Assembler
|
|||
};
|
||||
}
|
||||
|
||||
// Invalidate icache for newly written out region so we don't run
|
||||
// stale code.
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
let start = cb.get_ptr(start_write_pos).raw_ptr();
|
||||
let write_ptr = cb.get_write_ptr().raw_ptr();
|
||||
let codeblock_end = cb.get_ptr(cb.get_mem_size()).raw_ptr();
|
||||
let end = std::cmp::min(write_ptr, codeblock_end);
|
||||
unsafe { rb_yjit_icache_invalidate(start as _, end as _) };
|
||||
}
|
||||
|
||||
gc_offsets
|
||||
}
|
||||
|
||||
|
@ -996,12 +985,23 @@ impl Assembler
|
|||
assert!(label_idx == idx);
|
||||
}
|
||||
|
||||
let start_write_pos = cb.get_write_pos();
|
||||
let gc_offsets = asm.arm64_emit(cb);
|
||||
|
||||
if !cb.has_dropped_bytes() {
|
||||
cb.link_labels();
|
||||
}
|
||||
|
||||
// Invalidate icache for newly written out region so we don't run stale code.
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
let start = cb.get_ptr(start_write_pos).raw_ptr();
|
||||
let write_ptr = cb.get_write_ptr().raw_ptr();
|
||||
let codeblock_end = cb.get_ptr(cb.get_mem_size()).raw_ptr();
|
||||
let end = std::cmp::min(write_ptr, codeblock_end);
|
||||
unsafe { rb_yjit_icache_invalidate(start as _, end as _) };
|
||||
}
|
||||
|
||||
gc_offsets
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче