mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Revert "ZJIT: Do not call rb_gc_writebarrier() with an immediate value in gen_write_barrier()"
* This reverts commit 623559faa3dd0927b4034a752226a30ae8821604. * There is an issue with the jump in LIR, see https://github.com/ruby/ruby/pull/15542.
This commit is contained in:
parent
04edf3d993
commit
cc048f7571
@ -1130,31 +1130,11 @@ fn gen_store_field(asm: &mut Assembler, recv: Opnd, id: ID, offset: i32, val: Op
|
||||
}
|
||||
|
||||
fn gen_write_barrier(asm: &mut Assembler, recv: Opnd, val: Opnd, val_type: Type) {
|
||||
// See RB_OBJ_WRITE/rb_obj_write: it's just assignment and rb_obj_written().
|
||||
// rb_obj_written() does: if (!RB_SPECIAL_CONST_P(val)) { rb_gc_writebarrier(recv, val); }
|
||||
if val_type.is_immediate() {
|
||||
return;
|
||||
} else if val_type.is_heap_object() {
|
||||
asm_comment!(asm, "Write barrier with known heap object value");
|
||||
// See RB_OBJ_WRITE/rb_obj_write: it's just assignment and rb_obj_written()->rb_gc_writebarrier()
|
||||
if !val_type.is_immediate() {
|
||||
asm_comment!(asm, "Write barrier");
|
||||
let recv = asm.load(recv);
|
||||
asm_ccall!(asm, rb_gc_writebarrier, recv, val);
|
||||
} else {
|
||||
// Unknown if immediate or not, need to check because rb_gc_writebarrier() assumes not immediate
|
||||
asm_comment!(asm, "Write barrier with unknown value");
|
||||
let no_wb = asm.new_label("no_write_barrier_for_immediate");
|
||||
|
||||
// Continue if special constant
|
||||
asm.test(val, Opnd::UImm(RUBY_IMMEDIATE_MASK as u64));
|
||||
asm.jnz(no_wb.clone());
|
||||
|
||||
// Continue if false
|
||||
asm.cmp(val, Qfalse.into());
|
||||
asm.je(no_wb.clone());
|
||||
|
||||
let recv = asm.load(recv);
|
||||
asm_ccall!(asm, rb_gc_writebarrier, recv, val);
|
||||
|
||||
asm.write_label(no_wb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -517,10 +517,6 @@ impl Type {
|
||||
self.is_subtype(types::Immediate)
|
||||
}
|
||||
|
||||
pub fn is_heap_object(&self) -> bool {
|
||||
self.is_subtype(types::HeapBasicObject)
|
||||
}
|
||||
|
||||
pub fn print(self, ptr_map: &PtrPrintMap) -> TypePrinter<'_> {
|
||||
TypePrinter { inner: self, ptr_map }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user