[aarch64-port-dev ] RFR: 8155617: aarch64: ClearArray does not use DC ZVA
Roland Westrelin
rwestrel at redhat.com
Fri Apr 29 14:05:26 UTC 2016
Hi Ed,
I can't start a debug VM since that change was pushed:
# Internal Error (/scratch/rwestrel/hs-comp/hotspot/src/share/vm/runtime/stubRoutines.cpp:344), pid=16911, tid=16912
# assert(s.body[i] == 32) failed: what?
I think the problem is MacroAssembler::fill_words() moves the pointer
past the last word that was written (i.e. there'a hole between the last
written word and the value of the base). It passes again with this
patch:
diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
@@ -4754,12 +4754,12 @@
const int unroll = 8; // Number of stp instructions we'll unroll
cbz(cnt, fini);
- tbz(base, 3, skip);
+ tbz(cnt, 0, skip);
str(value, Address(post(base, 8)));
sub(cnt, cnt, 1);
bind(skip);
- andr(rscratch1, cnt, (unroll-1) * 2);
+ andr(rscratch1, cnt, unroll* 2 - 1);
sub(cnt, cnt, rscratch1);
add(base, base, rscratch1, Assembler::LSL, 3);
adr(rscratch2, entry);
@@ -4767,15 +4767,14 @@
br(rscratch2);
bind(loop);
- for (int i = -unroll; i < 0; i++)
+ add(base, base, unroll * 16);
+ sub(cnt, cnt, unroll * 2);
+ for (int i = -unroll; i < 0; i++) {
stp(value, value, Address(base, i * 16));
+ }
bind(entry);
- subs(cnt, cnt, unroll * 2);
- add(base, base, unroll * 16);
- br(Assembler::GE, loop);
-
- tbz(cnt, 0, fini);
- str(value, Address(base, -unroll * 16));
+ cbnz(cnt, loop);
+
bind(fini);
}
I've done very little testing with it but a few things felt strange in
that code:
- I don't understand why aligning the base at the beginning is
necessary. Once the base is aligned there's no guarantee the cnt is an
even number of words. so when we update the base with:
add(base, base, rscratch1, Assembler::LSL, 3);
base can be misaligned again. I changed it to test whether cnt is even
so at least we don't have to worry about that anymore.
- (unroll-1) * 2 seems like an incorrect mask.
- then there's the problem of base being updated at the end of the loop
that I mentioned above and that can lead to an incorrect base.
- That part at the end:
str(value, Address(base, -unroll * 16));
I don't understand.
Anyway, as I said I've done very little testing so it's entirely
possible my patch above is broken.
Roland.
More information about the hotspot-compiler-dev
mailing list