[aarch64-port-dev ] Try even harder to ensure that we have a "friendly" base address for compressed class pointers.

Andrew Haley aph at redhat.com
Wed Oct 1 18:08:00 UTC 2014


This fixes even the pathological case of -Xxmx31G so that we still have a
one-instruction decode for compressed class pointers.

Andrew.


# HG changeset patch
# User aph
# Date 1412181840 14400
#      Wed Oct 01 12:44:00 2014 -0400
# Node ID 95c8ad3592470f3e77cc032fb716c580944fccc1
# Parent  e95bdb68cbdcf2bcae33a3b6fc8d3ef1bdd1f7e0
Try even harder to ensure that we have a "friendly" base address for compressed class pointers.

diff -r e95bdb68cbdc -r 95c8ad359247 src/share/vm/memory/metaspace.cpp
--- a/src/share/vm/memory/metaspace.cpp	Tue Sep 09 18:50:10 2014 +0100
+++ b/src/share/vm/memory/metaspace.cpp	Wed Oct 01 12:44:00 2014 -0400
@@ -3005,11 +3005,18 @@
                                              requested_addr, 0);

   if (! metaspace_rs.is_reserved()) {
+    // If we have an address in high memory, ignore it and start with
+    // low memory.  An address in high memory is likely to result in a
+    // nonzero narrow_klass_base which is not a multiple of 4G.
+    char *a = requested_addr;
+    if (a > (char*)(256*G))
+      a = (char*)(4*G);
+
     // Try to align metaspace so that we can decode a compressed klass
-    // with a single MOVK instruction.  We can do this iff the
-    // compressed class base is a multiple of 4G.
-    for (char *a = (char*)align_ptr_up(requested_addr, 4*G);
-	 a < (char*)(1024*G);
+    // with a single instruction.  We can do this if the compressed
+    // klass base is a small multiple of 4G.
+    for (a = (char*)align_ptr_up(a, 4*G);
+	 a < (char*)(256*G);
 	 a += 4*G) {
       if (UseSharedSpaces
 	  && ! can_use_cds_with_metaspace_addr(a, cds_base)) {


More information about the aarch64-port-dev mailing list