# HG changeset patch # User Christian Wimmer # Date 1453763023 28800 # Node ID 3bc2598ce1e0003be30686a33c5909b0401156d1 # Parent 38215ade8ba65d36f82fc05971273429850a8ecd Update JVMCI import: Move lookup of Java class and hub from ResolvedJavaType to ConstantReflectionProvider diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Jan 25 15:03:43 2016 -0800 @@ -423,7 +423,7 @@ @Override public ValueNode staticFieldBase(StructuredGraph graph, ResolvedJavaField f) { HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) f; - JavaConstant base = field.getDeclaringClass().getJavaClass(); + JavaConstant base = constantReflection.asJavaClass(field.getDeclaringClass()); return ConstantNode.forConstant(base, metaAccess, graph); } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Jan 25 15:03:43 2016 -0800 @@ -98,7 +98,7 @@ */ HotSpotResolvedPrimitiveType primitive = (HotSpotResolvedPrimitiveType) type; ResolvedJavaType boxingClass = metaAccess.lookupJavaType(primitive.getJavaKind().toBoxedJavaClass()); - ConstantNode clazz = ConstantNode.forConstant(boxingClass.getJavaClass(), metaAccess, graph); + ConstantNode clazz = ConstantNode.forConstant(context.getConstantReflection().asJavaClass(boxingClass), metaAccess, graph); HotSpotResolvedJavaField[] a = (HotSpotResolvedJavaField[]) boxingClass.getStaticFields(); HotSpotResolvedJavaField typeField = null; for (HotSpotResolvedJavaField f : a) { diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -82,7 +82,7 @@ ResolvedJavaType exactType = tool.getConstantReflection().asJavaType(clazz.asJavaConstant()); if (exactType instanceof HotSpotResolvedObjectType) { HotSpotResolvedObjectType objectType = (HotSpotResolvedObjectType) exactType; - ConstantNode cn = ConstantNode.forConstant(stamp(), objectType.getObjectHub(), metaAccess); + ConstantNode cn = ConstantNode.forConstant(stamp(), tool.getConstantReflection().asObjectHub(objectType), metaAccess); return cn; } else if (exactType instanceof HotSpotResolvedPrimitiveType) { return ConstantNode.forConstant(stamp(), JavaConstant.NULL_POINTER, metaAccess); @@ -121,7 +121,7 @@ ResolvedJavaType exactType = constantReflection.asJavaType(c); if (exactType instanceof HotSpotResolvedObjectType) { HotSpotResolvedObjectType objectType = (HotSpotResolvedObjectType) exactType; - return objectType.getObjectHub(); + return constantReflection.asObjectHub(objectType); } else { assert exactType instanceof HotSpotResolvedPrimitiveType; return JavaConstant.NULL_POINTER; @@ -132,7 +132,7 @@ public Constant reverse(Constant c, ConstantReflectionProvider constantReflection) { assert !c.equals(JavaConstant.NULL_POINTER); ResolvedJavaType objectType = constantReflection.asJavaType(c); - return objectType.getJavaClass(); + return constantReflection.asJavaClass(objectType); } public boolean isLossless() { diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Jan 25 15:03:43 2016 -0800 @@ -492,9 +492,9 @@ ResolvedJavaType constantType = LoadHubNode.findSynonymType(read.graph(), tool.getMetaAccess(), object); if (constantType != null) { if (config().useCompressedClassPointers) { - return ConstantNode.forConstant(read.stamp(), ((HotSpotMetaspaceConstant) constantType.getObjectHub()).compress(), tool.getMetaAccess()); + return ConstantNode.forConstant(read.stamp(), ((HotSpotMetaspaceConstant) tool.getConstantReflection().asObjectHub(constantType)).compress(), tool.getMetaAccess()); } else { - return ConstantNode.forConstant(read.stamp(), constantType.getObjectHub(), tool.getMetaAccess()); + return ConstantNode.forConstant(read.stamp(), tool.getConstantReflection().asObjectHub(constantType), tool.getMetaAccess()); } } return read; @@ -1007,7 +1007,7 @@ AssumptionResult leafType = element.findLeafConcreteSubtype(); if (leafType != null && leafType.canRecordTo(assumptions)) { leafType.recordTo(assumptions); - return ConstantNode.forConstant(read.stamp(), leafType.getResult().getObjectHub(), tool.getMetaAccess()); + return ConstantNode.forConstant(read.stamp(), tool.getConstantReflection().asObjectHub(leafType.getResult()), tool.getMetaAccess()); } } } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -71,7 +71,7 @@ if (metaAccess != null && hub.isConstant()) { ResolvedJavaType exactType = tool.getConstantReflection().asJavaType(hub.asConstant()); if (exactType != null) { - return ConstantNode.forConstant(exactType.getJavaClass(), metaAccess); + return ConstantNode.forConstant(tool.getConstantReflection().asJavaClass(exactType), metaAccess); } } return this; @@ -96,7 +96,7 @@ if (JavaConstant.NULL_POINTER.equals(c)) { return c; } - return constantReflection.asJavaType(c).getJavaClass(); + return constantReflection.asJavaClass(constantReflection.asJavaType(c)); } @Override @@ -106,7 +106,7 @@ } ResolvedJavaType type = constantReflection.asJavaType(c); if (type instanceof HotSpotResolvedObjectType) { - return ((HotSpotResolvedObjectType) type).getObjectHub(); + return constantReflection.asObjectHub(type); } else { assert type instanceof HotSpotResolvedPrimitiveType; return JavaConstant.NULL_POINTER; diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -25,6 +25,7 @@ import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; +import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; @@ -54,7 +55,7 @@ @Override public Node canonical(CanonicalizerTool tool) { - ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess()); + ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess(), tool.getConstantReflection()); if (callerClassNode != null) { return callerClassNode; } @@ -63,7 +64,7 @@ @Override public void lower(LoweringTool tool) { - ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess()); + ConstantNode callerClassNode = getCallerClassNode(tool.getMetaAccess(), tool.getConstantReflection()); if (callerClassNode != null) { graph().replaceFixedWithFloating(this, graph().addOrUniqueWithInputs(callerClassNode)); @@ -81,7 +82,7 @@ * @param metaAccess * @return ConstantNode of the caller class, or null */ - private ConstantNode getCallerClassNode(MetaAccessProvider metaAccess) { + private ConstantNode getCallerClassNode(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { // Walk back up the frame states to find the caller at the required depth. FrameState state = stateAfter(); @@ -103,7 +104,7 @@ if (!method.ignoredBySecurityStackWalk()) { // We have reached the desired frame; return the holder class. HotSpotResolvedObjectType callerClass = method.getDeclaringClass(); - return ConstantNode.forConstant(callerClass.getJavaClass(), metaAccess); + return ConstantNode.forConstant(constantReflection.asJavaClass(callerClass), metaAccess); } break; } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Mon Jan 25 15:03:43 2016 -0800 @@ -2038,7 +2038,7 @@ private ValueNode synchronizedObject(FrameStateBuilder state, ResolvedJavaMethod target) { if (target.isStatic()) { - return appendConstant(target.getDeclaringClass().getJavaClass()); + return appendConstant(getConstantReflection().asJavaClass(target.getDeclaringClass())); } else { return state.loadLocal(0, JavaKind.Object); } @@ -2641,7 +2641,7 @@ // this is a load of class constant which might be unresolved JavaType type = (JavaType) con; if (type instanceof ResolvedJavaType) { - frameState.push(JavaKind.Object, appendConstant(((ResolvedJavaType) type).getJavaClass())); + frameState.push(JavaKind.Object, appendConstant(getConstantReflection().asJavaClass((ResolvedJavaType) type))); } else { handleUnresolvedLoadConstant(type); } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/GetClassNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/GetClassNode.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/GetClassNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -25,6 +25,7 @@ import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.Assumptions.AssumptionResult; import jdk.vm.ci.meta.Constant; +import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaType; @@ -67,7 +68,7 @@ tool.getLowerer().lower(this, tool); } - public static ValueNode tryFold(MetaAccessProvider metaAccess, ValueNode object) { + public static ValueNode tryFold(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ValueNode object) { if (metaAccess != null && object != null && object.stamp() instanceof ObjectStamp) { ObjectStamp objectStamp = (ObjectStamp) object.stamp(); @@ -84,7 +85,7 @@ } if (exactType != null) { - return ConstantNode.forConstant(exactType.getJavaClass(), metaAccess); + return ConstantNode.forConstant(constantReflection.asJavaClass(exactType), metaAccess); } } return null; @@ -92,7 +93,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - ValueNode folded = tryFold(tool.getMetaAccess(), getObject()); + ValueNode folded = tryFold(tool.getMetaAccess(), tool.getConstantReflection(), getObject()); return folded == null ? this : folded; } @@ -101,7 +102,7 @@ ValueNode alias = tool.getAlias(getObject()); if (alias instanceof VirtualObjectNode) { VirtualObjectNode virtual = (VirtualObjectNode) alias; - Constant javaClass = virtual.type().getJavaClass(); + Constant javaClass = tool.getConstantReflectionProvider().asJavaClass(virtual.type()); tool.replaceWithValue(ConstantNode.forConstant(stamp(), javaClass, tool.getMetaAccessProvider(), graph())); } } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -24,6 +24,7 @@ import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.Assumptions.AssumptionResult; +import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaType; @@ -61,9 +62,9 @@ return stampProvider.createHubStamp(((ObjectStamp) value.stamp())); } - public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess) { + public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { Stamp stamp = hubStamp(stampProvider, value); - ValueNode synonym = findSynonym(value, stamp, null, metaAccess); + ValueNode synonym = findSynonym(value, stamp, null, metaAccess, constantReflection); if (synonym != null) { return synonym; } @@ -88,17 +89,17 @@ public ValueNode canonical(CanonicalizerTool tool) { MetaAccessProvider metaAccess = tool.getMetaAccess(); ValueNode curValue = getValue(); - ValueNode newNode = findSynonym(curValue, stamp(), graph(), metaAccess); + ValueNode newNode = findSynonym(curValue, stamp(), graph(), metaAccess, tool.getConstantReflection()); if (newNode != null) { return newNode; } return this; } - public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, StructuredGraph graph, MetaAccessProvider metaAccess) { + public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, StructuredGraph graph, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { ResolvedJavaType exactType = findSynonymType(graph, metaAccess, curValue); if (exactType != null) { - return ConstantNode.forConstant(stamp, exactType.getObjectHub(), metaAccess); + return ConstantNode.forConstant(stamp, constantReflection.asObjectHub(exactType), metaAccess); } return null; } @@ -126,7 +127,7 @@ ValueNode alias = tool.getAlias(getValue()); ResolvedJavaType type = findSynonymType(graph(), tool.getMetaAccessProvider(), alias); if (type != null) { - tool.replaceWithValue(ConstantNode.forConstant(stamp(), type.getObjectHub(), tool.getMetaAccessProvider(), graph())); + tool.replaceWithValue(ConstantNode.forConstant(stamp(), tool.getConstantReflectionProvider().asObjectHub(type), tool.getMetaAccessProvider(), graph())); } } } diff -r 38215ade8ba6 -r 3bc2598ce1e0 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 Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Mon Jan 25 15:03:43 2016 -0800 @@ -26,6 +26,7 @@ import java.util.Arrays; import jdk.vm.ci.meta.Constant; +import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.ResolvedJavaType; import com.oracle.graal.compiler.common.type.AbstractPointerStamp; @@ -53,14 +54,20 @@ public static final NodeClass TYPE = NodeClass.create(TypeSwitchNode.class); protected final ResolvedJavaType[] keys; + protected final Constant[] hubs; - public TypeSwitchNode(ValueNode value, AbstractBeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) { + public TypeSwitchNode(ValueNode value, AbstractBeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors, ConstantReflectionProvider constantReflection) { super(TYPE, value, successors, keySuccessors, keyProbabilities); assert successors.length <= keys.length + 1; assert keySuccessors.length == keyProbabilities.length; this.keys = keys; assert value.stamp() instanceof AbstractPointerStamp; assert assertKeys(); + + hubs = new Constant[keys.length]; + for (int i = 0; i < hubs.length; i++) { + hubs[i] = constantReflection.asObjectHub(keys[i]); + } } /** @@ -90,7 +97,7 @@ @Override public Constant keyAt(int index) { - return keys[index].getObjectHub(); + return hubs[index]; } @Override @@ -183,7 +190,7 @@ } AbstractBeginNode[] successorsArray = newSuccessors.toArray(new AbstractBeginNode[newSuccessors.size()]); - TypeSwitchNode newSwitch = graph().add(new TypeSwitchNode(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors)); + TypeSwitchNode newSwitch = graph().add(new TypeSwitchNode(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors, tool.getConstantReflection())); ((FixedWithNextNode) predecessor()).setNext(newSwitch); GraphUtil.killWithUnusedFloatingInputs(this); } diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Mon Jan 25 15:03:43 2016 -0800 @@ -30,6 +30,7 @@ import java.util.List; import java.util.Set; +import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.DeoptimizationAction; import jdk.vm.ci.meta.DeoptimizationReason; import jdk.vm.ci.meta.JavaKind; @@ -160,7 +161,7 @@ @Override public Collection inline(Providers providers) { if (hasSingleMethod()) { - return inlineSingleMethod(graph(), providers.getStampProvider()); + return inlineSingleMethod(graph(), providers.getStampProvider(), providers.getConstantReflection()); } else { return inlineMultipleMethods(graph(), providers); } @@ -238,7 +239,7 @@ assert invoke.asNode().isAlive(); // replace the invoke with a switch on the type of the actual receiver - boolean methodDispatch = createDispatchOnTypeBeforeInvoke(graph, successors, false, providers.getStampProvider()); + boolean methodDispatch = createDispatchOnTypeBeforeInvoke(graph, successors, false, providers.getStampProvider(), providers.getConstantReflection()); assert invoke.next() == continuation; invoke.setNext(null); @@ -322,21 +323,22 @@ return result; } - private Collection inlineSingleMethod(StructuredGraph graph, StampProvider stampProvider) { + private Collection inlineSingleMethod(StructuredGraph graph, StampProvider stampProvider, ConstantReflectionProvider constantReflection) { assert concretes.size() == 1 && inlineableElements.length == 1 && ptypes.size() > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0; AbstractBeginNode calleeEntryNode = graph.add(new BeginNode()); AbstractBeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); AbstractBeginNode[] successors = new AbstractBeginNode[]{calleeEntryNode, unknownTypeSux}; - createDispatchOnTypeBeforeInvoke(graph, successors, false, stampProvider); + createDispatchOnTypeBeforeInvoke(graph, successors, false, stampProvider, constantReflection); calleeEntryNode.setNext(invoke.asNode()); return inline(invoke, methodAt(0), inlineableElementAt(0), false); } - private boolean createDispatchOnTypeBeforeInvoke(StructuredGraph graph, AbstractBeginNode[] successors, boolean invokeIsOnlySuccessor, StampProvider stampProvider) { + private boolean createDispatchOnTypeBeforeInvoke(StructuredGraph graph, AbstractBeginNode[] successors, boolean invokeIsOnlySuccessor, StampProvider stampProvider, + ConstantReflectionProvider constantReflection) { assert ptypes.size() >= 1; ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); LoadHubNode hub = graph.unique(new LoadHubNode(stampProvider, nonNullReceiver)); @@ -362,7 +364,7 @@ keyProbabilities[i] /= totalProbability; } - TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, keys, keyProbabilities, keySuccessors)); + TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, keys, keyProbabilities, keySuccessors, constantReflection)); FixedWithNextNode pred = (FixedWithNextNode) invoke.asNode().predecessor(); pred.setNext(typeSwitch); return false; @@ -422,13 +424,13 @@ @Override public void tryToDevirtualizeInvoke(Providers providers) { if (hasSingleMethod()) { - devirtualizeWithTypeSwitch(graph(), InvokeKind.Special, concretes.get(0), providers.getStampProvider()); + devirtualizeWithTypeSwitch(graph(), InvokeKind.Special, concretes.get(0), providers.getStampProvider(), providers.getConstantReflection()); } else { - tryToDevirtualizeMultipleMethods(graph(), providers.getStampProvider()); + tryToDevirtualizeMultipleMethods(graph(), providers.getStampProvider(), providers.getConstantReflection()); } } - private void tryToDevirtualizeMultipleMethods(StructuredGraph graph, StampProvider stampProvider) { + private void tryToDevirtualizeMultipleMethods(StructuredGraph graph, StampProvider stampProvider, ConstantReflectionProvider constantReflection) { MethodCallTargetNode methodCallTarget = (MethodCallTargetNode) invoke.callTarget(); if (methodCallTarget.invokeKind() == InvokeKind.Interface) { ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod(); @@ -440,17 +442,17 @@ if (!leastCommonType.isInterface() && targetMethod.getDeclaringClass().isAssignableFrom(leastCommonType)) { ResolvedJavaMethod baseClassTargetMethod = leastCommonType.resolveConcreteMethod(targetMethod, contextType); if (baseClassTargetMethod != null) { - devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveConcreteMethod(targetMethod, contextType), stampProvider); + devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveConcreteMethod(targetMethod, contextType), stampProvider, constantReflection); } } } } - private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target, StampProvider stampProvider) { + private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target, StampProvider stampProvider, ConstantReflectionProvider constantReflection) { AbstractBeginNode invocationEntry = graph.add(new BeginNode()); AbstractBeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); AbstractBeginNode[] successors = new AbstractBeginNode[]{invocationEntry, unknownTypeSux}; - createDispatchOnTypeBeforeInvoke(graph, successors, true, stampProvider); + createDispatchOnTypeBeforeInvoke(graph, successors, true, stampProvider, constantReflection); invocationEntry.setNext(invoke.asNode()); ValueNode receiver = ((MethodCallTargetNode) invoke.callTarget()).receiver(); diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java Mon Jan 25 15:03:43 2016 -0800 @@ -112,7 +112,7 @@ private void createGuard(StructuredGraph graph, Providers providers) { ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); LoadHubNode receiverHub = graph.unique(new LoadHubNode(providers.getStampProvider(), nonNullReceiver)); - ConstantNode typeHub = ConstantNode.forConstant(receiverHub.stamp(), type.getObjectHub(), providers.getMetaAccess(), graph); + ConstantNode typeHub = ConstantNode.forConstant(receiverHub.stamp(), providers.getConstantReflection().asObjectHub(type), providers.getMetaAccess(), graph); LogicNode typeCheck = CompareNode.createCompareNode(graph, Condition.EQ, receiverHub, typeHub, providers.getConstantReflection()); FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile)); diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Jan 25 15:03:43 2016 -0800 @@ -194,7 +194,8 @@ private void lowerTypeCheckNode(TypeCheckNode n, LoweringTool tool, StructuredGraph graph) { ValueNode hub = createReadHub(graph, n.getValue(), tool); - ValueNode clazz = graph.unique(ConstantNode.forConstant(tool.getStampProvider().createHubStamp((ObjectStamp) n.getValue().stamp()), n.type().getObjectHub(), tool.getMetaAccess())); + ValueNode clazz = graph.unique(ConstantNode.forConstant(tool.getStampProvider().createHubStamp((ObjectStamp) n.getValue().stamp()), tool.getConstantReflection().asObjectHub(n.type()), + tool.getMetaAccess())); LogicNode objectEquals = graph.unique(PointerEqualsNode.create(hub, clazz)); n.replaceAndDelete(objectEquals); } @@ -394,7 +395,7 @@ if (nullCheck != null) { object = graph.unique(new PiNode(object, ((ObjectStamp) object.stamp()).improveWith(StampFactory.objectNonNull()), (ValueNode) nullCheck)); } - ValueNode hub = graph.addOrUnique(LoadHubNode.create(object, tool.getStampProvider(), tool.getMetaAccess())); + ValueNode hub = graph.addOrUnique(LoadHubNode.create(object, tool.getStampProvider(), tool.getMetaAccess(), tool.getConstantReflection())); RawMonitorEnterNode rawMonitorEnter = graph.add(new RawMonitorEnterNode(object, hub, monitorEnter.getMonitorId())); rawMonitorEnter.setStateBefore(monitorEnter.stateBefore()); rawMonitorEnter.setStateAfter(monitorEnter.stateAfter()); diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Mon Jan 25 15:03:43 2016 -0800 @@ -434,7 +434,7 @@ r.register1("getClass", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) { ValueNode object = receiver.get(); - ValueNode folded = GetClassNode.tryFold(b.getMetaAccess(), GraphUtil.originalValue(object)); + ValueNode folded = GetClassNode.tryFold(b.getMetaAccess(), b.getConstantReflection(), GraphUtil.originalValue(object)); if (folded != null) { b.addPush(JavaKind.Object, folded); } else { diff -r 38215ade8ba6 -r 3bc2598ce1e0 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleConstantReflectionProvider.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleConstantReflectionProvider.java Sat Jan 23 12:07:27 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleConstantReflectionProvider.java Mon Jan 25 15:03:43 2016 -0800 @@ -129,4 +129,14 @@ public MemoryAccessProvider getMemoryAccessProvider() { return graalConstantReflection.getMemoryAccessProvider(); } + + @Override + public JavaConstant asJavaClass(ResolvedJavaType type) { + return graalConstantReflection.asJavaClass(type); + } + + @Override + public Constant asObjectHub(ResolvedJavaType type) { + return graalConstantReflection.asObjectHub(type); + } } diff -r 38215ade8ba6 -r 3bc2598ce1e0 mx.graal/suite.py --- a/mx.graal/suite.py Sat Jan 23 12:07:27 2016 +0100 +++ b/mx.graal/suite.py Mon Jan 25 15:03:43 2016 -0800 @@ -39,7 +39,7 @@ { "name" : "jvmci", "optional" : "true", - "version" : "d63506bb523746d86ea2d27ffdd2cded1b04ae4a", + "version" : "c2687aa5e5ca8815e540e3c4716388e3d694c481", "urls" : [ {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},