src/hotspot/share/opto/matcher.cpp
changeset 54780 f8d182aedc92
parent 54267 75445a7c2c04
child 55227 63a62cc10a0a
child 58678 9cf78a70fa4f
--- a/src/hotspot/share/opto/matcher.cpp	Thu May 09 07:21:32 2019 -0400
+++ b/src/hotspot/share/opto/matcher.cpp	Thu May 09 14:26:03 2019 +0200
@@ -27,6 +27,7 @@
 #include "gc/shared/c2/barrierSetC2.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/compressedOops.hpp"
 #include "opto/ad.hpp"
 #include "opto/addnode.hpp"
 #include "opto/callnode.hpp"
@@ -2482,6 +2483,19 @@
   }
 }
 
+bool Matcher::gen_narrow_oop_implicit_null_checks() {
+  // Advice matcher to perform null checks on the narrow oop side.
+  // Implicit checks are not possible on the uncompressed oop side anyway
+  // (at least not for read accesses).
+  // Performs significantly better (especially on Power 6).
+  if (!os::zero_page_read_protected()) {
+    return true;
+  }
+  return CompressedOops::use_implicit_null_checks() &&
+         (narrow_oop_use_complex_address() ||
+          CompressedOops::base() != NULL);
+}
+
 // Used by the DFA in dfa_xxx.cpp.  Check for a following barrier or
 // atomic instruction acting as a store_load barrier without any
 // intervening volatile load, and thus we don't need a barrier here.