summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-02-08 15:52:45 -0800
committerGitHub <noreply@github.com>2024-02-08 15:52:45 -0800
commite2aa00ca669704daf689110ea71e5844e2bd0536 (patch)
treef52e0778e696c6617fd860e5842ea303ae146afc /yjit
parent5cbca9110c3d8cffc95c70a0c0c793fe8c1d3662 (diff)
YJIT: Remove unnecessary casts for chain_depth (#9893)
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 0d721422c9..07155efd69 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -2277,7 +2277,7 @@ fn jit_chain_guard(
jit: &mut JITState,
asm: &mut Assembler,
ocb: &mut OutlinedCb,
- depth_limit: i32,
+ depth_limit: u8,
counter: Counter,
) {
let target0_gen_fn = match jcc {
@@ -2288,7 +2288,7 @@ fn jit_chain_guard(
JCC_JO_MUL => BranchGenFn::JOMulToTarget0,
};
- if (asm.ctx.get_chain_depth() as i32) < depth_limit {
+ if asm.ctx.get_chain_depth() < depth_limit {
// Rewind Context to use the stack_size at the beginning of this instruction.
let mut deeper = asm.ctx.with_stack_size(jit.stack_size_for_pc);
deeper.increment_chain_depth();
@@ -2304,22 +2304,22 @@ fn jit_chain_guard(
}
// up to 8 different shapes for each
-pub const GET_IVAR_MAX_DEPTH: i32 = 8;
+pub const GET_IVAR_MAX_DEPTH: u8 = 8;
// up to 8 different shapes for each
-pub const SET_IVAR_MAX_DEPTH: i32 = 8;
+pub const SET_IVAR_MAX_DEPTH: u8 = 8;
// hashes and arrays
-pub const OPT_AREF_MAX_CHAIN_DEPTH: i32 = 2;
+pub const OPT_AREF_MAX_CHAIN_DEPTH: u8 = 2;
// expandarray
-pub const EXPANDARRAY_MAX_CHAIN_DEPTH: i32 = 4;
+pub const EXPANDARRAY_MAX_CHAIN_DEPTH: u8 = 4;
// up to 5 different methods for send
-pub const SEND_MAX_DEPTH: i32 = 5;
+pub const SEND_MAX_DEPTH: u8 = 5;
// up to 20 different offsets for case-when
-pub const CASE_WHEN_MAX_DEPTH: i32 = 20;
+pub const CASE_WHEN_MAX_DEPTH: u8 = 20;
pub const MAX_SPLAT_LENGTH: i32 = 127;
@@ -2374,7 +2374,7 @@ fn gen_get_ivar(
jit: &mut JITState,
asm: &mut Assembler,
ocb: &mut OutlinedCb,
- max_chain_depth: i32,
+ max_chain_depth: u8,
comptime_receiver: VALUE,
ivar_name: ID,
recv: Opnd,
@@ -2401,7 +2401,7 @@ fn gen_get_ivar(
// Check if the comptime receiver is a T_OBJECT
let receiver_t_object = unsafe { RB_TYPE_P(comptime_receiver, RUBY_T_OBJECT) };
// Use a general C call at the last chain to avoid exits on megamorphic shapes
- let megamorphic = asm.ctx.get_chain_depth() as i32 >= max_chain_depth;
+ let megamorphic = asm.ctx.get_chain_depth() >= max_chain_depth;
if megamorphic {
gen_counter_incr(asm, Counter::num_getivar_megamorphic);
}
@@ -2613,7 +2613,7 @@ fn gen_setinstancevariable(
// Check if the comptime receiver is a T_OBJECT
let receiver_t_object = unsafe { RB_TYPE_P(comptime_receiver, RUBY_T_OBJECT) };
// Use a general C call at the last chain to avoid exits on megamorphic shapes
- let megamorphic = asm.ctx.get_chain_depth() as i32 >= SET_IVAR_MAX_DEPTH;
+ let megamorphic = asm.ctx.get_chain_depth() >= SET_IVAR_MAX_DEPTH;
if megamorphic {
gen_counter_incr(asm, Counter::num_setivar_megamorphic);
}
@@ -2865,7 +2865,7 @@ fn gen_definedivar(
// Specialize base on compile time values
let comptime_receiver = jit.peek_at_self();
- if comptime_receiver.shape_too_complex() || asm.ctx.get_chain_depth() as i32 >= GET_IVAR_MAX_DEPTH {
+ if comptime_receiver.shape_too_complex() || asm.ctx.get_chain_depth() >= GET_IVAR_MAX_DEPTH {
// Fall back to calling rb_ivar_defined
// Save the PC and SP because the callee may allocate
@@ -4321,7 +4321,7 @@ fn jit_guard_known_klass(
obj_opnd: Opnd,
insn_opnd: YARVOpnd,
sample_instance: VALUE,
- max_chain_depth: i32,
+ max_chain_depth: u8,
counter: Counter,
) {
let val_type = asm.ctx.get_opnd_type(insn_opnd);
@@ -7654,7 +7654,7 @@ fn gen_send_general(
gen_counter_incr(asm, Counter::num_send_polymorphic);
}
// If megamorphic, let the caller fallback to dynamic dispatch
- if asm.ctx.get_chain_depth() as i32 >= SEND_MAX_DEPTH {
+ if asm.ctx.get_chain_depth() >= SEND_MAX_DEPTH {
gen_counter_incr(asm, Counter::send_megamorphic);
return None;
}
@@ -8173,7 +8173,7 @@ fn gen_invokeblock_specialized(
}
// Fallback to dynamic dispatch if this callsite is megamorphic
- if asm.ctx.get_chain_depth() as i32 >= SEND_MAX_DEPTH {
+ if asm.ctx.get_chain_depth() >= SEND_MAX_DEPTH {
gen_counter_incr(asm, Counter::invokeblock_megamorphic);
return None;
}
@@ -8354,7 +8354,7 @@ fn gen_invokesuper_specialized(
};
// Fallback to dynamic dispatch if this callsite is megamorphic
- if asm.ctx.get_chain_depth() as i32 >= SEND_MAX_DEPTH {
+ if asm.ctx.get_chain_depth() >= SEND_MAX_DEPTH {
gen_counter_incr(asm, Counter::invokesuper_megamorphic);
return None;
}