RFRs: broken float/double parameters passing to jni methods
Hello everybody! It was noticed that passing over 8 float/double parameters to jni method was broken (or correctly saying wasn't not implemented even). I would like to ask somebody to review the fix for the issue. The test and the fix both are in attachment. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp --- a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp +++ b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp @@ -987,11 +987,23 @@ // A float arg may have to do float reg int reg conversion static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) { - if (src.first() != dst.first()) { - if (src.is_single_phys_reg() && dst.is_single_phys_reg()) + if (src.first()->is_stack()) { + if (dst.first()->is_stack()) { + //load float value as long int + __ ldrw(rscratch1, Address(rfp, reg2offset_in(src.first()))); + __ strw(rscratch1, Address(sp, reg2offset_out(dst.first()))); + } else { + // stack to reg + __ ldrs(dst.first()->as_FloatRegister(), Address(rfp, reg2offset_in(src.first()))); + } + } else if (dst.first()->is_stack()) { + // reg to stack + __ strs(src.first()->as_FloatRegister(), Address(sp, reg2offset_out(dst.first()))); + } else { + if (src.first() != dst.first()) { + assert(src.is_single_phys_reg() && dst.is_single_phys_reg(), "should be"); __ fmovs(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister()); - else - ShouldNotReachHere(); + } } } @@ -1021,11 +1033,23 @@ // A double move static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) { - if (src.first() != dst.first()) { - if (src.is_single_phys_reg() && dst.is_single_phys_reg()) + if (src.first()->is_stack()) { + if (dst.first()->is_stack()) { + //load double float value as long int + __ ldr(rscratch1, Address(rfp, reg2offset_in(src.first()))); + __ str(rscratch1, Address(sp, reg2offset_out(dst.first()))); + } else { + // stack to reg + __ ldrd(dst.first()->as_FloatRegister(), Address(rfp, reg2offset_in(src.first()))); + } + } else if (dst.first()->is_stack()) { + // reg to stack + __ strd(src.first()->as_FloatRegister(), Address(sp, reg2offset_out(dst.first()))); + } else { + if (src.first() != dst.first()) { + assert(src.is_single_phys_reg() && dst.is_single_phys_reg(), "should be"); __ fmovd(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister()); - else - ShouldNotReachHere(); + } } } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Thanks, Fedor
On 01/01/17 15:04, Fedor Burdun wrote:
It was noticed that passing over 8 float/double parameters to jni method was broken (or correctly saying wasn't not implemented even). I would like to ask somebody to review the fix for the issue. The test and the fix both are in attachment.
Can you tell me which version you tested? Andrew.
participants (2)
-
Andrew Haley
-
Fedor Burdun