-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
25
Currently, we have weird code generation in aarch64 Shenandoah barriers, e.g.:
// Check for heap stability
if (is_strong) {
__ tbz(rscratch2, ShenandoahHeap::HAS_FORWARDED_BITPOS, heap_stable);
} else {
Label lrb;
__ tbnz(rscratch2, ShenandoahHeap::WEAK_ROOTS_BITPOS, lrb);
__ tbz(rscratch2, ShenandoahHeap::HAS_FORWARDED_BITPOS, heap_stable);
__ bind(lrb);
}
The double-test in the weak-path could be avoided by doing something like:
__ andb(rscratch2, rscratch2, ShenandoahHeap::WEAK_ROOTS | ShenandoahHeap::HAS_FORWARDED);
__ cbz(done);
However, the two constants together makes 17, and this can not be encoded as immediate in aarch64. Re-ordering the GC state enum such that the two constants are adjacent would likely solve this.
// Check for heap stability
if (is_strong) {
__ tbz(rscratch2, ShenandoahHeap::HAS_FORWARDED_BITPOS, heap_stable);
} else {
Label lrb;
__ tbnz(rscratch2, ShenandoahHeap::WEAK_ROOTS_BITPOS, lrb);
__ tbz(rscratch2, ShenandoahHeap::HAS_FORWARDED_BITPOS, heap_stable);
__ bind(lrb);
}
The double-test in the weak-path could be avoided by doing something like:
__ andb(rscratch2, rscratch2, ShenandoahHeap::WEAK_ROOTS | ShenandoahHeap::HAS_FORWARDED);
__ cbz(done);
However, the two constants together makes 17, and this can not be encoded as immediate in aarch64. Re-ordering the GC state enum such that the two constants are adjacent would likely solve this.