6746907: Improve implicit null check generation

Wed, 10 Sep 2008 20:44:47 -0700

author
kvn
date
Wed, 10 Sep 2008 20:44:47 -0700
changeset 767
c792b641b8bd
parent 766
cecd8eb4e0ca
child 768
7484fa4b8825

6746907: Improve implicit null check generation
Summary: add missing implicit null check cases.
Reviewed-by: never

src/share/vm/opto/graphKit.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/lcm.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/graphKit.cpp	Wed Sep 10 18:23:32 2008 -0700
     1.2 +++ b/src/share/vm/opto/graphKit.cpp	Wed Sep 10 20:44:47 2008 -0700
     1.3 @@ -1212,6 +1212,7 @@
     1.4                      Deoptimization::Action_make_not_entrant,
     1.5                      NULL, "assert_null");
     1.6      } else {
     1.7 +      replace_in_map(value, zerocon(type));
     1.8        builtin_throw(reason);
     1.9      }
    1.10    }
    1.11 @@ -1960,6 +1961,7 @@
    1.12      // method will be compiled to handle NULLs.
    1.13      PreserveJVMState pjvms(this);
    1.14      set_control(*null_control);
    1.15 +    replace_in_map(value, null());
    1.16      uncommon_trap(Deoptimization::Reason_null_check,
    1.17                    Deoptimization::Action_make_not_entrant);
    1.18      (*null_control) = top();    // NULL path is dead
     2.1 --- a/src/share/vm/opto/lcm.cpp	Wed Sep 10 18:23:32 2008 -0700
     2.2 +++ b/src/share/vm/opto/lcm.cpp	Wed Sep 10 20:44:47 2008 -0700
     2.3 @@ -58,6 +58,9 @@
     2.4      not_null_block = _succs[0];
     2.5      null_block     = _succs[1];
     2.6    }
     2.7 +  while (null_block->is_Empty() == Block::empty_with_goto) {
     2.8 +    null_block     = null_block->_succs[0];
     2.9 +  }
    2.10  
    2.11    // Search the exception block for an uncommon trap.
    2.12    // (See Parse::do_if and Parse::do_ifnull for the reason
    2.13 @@ -149,6 +152,10 @@
    2.14        const TypePtr *adr_type = NULL;  // Do not need this return value here
    2.15        const Node* base = mach->get_base_and_disp(offset, adr_type);
    2.16        if (base == NULL || base == NodeSentinel) {
    2.17 +        // Narrow oop address doesn't have base, only index
    2.18 +        if( val->bottom_type()->isa_narrowoop() &&
    2.19 +            MacroAssembler::needs_explicit_null_check(offset) )
    2.20 +          continue;             // Give up if offset is beyond page size
    2.21          // cannot reason about it; is probably not implicit null exception
    2.22        } else {
    2.23          const TypePtr* tptr = base->bottom_type()->is_ptr();

mercurial