6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
authorcoleenp
Tue, 02 Sep 2008 15:18:26 -0400
changeset 1129 ec4dfac10759
parent 1128 defff92f9135
child 1130 e1831d987443
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page Summary: Turn off c2 implicit null checking on windows and large pages specified. Reviewed-by: jrose, xlu
hotspot/src/share/vm/opto/compile.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/src/share/vm/runtime/virtualspace.cpp
--- a/hotspot/src/share/vm/opto/compile.cpp	Sun Aug 31 15:24:54 2008 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Tue Sep 02 15:18:26 2008 -0400
@@ -2082,7 +2082,7 @@
         in2 = n->in(2)->in(1);
       } else if ( n->in(2)->Opcode() == Op_ConP ) {
         const Type* t = n->in(2)->bottom_type();
-        if (t == TypePtr::NULL_PTR) {
+        if (t == TypePtr::NULL_PTR && UseImplicitNullCheckForNarrowOop) {
           Node *in1 = n->in(1);
           if (Matcher::clone_shift_expressions) {
             // x86, ARM and friends can handle 2 adds in addressing mode.
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Sun Aug 31 15:24:54 2008 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Sep 02 15:18:26 2008 -0400
@@ -1204,15 +1204,17 @@
       // Turn off until bug is fixed.
       // FLAG_SET_ERGO(bool, UseCompressedOops, true);
     }
+#ifdef _WIN64
+    if (UseLargePages && UseCompressedOops) {
+      // Cannot allocate guard pages for implicit checks in indexed addressing
+      // mode, when large pages are specified on windows.
+      FLAG_SET_DEFAULT(UseImplicitNullCheckForNarrowOop, false);
+    }
+#endif //  _WIN64
   } else {
     if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
       // If specified, give a warning
-      if (UseConcMarkSweepGC){
-        warning("Compressed Oops does not work with CMS");
-      } else {
-        warning(
-          "Max heap size too large for Compressed Oops");
-      }
+      warning( "Max heap size too large for Compressed Oops");
       FLAG_SET_DEFAULT(UseCompressedOops, false);
     }
   }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Sun Aug 31 15:24:54 2008 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Sep 02 15:18:26 2008 -0400
@@ -294,6 +294,9 @@
   lp64_product(bool, CheckCompressedOops, trueInDebug,                      \
             "generate checks in encoding/decoding code")                    \
                                                                             \
+  product(bool, UseImplicitNullCheckForNarrowOop, true,                     \
+            "generate implicit null check in indexed addressing mode.")     \
+                                                                            \
   /* UseMembar is theoretically a temp flag used for memory barrier         \
    * removal testing.  It was supposed to be removed before FCS but has     \
    * been re-added (see 6401008) */                                         \
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Sun Aug 31 15:24:54 2008 -0700
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Tue Sep 02 15:18:26 2008 -0400
@@ -380,7 +380,8 @@
                                      bool large, char* requested_address) :
   ReservedSpace(size, alignment, large,
                 requested_address,
-                UseCompressedOops ? lcm(os::vm_page_size(), alignment) : 0) {
+                UseCompressedOops && UseImplicitNullCheckForNarrowOop ?
+                  lcm(os::vm_page_size(), alignment) : 0) {
   // Only reserved space for the java heap should have a noaccess_prefix
   // if using compressed oops.
   protect_noaccess_prefix(size);
@@ -391,7 +392,8 @@
                                      const size_t suffix_size,
                                      const size_t suffix_align) :
   ReservedSpace(prefix_size, prefix_align, suffix_size, suffix_align,
-                UseCompressedOops ? lcm(os::vm_page_size(), prefix_align) : 0) {
+                UseCompressedOops && UseImplicitNullCheckForNarrowOop ?
+                  lcm(os::vm_page_size(), prefix_align) : 0) {
   protect_noaccess_prefix(prefix_size+suffix_size);
 }