< prev index next >
src/share/vm/opto/graphKit.cpp
Print this page
rev 10293 : 8150720: Cleanup code around PrintOptoStatistics
Reviewed-by: kvn, shade, vlivanov
*** 1177,1188 ****
--- 1177,1190 ----
//------------------------------do_null_check----------------------------------
// Helper function to do a NULL pointer check. Returned value is
// the incoming address with NULL casted away. You are allowed to use the
// not-null value only if you are control dependent on the test.
+ #ifndef PRODUCT
extern int explicit_null_checks_inserted,
explicit_null_checks_elided;
+ #endif
Node* GraphKit::null_check_common(Node* value, BasicType type,
// optional arguments for variations:
bool assert_null,
Node* *null_control,
bool speculative) {
*** 1191,1201 ****
if (!GenerateCompilerNullChecks && !assert_null && null_control == NULL) {
// For some performance testing, we may wish to suppress null checking.
value = cast_not_null(value); // Make it appear to be non-null (4962416).
return value;
}
! explicit_null_checks_inserted++;
// Construct NULL check
Node *chk = NULL;
switch(type) {
case T_LONG : chk = new CmpLNode(value, _gvn.zerocon(T_LONG)); break;
--- 1193,1203 ----
if (!GenerateCompilerNullChecks && !assert_null && null_control == NULL) {
// For some performance testing, we may wish to suppress null checking.
value = cast_not_null(value); // Make it appear to be non-null (4962416).
return value;
}
! NOT_PRODUCT(explicit_null_checks_inserted++);
// Construct NULL check
Node *chk = NULL;
switch(type) {
case T_LONG : chk = new CmpLNode(value, _gvn.zerocon(T_LONG)); break;
*** 1231,1250 ****
if (assert_null) {
// See if the type is contained in NULL_PTR.
// If so, then the value is already null.
if (t->higher_equal(TypePtr::NULL_PTR)) {
! explicit_null_checks_elided++;
return value; // Elided null assert quickly!
}
} else {
// See if mixing in the NULL pointer changes type.
// If so, then the NULL pointer was not allowed in the original
// type. In other words, "value" was not-null.
if (t->meet(TypePtr::NULL_PTR) != t->remove_speculative()) {
// same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ...
! explicit_null_checks_elided++;
return value; // Elided null check quickly!
}
}
chk = new CmpPNode( value, null() );
break;
--- 1233,1252 ----
if (assert_null) {
// See if the type is contained in NULL_PTR.
// If so, then the value is already null.
if (t->higher_equal(TypePtr::NULL_PTR)) {
! NOT_PRODUCT(explicit_null_checks_elided++);
return value; // Elided null assert quickly!
}
} else {
// See if mixing in the NULL pointer changes type.
// If so, then the NULL pointer was not allowed in the original
// type. In other words, "value" was not-null.
if (t->meet(TypePtr::NULL_PTR) != t->remove_speculative()) {
// same as: if (!TypePtr::NULL_PTR->higher_equal(t)) ...
! NOT_PRODUCT(explicit_null_checks_elided++);
return value; // Elided null check quickly!
}
}
chk = new CmpPNode( value, null() );
break;
*** 1280,1290 ****
}
Node *oldcontrol = control();
set_control(cfg);
Node *res = cast_not_null(value);
set_control(oldcontrol);
! explicit_null_checks_elided++;
return res;
}
cfg = IfNode::up_one_dom(cfg, /*linear_only=*/ true);
if (cfg == NULL) break; // Quit at region nodes
depth++;
--- 1282,1292 ----
}
Node *oldcontrol = control();
set_control(cfg);
Node *res = cast_not_null(value);
set_control(oldcontrol);
! NOT_PRODUCT(explicit_null_checks_elided++);
return res;
}
cfg = IfNode::up_one_dom(cfg, /*linear_only=*/ true);
if (cfg == NULL) break; // Quit at region nodes
depth++;
*** 1324,1342 ****
if (null_control != NULL) {
IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
Node* null_true = _gvn.transform( new IfFalseNode(iff));
set_control( _gvn.transform( new IfTrueNode(iff)));
! if (null_true == top())
explicit_null_checks_elided++;
(*null_control) = null_true;
} else {
BuildCutout unless(this, tst, ok_prob);
// Check for optimizer eliding test at parse time
if (stopped()) {
// Failure not possible; do not bother making uncommon trap.
! explicit_null_checks_elided++;
} else if (assert_null) {
uncommon_trap(reason,
Deoptimization::Action_make_not_entrant,
NULL, "assert_null");
} else {
--- 1326,1347 ----
if (null_control != NULL) {
IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
Node* null_true = _gvn.transform( new IfFalseNode(iff));
set_control( _gvn.transform( new IfTrueNode(iff)));
! #ifndef PRODUCT
! if (null_true == top()) {
explicit_null_checks_elided++;
+ }
+ #endif
(*null_control) = null_true;
} else {
BuildCutout unless(this, tst, ok_prob);
// Check for optimizer eliding test at parse time
if (stopped()) {
// Failure not possible; do not bother making uncommon trap.
! NOT_PRODUCT(explicit_null_checks_elided++);
} else if (assert_null) {
uncommon_trap(reason,
Deoptimization::Action_make_not_entrant,
NULL, "assert_null");
} else {
< prev index next >