@@ -251,6 +251,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
251251 Insn :: PutSelf => gen_putself ( ) ,
252252 Insn :: Const { val : Const :: Value ( val) } => gen_const ( * val) ,
253253 Insn :: NewArray { elements, state } => gen_new_array ( jit, asm, elements, & function. frame_state ( * state) ) ,
254+ Insn :: NewRange { low, high, flag, state } => gen_new_range ( asm, opnd ! ( low) , opnd ! ( high) , * flag, & function. frame_state ( * state) ) ,
254255 Insn :: ArrayDup { val, state } => gen_array_dup ( asm, opnd ! ( val) , & function. frame_state ( * state) ) ,
255256 Insn :: Param { idx } => unreachable ! ( "block.insns should not have Insn::Param({idx})" ) ,
256257 Insn :: Snapshot { .. } => return Some ( ( ) ) , // we don't need to do anything for this instruction at the moment
@@ -550,6 +551,28 @@ fn gen_new_array(
550551 new_array
551552}
552553
554+ /// Compile a new range instruction
555+ fn gen_new_range (
556+ asm : & mut Assembler ,
557+ low : lir:: Opnd ,
558+ high : lir:: Opnd ,
559+ flag : u32 ,
560+ state : & FrameState ,
561+ ) -> lir:: Opnd {
562+ asm_comment ! ( asm, "call rb_range_new" ) ;
563+
564+ // Save PC
565+ gen_save_pc ( asm, state) ;
566+
567+ // Call rb_range_new(low, high, flag)
568+ let new_range = asm. ccall (
569+ rb_range_new as * const u8 ,
570+ vec ! [ low, high, lir:: Opnd :: Imm ( flag as i64 ) ] ,
571+ ) ;
572+
573+ new_range
574+ }
575+
553576/// Compile code that exits from JIT code with a return value
554577fn gen_return ( asm : & mut Assembler , val : lir:: Opnd ) -> Option < ( ) > {
555578 // Pop the current frame (ec->cfp++)
0 commit comments