diff options
| author | Stan Lo <stan.lo@shopify.com> | 2025-09-30 20:20:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 19:20:55 +0000 |
| commit | e90729aa6c34d00743e2de9095293d3189587333 (patch) | |
| tree | 26be3fa6e284e5e178dd1a24927587a8ad7d36f2 | |
| parent | a0a4068e1be52d01533496237ced56fe2e8f743c (diff) | |
ZJIT: Rust code refactors (#14687)
| -rw-r--r-- | zjit/src/codegen.rs | 2 | ||||
| -rw-r--r-- | zjit/src/hir.rs | 4 | ||||
| -rw-r--r-- | zjit/src/hir_type/mod.rs | 3 | ||||
| -rw-r--r-- | zjit/src/options.rs | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index c62fef73de..b8d527fb8d 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -573,7 +573,7 @@ fn gen_setlocal(asm: &mut Assembler, val: Opnd, val_type: Type, local_ep_offset: } else { // We're potentially writing a reference to an IMEMO/env object, // so take care of the write barrier with a function. - let local_index = local_ep_offset * -1; + let local_index = -local_ep_offset; asm_ccall!(asm, rb_vm_env_write, ep, local_index.into(), val); } } diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index 8f6e92d653..7d6167d490 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -3263,7 +3263,7 @@ struct BytecodeInfo { has_blockiseq: bool, } -fn compute_bytecode_info(iseq: *const rb_iseq_t, opt_table: &Vec<u32>) -> BytecodeInfo { +fn compute_bytecode_info(iseq: *const rb_iseq_t, opt_table: &[u32]) -> BytecodeInfo { let iseq_size = unsafe { get_iseq_encoded_size(iseq) }; let mut insn_idx = 0; let mut jump_targets: HashSet<u32> = opt_table.iter().copied().collect(); @@ -4251,7 +4251,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> { } /// Compile an entry_block for the interpreter -fn compile_entry_block(fun: &mut Function, jit_entry_insns: &Vec<u32>) { +fn compile_entry_block(fun: &mut Function, jit_entry_insns: &[u32]) { let entry_block = fun.entry_block; fun.push_insn(entry_block, Insn::EntryPoint { jit_entry_idx: None }); diff --git a/zjit/src/hir_type/mod.rs b/zjit/src/hir_type/mod.rs index 3e690c79d0..ffde7e458d 100644 --- a/zjit/src/hir_type/mod.rs +++ b/zjit/src/hir_type/mod.rs @@ -355,8 +355,7 @@ impl Type { fn is_builtin(class: VALUE) -> bool { types::ExactBitsAndClass .iter() - .find(|&(_, class_object)| unsafe { **class_object } == class) - .is_some() + .any(|&(_, class_object)| unsafe { *class_object } == class) } /// Union both types together, preserving specialization if possible. diff --git a/zjit/src/options.rs b/zjit/src/options.rs index ab9d1960eb..4040c85907 100644 --- a/zjit/src/options.rs +++ b/zjit/src/options.rs @@ -314,7 +314,7 @@ fn update_profile_threshold() { /// Update --zjit-call-threshold for testing #[cfg(test)] pub fn set_call_threshold(call_threshold: u64) { - unsafe { rb_zjit_call_threshold = call_threshold as u64; } + unsafe { rb_zjit_call_threshold = call_threshold; } rb_zjit_prepare_options(); update_profile_threshold(); } |
