# HG changeset patch # User Christos Kotselidis # Date 1366905301 -7200 # Node ID 95447e46ac86512ff4e9f6f477dc6d7c0a66ca50 # Parent 84ffc957dae3fc5e7586bd09f7652b75691835ca Simplify write barrier elimination phase diff -r 84ffc957dae3 -r 95447e46ac86 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Thu Apr 25 14:11:45 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Thu Apr 25 17:55:01 2013 +0200 @@ -34,48 +34,26 @@ import com.oracle.graal.phases.*; /** - * Verification phase that checks if, for every write, at least one write barrier is present between - * safepoint intervals. Initially, the algorithm performs a bottom-up traversal of the graph in - * order to discover safepoints. For every safepoint discovered, a brute-force bottom-up traversal - * is performed again that validates every write until all possible reachable safepoints from the - * currently processed write. + * Verification phase that checks if, for every write, at least one write barrier is present at all + * paths leading to the previous safepoint. For every write, necessitating a write barrier, a + * bottom-up traversal of the graph is performed up to the previous safepoints via all possible + * paths. If, for a certain path, no write barrier satisfying the processed write is found, an + * assertion is generated. */ public class WriteBarrierVerificationPhase extends Phase { @Override protected void run(StructuredGraph graph) { - processSafepoints(graph); - } - - private static void processSafepoints(StructuredGraph graph) { - for (Node node : graph.getNodes()) { - if (isSafepoint(node)) { - verifyWrites(node); - } - } + processWrites(graph); } - private static void verifyWrites(Node safepoint) { - /* - * The list below holds all already processed writes in order to avoid repetitive - * validations of writes reachable from different paths. - */ + private static void processWrites(StructuredGraph graph) { List processedWrites = new LinkedList<>(); - Deque frontier = new ArrayDeque<>(); - expandFrontier(frontier, safepoint); - while (!frontier.isEmpty()) { - Node currentNode = frontier.removeFirst(); - /* - * Any safepoints reached at this point are skipped since they will be processed later. - */ - if (isSafepoint(currentNode)) { - continue; + for (Node node : graph.getNodes()) { + if (isObjectWrite(node) && !processedWrites.contains(node)) { + validateWrite(node); + processedWrites.add(node); } - if (isObjectWrite(currentNode) && !processedWrites.contains(currentNode)) { - validateWrite(currentNode); - processedWrites.add(currentNode); - } - expandFrontier(frontier, currentNode); } }