changeset 48670:be259687afab

8194982: 2 Null pointer dereference defect groups related to ProjNode::is_uncommon_trap_if_pattern() Reviewed-by: kvn
author dlong
date Thu, 18 Jan 2018 10:05:32 -0800
parents 00d8c8d696e9
children 7fc3d62481ba
files src/hotspot/share/opto/ifnode.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/ifnode.cpp	Thu Jan 18 10:05:32 2018 -0800
+++ b/src/hotspot/share/opto/ifnode.cpp	Thu Jan 18 10:05:32 2018 -0800
@@ -1195,14 +1195,17 @@
 // Check that the If that is in between the 2 integer comparisons has
 // no side effect
 bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
-  if (proj != NULL &&
-      proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
-      proj->outcnt() <= 2) {
+  if (proj == NULL) {
+    return false;
+  }
+  CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
+  if (unc != NULL && proj->outcnt() <= 2) {
     if (proj->outcnt() == 1 ||
         // Allow simple null check from LoadRange
         (is_cmp_with_loadrange(proj) && is_null_check(proj, igvn))) {
       CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
       CallStaticJavaNode* dom_unc = proj->in(0)->in(0)->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
+      assert(dom_unc != NULL, "is_uncommon_trap_if_pattern returned NULL");
 
       // reroute_side_effect_free_unc changes the state of this
       // uncommon trap to restart execution at the previous