diff src/share/vm/opto/lcm.cpp @ 332:c792b641b8bd

6746907: Improve implicit null check generation Summary: add missing implicit null check cases. Reviewed-by: never
author kvn
date Wed, 10 Sep 2008 20:44:47 -0700
parents b0fe4deeb9fb
children 5f44674206d3
line wrap: on
line diff
--- a/src/share/vm/opto/lcm.cpp	Wed Sep 10 18:23:32 2008 -0700
+++ b/src/share/vm/opto/lcm.cpp	Wed Sep 10 20:44:47 2008 -0700
@@ -58,6 +58,9 @@
     not_null_block = _succs[0];
     null_block     = _succs[1];
   }
+  while (null_block->is_Empty() == Block::empty_with_goto) {
+    null_block     = null_block->_succs[0];
+  }
 
   // Search the exception block for an uncommon trap.
   // (See Parse::do_if and Parse::do_ifnull for the reason
@@ -149,6 +152,10 @@
       const TypePtr *adr_type = NULL;  // Do not need this return value here
       const Node* base = mach->get_base_and_disp(offset, adr_type);
       if (base == NULL || base == NodeSentinel) {
+        // Narrow oop address doesn't have base, only index
+        if( val->bottom_type()->isa_narrowoop() &&
+            MacroAssembler::needs_explicit_null_check(offset) )
+          continue;             // Give up if offset is beyond page size
         // cannot reason about it; is probably not implicit null exception
       } else {
         const TypePtr* tptr = base->bottom_type()->is_ptr();