changeset 6463:41f0849e107b

reverted LoadHubNode to be a fixed node
author Doug Simon <doug.simon@oracle.com>
date Sun, 30 Sep 2012 21:44:03 +0200
parents b3f5dc099f9d
children 6f2b35ef59b0 04f08ab5bacf
files graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java
diffstat 4 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java	Sun Sep 30 13:21:20 2012 +0200
+++ b/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java	Sun Sep 30 21:44:03 2012 +0200
@@ -191,7 +191,7 @@
             // receiver null check must be before the type check
             InliningUtil.receiverNullCheck(invoke);
             ValueNode receiver = invoke.methodCallTarget().receiver();
-            LoadHubNode receiverHub = graph.unique(new LoadHubNode(receiver));
+            LoadHubNode receiverHub = graph.add(new LoadHubNode(receiver));
             ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph);
             ObjectEqualsNode typeCheck = graph.unique(new ObjectEqualsNode(receiverHub, typeHub));
             FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile, invoke.leafGraphId()));
@@ -201,6 +201,7 @@
             ValueNode anchoredReceiver = createAnchoredReceiver(graph, anchor, type, receiver, true);
             invoke.callTarget().replaceFirstInput(receiver, anchoredReceiver);
 
+            graph.addBeforeFixed(invoke.node(), receiverHub);
             graph.addBeforeFixed(invoke.node(), guard);
             graph.addBeforeFixed(invoke.node(), anchor);
 
@@ -334,7 +335,8 @@
             }
 
             // replace the invoke with a switch on the type of the actual receiver
-            LoadHubNode receiverHub = graph.unique(new LoadHubNode(invoke.methodCallTarget().receiver()));
+            LoadHubNode receiverHub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver()));
+            graph.addBeforeFixed(invoke.node(), receiverHub);
             FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, calleeEntryNodes, unknownTypeNode);
 
             assert invoke.next() == continuation;
@@ -419,7 +421,8 @@
 
             MergeNode calleeEntryNode = graph.add(new MergeNode());
             calleeEntryNode.setProbability(invoke.probability());
-            LoadHubNode receiverHub = graph.unique(new LoadHubNode(invoke.methodCallTarget().receiver()));
+            LoadHubNode receiverHub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver()));
+            graph.addBeforeFixed(invoke.node(), receiverHub);
 
             FixedNode unknownTypeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated, invoke.leafGraphId()));
             FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, new BeginNode[] {calleeEntryNode}, unknownTypeNode);
--- a/graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java	Sun Sep 30 13:21:20 2012 +0200
+++ b/graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java	Sun Sep 30 21:44:03 2012 +0200
@@ -638,7 +638,7 @@
                 assert obj != null : x;
                 if (changeGraph) {
                     ConstantNode hub = ConstantNode.forConstant(obj.virtual.type().getEncoding(Representation.ObjectHub), runtime, graph);
-                    graph.replaceFloating(x, hub);
+                    graph.replaceFixedWithFloating(x, hub);
                     metricOtherRemoved.increment();
                 }
                 changed = true;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sun Sep 30 13:21:20 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sun Sep 30 21:44:03 2012 +0200
@@ -257,8 +257,6 @@
                         // as HotSpot does not guarantee they are final values.
                         int vtableEntryOffset = hsMethod.vtableEntryOffset();
                         assert vtableEntryOffset > 0;
-                        // Cannot use 'unique' here as we don't want to common out with a hub load that is scheduled
-                        // below the invoke we are lowering.
                         LoadHubNode hub = graph.add(new LoadHubNode(receiver));
                         Kind wordKind = graalRuntime.getTarget().wordKind;
                         Stamp nonNullWordStamp = StampFactory.forWord(wordKind, true);
@@ -267,7 +265,8 @@
 
                         loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(methodOop, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall));
 
-                        graph.addBeforeFixed(invoke.node(), methodOop);
+                        graph.addBeforeFixed(invoke.node(), hub);
+                        graph.addAfterFixed(hub, methodOop);
                         graph.addAfterFixed(methodOop, compiledEntry);
                     }
                 }
@@ -363,6 +362,7 @@
                     FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.arrayClassElementOffset, graph), null, StampFactory.objectNonNull()));
                     checkcast = graph.add(new CheckCastNode(arrayElementKlass, null, value));
                     graph.addBeforeFixed(storeIndexed, checkcast);
+                    graph.addBeforeFixed(checkcast, arrayClass);
                     value = checkcast;
                 }
             }
@@ -405,10 +405,12 @@
             }
         } else if (n instanceof LoadHubNode) {
             LoadHubNode loadHub = (LoadHubNode) n;
+            LocationNode location = LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.hubOffset, graph);
             ValueNode object = loadHub.object();
             ValueNode guard = tool.createNullCheckGuard(object, StructuredGraph.INVALID_GRAPH_ID);
-            FloatingReadNode hub = graph.add(new FloatingReadNode(object, LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.hubOffset, graph), null, StampFactory.objectNonNull(), guard));
-            graph.replaceFloating(loadHub, hub);
+            ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.objectNonNull()));
+            hub.dependencies().add(guard);
+            graph.replaceFixed(loadHub, hub);
         } else if (n instanceof CheckCastNode) {
             checkcastSnippets.lower((CheckCastNode) n, tool);
         } else if (n instanceof InstanceOfNode) {
@@ -473,7 +475,8 @@
                 Stamp resultStamp = StampFactory.declaredNonNull(getResolvedJavaType(Class.class));
                 FloatingReadNode result = graph.unique(new FloatingReadNode(hub, LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.classMirrorOffset, graph), null, resultStamp));
                 ReturnNode ret = graph.add(new ReturnNode(result));
-                graph.start().setNext(ret);
+                graph.start().setNext(hub);
+                hub.setNext(ret);
                 return graph;
             }
         } else if (holderName.equals("Ljava/lang/Class;")) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Sun Sep 30 13:21:20 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Sun Sep 30 21:44:03 2012 +0200
@@ -22,17 +22,16 @@
  */
 package com.oracle.graal.nodes.extended;
 
+import com.oracle.graal.api.meta.JavaType.Representation;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaType.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
 /**
  * Loads an object's {@linkplain Representation#ObjectHub hub}, null-checking the object first.
  */
-public final class LoadHubNode extends FloatingNode implements Lowerable, Canonicalizable {
+public final class LoadHubNode extends FixedWithNextNode implements Lowerable, Canonicalizable {
     @Input private ValueNode object;
 
     public ValueNode object() {