diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2022-05-19 12:26:20 -0400 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-29 08:46:53 -0700 |
commit | 99cfbdca6b7c2dd167137e7256cc861961969ffd (patch) | |
tree | 968d66353ee93196331715986c40664b36217fba | |
parent | 75c995b0d10515568ccfe8f67be1bd3bbcbb4b69 (diff) |
Fix bug with asm.comment()
-rw-r--r-- | yjit/src/backend/ir.rs | 3 | ||||
-rw-r--r-- | yjit/src/backend/x86_64/mod.rs | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs index 7f6a20c191..7971f69842 100644 --- a/yjit/src/backend/ir.rs +++ b/yjit/src/backend/ir.rs @@ -359,6 +359,7 @@ impl Assembler pos: None }; self.insns.push(insn); + self.live_ranges.push(self.insns.len()); } /// Add a label at the current position @@ -375,6 +376,7 @@ impl Assembler pos: None }; self.insns.push(insn); + self.live_ranges.push(self.insns.len()); Target::LabelIdx(insn_idx) } @@ -762,6 +764,7 @@ mod tests { { let mut asm = Assembler::new(); let mut cb = CodeBlock::new_dummy(1024); + asm.comment("check that comments work too"); asm.mov(Opnd::mem(64, SP, 0), Opnd::mem(64, SP, 8)); asm.compile(&mut cb); } diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs index 00b9998b69..ed68e13eb6 100644 --- a/yjit/src/backend/x86_64/mod.rs +++ b/yjit/src/backend/x86_64/mod.rs @@ -59,7 +59,9 @@ impl Assembler // For each instruction for insn in &self.insns { match insn.op { + // TODO: need to map the position of comments in the machine code Op::Comment => {}, + Op::Label => {}, Op::Add => add(cb, insn.opnds[0].into(), insn.opnds[1].into()), @@ -70,13 +72,12 @@ impl Assembler */ Op::Load => add(cb, insn.out.into(), insn.opnds[0].into()), - Op::Mov => add(cb, insn.opnds[0].into(), insn.opnds[1].into()), + Op::Mov => mov(cb, insn.opnds[0].into(), insn.opnds[1].into()), // Test and set flags - Op::Test => add(cb, insn.opnds[0].into(), insn.opnds[1].into()), + Op::Test => test(cb, insn.opnds[0].into(), insn.opnds[1].into()), /* - Test, Cmp, Jnz, Jbe, |