$OpenBSD: patch-hotspot_src_os_cpu_bsd_amd64_vm_assembler_bsd_amd64_cpp,v 1.1 2008/03/17 03:21:25 kurt Exp $
--- hotspot/src/os_cpu/bsd_amd64/vm/assembler_bsd_amd64.cpp.orig	Sun Mar 16 09:34:53 2008
+++ hotspot/src/os_cpu/bsd_amd64/vm/assembler_bsd_amd64.cpp	Sun Mar 16 09:51:59 2008
@@ -54,9 +54,10 @@ void MacroAssembler::get_thread(Register thread)
    }
 }
 
-// NOTE: since the linux kernel resides at the low end of
-// user address space, no null pointer check is needed.
+// only do implicit null optimizations on offsets landing in the
+// first page of memory.
 bool MacroAssembler::needs_explicit_null_check(int offset)
 {
-  return offset < 0 || offset >= 0x100000;
+  bool offset_in_first_page =   0 <= offset  &&  offset < os::vm_page_size();
+  return !offset_in_first_page;
 }
