Skip to content

Commit cc8cfbc

Browse files
authored
ZJIT: Standardize variable name for callable method entry (ruby#15021)
1 parent b931199 commit cc8cfbc

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

zjit/src/hir.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,9 +2677,9 @@ impl Function {
26772677
self.infer_types();
26782678
}
26792679

2680-
fn gen_patch_points_for_optimized_ccall(&mut self, block: BlockId, recv_class: VALUE, method_id: ID, method: *const rb_callable_method_entry_struct, state: InsnId) {
2680+
fn gen_patch_points_for_optimized_ccall(&mut self, block: BlockId, recv_class: VALUE, method_id: ID, cme: *const rb_callable_method_entry_struct, state: InsnId) {
26812681
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::NoTracePoint, state });
2682-
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass: recv_class, method: method_id, cme: method }, state });
2682+
self.push_insn(block, Insn::PatchPoint { invariant: Invariant::MethodRedefined { klass: recv_class, method: method_id, cme }, state });
26832683
}
26842684

26852685
/// Optimize SendWithoutBlock that land in a C method to a direct CCall without
@@ -2715,19 +2715,19 @@ impl Function {
27152715
};
27162716

27172717
// Do method lookup
2718-
let method: *const rb_callable_method_entry_struct = unsafe { rb_callable_method_entry(recv_class, method_id) };
2719-
if method.is_null() {
2718+
let cme: *const rb_callable_method_entry_struct = unsafe { rb_callable_method_entry(recv_class, method_id) };
2719+
if cme.is_null() {
27202720
return Err(());
27212721
}
27222722

27232723
// Filter for C methods
2724-
let def_type = unsafe { get_cme_def_type(method) };
2724+
let def_type = unsafe { get_cme_def_type(cme) };
27252725
if def_type != VM_METHOD_TYPE_CFUNC {
27262726
return Err(());
27272727
}
27282728

27292729
// Find the `argc` (arity) of the C method, which describes the parameters it expects
2730-
let cfunc = unsafe { get_cme_def_body_cfunc(method) };
2730+
let cfunc = unsafe { get_cme_def_body_cfunc(cme) };
27312731
let cfunc_argc = unsafe { get_mct_argc(cfunc) };
27322732
match cfunc_argc {
27332733
0.. => {
@@ -2747,7 +2747,7 @@ impl Function {
27472747
}
27482748

27492749
// Commit to the replacement. Put PatchPoint.
2750-
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, method, state);
2750+
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, cme, state);
27512751
if recv_class.instance_can_have_singleton_class() {
27522752
fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::NoSingletonClass { klass: recv_class }, state });
27532753
}
@@ -2769,7 +2769,7 @@ impl Function {
27692769
cd,
27702770
cfunc,
27712771
args: cfunc_args,
2772-
cme: method,
2772+
cme,
27732773
name: method_id,
27742774
state,
27752775
return_type: types::BasicObject,
@@ -2818,23 +2818,23 @@ impl Function {
28182818
};
28192819

28202820
// Do method lookup
2821-
let mut method: *const rb_callable_method_entry_struct = unsafe { rb_callable_method_entry(recv_class, method_id) };
2822-
if method.is_null() {
2821+
let mut cme: *const rb_callable_method_entry_struct = unsafe { rb_callable_method_entry(recv_class, method_id) };
2822+
if cme.is_null() {
28232823
return Err(());
28242824
}
28252825

28262826
// Filter for C methods
2827-
let mut def_type = unsafe { get_cme_def_type(method) };
2827+
let mut def_type = unsafe { get_cme_def_type(cme) };
28282828
while def_type == VM_METHOD_TYPE_ALIAS {
2829-
method = unsafe { rb_aliased_callable_method_entry(method) };
2830-
def_type = unsafe { get_cme_def_type(method) };
2829+
cme = unsafe { rb_aliased_callable_method_entry(cme) };
2830+
def_type = unsafe { get_cme_def_type(cme) };
28312831
}
28322832
if def_type != VM_METHOD_TYPE_CFUNC {
28332833
return Err(());
28342834
}
28352835

28362836
// Find the `argc` (arity) of the C method, which describes the parameters it expects
2837-
let cfunc = unsafe { get_cme_def_body_cfunc(method) };
2837+
let cfunc = unsafe { get_cme_def_body_cfunc(cme) };
28382838
let cfunc_argc = unsafe { get_mct_argc(cfunc) };
28392839
match cfunc_argc {
28402840
0.. => {
@@ -2854,14 +2854,14 @@ impl Function {
28542854
}
28552855

28562856
// Commit to the replacement. Put PatchPoint.
2857-
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, method, state);
2857+
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, cme, state);
28582858
if recv_class.instance_can_have_singleton_class() {
28592859
fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::NoSingletonClass { klass: recv_class }, state });
28602860
}
28612861

2862-
let props = ZJITState::get_method_annotations().get_cfunc_properties(method);
2862+
let props = ZJITState::get_method_annotations().get_cfunc_properties(cme);
28632863
if props.is_none() && get_option!(stats) {
2864-
count_not_annotated_cfunc(fun, block, method);
2864+
count_not_annotated_cfunc(fun, block, cme);
28652865
}
28662866
let props = props.unwrap_or_default();
28672867

@@ -2897,13 +2897,13 @@ impl Function {
28972897
fun.make_equal_to(send_insn_id, ccall);
28982898
} else {
28992899
if get_option!(stats) {
2900-
count_not_inlined_cfunc(fun, block, method);
2900+
count_not_inlined_cfunc(fun, block, cme);
29012901
}
29022902
let ccall = fun.push_insn(block, Insn::CCallWithFrame {
29032903
cd,
29042904
cfunc,
29052905
args: cfunc_args,
2906-
cme: method,
2906+
cme,
29072907
name: method_id,
29082908
state,
29092909
return_type,
@@ -2923,7 +2923,7 @@ impl Function {
29232923
if ci_flags & VM_CALL_ARGS_SIMPLE == 0 {
29242924
fun.count_fancy_call_features(block, ci_flags);
29252925
} else {
2926-
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, method, state);
2926+
fun.gen_patch_points_for_optimized_ccall(block, recv_class, method_id, cme, state);
29272927

29282928
if recv_class.instance_can_have_singleton_class() {
29292929
fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::NoSingletonClass { klass: recv_class }, state });
@@ -2935,9 +2935,9 @@ impl Function {
29352935
}
29362936

29372937
let cfunc = unsafe { get_mct_func(cfunc) }.cast();
2938-
let props = ZJITState::get_method_annotations().get_cfunc_properties(method);
2938+
let props = ZJITState::get_method_annotations().get_cfunc_properties(cme);
29392939
if props.is_none() && get_option!(stats) {
2940-
count_not_annotated_cfunc(fun, block, method);
2940+
count_not_annotated_cfunc(fun, block, cme);
29412941
}
29422942
let props = props.unwrap_or_default();
29432943

@@ -2956,15 +2956,15 @@ impl Function {
29562956

29572957
// No inlining; emit a call
29582958
if get_option!(stats) {
2959-
count_not_inlined_cfunc(fun, block, method);
2959+
count_not_inlined_cfunc(fun, block, cme);
29602960
}
29612961
let return_type = props.return_type;
29622962
let elidable = props.elidable;
29632963
let ccall = fun.push_insn(block, Insn::CCallVariadic {
29642964
cfunc,
29652965
recv,
29662966
args,
2967-
cme: method,
2967+
cme,
29682968
name: method_id,
29692969
state,
29702970
return_type,

0 commit comments

Comments
 (0)