summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-07 14:08:15 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-07 14:59:37 -0800
commit3e731cd945134da5f55cbd34f5cd8c9086a8c27a (patch)
treec340f96af75ad8c298e4d426112ff7cb28eb2e09 /yjit
parent7f557d02c343d25a07036e4170367897ed14c3b9 (diff)
YJIT: Add comments to peek and x86_merge
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7453
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/backend/ir.rs1
-rw-r--r--yjit/src/backend/x86_64/mod.rs3
2 files changed, 4 insertions, 0 deletions
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs
index f376ede181..c2b6afd760 100644
--- a/yjit/src/backend/ir.rs
+++ b/yjit/src/backend/ir.rs
@@ -1230,6 +1230,7 @@ impl AssemblerDrainingIterator {
self.insns.next().map(|insn| (index, insn))
}
+ /// Returns the next instruction without incrementing the iterator's index.
pub fn peek(&mut self) -> Option<&Insn> {
self.insns.peek()
}
diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs
index dadd6924bb..eb858de70b 100644
--- a/yjit/src/backend/x86_64/mod.rs
+++ b/yjit/src/backend/x86_64/mod.rs
@@ -105,6 +105,9 @@ impl Assembler
// These are the callee-saved registers in the x86-64 SysV ABI
// RBX, RSP, RBP, and R12–R15
+ /// Merge IR instructions for the x86 platform. As of x86_split, all `out` operands
+ /// are Opnd::Out, but you sometimes want to use Opnd::Reg for example to shorten the
+ /// generated code, which is what this pass does.
fn x86_merge(mut self) -> Assembler {
let live_ranges: Vec<usize> = take(&mut self.live_ranges);
let mut asm = Assembler::new_with_label_names(take(&mut self.label_names));