[aarch64-port-dev ] RFR: Save callee save FP registers on entry to java code

Edward Nevill edward.nevill at linaro.org
Wed Apr 2 11:01:10 UTC 2014


Hi,

The following patch fixes a bug whereby the callee save FP registers D8-D15 were not saved on entry to Java.

These registers are used (without being saved) by both C1 and C2 JIT.

Thanks to Matthias Klose for finding this, and to Andrew Haley for debugging this from just the hs_err log.

I have tested the client & server builds against Hotspot, and have done a basic test on the simulator build.

OK to push?
Ed.

--- CUT HERE ---
exporting patch:
# HG changeset patch
# User Edward Nevill edward.nevill at linaro.org
# Date 1396435308 -3600
#      Wed Apr 02 11:41:48 2014 +0100
# Node ID 273f8f0e7109ba0abe8f3697f2f48e34afe0d2f3
# Parent  780ed75ea21a727949abcfe57ea5544f7a1ca22c
Preserve callee save FP registers around call to java code

diff -r 780ed75ea21a -r 273f8f0e7109 src/cpu/aarch64/vm/frame_aarch64.hpp
--- a/src/cpu/aarch64/vm/frame_aarch64.hpp	Tue Apr 01 12:22:23 2014 -0400
+++ b/src/cpu/aarch64/vm/frame_aarch64.hpp	Wed Apr 02 11:41:48 2014 +0100
@@ -133,7 +133,7 @@
     // Entry frames
     // n.b. these values are determined by the layout defined in
     // stubGenerator for the Java call stub
-    entry_frame_after_call_words                     = 19,
+    entry_frame_after_call_words                     = 27,
     entry_frame_call_wrapper_offset                  = -8,
 
     // we don't need a save area
diff -r 780ed75ea21a -r 273f8f0e7109 src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
--- a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Tue Apr 01 12:22:23 2014 -0400
+++ b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Wed Apr 02 11:41:48 2014 +0100
@@ -135,8 +135,16 @@
   //     [ return_from_Java     ] <--- sp
   //     [ argument word n      ]
   //      ...
-  // -19 [ argument word 1      ]
-  // -18 [ saved r28            ] <--- sp_after_call
+  // -27 [ argument word 1      ]
+  // -26 [ saved d15            ] <--- sp_after_call
+  // -25 [ saved d14            ]
+  // -24 [ saved d13            ]
+  // -23 [ saved d12            ]
+  // -22 [ saved d11            ]
+  // -21 [ saved d10            ]
+  // -20 [ saved d9             ]
+  // -19 [ saved d8             ]
+  // -18 [ saved r28            ]
   // -17 [ saved r27            ]
   // -16 [ saved r26            ]
   // -15 [ saved r25            ]
@@ -159,7 +167,17 @@
 
   // Call stub stack layout word offsets from fp
   enum call_stub_layout {
-    sp_after_call_off = -18,
+    sp_after_call_off = -26,
+
+    d15_off            = -26,
+    d14_off            = -25,
+    d13_off            = -24,
+    d12_off            = -23,
+    d11_off            = -22,
+    d10_off            = -21,
+    d9_off             = -20,
+    d8_off             = -19,
+
     r28_off            = -18,
     r27_off            = -17,
     r26_off            = -16,
@@ -202,6 +220,15 @@
 
     const Address thread        (rfp, thread_off         * wordSize);
 
+    const Address d15_save      (rfp, d15_off * wordSize);
+    const Address d14_save      (rfp, d14_off * wordSize);
+    const Address d13_save      (rfp, d13_off * wordSize);
+    const Address d12_save      (rfp, d12_off * wordSize);
+    const Address d11_save      (rfp, d11_off * wordSize);
+    const Address d10_save      (rfp, d10_off * wordSize);
+    const Address d9_save       (rfp, d9_off * wordSize);
+    const Address d8_save       (rfp, d8_off * wordSize);
+
     const Address r28_save      (rfp, r28_off * wordSize);
     const Address r27_save      (rfp, r27_off * wordSize);
     const Address r26_save      (rfp, r26_off * wordSize);
@@ -220,11 +247,8 @@
 
     address aarch64_entry = __ pc();
 
-// AED: this should fix Ed's problem -- we only save the sender's SP for our sim
 #ifdef BUILTIN_SIM
     // Save sender's SP for stack traces.
-// ECN: FIXME
-// #if 0
     __ mov(rscratch1, sp);
     __ str(rscratch1, Address(__ pre(sp, -2 * wordSize)));
 #endif
@@ -254,6 +278,15 @@
     __ str(r27,      r27_save);
     __ str(r28,      r28_save);
 
+    __ strd(v8,      d8_save);
+    __ strd(v9,      d9_save);
+    __ strd(v10,     d10_save);
+    __ strd(v11,     d11_save);
+    __ strd(v12,     d12_save);
+    __ strd(v13,     d13_save);
+    __ strd(v14,     d14_save);
+    __ strd(v15,     d15_save);
+
     // install Java thread in global register now we have saved
     // whatever value it held
     __ mov(rthread, c_rarg7);
@@ -358,6 +391,15 @@
 #endif
 
     // restore callee-save registers
+    __ ldrd(v15,      d15_save);
+    __ ldrd(v14,      d14_save);
+    __ ldrd(v13,      d13_save);
+    __ ldrd(v12,      d12_save);
+    __ ldrd(v11,      d11_save);
+    __ ldrd(v10,      d10_save);
+    __ ldrd(v9,       d9_save);
+    __ ldrd(v8,       d8_save);
+
     __ ldr(r28,      r28_save);
     __ ldr(r27,      r27_save);
     __ ldr(r26,      r26_save);
--- CUT HERE ---




More information about the aarch64-port-dev mailing list