< prev index next >

src/share/vm/asm/assembler.cpp

Print this page

        

@@ -24,10 +24,11 @@
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
 #include "asm/codeBuffer.hpp"
+#include "gc_implementation/shenandoah/shenandoahBrooksPointer.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
 

@@ -298,20 +299,38 @@
 }
 
 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
   // Exception handler checks the nmethod's implicit null checks table
   // only when this method returns false.
+#ifdef AARCH64
+  // AArch64 addresses passed from the signal handler may have
+  // their top 8 bits zeroed. That affects the case where
+  // Shenandoah tries to load a Brooks pointer via a null oop.
+  const uintptr_t address_bits = (uintptr_t)0xfffffffffffful;
+#else
+  const uintptr_t address_bits = ~(uintptr_t)0;
+#endif
 #ifdef _LP64
   if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
     assert (Universe::heap() != NULL, "java heap should be initialized");
     // The first page after heap_base is unmapped and
     // the 'offset' is equal to [heap_base + offset] for
     // narrow oop implicit null checks.
     uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
-    if ((uintptr_t)offset >= base) {
+    int adj = 0;
+    if (UseShenandoahGC) {
+      adj = ShenandoahBrooksPointer::byte_offset();
+      assert(adj < 0, "no need for positive adjustments");
+    }
+    if ((uintptr_t)((offset - adj) & address_bits) >= base) {
       // Normalize offset for the next check.
       offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
     }
   }
 #endif
+
+  if (UseShenandoahGC && ((offset & address_bits) == (ShenandoahBrooksPointer::byte_offset() & address_bits))) {
+    return false;
+  }
+
   return offset < 0 || os::vm_page_size() <= offset;
 }
< prev index next >