< prev index next >
src/share/vm/opto/ifnode.cpp
Print this page
rev 10293 : 8150720: Cleanup code around PrintOptoStatistics
Reviewed-by: kvn, shade, vlivanov
@@ -38,11 +38,13 @@
// Portions of code courtesy of Clifford Click
// Optimization - Graph Style
+#ifndef PRODUCT
extern int explicit_null_checks_elided;
+#endif
//=============================================================================
//------------------------------Value------------------------------------------
// Return a tuple for whichever arm of the IF is reachable
const Type* IfNode::Value(PhaseGVN* phase) const {
@@ -1502,28 +1504,32 @@
// Setup to scan up the CFG looking for a dominating test
Node* dom = in(0);
Node* prev_dom = this;
int op = Opcode();
// Search up the dominator tree for an If with an identical test
- while( dom->Opcode() != op || // Not same opcode?
+ while (dom->Opcode() != op || // Not same opcode?
dom->in(1) != in(1) || // Not same input 1?
(req() == 3 && dom->in(2) != in(2)) || // Not same input 2?
- prev_dom->in(0) != dom ) { // One path of test does not dominate?
- if( dist < 0 ) return NULL;
+ prev_dom->in(0) != dom) { // One path of test does not dominate?
+ if (dist < 0) return NULL;
dist--;
prev_dom = dom;
- dom = up_one_dom( dom );
- if( !dom ) return NULL;
+ dom = up_one_dom(dom);
+ if (!dom) return NULL;
}
// Check that we did not follow a loop back to ourselves
- if( this == dom )
+ if (this == dom) {
return NULL;
+ }
- if( dist > 2 ) // Add to count of NULL checks elided
+#ifndef PRODUCT
+ if (dist > 2) { // Add to count of NULL checks elided
explicit_null_checks_elided++;
+ }
+#endif
return prev_dom;
}
//------------------------------Identity---------------------------------------
< prev index next >