changeset 18919:0061f550ef31

Make starting node a parameter in the GraphBuilder.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 21 Jan 2015 12:01:14 +0100
parents e8fd0342d9c4
children 4af661af76fd
files graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Wed Jan 21 11:55:37 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Wed Jan 21 12:01:14 2015 +0100
@@ -124,7 +124,7 @@
             TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
             try {
                 BytecodeParser parser = new BytecodeParser(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, entryBCI);
-                parser.build();
+                parser.build(graph.start());
             } finally {
                 filter.remove();
             }
@@ -158,7 +158,7 @@
                 super(metaAccess, method, graphBuilderConfig, optimisticOpts, frameState, entryBCI);
             }
 
-            protected void build() {
+            protected void build(FixedWithNextNode startInstruction) {
                 if (PrintProfilingInformation.getValue()) {
                     TTY.println("Profiling info for " + method.format("%H.%n(%p)"));
                     TTY.println(MetaUtil.indent(profilingInfo.toString(method, CodeUtil.NEW_LINE), "  "));
@@ -171,14 +171,21 @@
                     loopHeaders = blockMap.getLoopHeaders();
                     liveness = blockMap.liveness;
 
-                    lastInstr = currentGraph.start();
-                    frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true);
-                    assert bci() == 0;
-                    ((StateSplit) lastInstr).setStateAfter(frameState.create(bci()));
+                    lastInstr = startInstruction;
+
+                    if (startInstruction == currentGraph.start()) {
+                        StartNode startNode = currentGraph.start();
+                        if (method.isSynchronized()) {
+                            startNode.setStateAfter(frameState.create(BytecodeFrame.BEFORE_BCI));
+                        } else {
+                            frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true);
+                            assert bci() == 0;
+                            startNode.setStateAfter(frameState.create(bci()));
+                        }
+                    }
 
                     if (method.isSynchronized()) {
                         // add a monitor enter to the start block
-                        currentGraph.start().stateAfter().replaceAndDelete(frameState.create(BytecodeFrame.BEFORE_BCI));
                         methodSynchronizedObject = synchronizedObject(frameState, method);
                         genMonitorEnter(methodSynchronizedObject);
                     }