# HG changeset patch # User Doug Simon # Date 1348839209 -7200 # Node ID 78e352577028a6c4ce6ec80b712d36e2caf110db # Parent a938e15e3bd7b5cd0ff3af7260244987c8ea942e renamed ReadHubNode to LoadHubNode to be imply higher level operation (c.f. UnsafeLoadNode vs ReadNode) diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java --- a/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java Fri Sep 28 15:27:42 2012 +0200 +++ b/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/util/InliningUtil.java Fri Sep 28 15:33:29 2012 +0200 @@ -191,7 +191,7 @@ // receiver null check must be before the type check InliningUtil.receiverNullCheck(invoke); ValueNode receiver = invoke.methodCallTarget().receiver(); - ReadHubNode receiverHub = graph.unique(new ReadHubNode(receiver)); + LoadHubNode receiverHub = graph.unique(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())); @@ -334,7 +334,7 @@ } // replace the invoke with a switch on the type of the actual receiver - ReadHubNode receiverHub = graph.unique(new ReadHubNode(invoke.methodCallTarget().receiver())); + LoadHubNode receiverHub = graph.unique(new LoadHubNode(invoke.methodCallTarget().receiver())); FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, calleeEntryNodes, unknownTypeNode); assert invoke.next() == continuation; @@ -419,7 +419,7 @@ MergeNode calleeEntryNode = graph.add(new MergeNode()); calleeEntryNode.setProbability(invoke.probability()); - ReadHubNode receiverHub = graph.unique(new ReadHubNode(invoke.methodCallTarget().receiver())); + LoadHubNode receiverHub = graph.unique(new LoadHubNode(invoke.methodCallTarget().receiver())); FixedNode unknownTypeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated, invoke.leafGraphId())); FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, new BeginNode[] {calleeEntryNode}, unknownTypeNode); @@ -435,7 +435,7 @@ InliningUtil.inline(invoke, calleeGraph, false); } - private FixedNode createDispatchOnType(StructuredGraph graph, ReadHubNode objectClassNode, BeginNode[] calleeEntryNodes, FixedNode unknownTypeSux) { + private FixedNode createDispatchOnType(StructuredGraph graph, LoadHubNode objectClassNode, BeginNode[] calleeEntryNodes, FixedNode unknownTypeSux) { assert ptypes.length > 1; ResolvedJavaType[] types = new ResolvedJavaType[ptypes.length]; diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java --- a/graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java Fri Sep 28 15:27:42 2012 +0200 +++ b/graal/com.oracle.graal.compiler.virtual/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java Fri Sep 28 15:33:29 2012 +0200 @@ -632,8 +632,8 @@ } changed = true; usageFound = true; - } else if (node instanceof ReadHubNode) { - ReadHubNode x = (ReadHubNode) node; + } else if (node instanceof LoadHubNode) { + LoadHubNode x = (LoadHubNode) node; ObjectState obj = state.objectState(x.object()); assert obj != null : x; if (changeGraph) { diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Fri Sep 28 15:27:42 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Fri Sep 28 15:33:29 2012 +0200 @@ -259,7 +259,7 @@ 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. - ReadHubNode hub = graph.add(new ReadHubNode(receiver)); + LoadHubNode hub = graph.add(new LoadHubNode(receiver)); Kind wordKind = graalRuntime.getTarget().wordKind; Stamp nonNullWordStamp = StampFactory.forWord(wordKind, true); ReadNode methodOop = graph.add(new ReadNode(hub, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), nonNullWordStamp)); @@ -359,7 +359,7 @@ assert elementType.name().equals("Ljava/lang/Object;") : elementType.name(); } } else { - ReadHubNode arrayClass = graph.add(new ReadHubNode(array)); + LoadHubNode arrayClass = graph.add(new LoadHubNode(array)); 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); @@ -403,12 +403,12 @@ } graph.addAfterFixed(write, writeBarrier); } - } else if (n instanceof ReadHubNode) { - ReadHubNode readHub = (ReadHubNode) n; - ValueNode object = readHub.object(); + } else if (n instanceof LoadHubNode) { + LoadHubNode loadHub = (LoadHubNode) n; + 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(readHub, hub); + graph.replaceFloating(loadHub, hub); } else if (n instanceof CheckCastNode) { if (matches(graph, GraalOptions.HIRLowerCheckcast)) { checkcastSnippets.lower((CheckCastNode) n, tool); @@ -494,7 +494,7 @@ } StructuredGraph graph = new StructuredGraph(); LocalNode receiver = graph.unique(new LocalNode(0, StampFactory.objectNonNull())); - ReadHubNode hub = graph.add(new ReadHubNode(receiver)); + LoadHubNode hub = graph.add(new LoadHubNode(receiver)); 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)); diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Fri Sep 28 15:27:42 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Fri Sep 28 15:33:29 2012 +0200 @@ -193,7 +193,7 @@ * Loads the hub from a object, null checking it first. */ static Object loadHub(Object object) { - return ReadHubNode.loadHub(object); + return LoadHubNode.loadHub(object); } diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Fri Sep 28 15:33:29 2012 +0200 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.nodes.extended; + +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 { + @Input private ValueNode object; + + public ValueNode object() { + return object; + } + + public LoadHubNode(ValueNode object) { + super(StampFactory.objectNonNull()); + this.object = object; + } + + @Override + public void lower(LoweringTool tool) { + tool.getRuntime().lower(this, tool); + } + + @Override + public ValueNode canonical(CanonicalizerTool tool) { + MetaAccessProvider runtime = tool.runtime(); + if (runtime != null) { + ObjectStamp stamp = object.objectStamp(); + + ResolvedJavaType exactType; + if (stamp.isExactType()) { + exactType = stamp.type(); + } else if (stamp.type() != null && tool.assumptions() != null) { + exactType = stamp.type().uniqueConcreteSubtype(); + if (exactType != null) { + tool.assumptions().recordConcreteSubtype(stamp.type(), exactType); + } + } else { + exactType = null; + } + + if (exactType != null) { + return ConstantNode.forConstant(exactType.getEncoding(Representation.ObjectHub), runtime, graph()); + } + } + return this; + } + + @NodeIntrinsic + public static native Object loadHub(Object object); +} diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java Fri Sep 28 15:27:42 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes.extended; - -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 ReadHubNode extends FloatingNode implements Lowerable, Canonicalizable { - @Input private ValueNode object; - - public ValueNode object() { - return object; - } - - public ReadHubNode(ValueNode object) { - super(StampFactory.objectNonNull()); - this.object = object; - } - - @Override - public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); - } - - @Override - public ValueNode canonical(CanonicalizerTool tool) { - MetaAccessProvider runtime = tool.runtime(); - if (runtime != null) { - ObjectStamp stamp = object.objectStamp(); - - ResolvedJavaType exactType; - if (stamp.isExactType()) { - exactType = stamp.type(); - } else if (stamp.type() != null && tool.assumptions() != null) { - exactType = stamp.type().uniqueConcreteSubtype(); - if (exactType != null) { - tool.assumptions().recordConcreteSubtype(stamp.type(), exactType); - } - } else { - exactType = null; - } - - if (exactType != null) { - return ConstantNode.forConstant(exactType.getEncoding(Representation.ObjectHub), runtime, graph()); - } - } - return this; - } - - @NodeIntrinsic - public static native Object loadHub(Object object); -} diff -r a938e15e3bd7 -r 78e352577028 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Fri Sep 28 15:27:42 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Fri Sep 28 15:33:29 2012 +0200 @@ -93,8 +93,8 @@ tool.addToWorkList(blockSuccessor(survivingEdge)); ((StructuredGraph) graph()).removeSplitPropagate(this, survivingEdge); } - if (value() instanceof ReadHubNode) { - ObjectStamp stamp = ((ReadHubNode) value()).object().objectStamp(); + if (value() instanceof LoadHubNode) { + ObjectStamp stamp = ((LoadHubNode) value()).object().objectStamp(); if (stamp.type() != null) { int validKeys = 0; for (int i = 0; i < keyCount(); i++) {