Use GuardType output variable
Helps with readability and threads type info that's there around for longer. Amend test so `GuardType` doesn't DCE'ed.
This commit is contained in:
parent
164bd8e1a6
commit
4f43a09a20
Notes:
git
2025-04-18 13:47:39 +00:00
@ -1036,7 +1036,7 @@ impl Function {
|
|||||||
// Commit to the replacement. Put PatchPoint.
|
// Commit to the replacement. Put PatchPoint.
|
||||||
fun.push_insn(block, Insn::PatchPoint(Invariant::MethodRedefined { klass: recv_class, method: method_id }));
|
fun.push_insn(block, Insn::PatchPoint(Invariant::MethodRedefined { klass: recv_class, method: method_id }));
|
||||||
// Guard receiver class
|
// Guard receiver class
|
||||||
fun.push_insn(block, Insn::GuardType { val: self_val, guard_type: recv_type.unspecialized(), state });
|
let self_val = fun.push_insn(block, Insn::GuardType { val: self_val, guard_type: recv_type.unspecialized(), state });
|
||||||
let cfun = unsafe { get_mct_func(cfunc) }.cast();
|
let cfun = unsafe { get_mct_func(cfunc) }.cast();
|
||||||
let mut cfunc_args = vec![self_val];
|
let mut cfunc_args = vec![self_val];
|
||||||
cfunc_args.append(&mut args);
|
cfunc_args.append(&mut args);
|
||||||
@ -3305,16 +3305,16 @@ mod opt_tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn kernel_itself_simple() {
|
fn kernel_itself_simple() {
|
||||||
eval("
|
eval("
|
||||||
def test = 1.itself
|
def test(x) = x.itself
|
||||||
test
|
test(0) # profile
|
||||||
test
|
test(1)
|
||||||
");
|
");
|
||||||
assert_optimized_method_hir("test", expect![[r#"
|
assert_optimized_method_hir("test", expect![[r#"
|
||||||
fn test:
|
fn test:
|
||||||
bb0():
|
bb0(v0:BasicObject):
|
||||||
v1:Fixnum[1] = Const Value(1)
|
|
||||||
PatchPoint MethodRedefined(Integer@0x1000, itself@0x1008)
|
PatchPoint MethodRedefined(Integer@0x1000, itself@0x1008)
|
||||||
v8:BasicObject = CCall itself@0x1010, v1
|
v7:Fixnum = GuardType v0, Fixnum
|
||||||
|
v8:BasicObject = CCall itself@0x1010, v7
|
||||||
PatchPoint CalleeModifiedLocals(v8)
|
PatchPoint CalleeModifiedLocals(v8)
|
||||||
Return v8
|
Return v8
|
||||||
"#]]);
|
"#]]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user