[aarch64-port-dev ] RFC: Change stack bang sequence
Andrew Haley
aph at redhat.com
Tue Jul 4 15:50:38 UTC 2017
The stack bang size changed to 25 4k pages due to 8172144, Implement
"JEP 270: Reserved Stack Areas for Critical Sections" and 8173339, Fix
minimum stack size computations.
Unfortunately this means that we now generate three instructions for a
stack bang if we are using 4k pages.
This patch changes
0x0000007fa8f748d4: mov x9, #0xffffffffffffc000 // #-16384
0x0000007fa8f748d8: movk x9, #0xfffe, lsl #16
0x0000007fa8f748dc: str xzr, [sp,x9]
to
0x0000007f88bae8d4: sub x9, sp, #0x14, lsl #12
0x0000007f88bae8d8: str xzr, [x9]
There's no measurable speed difference on a system I have tested, so
do we care? I suppose we do, given that it makes the code slightly
smaller. Opinions welcome.
diff -r ddabaeb7d186 src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Wed Jun 28 10:58:19 2017 +0200
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Fri Jun 30 15:29:47 2017 +0100
@@ -949,8 +949,8 @@
void bang_stack_with_offset(int offset) {
// stack grows down, caller passes positive offset
assert(offset > 0, "must bang with negative offset");
- mov(rscratch2, -offset);
- str(zr, Address(sp, rscratch2));
+ sub(rscratch2, sp, offset);
+ str(zr, Address(rscratch2));
}
// Writes to stack successive pages until offset reached to check for
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the aarch64-port-dev
mailing list