8231583: Shenandoah: Fix register clash in SBSA::resolve_forwarding_pointer() borrowing
authorshade
Mon, 30 Sep 2019 18:02:24 +0200
changeset 58407 b14643d898d3
parent 58406 3764371e022f
child 58408 2c06226003aa
child 58409 a595e67d6683
8231583: Shenandoah: Fix register clash in SBSA::resolve_forwarding_pointer() borrowing Reviewed-by: rkennke
src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp
src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Mon Sep 30 17:18:30 2019 +0200
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Mon Sep 30 18:02:24 2019 +0200
@@ -211,9 +211,14 @@
   if (borrow_reg) {
     // No free registers available. Make one useful.
     tmp = rscratch1;
+    if (tmp == dst) {
+      tmp = rscratch2;
+    }
     __ push(RegSet::of(tmp), sp);
   }
 
+  assert_different_registers(tmp, dst);
+
   Label done;
   __ ldr(tmp, Address(dst, oopDesc::mark_offset_in_bytes()));
   __ eon(tmp, tmp, zr);
--- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Mon Sep 30 17:18:30 2019 +0200
+++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp	Mon Sep 30 18:02:24 2019 +0200
@@ -271,9 +271,14 @@
   if (borrow_reg) {
     // No free registers available. Make one useful.
     tmp = LP64_ONLY(rscratch1) NOT_LP64(rdx);
+    if (tmp == dst) {
+      tmp = LP64_ONLY(rscratch2) NOT_LP64(rcx);
+    }
     __ push(tmp);
   }
 
+  assert_different_registers(dst, tmp);
+
   Label done;
   __ movptr(tmp, Address(dst, oopDesc::mark_offset_in_bytes()));
   __ notptr(tmp);