Skip to content

Commit c2bec7f

Browse files
committed
perf(jit): restore heap exits inline
1 parent 4e8bc4b commit c2bec7f

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

src/vm/jit/native/lower.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4726,7 +4726,7 @@ fn lower_ssa_exit_block(
47264726
.contains_key(&SsaTempValueSlotKey::Output(*value))
47274727
&& moved_owned_values.insert(*value)
47284728
}
4729-
SsaMaterialization::BoxHeapPtr { .. } => false,
4729+
SsaMaterialization::BoxHeapPtr { .. } => true,
47304730
}
47314731
});
47324732
if inline_owned_restore {
@@ -4755,15 +4755,24 @@ fn lower_ssa_exit_block(
47554755
})?,
47564756
);
47574757
let dst_addr = ssa_value_addr(b, pointer_type, vm_locals_ptr, index, layout.value.size);
4758-
clear_owned_value_temp_slot(b, pointer_type, deopt_refs, deopt_addrs, dst_addr)?;
4759-
if let SsaMaterialization::Value(value) = materialization {
4760-
let src = *exit_values.get(value).ok_or_else(|| {
4761-
VmError::JitNative("SSA exit tagged local value missing".to_string())
4762-
})?;
4763-
ssa_copy_value_bytes(b, src, dst_addr, layout.value.size);
4764-
ssa_store_tag(b, layout.value, src, layout.value.null_tag);
4758+
if matches!(materialization, SsaMaterialization::BoxHeapPtr { .. }) {
4759+
let temp_slot = ssa_create_value_stack_slot(b, layout.value.size)?;
4760+
let temp_addr = b.ins().stack_addr(pointer_type, temp_slot, 0);
4761+
ssa_materialize_slot(b, materialize_ctx, materialization, temp_addr, "local")?;
4762+
clear_owned_value_temp_slot(b, pointer_type, deopt_refs, deopt_addrs, dst_addr)?;
4763+
ssa_copy_value_bytes(b, temp_addr, dst_addr, layout.value.size);
4764+
ssa_store_tag(b, layout.value, temp_addr, layout.value.null_tag);
47654765
} else {
4766-
ssa_materialize_slot(b, materialize_ctx, materialization, dst_addr, "local")?;
4766+
clear_owned_value_temp_slot(b, pointer_type, deopt_refs, deopt_addrs, dst_addr)?;
4767+
if let SsaMaterialization::Value(value) = materialization {
4768+
let src = *exit_values.get(value).ok_or_else(|| {
4769+
VmError::JitNative("SSA exit tagged local value missing".to_string())
4770+
})?;
4771+
ssa_copy_value_bytes(b, src, dst_addr, layout.value.size);
4772+
ssa_store_tag(b, layout.value, src, layout.value.null_tag);
4773+
} else {
4774+
ssa_materialize_slot(b, materialize_ctx, materialization, dst_addr, "local")?;
4775+
}
47674776
}
47684777
}
47694778
let ip_val = b.ins().iconst(

0 commit comments

Comments
 (0)