diff src/share/vm/opto/phaseX.cpp @ 8116:6931f425c517

8007294: ReduceFieldZeroing doesn't check for dependent load and can lead to incorrect execution Summary: InitializeNode::can_capture_store() must check that the captured store doesn't overwrite a memory location that is loaded before the store. Reviewed-by: kvn
author roland
date Mon, 25 Feb 2013 14:13:04 +0100
parents 8b3da8d14c93
children 30f42e691e70
line wrap: on
line diff
--- a/src/share/vm/opto/phaseX.cpp	Fri Feb 22 10:12:00 2013 -0800
+++ b/src/share/vm/opto/phaseX.cpp	Mon Feb 25 14:13:04 2013 +0100
@@ -1197,6 +1197,18 @@
                 assert(!(i < imax), "sanity");
               }
             }
+            if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory &&
+                in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) {
+              // A Load that directly follows an InitializeNode is
+              // going away. The Stores that follow are candidates
+              // again to be captured by the InitializeNode.
+              for (DUIterator_Fast jmax, j = in->fast_outs(jmax); j < jmax; j++) {
+                Node *n = in->fast_out(j);
+                if (n->is_Store()) {
+                  _worklist.push(n);
+                }
+              }
+            }
           }
         }
         C->record_dead_node(dead->_idx);