@@ -3304,6 +3304,41 @@ fn gen_opt_str_uminus(
33043304 KeepCompiling
33053305}
33063306
3307+ fn gen_opt_newarray_max (
3308+ jit : & mut JITState ,
3309+ ctx : & mut Context ,
3310+ asm : & mut Assembler ,
3311+ _ocb : & mut OutlinedCb ,
3312+ ) -> CodegenStatus {
3313+ let num = jit_get_arg ( jit, 0 ) . as_u32 ( ) ;
3314+
3315+ // Save the PC and SP because we may allocate
3316+ jit_prepare_routine_call ( jit, ctx, asm) ;
3317+
3318+ extern "C" {
3319+ fn rb_vm_opt_newarray_max ( ec : EcPtr , num : u32 , elts : * const VALUE ) -> VALUE ;
3320+ }
3321+
3322+ let offset_magnitude = ( SIZEOF_VALUE as u32 ) * num;
3323+ let values_opnd = ctx. sp_opnd ( -( offset_magnitude as isize ) ) ;
3324+ let values_ptr = asm. lea ( values_opnd) ;
3325+
3326+ let val_opnd = asm. ccall (
3327+ rb_vm_opt_newarray_max as * const u8 ,
3328+ vec ! [
3329+ EC ,
3330+ num. into( ) ,
3331+ values_ptr
3332+ ] ,
3333+ ) ;
3334+
3335+ ctx. stack_pop ( num. as_usize ( ) ) ;
3336+ let stack_ret = ctx. stack_push ( Type :: Unknown ) ;
3337+ asm. mov ( stack_ret, val_opnd) ;
3338+
3339+ KeepCompiling
3340+ }
3341+
33073342fn gen_opt_newarray_min (
33083343 jit : & mut JITState ,
33093344 ctx : & mut Context ,
@@ -7006,6 +7041,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> {
70067041 YARVINSN_opt_mod => Some ( gen_opt_mod) ,
70077042 YARVINSN_opt_str_freeze => Some ( gen_opt_str_freeze) ,
70087043 YARVINSN_opt_str_uminus => Some ( gen_opt_str_uminus) ,
7044+ YARVINSN_opt_newarray_max => Some ( gen_opt_newarray_max) ,
70097045 YARVINSN_opt_newarray_min => Some ( gen_opt_newarray_min) ,
70107046 YARVINSN_splatarray => Some ( gen_splatarray) ,
70117047 YARVINSN_concatarray => Some ( gen_concatarray) ,
0 commit comments