summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2022-06-15 16:30:40 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2022-08-29 08:46:56 -0700
commitb8fc9909bfa18677d5ad2cb2535ca1f0537216e5 (patch)
treeebaeb5ff1af3904d6136b3d3fcdba883a913c613
parent40ac79ada89953f5ed9e36bdb5b3d0d3ae8d8f3e (diff)
Get rid of temporary context methods
-rw-r--r--yjit/src/backend/ir.rs26
-rw-r--r--yjit/src/backend/tests.rs4
-rw-r--r--yjit/src/codegen.rs18
3 files changed, 11 insertions, 37 deletions
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs
index f1146f152e..a441303d64 100644
--- a/yjit/src/backend/ir.rs
+++ b/yjit/src/backend/ir.rs
@@ -725,29 +725,3 @@ def_push_2_opnd_no_out!(cmp, Op::Cmp);
def_push_2_opnd_no_out!(test, Op::Test);
def_push_0_opnd_no_out!(breakpoint, Op::Breakpoint);
def_push_2_opnd_no_out!(incr_counter, Op::IncrCounter);
-
-// NOTE: these methods are temporary and will likely move
-// to context.rs later
-// They are just wrappers to convert from X86Opnd into the IR Opnd type
-impl Context
-{
- pub fn ir_sp_opnd(&mut self, idx: isize) -> Opnd {
- self.sp_opnd(idx).into()
- }
-
- pub fn ir_stack_opnd(&mut self, idx: i32) -> Opnd {
- self.stack_opnd(idx).into()
- }
-
- pub fn ir_stack_pop(&mut self, n: usize) -> Opnd {
- self.stack_pop(n).into()
- }
-
- pub fn ir_stack_push(&mut self, val_type: Type) -> Opnd {
- self.stack_push(val_type).into()
- }
-
- pub fn ir_stack_push_mapping(&mut self, (mapping, temp_type): (TempMapping, Type)) -> Opnd {
- self.stack_push_mapping((mapping, temp_type)).into()
- }
-}
diff --git a/yjit/src/backend/tests.rs b/yjit/src/backend/tests.rs
index afb4c42fa8..7b2f357455 100644
--- a/yjit/src/backend/tests.rs
+++ b/yjit/src/backend/tests.rs
@@ -12,10 +12,10 @@ fn gen_dup(
ctx: &mut Context,
asm: &mut Assembler,
) {
- let dup_val = ctx.ir_stack_pop(0);
+ let dup_val = ctx.stack_pop(0);
let (mapping, tmp_type) = ctx.get_opnd_mapping(StackOpnd(0));
- let loc0 = ctx.ir_stack_push_mapping((mapping, tmp_type));
+ let loc0 = ctx.stack_push_mapping((mapping, tmp_type));
asm.mov(loc0, dup_val);
}
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index c1ed715f0f..b58caa0984 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -277,7 +277,7 @@ fn jit_save_pc(jit: &JITState, asm: &mut Assembler) {
/// which could invalidate memory operands
fn gen_save_sp(jit: &JITState, asm: &mut Assembler, ctx: &mut Context) {
if ctx.get_sp_offset() != 0 {
- let stack_pointer = ctx.ir_sp_opnd(0);
+ let stack_pointer = ctx.sp_opnd(0);
let sp_addr = asm.lea(stack_pointer);
asm.mov(SP, sp_addr);
let cfp_sp_opnd = Opnd::mem(64, CFP, RUBY_OFFSET_CFP_SP);
@@ -897,10 +897,10 @@ fn gen_dup(
_ocb: &mut OutlinedCb,
) -> CodegenStatus {
- let dup_val = ctx.ir_stack_pop(0);
+ let dup_val = ctx.stack_pop(0);
let (mapping, tmp_type) = ctx.get_opnd_mapping(StackOpnd(0));
- let loc0 = ctx.ir_stack_push_mapping((mapping, tmp_type));
+ let loc0 = ctx.stack_push_mapping((mapping, tmp_type));
asm.mov(loc0, dup_val);
KeepCompiling
@@ -924,16 +924,16 @@ fn gen_dupn(
return CantCompile;
}
- let opnd1: Opnd = ctx.ir_stack_opnd(1);
- let opnd0: Opnd = ctx.ir_stack_opnd(0);
+ let opnd1: Opnd = ctx.stack_opnd(1);
+ let opnd0: Opnd = ctx.stack_opnd(0);
let mapping1 = ctx.get_opnd_mapping(StackOpnd(1));
let mapping0 = ctx.get_opnd_mapping(StackOpnd(0));
- let dst1: Opnd = ctx.ir_stack_push_mapping(mapping1);
+ let dst1: Opnd = ctx.stack_push_mapping(mapping1);
asm.mov(dst1, opnd1);
- let dst0: Opnd = ctx.ir_stack_push_mapping(mapping0);
+ let dst0: Opnd = ctx.stack_push_mapping(mapping0);
asm.mov(dst0, opnd0);
KeepCompiling
@@ -957,8 +957,8 @@ fn stack_swap(
offset0: u16,
offset1: u16,
) {
- let stack0_mem = ctx.ir_stack_opnd(offset0 as i32);
- let stack1_mem = ctx.ir_stack_opnd(offset1 as i32);
+ let stack0_mem = ctx.stack_opnd(offset0 as i32);
+ let stack1_mem = ctx.stack_opnd(offset1 as i32);
let mapping0 = ctx.get_opnd_mapping(StackOpnd(offset0));
let mapping1 = ctx.get_opnd_mapping(StackOpnd(offset1));