summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <[email protected]>2025-02-06 11:21:40 -0500
committerTakashi Kokubun <[email protected]>2025-04-18 21:52:55 +0900
commitf0954d1b2b7703e0d5dc89564caa4620305d16c1 (patch)
treeb3fb7e9da4b307c48810237f32522fb859dfe0c2
parentcabfa3bfe14f72ef139ff081766add46db6922cd (diff)
Add Putstring
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/ir.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs
index 3411f5bcb6..1f9911742f 100644
--- a/zjit/src/ir.rs
+++ b/zjit/src/ir.rs
@@ -17,6 +17,9 @@ enum Opnd {
enum Insn {
// SSA block parameter. Also used for function parameters in the function's entry block.
Param { idx: usize },
+ StringCopy { val: Opnd },
+
+ // Control flow instructions
Return { val: Opnd },
}
@@ -53,6 +56,7 @@ impl Function {
enum RubyOpcode {
Putnil,
Putobject(VALUE),
+ Putstring(VALUE),
Setlocal(usize),
Getlocal(usize),
Leave,
@@ -103,6 +107,10 @@ fn to_ssa(opcodes: &Vec<RubyOpcode>) -> Function {
match opcode {
RubyOpcode::Putnil => { state.push(Opnd::Const(Qnil)); },
RubyOpcode::Putobject(val) => { state.push(Opnd::Const(*val)); },
+ RubyOpcode::Putstring(val) => {
+ let insn_id = Opnd::Insn(result.push_insn(block, Insn::StringCopy { val: Opnd::Const(*val) }));
+ state.push(insn_id);
+ }
RubyOpcode::Setlocal(idx) => {
let val = state.pop();
state.setlocal(*idx, val);