Skip to content

Commit e299eaf

Browse files
committed
Add more recompilation to type_specialize and optimize_c_calls
1 parent 33022a9 commit e299eaf

3 files changed

Lines changed: 484 additions & 463 deletions

File tree

zjit/src/hir.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,7 +3767,8 @@ impl Function {
37673767
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass, method: mid, cme }, state });
37683768

37693769
if let Some(profiled_type) = profiled_type {
3770-
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
3770+
let argc = unsafe { vm_ci_argc(ci) } as i32;
3771+
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend{ argc }) });
37713772
}
37723773

37733774
let send_direct = self.push_insn(block, Insn::SendDirect { recv, cd, cme, iseq, args: processed_args, kw_bits, state: send_state, block: None });
@@ -3787,7 +3788,8 @@ impl Function {
37873788

37883789
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass, method: mid, cme }, state });
37893790
if let Some(profiled_type) = profiled_type {
3790-
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
3791+
let argc = unsafe { vm_ci_argc(ci) } as i32;
3792+
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend{ argc }) });
37913793
}
37923794
let id = unsafe { get_cme_def_body_attr_id(cme) };
37933795

@@ -3803,7 +3805,8 @@ impl Function {
38033805

38043806
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass, method: mid, cme }, state });
38053807
if let Some(profiled_type) = profiled_type {
3806-
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
3808+
let argc = unsafe { vm_ci_argc(ci) } as i32;
3809+
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend{ argc }) });
38073810
}
38083811
let id = unsafe { get_cme_def_body_attr_id(cme) };
38093812

@@ -3825,7 +3828,8 @@ impl Function {
38253828
}
38263829
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass, method: mid, cme }, state });
38273830
if let Some(profiled_type) = profiled_type {
3828-
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
3831+
let argc = unsafe { vm_ci_argc(ci) } as i32;
3832+
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend{ argc }) });
38293833
}
38303834
let kw_splat = flags & VM_CALL_KW_SPLAT != 0;
38313835
let invoke_proc = self.push_insn(block, Insn::InvokeProc { recv, args: args.clone(), state, kw_splat });
@@ -3863,7 +3867,8 @@ impl Function {
38633867
}
38643868
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass, method: mid, cme }, state });
38653869
if let Some(profiled_type) = profiled_type {
3866-
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
3870+
let argc = unsafe { vm_ci_argc(ci) } as i32;
3871+
recv = self.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend{ argc }) });
38673872
}
38683873
// All structs from the same Struct class should have the same
38693874
// length. So if our recv is embedded all runtime
@@ -4784,7 +4789,8 @@ impl Function {
47844789

47854790
if let Some(profiled_type) = profiled_type {
47864791
// Guard receiver class
4787-
recv = fun.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
4792+
let argc = unsafe { vm_ci_argc(call_info) } as i32;
4793+
recv = fun.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend { argc }) });
47884794
fun.insn_types[recv.0] = fun.infer_type(recv);
47894795
}
47904796

@@ -4850,7 +4856,8 @@ impl Function {
48504856

48514857
if let Some(profiled_type) = profiled_type {
48524858
// Guard receiver class
4853-
recv = fun.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: None });
4859+
let argc = unsafe { vm_ci_argc(call_info) } as i32;
4860+
recv = fun.push_insn(block, Insn::GuardType { val: recv, guard_type: Type::from_profiled_type(profiled_type), state, recompile: Some(Recompile::ProfileSend { argc }) });
48544861
fun.insn_types[recv.0] = fun.infer_type(recv);
48554862
}
48564863

0 commit comments

Comments
 (0)