< prev index next >

src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp

Print this page
rev 6466 : 8165673: AArch64: Fix JNI floating point argument handling
Reviewed-by: aph, adinn
Contributed-by: ningsheng.jian@linaro.org


 961     // Store oop in handle area, may be NULL
 962     __ str(rOop, Address(sp, offset));
 963     if (is_receiver) {
 964       *receiver_offset = offset;
 965     }
 966 
 967     __ cmp(rOop, zr);
 968     __ lea(rHandle, Address(sp, offset));
 969     // conditionally move a NULL
 970     __ csel(rHandle, zr, rHandle, Assembler::EQ);
 971   }
 972 
 973   // If arg is on the stack then place it otherwise it is already in correct reg.
 974   if (dst.first()->is_stack()) {
 975     __ str(rHandle, Address(sp, reg2offset_out(dst.first())));
 976   }
 977 }
 978 
 979 // A float arg may have to do float reg int reg conversion
 980 static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
 981   if (src.first() != dst.first()) {









 982     if (src.is_single_phys_reg() && dst.is_single_phys_reg())
 983       __ fmovs(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
 984     else
 985       ShouldNotReachHere();
 986   }
 987 }
 988 
 989 // A long move
 990 static void long_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
 991   if (src.first()->is_stack()) {
 992     if (dst.first()->is_stack()) {
 993       // stack to stack
 994       __ ldr(rscratch1, Address(rfp, reg2offset_in(src.first())));
 995       __ str(rscratch1, Address(sp, reg2offset_out(dst.first())));
 996     } else {
 997       // stack to reg
 998       __ ldr(dst.first()->as_Register(), Address(rfp, reg2offset_in(src.first())));
 999     }
1000   } else if (dst.first()->is_stack()) {
1001     // reg to stack
1002     // Do we really have to sign extend???
1003     // __ movslq(src.first()->as_Register(), src.first()->as_Register());
1004     __ str(src.first()->as_Register(), Address(sp, reg2offset_out(dst.first())));
1005   } else {
1006     if (dst.first() != src.first()) {
1007       __ mov(dst.first()->as_Register(), src.first()->as_Register());
1008     }
1009   }
1010 }
1011 
1012 
1013 // A double move
1014 static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
1015   if (src.first() != dst.first()) {









1016     if (src.is_single_phys_reg() && dst.is_single_phys_reg())
1017       __ fmovd(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
1018     else
1019       ShouldNotReachHere();
1020   }
1021 }
1022 
1023 
1024 void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1025   // We always ignore the frame_slots arg and just use the space just below frame pointer
1026   // which by this time is free to use
1027   switch (ret_type) {
1028   case T_FLOAT:
1029     __ strs(v0, Address(rfp, -wordSize));
1030     break;
1031   case T_DOUBLE:
1032     __ strd(v0, Address(rfp, -wordSize));
1033     break;
1034   case T_VOID:  break;
1035   default: {




 961     // Store oop in handle area, may be NULL
 962     __ str(rOop, Address(sp, offset));
 963     if (is_receiver) {
 964       *receiver_offset = offset;
 965     }
 966 
 967     __ cmp(rOop, zr);
 968     __ lea(rHandle, Address(sp, offset));
 969     // conditionally move a NULL
 970     __ csel(rHandle, zr, rHandle, Assembler::EQ);
 971   }
 972 
 973   // If arg is on the stack then place it otherwise it is already in correct reg.
 974   if (dst.first()->is_stack()) {
 975     __ str(rHandle, Address(sp, reg2offset_out(dst.first())));
 976   }
 977 }
 978 
 979 // A float arg may have to do float reg int reg conversion
 980 static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
 981   assert(src.first()->is_stack() && dst.first()->is_stack() ||                 
 982          src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");  
 983   if (src.first()->is_stack()) {                                               
 984     if (dst.first()->is_stack()) {                                             
 985       __ ldrw(rscratch1, Address(rfp, reg2offset_in(src.first())));            
 986       __ strw(rscratch1, Address(sp, reg2offset_out(dst.first())));            
 987     } else {                                                                   
 988       ShouldNotReachHere();                                                    
 989     }                                                                          
 990   } else if (src.first() != dst.first()) {
 991     if (src.is_single_phys_reg() && dst.is_single_phys_reg())
 992       __ fmovs(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
 993     else
 994       ShouldNotReachHere();
 995   }
 996 }
 997 
 998 // A long move
 999 static void long_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
1000   if (src.first()->is_stack()) {
1001     if (dst.first()->is_stack()) {
1002       // stack to stack
1003       __ ldr(rscratch1, Address(rfp, reg2offset_in(src.first())));
1004       __ str(rscratch1, Address(sp, reg2offset_out(dst.first())));
1005     } else {
1006       // stack to reg
1007       __ ldr(dst.first()->as_Register(), Address(rfp, reg2offset_in(src.first())));
1008     }
1009   } else if (dst.first()->is_stack()) {
1010     // reg to stack
1011     // Do we really have to sign extend???
1012     // __ movslq(src.first()->as_Register(), src.first()->as_Register());
1013     __ str(src.first()->as_Register(), Address(sp, reg2offset_out(dst.first())));
1014   } else {
1015     if (dst.first() != src.first()) {
1016       __ mov(dst.first()->as_Register(), src.first()->as_Register());
1017     }
1018   }
1019 }
1020 
1021 
1022 // A double move
1023 static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
1024   assert(src.first()->is_stack() && dst.first()->is_stack() ||                 
1025          src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");
1026   if (src.first()->is_stack()) {
1027     if (dst.first()->is_stack()) {
1028       __ ldr(rscratch1, Address(rfp, reg2offset_in(src.first())));
1029       __ str(rscratch1, Address(sp, reg2offset_out(dst.first())));
1030     } else {
1031       ShouldNotReachHere(); 
1032     }
1033   } else if (src.first() != dst.first()) {
1034     if (src.is_single_phys_reg() && dst.is_single_phys_reg())
1035       __ fmovd(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
1036     else
1037       ShouldNotReachHere();
1038   }
1039 }
1040 
1041 
1042 void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1043   // We always ignore the frame_slots arg and just use the space just below frame pointer
1044   // which by this time is free to use
1045   switch (ret_type) {
1046   case T_FLOAT:
1047     __ strs(v0, Address(rfp, -wordSize));
1048     break;
1049   case T_DOUBLE:
1050     __ strd(v0, Address(rfp, -wordSize));
1051     break;
1052   case T_VOID:  break;
1053   default: {


< prev index next >