mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6746907: Improve implicit null check generation
Add missing implicit null check cases. Reviewed-by: never
This commit is contained in:
parent
659ca734bb
commit
9812da470c
2 changed files with 9 additions and 0 deletions
|
@ -1212,6 +1212,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
|
|||
Deoptimization::Action_make_not_entrant,
|
||||
NULL, "assert_null");
|
||||
} else {
|
||||
replace_in_map(value, zerocon(type));
|
||||
builtin_throw(reason);
|
||||
}
|
||||
}
|
||||
|
@ -1960,6 +1961,7 @@ Node* GraphKit::null_check_oop(Node* value, Node* *null_control,
|
|||
// method will be compiled to handle NULLs.
|
||||
PreserveJVMState pjvms(this);
|
||||
set_control(*null_control);
|
||||
replace_in_map(value, null());
|
||||
uncommon_trap(Deoptimization::Reason_null_check,
|
||||
Deoptimization::Action_make_not_entrant);
|
||||
(*null_control) = top(); // NULL path is dead
|
||||
|
|
|
@ -58,6 +58,9 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe
|
|||
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 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe
|
|||
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue