openjdk-11/ZGC-aarch64-not-using-zr-register-avoid-sigill-in-Ma.patch

107 lines
3.0 KiB
Diff
Raw Normal View History

2020-04-26 19:46:07 +08:00
From 425112071e77e2fb599d1f96ce48689d45461261 Mon Sep 17 00:00:00 2001
Date: Mon, 17 Feb 2020 18:55:47 +0800
Subject: [PATCH] ZGC: aarch64: not using zr register avoid sigill in
MacroAssembler::push_fp and pop_fp
Summary: <gc>: <instruction ldp doesn't support two same register>
LLT: jtreg
2020-05-21 15:31:32 +08:00
Bug url:
2020-04-26 19:46:07 +08:00
---
2020-05-21 15:31:32 +08:00
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 48 +++++++++++++---------
1 file changed, 28 insertions(+), 20 deletions(-)
2020-04-26 19:46:07 +08:00
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
2020-05-21 15:31:32 +08:00
index 611f13b0e..a65a605d0 100644
2020-04-26 19:46:07 +08:00
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
2020-05-21 15:31:32 +08:00
@@ -2100,58 +2100,66 @@ int MacroAssembler::pop(unsigned int bitset, Register stack) {
2020-04-26 19:46:07 +08:00
// Push lots of registers in the bit set supplied. Don't push sp.
// Return the number of words pushed
int MacroAssembler::push_fp(unsigned int bitset, Register stack) {
- int words_pushed = 0;
-
// Scan bitset to accumulate register pairs
unsigned char regs[32];
int count = 0;
+ int i = 0;
for (int reg = 0; reg <= 31; reg++) {
if (1 & bitset)
regs[count++] = reg;
bitset >>= 1;
}
- regs[count++] = zr->encoding_nocheck();
- count &= ~1; // Only push an even number of regs
- // Always pushing full 128 bit registers.
- if (count) {
+ if (!count) {
+ return 0;
2020-05-21 15:31:32 +08:00
+ }
2020-04-26 19:46:07 +08:00
+
+ if (count & 1) {
2020-05-21 15:31:32 +08:00
+ strq(as_FloatRegister(regs[0]), Address(pre(stack, -count * wordSize * 2)));
2020-04-26 19:46:07 +08:00
+ i += 1;
2020-05-21 15:31:32 +08:00
+ } else {
stpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(pre(stack, -count * wordSize * 2)));
- words_pushed += 2;
+ i += 2;
}
- for (int i = 2; i < count; i += 2) {
2020-04-26 19:46:07 +08:00
+
+ for (; i < count; i += 2) {
stpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
- words_pushed += 2;
}
- assert(words_pushed == count, "oops, pushed != count");
return count;
}
int MacroAssembler::pop_fp(unsigned int bitset, Register stack) {
- int words_pushed = 0;
-
// Scan bitset to accumulate register pairs
unsigned char regs[32];
int count = 0;
+ int i = 0;
for (int reg = 0; reg <= 31; reg++) {
if (1 & bitset)
regs[count++] = reg;
bitset >>= 1;
}
- regs[count++] = zr->encoding_nocheck();
- count &= ~1;
- for (int i = 2; i < count; i += 2) {
+ if (!count) {
+ return 0;
2020-05-21 15:31:32 +08:00
+ }
2020-04-26 19:46:07 +08:00
+
+ if (count & 1) {
+ i += 1;
2020-05-21 15:31:32 +08:00
+ } else {
+ i += 2;
2020-04-26 19:46:07 +08:00
+ }
+
2020-05-21 15:31:32 +08:00
+ for (; i < count; i += 2) {
ldpq(as_FloatRegister(regs[i]), as_FloatRegister(regs[i+1]), Address(stack, i * wordSize * 2));
- words_pushed += 2;
}
- if (count) {
+
+ if ((count & 1) == 0) {
ldpq(as_FloatRegister(regs[0]), as_FloatRegister(regs[1]), Address(post(stack, count * wordSize * 2)));
- words_pushed += 2;
+ } else {
+ ldrq(as_FloatRegister(regs[0]), Address(post(stack, count * wordSize * 2)));
}
2020-04-26 19:46:07 +08:00
2020-05-21 15:31:32 +08:00
- assert(words_pushed == count, "oops, pushed != count");
-
2020-04-26 19:46:07 +08:00
return count;
}
2020-05-21 15:31:32 +08:00
--
2.12.3