8024379: Adapt PPC64 port to 8003424
authorgoetz
Fri, 06 Sep 2013 10:13:17 +0200
changeset 22829 08b62d0e80ed
parent 22828 17ecb098bc1e
child 22830 df1bb606b2ca
8024379: Adapt PPC64 port to 8003424 Reviewed-by: coleenp
hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Thu Sep 05 11:04:39 2013 -0700
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Fri Sep 06 10:13:17 2013 +0200
@@ -2382,17 +2382,11 @@
 
 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
   if (src == noreg) src = dst;
-  if (Universe::narrow_klass_base() != NULL) {
-    // heapbased
-    assert(Universe::narrow_klass_shift() != 0, "sanity");
-    sub(dst, src, R30);
-    srdi(dst, dst, Universe::narrow_klass_shift());
-  } else if (Universe::narrow_klass_shift() != 0) {
-    // zerobased
+  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
+  load_const(R0, Universe::narrow_klass_base());
+  sub(dst, src, R0);
+  if (Universe::narrow_klass_shift() != 0) {
     srdi(dst, src, Universe::narrow_klass_shift());
-  } else if (src != dst) {
-    // unscaled
-    mr(dst, src);
   }
 }
 
@@ -2407,18 +2401,14 @@
 
 void MacroAssembler::decode_klass_not_null(Register dst, Register src) {
   if (src == noreg) src = dst;
-  if (Universe::narrow_klass_base() != NULL) {
-    // heapbased
-    assert(Universe::narrow_klass_shift() != 0, "sanity");
-    sldi(dst, src, Universe::narrow_klass_shift());
-    add(dst, dst, R30);
-  } else if (Universe::narrow_klass_shift() != 0) {
-    // zerobased
-    sldi(dst, src, Universe::narrow_klass_shift());
-  } else if (src != dst) {
-    // unscaled
-    mr(dst, src);
+  Register shifted_src = src;
+  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
+  if (Universe::narrow_klass_shift() != 0) {
+    shifted_src = dst;
+    sldi(shifted_src, src, Universe::narrow_klass_shift());
   }
+  load_const(R0, Universe::narrow_klass_base());
+  add(dst, shifted_src, R0);
 }
 
 void MacroAssembler::load_klass(Register dst, Register src) {
@@ -2441,7 +2431,13 @@
 }
 
 void MacroAssembler::reinit_heapbase(Register d, Register tmp) {
-  if (UseCompressedOops || UseCompressedKlassPointers) {
+  if (Universe::heap() != NULL) {
+    if (Universe::narrow_oop_base() == NULL) {
+      Assembler::xorr(R30, R30, R30);
+    } else {
+      load_const(R30, Universe::narrow_ptrs_base(), tmp);
+    }
+  } else {
     load_const(R30, Universe::narrow_ptrs_base_addr(), tmp);
     ld(R30, 0, R30);
   }
--- a/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp	Thu Sep 05 11:04:39 2013 -0700
+++ b/hotspot/src/cpu/ppc/vm/relocInfo_ppc.cpp	Fri Sep 06 10:13:17 2013 +0200
@@ -58,7 +58,7 @@
       assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type,
              "how to encode else?");
       narrowOop no = (type() == relocInfo::oop_type) ?
-        oopDesc::encode_heap_oop((oop)x) : oopDesc::encode_klass((Klass*)x);
+        oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x);
       nativeMovConstReg_at(addr())->set_narrow_oop(no, code());
     }
   } else {