src/cpu/sparc/vm/sharedRuntime_sparc.cpp

Print this page
rev 5186 : 8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
Summary: Some platforms, as ppc and s390x/zArch require that 32-bit ints are passed as 64-bit values to C functions. This change adds support to adapt the signature and to issue proper casts to c2-compiled stubs. The functions are used in generate_native_wrapper(). Adapt signature in PhaseIdealLoop::intrinsify_fill().


1211         break;
1212       case T_VOID: regs[i].set_bad(); break;
1213       default:
1214         ShouldNotReachHere();
1215       }
1216       if (regs[i].first()->is_stack()) {
1217         int off =  regs[i].first()->reg2stack();
1218         if (off > max_stack_slots) max_stack_slots = off;
1219       }
1220       if (regs[i].second()->is_stack()) {
1221         int off =  regs[i].second()->reg2stack();
1222         if (off > max_stack_slots) max_stack_slots = off;
1223       }
1224     }
1225 #endif // _LP64
1226 
1227   return round_to(max_stack_slots + 1, 2);
1228 
1229 }
1230 




1231 
1232 // ---------------------------------------------------------------------------
1233 void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1234   switch (ret_type) {
1235   case T_FLOAT:
1236     __ stf(FloatRegisterImpl::S, F0, SP, frame_slots*VMRegImpl::stack_slot_size - 4+STACK_BIAS);
1237     break;
1238   case T_DOUBLE:
1239     __ stf(FloatRegisterImpl::D, F0, SP, frame_slots*VMRegImpl::stack_slot_size - 8+STACK_BIAS);
1240     break;
1241   }
1242 }
1243 
1244 void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1245   switch (ret_type) {
1246   case T_FLOAT:
1247     __ ldf(FloatRegisterImpl::S, SP, frame_slots*VMRegImpl::stack_slot_size - 4+STACK_BIAS, F0);
1248     break;
1249   case T_DOUBLE:
1250     __ ldf(FloatRegisterImpl::D, SP, frame_slots*VMRegImpl::stack_slot_size - 8+STACK_BIAS, F0);




1211         break;
1212       case T_VOID: regs[i].set_bad(); break;
1213       default:
1214         ShouldNotReachHere();
1215       }
1216       if (regs[i].first()->is_stack()) {
1217         int off =  regs[i].first()->reg2stack();
1218         if (off > max_stack_slots) max_stack_slots = off;
1219       }
1220       if (regs[i].second()->is_stack()) {
1221         int off =  regs[i].second()->reg2stack();
1222         if (off > max_stack_slots) max_stack_slots = off;
1223       }
1224     }
1225 #endif // _LP64
1226 
1227   return round_to(max_stack_slots + 1, 2);
1228 
1229 }
1230 
1231 // Do we need to convert ints to longs for c calls?
1232 bool SharedRuntime::c_calling_convention_requires_ints_as_longs() {
1233   return false;
1234 }
1235 
1236 // ---------------------------------------------------------------------------
1237 void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1238   switch (ret_type) {
1239   case T_FLOAT:
1240     __ stf(FloatRegisterImpl::S, F0, SP, frame_slots*VMRegImpl::stack_slot_size - 4+STACK_BIAS);
1241     break;
1242   case T_DOUBLE:
1243     __ stf(FloatRegisterImpl::D, F0, SP, frame_slots*VMRegImpl::stack_slot_size - 8+STACK_BIAS);
1244     break;
1245   }
1246 }
1247 
1248 void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
1249   switch (ret_type) {
1250   case T_FLOAT:
1251     __ ldf(FloatRegisterImpl::S, SP, frame_slots*VMRegImpl::stack_slot_size - 4+STACK_BIAS, F0);
1252     break;
1253   case T_DOUBLE:
1254     __ ldf(FloatRegisterImpl::D, SP, frame_slots*VMRegImpl::stack_slot_size - 8+STACK_BIAS, F0);