提交 19d89d58 编写于 作者: G goetz

8139258: PPC64LE: argument passing problem when passing 15 floats in native call

Reviewed-by: mdoerr, goetz
Contributed-by: asmundak@google.com
上级 82e3a0aa
...@@ -296,8 +296,16 @@ address AbstractInterpreterGenerator::generate_slow_signature_handler() { ...@@ -296,8 +296,16 @@ address AbstractInterpreterGenerator::generate_slow_signature_handler() {
__ bind(do_float); __ bind(do_float);
__ lfs(floatSlot, 0, arg_java); __ lfs(floatSlot, 0, arg_java);
#if defined(LINUX) #if defined(LINUX)
// Linux uses ELF ABI. Both original ELF and ELFv2 ABIs have float
// in the least significant word of an argument slot.
#if defined(VM_LITTLE_ENDIAN)
__ stfs(floatSlot, 0, arg_c);
#else
__ stfs(floatSlot, 4, arg_c); __ stfs(floatSlot, 4, arg_c);
#endif
#elif defined(AIX) #elif defined(AIX)
// Although AIX runs on big endian CPU, float is in most significant
// word of an argument slot.
__ stfs(floatSlot, 0, arg_c); __ stfs(floatSlot, 0, arg_c);
#else #else
#error "unknown OS" #error "unknown OS"
......
...@@ -766,6 +766,21 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt, ...@@ -766,6 +766,21 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
// in farg_reg[j] if argument i is the j-th float argument of this call. // in farg_reg[j] if argument i is the j-th float argument of this call.
// //
case T_FLOAT: case T_FLOAT:
#if defined(LINUX)
// Linux uses ELF ABI. Both original ELF and ELFv2 ABIs have float
// in the least significant word of an argument slot.
#if defined(VM_LITTLE_ENDIAN)
#define FLOAT_WORD_OFFSET_IN_SLOT 0
#else
#define FLOAT_WORD_OFFSET_IN_SLOT 1
#endif
#elif defined(AIX)
// Although AIX runs on big endian CPU, float is in the most
// significant word of an argument slot.
#define FLOAT_WORD_OFFSET_IN_SLOT 0
#else
#error "unknown OS"
#endif
if (freg < Argument::n_float_register_parameters_c) { if (freg < Argument::n_float_register_parameters_c) {
// Put float in register ... // Put float in register ...
reg = farg_reg[freg]; reg = farg_reg[freg];
...@@ -779,14 +794,14 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt, ...@@ -779,14 +794,14 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
if (arg >= Argument::n_regs_not_on_stack_c) { if (arg >= Argument::n_regs_not_on_stack_c) {
// ... and on the stack. // ... and on the stack.
guarantee(regs2 != NULL, "must pass float in register and stack slot"); guarantee(regs2 != NULL, "must pass float in register and stack slot");
VMReg reg2 = VMRegImpl::stack2reg(stk LINUX_ONLY(+1)); VMReg reg2 = VMRegImpl::stack2reg(stk + FLOAT_WORD_OFFSET_IN_SLOT);
regs2[i].set1(reg2); regs2[i].set1(reg2);
stk += inc_stk_for_intfloat; stk += inc_stk_for_intfloat;
} }
} else { } else {
// Put float on stack. // Put float on stack.
reg = VMRegImpl::stack2reg(stk LINUX_ONLY(+1)); reg = VMRegImpl::stack2reg(stk + FLOAT_WORD_OFFSET_IN_SLOT);
stk += inc_stk_for_intfloat; stk += inc_stk_for_intfloat;
} }
regs[i].set1(reg); regs[i].set1(reg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册