@@ -349,6 +349,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
349349 Insn :: NewRange { low, high, flag, state } => gen_new_range ( jit, asm, opnd ! ( low) , opnd ! ( high) , * flag, & function. frame_state ( * state) ) ,
350350 Insn :: NewRangeFixnum { low, high, flag, state } => gen_new_range_fixnum ( asm, opnd ! ( low) , opnd ! ( high) , * flag, & function. frame_state ( * state) ) ,
351351 Insn :: ArrayDup { val, state } => gen_array_dup ( asm, opnd ! ( val) , & function. frame_state ( * state) ) ,
352+ Insn :: ObjectAlloc { val, state } => gen_object_alloc ( asm, opnd ! ( val) , & function. frame_state ( * state) ) ,
352353 Insn :: StringCopy { val, chilled, state } => gen_string_copy ( asm, opnd ! ( val) , * chilled, & function. frame_state ( * state) ) ,
353354 // concatstrings shouldn't have 0 strings
354355 // If it happens we abort the compilation for now
@@ -385,6 +386,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
385386 Insn :: FixnumAnd { left, right } => gen_fixnum_and ( asm, opnd ! ( left) , opnd ! ( right) ) ,
386387 Insn :: FixnumOr { left, right } => gen_fixnum_or ( asm, opnd ! ( left) , opnd ! ( right) ) ,
387388 Insn :: IsNil { val } => gen_isnil ( asm, opnd ! ( val) ) ,
389+ & Insn :: IsMethodCfunc { val, cd, cfunc } => gen_is_method_cfunc ( jit, asm, opnd ! ( val) , cd, cfunc) ,
388390 Insn :: Test { val } => gen_test ( asm, opnd ! ( val) ) ,
389391 Insn :: GuardType { val, guard_type, state } => gen_guard_type ( jit, asm, opnd ! ( val) , * guard_type, & function. frame_state ( * state) ) ,
390392 Insn :: GuardBitEquals { val, expected, state } => gen_guard_bit_equals ( jit, asm, opnd ! ( val) , * expected, & function. frame_state ( * state) ) ,
@@ -1190,6 +1192,11 @@ fn gen_new_range_fixnum(
11901192 asm_ccall ! ( asm, rb_range_new, low, high, ( flag as i64 ) . into( ) )
11911193}
11921194
1195+ fn gen_object_alloc ( asm : & mut Assembler , val : lir:: Opnd , state : & FrameState ) -> lir:: Opnd {
1196+ gen_prepare_call_with_gc ( asm, state) ;
1197+ asm_ccall ! ( asm, rb_obj_alloc, val)
1198+ }
1199+
11931200/// Compile code that exits from JIT code with a return value
11941201fn gen_return ( asm : & mut Assembler , val : lir:: Opnd ) {
11951202 // Pop the current frame (ec->cfp++)
@@ -1292,6 +1299,13 @@ fn gen_isnil(asm: &mut Assembler, val: lir::Opnd) -> lir::Opnd {
12921299 asm. csel_e ( Opnd :: Imm ( 1 ) , Opnd :: Imm ( 0 ) )
12931300}
12941301
1302+ fn gen_is_method_cfunc ( jit : & JITState , asm : & mut Assembler , val : lir:: Opnd , cd : * const rb_call_data , cfunc : * const u8 ) -> lir:: Opnd {
1303+ unsafe extern "C" {
1304+ fn rb_vm_method_cfunc_is ( iseq : IseqPtr , cd : * const rb_call_data , recv : VALUE , cfunc : * const u8 ) -> VALUE ;
1305+ }
1306+ asm_ccall ! ( asm, rb_vm_method_cfunc_is, VALUE ( jit. iseq as usize ) . into( ) , ( cd as usize ) . into( ) , val, ( cfunc as usize ) . into( ) )
1307+ }
1308+
12951309fn gen_anytostring ( asm : & mut Assembler , val : lir:: Opnd , str : lir:: Opnd , state : & FrameState ) -> lir:: Opnd {
12961310 gen_prepare_call_with_gc ( asm, state) ;
12971311
0 commit comments