--- a/hotspot/src/share/vm/opto/graphKit.cpp Fri Oct 11 13:14:48 2013 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Sun Oct 13 13:22:24 2013 -0700
@@ -2122,7 +2122,7 @@
// Null check oop. Set null-path control into Region in slot 3.
// Make a cast-not-nullness use the other not-null control. Return cast.
Node* GraphKit::null_check_oop(Node* value, Node* *null_control,
- bool never_see_null) {
+ bool never_see_null, bool safe_for_replace) {
// Initial NULL check taken path
(*null_control) = top();
Node* cast = null_check_common(value, T_OBJECT, false, null_control);
@@ -2140,6 +2140,9 @@
Deoptimization::Action_make_not_entrant);
(*null_control) = top(); // NULL path is dead
}
+ if ((*null_control) == top() && safe_for_replace) {
+ replace_in_map(value, cast);
+ }
// Cast away null-ness on the result
return cast;
@@ -2634,15 +2637,17 @@
C->set_has_split_ifs(true); // Has chance for split-if optimization
ciProfileData* data = NULL;
+ bool safe_for_replace = false;
if (java_bc() == Bytecodes::_instanceof) { // Only for the bytecode
data = method()->method_data()->bci_to_data(bci());
+ safe_for_replace = true;
}
bool never_see_null = (ProfileDynamicTypes // aggressive use of profile
&& seems_never_null(obj, data));
// Null check; get casted pointer; set region slot 3
Node* null_ctl = top();
- Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null);
+ Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null, safe_for_replace);
// If not_null_obj is dead, only null-path is taken
if (stopped()) { // Doing instance-of on a NULL?
@@ -2723,11 +2728,13 @@
}
ciProfileData* data = NULL;
+ bool safe_for_replace = false;
if (failure_control == NULL) { // use MDO in regular case only
assert(java_bc() == Bytecodes::_aastore ||
java_bc() == Bytecodes::_checkcast,
"interpreter profiles type checks only for these BCs");
data = method()->method_data()->bci_to_data(bci());
+ safe_for_replace = true;
}
// Make the merge point
@@ -2742,7 +2749,7 @@
// Null check; get casted pointer; set region slot 3
Node* null_ctl = top();
- Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null);
+ Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null, safe_for_replace);
// If not_null_obj is dead, only null-path is taken
if (stopped()) { // Doing instance-of on a NULL?