summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-11-10 15:21:56 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2023-11-10 16:55:56 -0500
commit0a93ea4808d0d5c2cd0a757abe664e572036fe80 (patch)
tree0119158a2118af9286b13b04d89bee2a0c31e053 /yjit
parent85db7baccb946c6bb463166acdd0fd7b12568d35 (diff)
YJIT: Auto fix for clippy::clone_on_copy
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/backend/ir.rs2
-rw-r--r--yjit/src/codegen.rs20
-rw-r--r--yjit/src/core.rs20
3 files changed, 21 insertions, 21 deletions
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs
index 1b9ae944ee..ce9c4f3f24 100644
--- a/yjit/src/backend/ir.rs
+++ b/yjit/src/backend/ir.rs
@@ -1097,7 +1097,7 @@ impl Assembler
let side_exit = match self.side_exits.get(&side_exit_context) {
None => {
let exit_code = gen_outlined_exit(side_exit_context.pc, &side_exit_context.get_ctx(), ocb)?;
- self.side_exits.insert(side_exit_context.clone(), exit_code);
+ self.side_exits.insert(*side_exit_context, exit_code);
exit_code
}
Some(code_ptr) => *code_ptr,
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index be6d38a466..e99161c9f0 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -108,7 +108,7 @@ impl JITState {
JITState {
iseq: blockid.iseq,
starting_insn_idx: blockid.idx,
- starting_ctx: starting_ctx.clone(),
+ starting_ctx,
output_ptr,
insn_idx: 0,
opcode: 0,
@@ -151,7 +151,7 @@ impl JITState {
}
pub fn get_starting_ctx(&self) -> Context {
- self.starting_ctx.clone()
+ self.starting_ctx
}
pub fn get_arg(&self, arg_idx: isize) -> VALUE {
@@ -550,7 +550,7 @@ fn gen_exit(exit_pc: *mut VALUE, asm: &mut Assembler) {
pub fn gen_outlined_exit(exit_pc: *mut VALUE, ctx: &Context, ocb: &mut OutlinedCb) -> Option<CodePtr> {
let mut cb = ocb.unwrap();
let mut asm = Assembler::new();
- asm.ctx = ctx.clone();
+ asm.ctx = *ctx;
asm.set_reg_temps(ctx.get_reg_temps());
gen_exit(exit_pc, &mut asm);
@@ -599,7 +599,7 @@ pub fn jit_ensure_block_entry_exit(jit: &mut JITState, asm: &mut Assembler, ocb:
// If we're compiling the first instruction in the block.
if jit.insn_idx == jit.starting_insn_idx {
// Generate the exit with the cache in Assembler.
- let side_exit_context = SideExitContext::new(jit.pc, block_starting_context.clone());
+ let side_exit_context = SideExitContext::new(jit.pc, *block_starting_context);
let entry_exit = asm.get_side_exit(&side_exit_context, None, ocb);
jit.block_entry_exit = Some(entry_exit?);
} else {
@@ -843,7 +843,7 @@ fn jump_to_next_insn(
) -> Option<()> {
// Reset the depth since in current usages we only ever jump to to
// chain_depth > 0 from the same instruction.
- let mut reset_depth = asm.ctx.clone();
+ let mut reset_depth = asm.ctx;
reset_depth.reset_chain_depth();
let jump_block = BlockId {
@@ -897,7 +897,7 @@ pub fn gen_single_block(
let mut insn_idx: IseqIdx = blockid.idx;
// Initialize a JIT state object
- let mut jit = JITState::new(blockid, ctx.clone(), cb.get_write_ptr(), ec);
+ let mut jit = JITState::new(blockid, ctx, cb.get_write_ptr(), ec);
jit.iseq = blockid.iseq;
// Create a backend assembler instance
@@ -3920,7 +3920,7 @@ fn gen_branchif(
asm.test(val_opnd, Opnd::Imm(!Qnil.as_i64()));
// Generate the branch instructions
- let ctx = asm.ctx.clone();
+ let ctx = asm.ctx;
gen_branch(
jit,
asm,
@@ -3976,7 +3976,7 @@ fn gen_branchunless(
asm.test(val_opnd, not_qnil.into());
// Generate the branch instructions
- let ctx = asm.ctx.clone();
+ let ctx = asm.ctx;
gen_branch(
jit,
asm,
@@ -4029,7 +4029,7 @@ fn gen_branchnil(
// Test if the value is Qnil
asm.cmp(val_opnd, Opnd::UImm(Qnil.into()));
// Generate the branch instructions
- let ctx = asm.ctx.clone();
+ let ctx = asm.ctx;
gen_branch(
jit,
asm,
@@ -6671,7 +6671,7 @@ fn gen_send_iseq(
// Pop arguments and receiver in return context and
// mark it as a continuation of gen_leave()
let mut return_asm = Assembler::new();
- return_asm.ctx = asm.ctx.clone();
+ return_asm.ctx = asm.ctx;
return_asm.stack_pop(sp_offset.try_into().unwrap());
return_asm.ctx.set_sp_offset(0); // We set SP on the caller's frame above
return_asm.ctx.reset_chain_depth();
diff --git a/yjit/src/core.rs b/yjit/src/core.rs
index 61661e1a2c..68d705a4bf 100644
--- a/yjit/src/core.rs
+++ b/yjit/src/core.rs
@@ -634,8 +634,8 @@ impl BranchTarget {
fn get_ctx(&self) -> Context {
match self {
- BranchTarget::Stub(stub) => stub.ctx.clone(),
- BranchTarget::Block(blockref) => unsafe { blockref.as_ref() }.ctx.clone(),
+ BranchTarget::Stub(stub) => stub.ctx,
+ BranchTarget::Block(blockref) => unsafe { blockref.as_ref() }.ctx,
}
}
@@ -792,7 +792,7 @@ impl PendingBranch {
address: Some(stub_addr),
iseq: Cell::new(target.iseq),
iseq_idx: target.idx,
- ctx: ctx.clone(),
+ ctx: *ctx,
})))));
}
@@ -1401,7 +1401,7 @@ fn find_block_version(blockid: BlockId, ctx: &Context) -> Option<BlockRef> {
pub fn limit_block_versions(blockid: BlockId, ctx: &Context) -> Context {
// Guard chains implement limits separately, do nothing
if ctx.get_chain_depth() > 0 {
- return ctx.clone();
+ return *ctx;
}
// If this block version we're about to add will hit the version limit
@@ -1420,7 +1420,7 @@ pub fn limit_block_versions(blockid: BlockId, ctx: &Context) -> Context {
return generic_ctx;
}
- return ctx.clone();
+ return *ctx;
}
/// Install a block version into its [IseqPayload], letting the GC track its
@@ -1618,7 +1618,7 @@ impl Context {
/// accordingly. This is useful when you want to virtually rewind a stack_size for
/// generating a side exit while considering past sp_offset changes on gen_save_sp.
pub fn with_stack_size(&self, stack_size: u8) -> Context {
- let mut ctx = self.clone();
+ let mut ctx = *self;
ctx.sp_offset -= (ctx.get_stack_size() as isize - stack_size as isize) as i8;
ctx.stack_size = stack_size;
ctx
@@ -2670,7 +2670,7 @@ fn gen_branch_stub(
let ocb = ocb.unwrap();
let mut asm = Assembler::new();
- asm.ctx = ctx.clone();
+ asm.ctx = *ctx;
asm.set_reg_temps(ctx.reg_temps);
asm_comment!(asm, "branch stub hit");
@@ -2868,7 +2868,7 @@ pub fn gen_direct_jump(jit: &mut JITState, ctx: &Context, target0: BlockId, asm:
// compile the target block right after this one (fallthrough).
BranchTarget::Stub(Box::new(BranchStub {
address: None,
- ctx: ctx.clone(),
+ ctx: *ctx,
iseq: Cell::new(target0.iseq),
iseq_idx: target0.idx,
}))
@@ -2887,7 +2887,7 @@ pub fn defer_compilation(
panic!("Double defer!");
}
- let mut next_ctx = asm.ctx.clone();
+ let mut next_ctx = asm.ctx;
next_ctx.increment_chain_depth();
@@ -3127,7 +3127,7 @@ pub fn invalidate_block_version(blockref: &BlockRef) {
address: Some(stub_addr),
iseq: block.iseq.clone(),
iseq_idx: block.iseq_range.start,
- ctx: block.ctx.clone(),
+ ctx: block.ctx,
})))));
// Check if the invalidated block immediately follows