@@ -742,21 +742,21 @@ fn gen_branch_params(jit: &mut JITState, asm: &mut Assembler, branch: &BranchEdg
742742 return ;
743743 }
744744
745- asm_comment ! ( asm, "set branch params: {}" , branch. args. len( ) ) ;
746- let mut moves: Vec < ( Reg , Opnd ) > = vec ! [ ] ;
747- for ( idx, & arg) in branch. args . iter ( ) . enumerate ( ) {
748- match param_opnd ( idx) {
749- Opnd :: Reg ( reg) => {
750- // If a parameter is a register, we need to parallel-move it
751- moves. push ( ( reg, jit. get_opnd ( arg) ) ) ;
752- } ,
753- param => {
754- // If a parameter is memory, we set it beforehand
755- asm. mov ( param, jit. get_opnd ( arg) ) ;
745+ asm_comment ! ( asm, "set branch params: {}" , branch. args. len( ) ) ;
746+ let mut moves: Vec < ( Reg , Opnd ) > = vec ! [ ] ;
747+ for ( idx, & arg) in branch. args . iter ( ) . enumerate ( ) {
748+ match param_opnd ( idx) {
749+ Opnd :: Reg ( reg) => {
750+ // If a parameter is a register, we need to parallel-move it
751+ moves. push ( ( reg, jit. get_opnd ( arg) ) ) ;
752+ } ,
753+ param => {
754+ // If a parameter is memory, we set it beforehand
755+ asm. mov ( param, jit. get_opnd ( arg) ) ;
756+ }
756757 }
757758 }
758- }
759- asm. parallel_mov ( moves) ;
759+ asm. parallel_mov ( moves) ;
760760}
761761
762762/// Get a method parameter on JIT entry. As of entry, whether EP is escaped or not solely
@@ -1005,35 +1005,11 @@ fn gen_new_hash(
10051005 pairs. push ( val) ;
10061006 }
10071007
1008- let n = pairs. len ( ) ;
1009-
1010- // Calculate the compile-time NATIVE_STACK_PTR offset from NATIVE_BASE_PTR
1011- // At this point, frame_setup(&[], jit.c_stack_slots) has been called,
1012- // which allocated aligned_stack_bytes(jit.c_stack_slots) on the stack
1013- let frame_size = aligned_stack_bytes ( jit. c_stack_slots ) ;
1014- let allocation_size = aligned_stack_bytes ( n) ;
1015-
1016- asm_comment ! ( asm, "allocate {} bytes on C stack for {} hash elements" , allocation_size, n) ;
1017- asm. sub_into ( NATIVE_STACK_PTR , allocation_size. into ( ) ) ;
1018-
1019- // Calculate the total offset from NATIVE_BASE_PTR to our buffer
1020- let total_offset_from_base = ( frame_size + allocation_size) as i32 ;
1021-
1022- for ( idx, & pair_opnd) in pairs. iter ( ) . enumerate ( ) {
1023- let slot_offset = -total_offset_from_base + ( idx as i32 * SIZEOF_VALUE_I32 ) ;
1024- asm. mov (
1025- Opnd :: mem ( VALUE_BITS , NATIVE_BASE_PTR , slot_offset) ,
1026- pair_opnd
1027- ) ;
1028- }
1029-
1030- let argv = asm. lea ( Opnd :: mem ( 64 , NATIVE_BASE_PTR , -total_offset_from_base) ) ;
1031-
1008+ let argv = gen_push_opnds ( jit, asm, & pairs) ;
10321009 let argc = ( elements. len ( ) * 2 ) as :: std:: os:: raw:: c_long ;
10331010 asm_ccall ! ( asm, rb_hash_bulk_insert, lir:: Opnd :: Imm ( argc) , argv, new_hash) ;
10341011
1035- asm_comment ! ( asm, "restore C stack pointer" ) ;
1036- asm. add_into ( NATIVE_STACK_PTR , allocation_size. into ( ) ) ;
1012+ gen_pop_opnds ( asm, & pairs) ;
10371013 }
10381014
10391015 new_hash
0 commit comments