[aarch64-port-dev ] RFRs: broken float/double parameters passing to jni methods
Fedor Burdun
fedor.burdun at azulsystems.com
Sun Jan 1 15:04:12 UTC 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: text/x-diff
Size: 2305 bytes
Desc: 1.patch
URL: <http://mail.openjdk.java.net/pipermail/aarch64-port-dev/attachments/20170101/137d6e0d/1-0001.patch>
More information about the aarch64-port-dev
mailing list