changeset 54639:cbefe308b543

8217747: ZGC: Minor optimization of ZLoadBarrierStubC1 Reviewed-by: neliasso, eosterlund
author pliden
date Tue, 29 Jan 2019 10:23:38 +0100
parents b5c92b95fe45
children 4ffdb0093c89
files src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Tue Jan 29 10:23:38 2019 +0100
+++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp	Tue Jan 29 10:23:38 2019 +0100
@@ -278,11 +278,12 @@
 
   Register ref = stub->ref()->as_register();
   Register ref_addr = noreg;
+  Register tmp = noreg;
 
   if (stub->tmp()->is_valid()) {
     // Load address into tmp register
     ce->leal(stub->ref_addr(), stub->tmp());
-    ref_addr = stub->tmp()->as_pointer_register();
+    ref_addr = tmp = stub->tmp()->as_pointer_register();
   } else {
     // Address already in register
     ref_addr = stub->ref_addr()->as_address_ptr()->base()->as_pointer_register();
@@ -290,8 +291,8 @@
 
   assert_different_registers(ref, ref_addr, noreg);
 
-  // Save rax unless it is the result register
-  if (ref != rax) {
+  // Save rax unless it is the result or tmp register
+  if (ref != rax && tmp != rax) {
     __ push(rax);
   }
 
@@ -305,9 +306,13 @@
   // Verify result
   __ verify_oop(rax, "Bad oop");
 
-  // Restore rax unless it is the result register
+  // Move result into place
   if (ref != rax) {
     __ movptr(ref, rax);
+  }
+
+  // Restore rax unless it is the result or tmp register
+  if (ref != rax && tmp != rax) {
     __ pop(rax);
   }