# HG changeset patch # User Roland Schatz # Date 1418140519 -3600 # Node ID d138867d61c4ae4fef9b4356b40c550cef2234f4 # Parent a1584e21457c0ca70e36d377786b90d76d013396 Remove getValueKind() from LocationNode. diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue Dec 09 16:55:19 2014 +0100 @@ -1228,10 +1228,10 @@ int intSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Int); if (regNumber >= HSAIL.s0.number && regNumber <= HSAIL.s31.number) { long offset = config.hsailFrameHeaderSize + intSize * (regNumber - HSAIL.s0.number); - location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); + location = ConstantLocationNode.create(FINAL_LOCATION, offset, hostGraph); } else if (regNumber >= HSAIL.d0.number && regNumber <= HSAIL.d15.number) { long offset = config.hsailFrameHeaderSize + intSize * numSRegs + longSize * (regNumber - HSAIL.d0.number); - location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); + location = ConstantLocationNode.create(FINAL_LOCATION, offset, hostGraph); } else { throw GraalInternalError.shouldNotReachHere("unknown hsail register: " + regNumber); } @@ -1246,7 +1246,7 @@ int longSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Long); int intSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Int); long offset = config.hsailFrameHeaderSize + (intSize * numSRegs) + (longSize * numDRegs) + HSAIL.getStackOffsetStart(slot, slotSizeInBits); - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, offset, hostGraph); ValueNode valueNode = hostGraph.unique(FloatingReadNode.create(hsailFrame, location, null, StampFactory.forKind(valueKind))); return valueNode; } else { diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLoweringProvider.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLoweringProvider.java Tue Dec 09 16:55:19 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.ptx; +import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -51,7 +52,7 @@ } } - public ValueNode reconstructArrayIndex(LocationNode location) { + public ValueNode reconstructArrayIndex(Kind elementKind, LocationNode location) { throw GraalInternalError.unimplemented(); } } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java Tue Dec 09 16:55:19 2014 +0100 @@ -210,7 +210,7 @@ int index = 0; for (int slot : objectSlots) { int offset = slot * wordSize; - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, index * intSize, getGraph()); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, index * intSize, getGraph()); append(WriteNode.create(objectParametersOffsets, ConstantNode.forInt(offset, getGraph()), location, BarrierType.NONE, false)); index++; } @@ -233,12 +233,12 @@ for (javaParametersIndex = 0; javaParametersIndex < javaParameters.length; javaParametersIndex++) { ParameterNode javaParameter = javaParameters[javaParametersIndex]; int javaParameterOffset = javaParameterOffsetsInKernelParametersBuffer[javaParametersIndex]; - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, javaParameter.getKind(), javaParameterOffset, getGraph()); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, javaParameterOffset, getGraph()); append(WriteNode.create(buf, javaParameter, location, BarrierType.NONE, false)); updateDimArg(method, sig, sigIndex++, args, javaParameter); } if (returnKind != Kind.Void) { - LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, bufSize - wordSize, getGraph()); + LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, bufSize - wordSize, getGraph()); append(WriteNode.create(buf, nullWord, location, BarrierType.NONE, false)); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Tue Dec 09 16:55:19 2014 +0100 @@ -383,9 +383,9 @@ if (index >= config.graalCountersSize) { throw new GraalInternalError("too many counters, reduce number of counters or increase -XX:GraalCounterSize=... (current value: " + config.graalCountersSize + ")"); } - ConstantLocationNode arrayLocation = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, wordKind, config.graalCountersThreadOffset, graph); + ConstantLocationNode arrayLocation = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, config.graalCountersThreadOffset, graph); ReadNode readArray = graph.add(ReadNode.create(thread, arrayLocation, StampFactory.forKind(wordKind), BarrierType.NONE)); - ConstantLocationNode location = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, Kind.Long, Unsafe.ARRAY_LONG_INDEX_SCALE * index, graph); + ConstantLocationNode location = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, Unsafe.ARRAY_LONG_INDEX_SCALE * index, graph); ReadNode read = graph.add(ReadNode.create(readArray, location, StampFactory.forKind(Kind.Long), BarrierType.NONE)); AddNode add = graph.unique(AddNode.create(read, counter.getIncrement())); WriteNode write = graph.add(WriteNode.create(readArray, add, location, BarrierType.NONE)); diff -r a1584e21457c -r d138867d61c4 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 Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Tue Dec 09 16:55:19 2014 +0100 @@ -198,11 +198,11 @@ Kind wordKind = runtime.getTarget().wordKind; ValueNode hub = createReadHub(graph, receiver, receiverNullCheck); - ReadNode metaspaceMethod = createReadVirtualMethod(graph, wordKind, hub, hsMethod, receiverType); + ReadNode metaspaceMethod = createReadVirtualMethod(graph, hub, hsMethod, receiverType); // We use LocationNode.ANY_LOCATION for the reads that access the // compiled code entry as HotSpot does not guarantee they are final // values. - ReadNode compiledEntry = graph.add(ReadNode.create(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, runtime.getConfig().methodCompiledEntryOffset, graph), + ReadNode compiledEntry = graph.add(ReadNode.create(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, runtime.getConfig().methodCompiledEntryOffset, graph), StampFactory.forKind(wordKind), BarrierType.NONE)); loweredCallTarget = graph.add(HotSpotIndirectCallTargetNode.create(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), @@ -254,8 +254,7 @@ @Override protected ValueNode createReadArrayComponentHub(StructuredGraph graph, ValueNode arrayHub, FixedNode anchor) { - Kind wordKind = runtime.getTarget().wordKind; - LocationNode location = ConstantLocationNode.create(OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION, wordKind, runtime.getConfig().arrayClassElementOffset, graph); + LocationNode location = ConstantLocationNode.create(OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION, runtime.getConfig().arrayClassElementOffset, graph); /* * Anchor the read of the element klass to the cfg, because it is only valid when arrayClass * is an object class, which might not be the case in other parts of the compiled method. @@ -273,15 +272,15 @@ } } - private void lowerLoadMethodNode(LoadMethodNode loadMethodNode) { + private static void lowerLoadMethodNode(LoadMethodNode loadMethodNode) { StructuredGraph graph = loadMethodNode.graph(); HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) loadMethodNode.getMethod(); - ReadNode metaspaceMethod = createReadVirtualMethod(graph, runtime.getTarget().wordKind, loadMethodNode.getHub(), method, loadMethodNode.getReceiverType()); + ReadNode metaspaceMethod = createReadVirtualMethod(graph, loadMethodNode.getHub(), method, loadMethodNode.getReceiverType()); graph.replaceFixed(loadMethodNode, metaspaceMethod); } private void lowerStoreHubNode(StoreHubNode storeHub, StructuredGraph graph) { - WriteNode hub = createWriteHub(graph, runtime.getTarget().wordKind, storeHub.getObject(), storeHub.getValue()); + WriteNode hub = createWriteHub(graph, storeHub.getObject(), storeHub.getValue()); graph.replaceFixed(storeHub, hub); } @@ -314,7 +313,7 @@ for (OSRLocalNode osrLocal : graph.getNodes(OSRLocalNode.class)) { int size = HIRFrameStateBuilder.stackSlots(osrLocal.getKind()); int offset = localsOffset - (osrLocal.index() + size - 1) * 8; - IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, osrLocal.getKind(), offset, ConstantNode.forLong(0, graph), graph, 1); + IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, offset, ConstantNode.forLong(0, graph), graph, 1); ReadNode load = graph.add(ReadNode.create(buffer, location, osrLocal.stamp(), BarrierType.NONE)); osrLocal.replaceAndDelete(load); graph.addBeforeFixed(migrationEnd, load); @@ -390,24 +389,23 @@ return false; } - private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, HotSpotResolvedJavaMethod method, ResolvedJavaType receiverType) { - return createReadVirtualMethod(graph, wordKind, hub, method.vtableEntryOffset(receiverType)); + private static ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, HotSpotResolvedJavaMethod method, ResolvedJavaType receiverType) { + return createReadVirtualMethod(graph, hub, method.vtableEntryOffset(receiverType)); } - private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, int vtableEntryOffset) { + private static ReadNode createReadVirtualMethod(StructuredGraph graph, ValueNode hub, int vtableEntryOffset) { assert vtableEntryOffset > 0; // We use LocationNode.ANY_LOCATION for the reads that access the vtable // entry as HotSpot does not guarantee that this is a final value. Stamp methodStamp = MethodPointerStamp.method(); - ReadNode metaspaceMethod = graph.add(ReadNode.create(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), methodStamp, BarrierType.NONE)); + ReadNode metaspaceMethod = graph.add(ReadNode.create(hub, ConstantLocationNode.create(ANY_LOCATION, vtableEntryOffset, graph), methodStamp, BarrierType.NONE)); return metaspaceMethod; } @Override protected ValueNode createReadHub(StructuredGraph graph, ValueNode object, GuardingNode guard) { - Kind wordKind = target.wordKind; HotSpotVMConfig config = runtime.getConfig(); - LocationNode location = ConstantLocationNode.create(HUB_LOCATION, wordKind, config.hubOffset, graph); + LocationNode location = ConstantLocationNode.create(HUB_LOCATION, config.hubOffset, graph); assert !object.isConstant() || object.isNullConstant(); KlassPointerStamp hubStamp = KlassPointerStamp.klassNonNull(); @@ -423,9 +421,9 @@ } } - private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { + private WriteNode createWriteHub(StructuredGraph graph, ValueNode object, ValueNode value) { HotSpotVMConfig config = runtime.getConfig(); - LocationNode location = ConstantLocationNode.create(HUB_WRITE_LOCATION, wordKind, config.hubOffset, graph); + LocationNode location = ConstantLocationNode.create(HUB_WRITE_LOCATION, config.hubOffset, graph); assert !object.isConstant() || object.isNullConstant(); ValueNode writeValue = value; diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java Tue Dec 09 16:55:19 2014 +0100 @@ -120,7 +120,7 @@ int displacement = runtime().getArrayBaseOffset(arrayElementKind); ConstantNode index = ConstantNode.forInt(0, g); int indexScaling = runtime().getArrayIndexScale(arrayElementKind); - IndexedLocationNode locationNode = IndexedLocationNode.create(locationIdentity, arrayElementKind, displacement, index, g, indexScaling); + IndexedLocationNode locationNode = IndexedLocationNode.create(locationIdentity, displacement, index, g, indexScaling); Stamp wordStamp = StampFactory.forKind(providers.getCodeCache().getTarget().wordKind); ComputeAddressNode arrayAddress = g.unique(ComputeAddressNode.create(boxedElement, locationNode, wordStamp)); args.add(arrayAddress); diff -r a1584e21457c -r d138867d61c4 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 Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Tue Dec 09 16:55:19 2014 +0100 @@ -70,7 +70,7 @@ Constant klass; LocationNode location; if (type instanceof HotSpotResolvedObjectType) { - location = ConstantLocationNode.create(CLASS_MIRROR_LOCATION, Kind.Object, classMirrorOffset, graph); + location = ConstantLocationNode.create(CLASS_MIRROR_LOCATION, classMirrorOffset, graph); klass = ((HotSpotResolvedObjectType) type).klass(); } else { /* @@ -91,7 +91,7 @@ if (typeField == null) { throw new GraalInternalError("Can't find TYPE field in class"); } - location = ConstantLocationNode.create(FINAL_LOCATION, Kind.Object, typeField.offset(), graph); + location = ConstantLocationNode.create(FINAL_LOCATION, typeField.offset(), graph); } ConstantNode klassNode = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), klass, metaAccess, graph); diff -r a1584e21457c -r d138867d61c4 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 Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -98,7 +98,7 @@ return; } - LocationNode location = ConstantLocationNode.create(CLASS_KLASS_LOCATION, runtime.getTarget().wordKind, runtime.getConfig().klassOffset, graph()); + LocationNode location = ConstantLocationNode.create(CLASS_KLASS_LOCATION, runtime.getConfig().klassOffset, graph()); assert !clazz.isConstant(); FloatingReadNode read = graph().unique(FloatingReadNode.create(clazz, location, null, stamp(), getGuard(), BarrierType.NONE)); graph().replaceFloating(this, read); diff -r a1584e21457c -r d138867d61c4 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 Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -81,7 +81,7 @@ return; } - LocationNode location = ConstantLocationNode.create(CLASS_MIRROR_LOCATION, Kind.Object, config.classMirrorOffset, graph()); + LocationNode location = ConstantLocationNode.create(CLASS_MIRROR_LOCATION, config.classMirrorOffset, graph()); assert !hub.isConstant(); FloatingReadNode read = graph().unique(FloatingReadNode.create(hub, location, null, stamp(), getGuard(), BarrierType.NONE)); graph().replaceFloating(this, read); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -117,7 +117,7 @@ if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) { return; } - LocationNode location = ConstantLocationNode.create(KLASS_LAYOUT_HELPER_LOCATION, Kind.Int, config.klassLayoutHelperOffset, graph()); + LocationNode location = ConstantLocationNode.create(KLASS_LAYOUT_HELPER_LOCATION, config.klassLayoutHelperOffset, graph()); assert !klass.isConstant(); graph().replaceFloating(this, graph().unique(FloatingReadNode.create(klass, location, null, stamp(), getGuard(), BarrierType.NONE))); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Tue Dec 09 16:55:19 2014 +0100 @@ -481,7 +481,7 @@ public static void validateObject(Object parent, Object child) { if (verifyOops() && child != null && !validateOop(VALIDATE_OBJECT, parent, child)) { log(true, "Verification ERROR, Parent: %p Child: %p\n", Word.fromObject(parent).rawValue(), Word.fromObject(child).rawValue()); - DirectObjectStoreNode.storeObject(null, 0, 0, null, LocationIdentity.ANY_LOCATION); + DirectObjectStoreNode.storeObject(null, 0, 0, null, LocationIdentity.ANY_LOCATION, Kind.Object); } } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -111,7 +111,7 @@ private ValueNode computeBase(ValueNode base, ValueNode pos) { FixedWithNextNode basePtr = graph().add(GetObjectAddressNode.create(base)); graph().addBeforeFixed(this, basePtr); - ValueNode loc = IndexedLocationNode.create(getLocationIdentity(), elementKind, runtime.getArrayBaseOffset(elementKind), pos, graph(), runtime.getArrayIndexScale(elementKind)); + ValueNode loc = IndexedLocationNode.create(getLocationIdentity(), runtime.getArrayBaseOffset(elementKind), pos, graph(), runtime.getArrayIndexScale(elementKind)); return graph().unique(ComputeAddressNode.create(basePtr, loc, StampFactory.forKind(Kind.Long))); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -98,7 +98,7 @@ private ValueNode computeBase(ValueNode base, ValueNode pos) { FixedWithNextNode basePtr = graph().add(GetObjectAddressNode.create(base)); graph().addBeforeFixed(this, basePtr); - ValueNode loc = IndexedLocationNode.create(getLocationIdentity(), Kind.Object, runtime.getArrayBaseOffset(Kind.Object), pos, graph(), runtime.getArrayIndexScale(Kind.Object)); + ValueNode loc = IndexedLocationNode.create(getLocationIdentity(), runtime.getArrayBaseOffset(Kind.Object), pos, graph(), runtime.getArrayIndexScale(Kind.Object)); return graph().unique(ComputeAddressNode.create(basePtr, loc, StampFactory.forKind(Kind.Long))); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java Tue Dec 09 16:55:19 2014 +0100 @@ -207,13 +207,13 @@ long start = (long) (length - 1) * scale; for (long i = start; i >= 0; i -= scale) { Object a = UnsafeLoadNode.load(src, arrayBaseOffset + i + (long) srcPos * scale, kind, arrayLocation); - DirectObjectStoreNode.storeObject(dest, arrayBaseOffset, i + (long) destPos * scale, a, getArrayLocation(kind)); + DirectObjectStoreNode.storeObject(dest, arrayBaseOffset, i + (long) destPos * scale, a, getArrayLocation(kind), kind); } } else { long end = (long) length * scale; for (long i = 0; i < end; i += scale) { Object a = UnsafeLoadNode.load(src, arrayBaseOffset + i + (long) srcPos * scale, kind, arrayLocation); - DirectObjectStoreNode.storeObject(dest, arrayBaseOffset, i + (long) destPos * scale, a, getArrayLocation(kind)); + DirectObjectStoreNode.storeObject(dest, arrayBaseOffset, i + (long) destPos * scale, a, getArrayLocation(kind), kind); } } } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypeRewriterPhase.java Tue Dec 09 16:55:19 2014 +0100 @@ -130,13 +130,12 @@ case READ_KLASS_POINTER: assert arguments.size() == 2 || arguments.size() == 3; - Kind readKind = asKind(callTargetNode.returnType()); Stamp readStamp = KlassPointerStamp.klass(); LocationNode location; if (arguments.size() == 2) { - location = makeLocation(graph, arguments.get(1), readKind, ANY_LOCATION); + location = makeLocation(graph, arguments.get(1), ANY_LOCATION); } else { - location = makeLocation(graph, arguments.get(1), readKind, arguments.get(2)); + location = makeLocation(graph, arguments.get(1), arguments.get(2)); } replace(invoke, readKlassOp(graph, arguments.get(0), invoke, location, readStamp, operation.opcode())); break; diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -51,7 +51,7 @@ } public static AddLocationNode create(LocationNode x, LocationNode y, Graph graph) { - assert x.getValueKind().equals(y.getValueKind()) && x.getLocationIdentity().equals(y.getLocationIdentity()); + assert x.getLocationIdentity().equals(y.getLocationIdentity()); return graph.unique(AddLocationNode.create(x, y)); } @@ -66,11 +66,6 @@ } @Override - public Kind getValueKind() { - return getX().getValueKind(); - } - - @Override public LocationIdentity getLocationIdentity() { return getX().getLocationIdentity(); } @@ -88,7 +83,7 @@ if (xIdx.getIndexScaling() == yIdx.getIndexScaling()) { long displacement = xIdx.getDisplacement() + yIdx.getDisplacement(); ValueNode index = BinaryArithmeticNode.add(xIdx.getIndex(), yIdx.getIndex()); - return IndexedLocationNode.create(getLocationIdentity(), getValueKind(), displacement, index, xIdx.getIndexScaling()); + return IndexedLocationNode.create(getLocationIdentity(), displacement, index, xIdx.getIndexScaling()); } } return this; @@ -97,10 +92,10 @@ private LocationNode canonical(ConstantLocationNode constant, LocationNode other) { if (other instanceof ConstantLocationNode) { ConstantLocationNode otherConst = (ConstantLocationNode) other; - return ConstantLocationNode.create(getLocationIdentity(), getValueKind(), otherConst.getDisplacement() + constant.getDisplacement()); + return ConstantLocationNode.create(getLocationIdentity(), otherConst.getDisplacement() + constant.getDisplacement()); } else if (other instanceof IndexedLocationNode) { IndexedLocationNode otherIdx = (IndexedLocationNode) other; - return IndexedLocationNode.create(getLocationIdentity(), getValueKind(), otherIdx.getDisplacement() + constant.getDisplacement(), otherIdx.getIndex(), otherIdx.getIndexScaling()); + return IndexedLocationNode.create(getLocationIdentity(), otherIdx.getDisplacement() + constant.getDisplacement(), otherIdx.getIndex(), otherIdx.getIndexScaling()); } else if (other instanceof AddLocationNode) { AddLocationNode otherAdd = (AddLocationNode) other; LocationNode newInner = otherAdd.canonical(constant, otherAdd.getX()); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -36,32 +36,24 @@ @NodeInfo(nameTemplate = "Loc {p#locationIdentity/s}") public class ConstantLocationNode extends LocationNode { - protected final Kind valueKind; protected final LocationIdentity locationIdentity; protected final long displacement; - public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement, Graph graph) { - return graph.unique(ConstantLocationNode.create(identity, kind, displacement)); - } - - public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement) { - return new ConstantLocationNode(identity, kind, displacement); + public static ConstantLocationNode create(LocationIdentity identity, long displacement, Graph graph) { + return graph.unique(ConstantLocationNode.create(identity, displacement)); } - protected ConstantLocationNode(LocationIdentity identity, Kind kind, long displacement) { + public static ConstantLocationNode create(LocationIdentity identity, long displacement) { + return new ConstantLocationNode(identity, displacement); + } + + protected ConstantLocationNode(LocationIdentity identity, long displacement) { super(StampFactory.forVoid()); - assert kind != Kind.Illegal && kind != Kind.Void; - this.valueKind = kind; this.locationIdentity = identity; this.displacement = displacement; } @Override - public Kind getValueKind() { - return valueKind; - } - - @Override public LocationIdentity getLocationIdentity() { return locationIdentity; } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -41,7 +41,6 @@ @NodeInfo(nameTemplate = "IdxLoc {p#locationIdentity/s}") public class IndexedLocationNode extends LocationNode implements Canonicalizable { - protected final Kind valueKind; protected final LocationIdentity locationIdentity; protected final long displacement; @Input ValueNode index; @@ -65,20 +64,18 @@ return indexScaling; } - public static IndexedLocationNode create(LocationIdentity identity, Kind kind, long displacement, ValueNode index, Graph graph, int indexScaling) { - return graph.unique(IndexedLocationNode.create(identity, kind, displacement, index, indexScaling)); + public static IndexedLocationNode create(LocationIdentity identity, long displacement, ValueNode index, Graph graph, int indexScaling) { + return graph.unique(IndexedLocationNode.create(identity, displacement, index, indexScaling)); } - public static IndexedLocationNode create(LocationIdentity identity, Kind kind, long displacement, ValueNode index, int indexScaling) { - return new IndexedLocationNode(identity, kind, displacement, index, indexScaling); + public static IndexedLocationNode create(LocationIdentity identity, long displacement, ValueNode index, int indexScaling) { + return new IndexedLocationNode(identity, displacement, index, indexScaling); } - protected IndexedLocationNode(LocationIdentity identity, Kind kind, long displacement, ValueNode index, int indexScaling) { + protected IndexedLocationNode(LocationIdentity identity, long displacement, ValueNode index, int indexScaling) { super(StampFactory.forVoid()); assert index != null; assert indexScaling != 0; - assert kind != Kind.Illegal && kind != Kind.Void; - this.valueKind = kind; this.locationIdentity = identity; this.index = index; this.displacement = displacement; @@ -86,11 +83,6 @@ } @Override - public Kind getValueKind() { - return valueKind; - } - - @Override public LocationIdentity getLocationIdentity() { return locationIdentity; } @@ -98,7 +90,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (index.isConstant()) { - return ConstantLocationNode.create(getLocationIdentity(), getValueKind(), index.asJavaConstant().asLong() * indexScaling + displacement); + return ConstantLocationNode.create(getLocationIdentity(), index.asJavaConstant().asLong() * indexScaling + displacement); } return this; } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.nodes.extended; +import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; @@ -36,14 +37,16 @@ @NodeInfo public class JavaReadNode extends FixedAccessNode implements Lowerable, GuardingNode, Canonicalizable { + protected final Kind readKind; protected final boolean compressible; - public static JavaReadNode create(ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { - return new JavaReadNode(object, location, barrierType, compressible); + public static JavaReadNode create(Kind readKind, ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { + return new JavaReadNode(readKind, object, location, barrierType, compressible); } - protected JavaReadNode(ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { - super(object, location, StampFactory.forKind(location.getValueKind()), barrierType); + protected JavaReadNode(Kind readKind, ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { + super(object, location, StampFactory.forKind(readKind), barrierType); + this.readKind = readKind; this.compressible = compressible; } @@ -55,6 +58,10 @@ return true; } + public Kind getReadKind() { + return readKind; + } + public boolean isCompressible() { return compressible; } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.nodes.extended; +import com.oracle.graal.api.meta.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; @@ -33,14 +34,16 @@ @NodeInfo public class JavaWriteNode extends AbstractWriteNode implements Lowerable, StateSplit, MemoryAccess, MemoryCheckpoint.Single { + protected final Kind writeKind; protected final boolean compressible; - public static JavaWriteNode create(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { - return new JavaWriteNode(object, value, location, barrierType, compressible, initialization); + public static JavaWriteNode create(Kind writeKind, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { + return new JavaWriteNode(writeKind, object, value, location, barrierType, compressible, initialization); } - protected JavaWriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { + protected JavaWriteNode(Kind writeKind, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { super(object, value, location, barrierType, initialization); + this.writeKind = writeKind; this.compressible = compressible; } @@ -52,6 +55,10 @@ return true; } + public Kind getWriteKind() { + return writeKind; + } + public boolean isCompressible() { return compressible; } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -49,11 +49,6 @@ } /** - * Returns the kind of the accessed memory value. - */ - public abstract Kind getValueKind(); - - /** * Returns the identity of the accessed memory location. */ public abstract LocationIdentity getLocationIdentity(); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.nodes.extended; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; @@ -31,7 +32,6 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; -import com.oracle.graal.nodes.virtual.*; /** * Reads an {@linkplain FixedAccessNode accessed} value. @@ -171,17 +171,7 @@ @Override public void virtualize(VirtualizerTool tool) { - if (location() instanceof ConstantLocationNode) { - ConstantLocationNode constantLocation = (ConstantLocationNode) location(); - State state = tool.getObjectState(object()); - if (state != null && state.getState() == EscapeState.Virtual) { - VirtualObjectNode virtual = state.getVirtualObject(); - int entryIndex = virtual.entryIndexForOffset(constantLocation.getDisplacement()); - if (entryIndex != -1 && virtual.entryKind(entryIndex) == constantLocation.getValueKind()) { - tool.replaceWith(state.getEntry(entryIndex)); - } - } - } + throw GraalInternalError.shouldNotReachHere("unexpected ReadNode before PEA"); } public boolean canNullCheck() { diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -23,12 +23,12 @@ package com.oracle.graal.nodes.extended; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.LocationNode.Location; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.virtual.*; /** * Writes a given {@linkplain #value() value} a {@linkplain FixedAccessNode memory location}. @@ -79,18 +79,7 @@ @Override public void virtualize(VirtualizerTool tool) { - if (location() instanceof ConstantLocationNode) { - ConstantLocationNode constantLocation = (ConstantLocationNode) location(); - State state = tool.getObjectState(object()); - if (state != null && state.getState() == EscapeState.Virtual) { - VirtualObjectNode virtual = state.getVirtualObject(); - int entryIndex = virtual.entryIndexForOffset(constantLocation.getDisplacement()); - if (entryIndex != -1 && virtual.entryKind(entryIndex) == constantLocation.getValueKind()) { - tool.setVirtualEntry(state, entryIndex, value(), false); - tool.delete(); - } - } - } + throw GraalInternalError.shouldNotReachHere("unexpected WriteNode before PEA"); } public boolean canNullCheck() { diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -73,7 +73,7 @@ } public void generate(NodeLIRBuilderTool gen) { - LocationNode location = IndexedLocationNode.create(getLocationIdentity(), delta.getKind(), 0, offset, graph(), 1); + LocationNode location = IndexedLocationNode.create(getLocationIdentity(), 0, offset, graph(), 1); Value address = location.generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object())); Value result = gen.getLIRGeneratorTool().emitAtomicReadAndAdd(address, gen.operand(delta)); gen.setResult(this, result); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java Tue Dec 09 16:55:19 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.nodes.spi; +import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; @@ -36,9 +37,10 @@ /** * Reconstructs the array index from a location node that was created as a lowering of an * indexed access to an array. - * + * + * @param elementKind the {@link Kind} of the array elements * @param location a location pointing to an element in an array * @return a node that gives the index of the element */ - ValueNode reconstructArrayIndex(LocationNode location); + ValueNode reconstructArrayIndex(Kind elementKind, LocationNode location); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Tue Dec 09 16:55:19 2014 +0100 @@ -79,21 +79,21 @@ @Test public void testWrite1() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "1"), kind, true, ID); + assertWrite(parseEager("write" + kind.name() + "1"), true, ID); } } @Test public void testWrite2() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "2"), kind, true, ID); + assertWrite(parseEager("write" + kind.name() + "2"), true, ID); } } @Test public void testWrite3() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "3"), kind, true, LocationIdentity.ANY_LOCATION); + assertWrite(parseEager("write" + kind.name() + "3"), true, LocationIdentity.ANY_LOCATION); } } @@ -103,7 +103,6 @@ Assert.assertEquals(graph.getParameter(0), read.object()); IndexedLocationNode location = (IndexedLocationNode) read.location(); - Assert.assertEquals(kind, location.getValueKind()); Assert.assertEquals(locationIdentity, location.getLocationIdentity()); Assert.assertEquals(1, location.getIndexScaling()); @@ -120,14 +119,13 @@ Assert.assertEquals(read, ret.result()); } - private static void assertWrite(StructuredGraph graph, Kind kind, boolean indexConvert, LocationIdentity locationIdentity) { + private static void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) { JavaWriteNode write = (JavaWriteNode) graph.start().next(); Assert.assertEquals(graph.getParameter(2), write.value()); Assert.assertEquals(graph.getParameter(0), write.object()); Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci); IndexedLocationNode location = (IndexedLocationNode) write.location(); - Assert.assertEquals(kind, location.getValueKind()); Assert.assertEquals(locationIdentity, location.getLocationIdentity()); Assert.assertEquals(1, location.getIndexScaling()); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Tue Dec 09 16:55:19 2014 +0100 @@ -85,21 +85,21 @@ @Test public void testWrite1() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "1"), kind, true, ID); + assertWrite(parseEager("write" + kind.name() + "1"), true, ID); } } @Test public void testWrite2() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "2"), kind, true, ID); + assertWrite(parseEager("write" + kind.name() + "2"), true, ID); } } @Test public void testWrite3() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "3"), kind, true, LocationIdentity.ANY_LOCATION); + assertWrite(parseEager("write" + kind.name() + "3"), true, LocationIdentity.ANY_LOCATION); } } @@ -114,7 +114,6 @@ Assert.assertEquals(target.wordKind, cast.stamp().getStackKind()); IndexedLocationNode location = (IndexedLocationNode) read.location(); - Assert.assertEquals(kind, location.getValueKind()); Assert.assertEquals(locationIdentity, location.getLocationIdentity()); Assert.assertEquals(1, location.getIndexScaling()); @@ -131,7 +130,7 @@ Assert.assertEquals(read, ret.result()); } - private void assertWrite(StructuredGraph graph, Kind kind, boolean indexConvert, LocationIdentity locationIdentity) { + private void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) { WordCastNode cast = (WordCastNode) graph.start().next(); JavaWriteNode write = (JavaWriteNode) cast.next(); @@ -143,7 +142,6 @@ Assert.assertEquals(target.wordKind, cast.stamp().getStackKind()); IndexedLocationNode location = (IndexedLocationNode) write.location(); - Assert.assertEquals(kind, location.getValueKind()); Assert.assertEquals(locationIdentity, location.getLocationIdentity()); Assert.assertEquals(1, location.getIndexScaling()); diff -r a1584e21457c -r d138867d61c4 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 Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Tue Dec 09 16:55:19 2014 +0100 @@ -211,7 +211,7 @@ protected void lowerArrayLengthNode(ArrayLengthNode arrayLengthNode, LoweringTool tool) { StructuredGraph graph = arrayLengthNode.graph(); ValueNode array = arrayLengthNode.array(); - ConstantLocationNode location = ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, arrayLengthOffset(), graph); + ConstantLocationNode location = ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, arrayLengthOffset(), graph); ReadNode arrayLengthRead = graph.add(ReadNode.create(array, location, StampFactory.positiveInt(), BarrierType.NONE)); arrayLengthRead.setGuard(createNullCheck(array, arrayLengthNode, tool)); @@ -243,7 +243,7 @@ protected void lowerAtomicReadAndWriteNode(AtomicReadAndWriteNode n) { StructuredGraph graph = n.graph(); Kind valueKind = n.getValueKind(); - LocationNode location = IndexedLocationNode.create(n.getLocationIdentity(), valueKind, 0, n.offset(), graph, 1); + LocationNode location = IndexedLocationNode.create(n.getLocationIdentity(), 0, n.offset(), graph, 1); ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue()); @@ -312,7 +312,7 @@ protected void lowerJavaReadNode(JavaReadNode read) { StructuredGraph graph = read.graph(); - Kind valueKind = read.location().getValueKind(); + Kind valueKind = read.getReadKind(); Stamp loadStamp = loadStamp(read.stamp(), valueKind, read.isCompressible()); ReadNode memoryRead = graph.add(ReadNode.create(read.object(), read.location(), loadStamp, read.getBarrierType())); @@ -324,7 +324,7 @@ protected void lowerJavaWriteNode(JavaWriteNode write) { StructuredGraph graph = write.graph(); - Kind valueKind = write.location().getValueKind(); + Kind valueKind = write.getWriteKind(); ValueNode value = implicitStoreConvert(graph, valueKind, write.value(), write.isCompressible()); WriteNode memoryWrite = graph.add(WriteNode.create(write.object(), value, write.location(), write.getBarrierType(), write.isInitialization())); @@ -366,7 +366,6 @@ Kind entryKind = virtual.entryKind(i); // Truffle requires some leniency in terms of what can be put where: - Kind accessKind = valueKind.getStackKind() == entryKind.getStackKind() ? entryKind : valueKind; assert valueKind.getStackKind() == entryKind.getStackKind() || (valueKind == Kind.Long || valueKind == Kind.Double || (valueKind == Kind.Int && virtual instanceof VirtualArrayNode)); ConstantLocationNode location = null; @@ -375,11 +374,11 @@ ResolvedJavaField field = ((VirtualInstanceNode) virtual).field(i); long offset = fieldOffset(field); if (offset >= 0) { - location = ConstantLocationNode.create(initLocationIdentity(), accessKind, offset, graph); + location = ConstantLocationNode.create(initLocationIdentity(), offset, graph); barrierType = fieldInitializationBarrier(entryKind); } } else { - location = ConstantLocationNode.create(initLocationIdentity(), accessKind, arrayBaseOffset(entryKind) + i * arrayScalingFactor(entryKind), graph); + location = ConstantLocationNode.create(initLocationIdentity(), arrayBaseOffset(entryKind) + i * arrayScalingFactor(entryKind), graph); barrierType = arrayInitializationBarrier(entryKind); } if (location != null) { @@ -583,7 +582,7 @@ int offset = fieldOffset(field); if (offset >= 0) { LocationIdentity loc = initialization ? initLocationIdentity() : field; - return ConstantLocationNode.create(loc, field.getKind(), offset, graph); + return ConstantLocationNode.create(loc, offset, graph); } else { return null; } @@ -612,7 +611,7 @@ ValueNode offset = offsetNode; if (offset.isConstant()) { long offsetValue = offset.asJavaConstant().asLong(); - return ConstantLocationNode.create(locationIdentity, accessKind, offsetValue, offset.graph()); + return ConstantLocationNode.create(locationIdentity, offsetValue, offset.graph()); } long displacement = 0; @@ -673,12 +672,12 @@ // If we were using sign extended values before restore the sign extension. offset = offset.graph().addOrUnique(SignExtendNode.create(offset, 64)); } - return IndexedLocationNode.create(locationIdentity, accessKind, displacement, offset, offset.graph(), indexScaling); + return IndexedLocationNode.create(locationIdentity, displacement, offset, offset.graph(), indexScaling); } public IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index, boolean initialization) { LocationIdentity loc = initialization ? initLocationIdentity() : NamedLocationIdentity.getArrayLocation(elementKind); - return IndexedLocationNode.create(loc, elementKind, arrayBaseOffset(elementKind), index, graph, arrayScalingFactor(elementKind)); + return IndexedLocationNode.create(loc, arrayBaseOffset(elementKind), index, graph, arrayScalingFactor(elementKind)); } protected GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { @@ -687,7 +686,7 @@ ValueNode arrayLength = readArrayLength(array, tool.getConstantReflection()); if (arrayLength == null) { Stamp stamp = StampFactory.positiveInt(); - ReadNode readArrayLength = graph.add(ReadNode.create(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, arrayLengthOffset(), graph), stamp, BarrierType.NONE)); + ReadNode readArrayLength = graph.add(ReadNode.create(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, arrayLengthOffset(), graph), stamp, BarrierType.NONE)); graph.addBeforeFixed(n, readArrayLength); readArrayLength.setGuard(createNullCheck(array, readArrayLength, tool)); arrayLength = readArrayLength; @@ -715,8 +714,7 @@ } @Override - public ValueNode reconstructArrayIndex(LocationNode location) { - Kind elementKind = location.getValueKind(); + public ValueNode reconstructArrayIndex(Kind elementKind, LocationNode location) { assert location.getLocationIdentity().equals(NamedLocationIdentity.getArrayLocation(elementKind)); long base; diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -42,30 +42,34 @@ @Input ValueNode offset; protected final int displacement; protected final LocationIdentity locationIdentity; + protected final Kind storeKind; - public static DirectObjectStoreNode create(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity) { - return new DirectObjectStoreNode(object, displacement, offset, value, locationIdentity); + public static DirectObjectStoreNode create(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity, Kind storeKind) { + return new DirectObjectStoreNode(object, displacement, offset, value, locationIdentity, storeKind); } - protected DirectObjectStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity) { + protected DirectObjectStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity, Kind storeKind) { super(StampFactory.forVoid()); this.object = object; this.value = value; this.offset = offset; this.displacement = displacement; this.locationIdentity = locationIdentity; + this.storeKind = storeKind; } @NodeIntrinsic - public static native void storeObject(Object obj, @ConstantNodeParameter int displacement, long offset, Object value, @ConstantNodeParameter LocationIdentity locationIdentity); + public static native void storeObject(Object obj, @ConstantNodeParameter int displacement, long offset, Object value, @ConstantNodeParameter LocationIdentity locationIdentity, + @ConstantNodeParameter Kind storeKind); @NodeIntrinsic - public static native void storeLong(Object obj, @ConstantNodeParameter int displacement, long offset, long value, @ConstantNodeParameter LocationIdentity locationIdenity); + public static native void storeLong(Object obj, @ConstantNodeParameter int displacement, long offset, long value, @ConstantNodeParameter LocationIdentity locationIdenity, + @ConstantNodeParameter Kind storeKind); @Override public void lower(LoweringTool tool) { - IndexedLocationNode location = IndexedLocationNode.create(locationIdentity, value.getKind(), displacement, offset, graph(), 1); - JavaWriteNode write = graph().add(JavaWriteNode.create(object, value, location, BarrierType.NONE, value.getKind() == Kind.Object, false)); + IndexedLocationNode location = IndexedLocationNode.create(locationIdentity, displacement, offset, graph(), 1); + JavaWriteNode write = graph().add(JavaWriteNode.create(storeKind, object, value, location, BarrierType.NONE, storeKind == Kind.Object, false)); graph().replaceFixedWithFixed(this, write); tool.getLowerer().lower(write, tool); diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Tue Dec 09 16:55:19 2014 +0100 @@ -48,34 +48,32 @@ protected final SnippetReflectionProvider snippetReflection; - @Input ValueNode valueKind; @Input(InputType.Association) ValueNode locationIdentity; @Input ValueNode displacement; @Input ValueNode index; @Input ValueNode indexScaling; - public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, - ValueNode indexScaling, Graph graph) { - return graph.unique(SnippetLocationNode.create(snippetReflection, identity, kind, displacement, index, indexScaling)); + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode displacement, ValueNode index, ValueNode indexScaling, + Graph graph) { + return graph.unique(SnippetLocationNode.create(snippetReflection, identity, displacement, index, indexScaling)); } - public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { - return new SnippetLocationNode(snippetReflection, locationIdentity, kind, displacement); + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement) { + return new SnippetLocationNode(snippetReflection, locationIdentity, displacement); } - protected SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { - this(snippetReflection, locationIdentity, kind, displacement, null, null); + protected SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement) { + this(snippetReflection, locationIdentity, displacement, null, null); } - public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, + public static SnippetLocationNode create(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement, ValueNode index, ValueNode indexScaling) { - return new SnippetLocationNode(snippetReflection, locationIdentity, kind, displacement, index, indexScaling); + return new SnippetLocationNode(snippetReflection, locationIdentity, displacement, index, indexScaling); } - protected SnippetLocationNode(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { + protected SnippetLocationNode(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode displacement, ValueNode index, ValueNode indexScaling) { super(StampFactory.object()); this.snippetReflection = snippetReflection; - this.valueKind = kind; this.locationIdentity = locationIdentity; this.displacement = displacement; this.index = index; @@ -83,14 +81,6 @@ } @Override - public Kind getValueKind() { - if (valueKind.isConstant()) { - return snippetReflection.asObject(Kind.class, valueKind.asJavaConstant()); - } - throw new GraalInternalError("Cannot access kind yet because it is not constant: " + valueKind); - } - - @Override public LocationIdentity getLocationIdentity() { if (locationIdentity.isConstant()) { LocationIdentity identity = snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant()); @@ -102,18 +92,17 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (valueKind.isConstant() && locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) { - Kind constKind = snippetReflection.asObject(Kind.class, valueKind.asJavaConstant()); + if (locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) { LocationIdentity constLocation = snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant()); long constDisplacement = displacement.asJavaConstant().asLong(); int constIndexScaling = indexScaling == null ? 0 : indexScaling.asJavaConstant().asInt(); if (index == null || constIndexScaling == 0) { - return ConstantLocationNode.create(constLocation, constKind, constDisplacement, graph()); + return ConstantLocationNode.create(constLocation, constDisplacement, graph()); } else if (index.isConstant()) { - return ConstantLocationNode.create(constLocation, constKind, index.asJavaConstant().asLong() * constIndexScaling + constDisplacement, graph()); + return ConstantLocationNode.create(constLocation, index.asJavaConstant().asLong() * constIndexScaling + constDisplacement, graph()); } else { - return IndexedLocationNode.create(constLocation, constKind, constDisplacement, index, graph(), constIndexScaling); + return IndexedLocationNode.create(constLocation, constDisplacement, index, graph(), constIndexScaling); } } return this; @@ -130,8 +119,8 @@ } @NodeIntrinsic - public static native Location constantLocation(LocationIdentity identity, Kind kind, long displacement); + public static native Location constantLocation(LocationIdentity identity, long displacement); @NodeIntrinsic - public static native Location indexedLocation(LocationIdentity identity, Kind kind, long displacement, int index, int indexScaling); + public static native Location indexedLocation(LocationIdentity identity, long displacement, int index, int indexScaling); } diff -r a1584e21457c -r d138867d61c4 graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Tue Dec 09 15:39:47 2014 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Tue Dec 09 16:55:19 2014 +0100 @@ -230,19 +230,19 @@ Kind readKind = asKind(callTargetNode.returnType()); LocationNode location; if (arguments.size() == 2) { - location = makeLocation(graph, arguments.get(1), readKind, ANY_LOCATION); + location = makeLocation(graph, arguments.get(1), ANY_LOCATION); } else { - location = makeLocation(graph, arguments.get(1), readKind, arguments.get(2)); + location = makeLocation(graph, arguments.get(1), arguments.get(2)); } - replace(invoke, readOp(graph, arguments.get(0), invoke, location, operation.opcode())); + replace(invoke, readOp(graph, readKind, arguments.get(0), invoke, location, operation.opcode())); break; } case READ_HEAP: { assert arguments.size() == 3; Kind readKind = asKind(callTargetNode.returnType()); - LocationNode location = makeLocation(graph, arguments.get(1), readKind, ANY_LOCATION); + LocationNode location = makeLocation(graph, arguments.get(1), ANY_LOCATION); BarrierType barrierType = snippetReflection.asObject(BarrierType.class, arguments.get(2).asJavaConstant()); - replace(invoke, readOp(graph, arguments.get(0), invoke, location, barrierType, true)); + replace(invoke, readOp(graph, readKind, arguments.get(0), invoke, location, barrierType, true)); break; } case WRITE_POINTER: @@ -253,11 +253,11 @@ Kind writeKind = asKind(targetMethod.getSignature().getParameterType(targetMethod.isStatic() ? 2 : 1, targetMethod.getDeclaringClass())); LocationNode location; if (arguments.size() == 3) { - location = makeLocation(graph, arguments.get(1), writeKind, LocationIdentity.ANY_LOCATION); + location = makeLocation(graph, arguments.get(1), LocationIdentity.ANY_LOCATION); } else { - location = makeLocation(graph, arguments.get(1), writeKind, arguments.get(3)); + location = makeLocation(graph, arguments.get(1), arguments.get(3)); } - replace(invoke, writeOp(graph, arguments.get(0), arguments.get(2), invoke, location, operation.opcode())); + replace(invoke, writeOp(graph, writeKind, arguments.get(0), arguments.get(2), invoke, location, operation.opcode())); break; } case ZERO: @@ -379,28 +379,27 @@ return materialize; } - protected LocationNode makeLocation(StructuredGraph graph, ValueNode offset, Kind readKind, ValueNode locationIdentity) { + protected LocationNode makeLocation(StructuredGraph graph, ValueNode offset, ValueNode locationIdentity) { if (locationIdentity.isConstant()) { - return makeLocation(graph, offset, readKind, snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant())); + return makeLocation(graph, offset, snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant())); } - return SnippetLocationNode.create(snippetReflection, locationIdentity, ConstantNode.forConstant(snippetReflection.forObject(readKind), metaAccess, graph), ConstantNode.forLong(0, graph), - fromSigned(graph, offset), ConstantNode.forInt(1, graph), graph); + return SnippetLocationNode.create(snippetReflection, locationIdentity, ConstantNode.forLong(0, graph), fromSigned(graph, offset), ConstantNode.forInt(1, graph), graph); } - protected LocationNode makeLocation(StructuredGraph graph, ValueNode offset, Kind readKind, LocationIdentity locationIdentity) { - return IndexedLocationNode.create(locationIdentity, readKind, 0, fromSigned(graph, offset), graph, 1); + protected LocationNode makeLocation(StructuredGraph graph, ValueNode offset, LocationIdentity locationIdentity) { + return IndexedLocationNode.create(locationIdentity, 0, fromSigned(graph, offset), graph, 1); } - protected ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, Opcode op) { + protected ValueNode readOp(StructuredGraph graph, Kind readKind, ValueNode base, Invoke invoke, LocationNode location, Opcode op) { assert op == Opcode.READ_POINTER || op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED; final BarrierType barrier = (op == Opcode.READ_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); final boolean compressible = (op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED); - return readOp(graph, base, invoke, location, barrier, compressible); + return readOp(graph, readKind, base, invoke, location, barrier, compressible); } - protected ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, BarrierType barrierType, boolean compressible) { - JavaReadNode read = graph.add(JavaReadNode.create(base, location, barrierType, compressible)); + protected ValueNode readOp(StructuredGraph graph, Kind readKind, ValueNode base, Invoke invoke, LocationNode location, BarrierType barrierType, boolean compressible) { + JavaReadNode read = graph.add(JavaReadNode.create(readKind, base, location, barrierType, compressible)); graph.addBeforeFixed(invoke.asNode(), read); /* * The read must not float outside its block otherwise it may float above an explicit zero @@ -410,12 +409,12 @@ return read; } - protected ValueNode writeOp(StructuredGraph graph, ValueNode base, ValueNode value, Invoke invoke, LocationNode location, Opcode op) { + protected ValueNode writeOp(StructuredGraph graph, Kind writeKind, ValueNode base, ValueNode value, Invoke invoke, LocationNode location, Opcode op) { assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE; final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED); final boolean initialize = (op == Opcode.INITIALIZE); - JavaWriteNode write = graph.add(JavaWriteNode.create(base, value, location, barrier, compressible, initialize)); + JavaWriteNode write = graph.add(JavaWriteNode.create(writeKind, base, value, location, barrier, compressible, initialize)); write.setStateAfter(invoke.stateAfter()); graph.addBeforeFixed(invoke.asNode(), write); return write;