Mercurial > hg > graal-jvmci-8
changeset 22285:7d453d4d855a
Remove unneeded files.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 23 Jul 2015 11:08:42 +0200 |
parents | 09acb1bc3a56 |
children | 2ecfec90e51e |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAAssertionsTest.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDirectStaticCallOp.java graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ConstantPoolSubstitutionsTests.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMapBuilder.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ConstantPoolSubstitutions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyUnrollNode.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/ConstantLoadTest.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/VarArgs_Unroll.java graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/ConstantStackCastTest.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LiveValueSet.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LocationMarker.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LocationMarkerPhase.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/MarkBasePointersPhase.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/UniqueWorkList.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/ValueSet.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/ReferenceMapBuilder.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/SpillMoveFactoryBase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CanonicalizableLocation.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeValueMap.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EnsureVirtualizedNode.java graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DerivedOopTest.java graal/com.oracle.graal.truffle.test/sl/TestDeoptInInlinedFunction.sl.disable graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/MockLanguage.java |
diffstat | 23 files changed, 0 insertions(+), 2261 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAAssertionsTest.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.compiler.test.ea; - -import jdk.internal.jvmci.code.*; - -import org.junit.*; - -import com.oracle.graal.api.directives.*; -import com.oracle.graal.compiler.test.*; - -public class PEAAssertionsTest extends GraalCompilerTest { - - public static Object field; - - public static void snippet1(int i) { - Integer object = new Integer(i); - GraalDirectives.ensureVirtualized(object); - } - - @Test - public void test1() { - test("snippet1", 1); - } - - public static void snippet2(int i) { - Integer object = new Integer(i); - GraalDirectives.ensureVirtualized(object); - field = object; // assert here - } - - @Test(expected = SourceStackTrace.class) - public void test2() { - test("snippet2", 1); - } - - public static void snippet3(int i) { - Integer object = new Integer(i); - field = object; - GraalDirectives.ensureVirtualized(object); // assert here - } - - @Test(expected = SourceStackTrace.class) - public void test3() { - test("snippet3", 1); - } - - public static void snippetHere1(int i) { - Integer object = new Integer(i); - GraalDirectives.ensureVirtualizedHere(object); - } - - @Test - public void testHere1() { - test("snippetHere1", 1); - } - - public static void snippetHere2(int i) { - Integer object = new Integer(i); - GraalDirectives.ensureVirtualizedHere(object); - field = object; - } - - @Test - public void testHere2() { - test("snippetHere2", 1); - } - - public static void snippetHere3(int i) { - Integer object = new Integer(i); - field = object; - GraalDirectives.ensureVirtualizedHere(object); // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testHere3() { - test("snippetHere3", 1); - } - - public static void snippetBoxing1(int i) { - Integer object = i; - GraalDirectives.ensureVirtualizedHere(object); // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testBoxing1() { - test("snippetBoxing1", 1); - } - - public static void snippetBoxing2(int i) { - Integer object = i; - GraalDirectives.ensureVirtualized(object); // assert here - field = object; - } - - @Test(expected = SourceStackTrace.class) - public void testBoxing2() { - test("snippetBoxing2", 1); - } - - public static void snippetControlFlow1(boolean b, int i) { - Integer object = new Integer(i); - if (b) { - GraalDirectives.ensureVirtualized(object); - } - field = object; - } - - @Test - public void testControlFlow1() { - test("snippetControlFlow1", true, 1); - } - - public static void snippetControlFlow2(boolean b, int i) { - Integer object = new Integer(i); - if (b) { - GraalDirectives.ensureVirtualized(object); - } else { - GraalDirectives.ensureVirtualized(object); - } - field = object; // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testControlFlow2() { - test("snippetControlFlow2", true, 1); - } - - public static void snippetControlFlow3(boolean b, int i) { - Integer object = new Integer(i); - GraalDirectives.ensureVirtualized(object); - if (b) { - field = 1; - } else { - field = 2; - } - field = object; // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testControlFlow3() { - test("snippetControlFlow3", true, 1); - } - - public static void snippetControlFlow4(boolean b, int i) { - Integer object = new Integer(i); - if (b) { - field = object; - } else { - field = 2; - } - GraalDirectives.ensureVirtualized(object); // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testControlFlow4() { - test("snippetControlFlow4", true, 1); - } - - public static void snippetControlFlow5(boolean b, int i) { - Integer object = new Integer(i); - if (b) { - field = object; - } else { - field = 2; - } - GraalDirectives.ensureVirtualizedHere(object); // assert here - } - - @Test(expected = SourceStackTrace.class) - public void testControlFlow5() { - test("snippetControlFlow5", true, 1); - } - - public static final class TestClass { - Object a; - Object b; - } - - public static void snippetIndirect1(boolean b, int i) { - Integer object = new Integer(i); - TestClass t = new TestClass(); - t.a = object; - GraalDirectives.ensureVirtualized(object); - - if (b) { - field = t; // assert here - } else { - field = 2; - } - } - - @Test(expected = SourceStackTrace.class) - public void testIndirect1() { - test("snippetIndirect1", true, 1); - } - - public static void snippetIndirect2(boolean b, int i) { - Integer object = new Integer(i); - TestClass t = new TestClass(); - t.a = object; - GraalDirectives.ensureVirtualized(t); - - if (b) { - field = object; - } else { - field = 2; - } - } - - @Test - public void testIndirect2() { - test("snippetIndirect2", true, 1); - } -}
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDirectStaticCallOp.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.amd64; - -import jdk.internal.jvmci.hotspot.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.asm.amd64.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp; -import com.oracle.graal.lir.asm.*; -import com.oracle.graal.nodes.CallTargetNode.InvokeKind; - -/** - * A direct call that complies with the conventions for such calls in HotSpot. It doesn't use an - * inline cache so it's just a patchable call site. - */ -@Opcode("CALL_DIRECT") -final class AMD64HotSpotDirectStaticCallOp extends DirectCallOp { - public static final LIRInstructionClass<AMD64HotSpotDirectStaticCallOp> TYPE = LIRInstructionClass.create(AMD64HotSpotDirectStaticCallOp.class); - - private final InvokeKind invokeKind; - private final HotSpotVMConfig config; - - AMD64HotSpotDirectStaticCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, HotSpotVMConfig config) { - super(TYPE, target, result, parameters, temps, state); - assert invokeKind.isDirect(); - this.invokeKind = invokeKind; - this.config = config; - } - - @Override - public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { - crb.recordMark(invokeKind == InvokeKind.Static ? config.MARKID_INVOKESTATIC : config.MARKID_INVOKESPECIAL); - super.emitCode(crb, masm); - } -}
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ConstantPoolSubstitutionsTests.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.oracle.graal.hotspot.test; - -import org.junit.*; - -import com.oracle.graal.compiler.test.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.StructuredGraph.*; - -import jdk.internal.jvmci.debug.*; -import jdk.internal.jvmci.debug.Debug.*; -import sun.misc.*; -import sun.reflect.*; - -public class ConstantPoolSubstitutionsTests extends GraalCompilerTest { - - protected StructuredGraph test(final String snippet) { - try (Scope s = Debug.scope("ConstantPoolSubstitutionsTests", getMetaAccess().lookupJavaMethod(getMethod(snippet)))) { - StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); - compile(graph.method(), graph); - assertNotInGraph(graph, Invoke.class); - Debug.dump(graph, snippet); - return graph; - } catch (Throwable e) { - throw Debug.handle(e); - } - } - - protected static StructuredGraph assertNotInGraph(StructuredGraph graph, Class<?> clazz) { - for (Node node : graph.getNodes()) { - if (clazz.isInstance(node)) { - fail(node.toString()); - } - } - return graph; - } - - @Test - public void testGetSize() { - ConstantPool cp = SharedSecrets.getJavaLangAccess().getConstantPool(Object.class); - test("getSize", cp); - } - - @Test - public void testGetIntAt() { - test("getIntAt"); - } - - @Test - public void testGetLongAt() { - test("getLongAt"); - } - - @Test - public void testGetFloatAt() { - test("getFloatAt"); - } - - @Test - public void testGetDoubleAt() { - test("getDoubleAt"); - } - - // @Test - public void testGetUTF8At() { - test("getUTF8At"); - } - - public int getSize(ConstantPool cp) { - return cp.getSize(); - } - - public int getIntAt(ConstantPool cp) { - return cp.getIntAt(0); - } - - public long getLongAt(ConstantPool cp) { - return cp.getLongAt(0); - } - - public float getFloatAt(ConstantPool cp) { - return cp.getFloatAt(0); - } - - public double getDoubleAt(ConstantPool cp) { - return cp.getDoubleAt(0); - } - - public String getUTF8At(ConstantPool cp) { - return cp.getUTF8At(0); - } - -}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMapBuilder.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot; - -import static jdk.internal.jvmci.code.ValueUtil.*; - -import java.util.*; - -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.framemap.*; - -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.common.*; -import jdk.internal.jvmci.hotspot.*; -import jdk.internal.jvmci.meta.*; - -public final class HotSpotReferenceMapBuilder extends ReferenceMapBuilder { - - private int maxRegisterSize; - - private final ArrayList<Value> objectValues; - private int objectCount; - - private final TargetDescription target; - private final int totalFrameSize; - - public HotSpotReferenceMapBuilder(TargetDescription target, int totalFrameSize) { - this.objectValues = new ArrayList<>(); - this.objectCount = 0; - - this.target = target; - this.totalFrameSize = totalFrameSize; - } - - @Override - public void addLiveValue(Value v) { - if (isConstant(v)) { - return; - } - LIRKind lirKind = v.getLIRKind(); - if (!lirKind.isValue()) { - objectValues.add(v); - if (lirKind.isUnknownReference()) { - objectCount++; - } else { - objectCount += lirKind.getReferenceCount(); - } - } - if (isRegister(v)) { - int size = target.getSizeInBytes(lirKind.getPlatformKind()); - if (size > maxRegisterSize) { - maxRegisterSize = size; - } - } - } - - @Override - public ReferenceMap finish(LIRFrameState state) { - Location[] objects = new Location[objectCount]; - Location[] derivedBase = new Location[objectCount]; - int[] sizeInBytes = new int[objectCount]; - - int idx = 0; - for (Value obj : objectValues) { - LIRKind kind = obj.getLIRKind(); - int bytes = bytesPerElement(kind); - if (kind.isUnknownReference()) { - throw JVMCIError.unimplemented("derived references not yet implemented"); - } else { - Location base = null; - if (kind.isDerivedReference()) { - Variable baseVariable = (Variable) kind.getDerivedReferenceBase(); - Value baseValue = state.getLiveBasePointers().get(baseVariable.index); - assert baseValue.getPlatformKind().getVectorLength() == 1 && baseValue.getLIRKind().isReference(0) && !baseValue.getLIRKind().isDerivedReference(); - base = toLocation(baseValue, 0); - } - - for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) { - if (kind.isReference(i)) { - objects[idx] = toLocation(obj, i * bytes); - derivedBase[idx] = base; - sizeInBytes[idx] = bytes; - idx++; - } - } - } - } - - return new HotSpotReferenceMap(objects, derivedBase, sizeInBytes, maxRegisterSize); - } - - private int bytesPerElement(LIRKind kind) { - PlatformKind platformKind = kind.getPlatformKind(); - return target.getSizeInBytes(platformKind) / platformKind.getVectorLength(); - } - - private Location toLocation(Value v, int offset) { - if (isRegister(v)) { - return Location.subregister(asRegister(v), offset); - } else { - StackSlot s = asStackSlot(v); - return Location.stack(s.getOffset(totalFrameSize) + offset); - } - } -}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ConstantPoolSubstitutions.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.replacements; - -import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; - -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.hotspot.word.*; -import com.oracle.graal.word.*; - -import sun.reflect.*; - -/** - * Substitutions for {@link sun.reflect.ConstantPool} methods. - */ -@ClassSubstitution(sun.reflect.ConstantPool.class) -public class ConstantPoolSubstitutions { - - /** - * Get the metaspace {@code ConstantPool} pointer for the given holder class. - * - * @param constantPoolOop the holder class as {@link Object} - * @return a metaspace {@code ConstantPool} pointer - */ - private static Word metaspaceConstantPool(Object constantPoolOop) { - // ConstantPool.constantPoolOop is in fact the holder class. - Class<?> constantPoolHolder = (Class<?>) constantPoolOop; - KlassPointer klass = ClassGetHubNode.readClass(constantPoolHolder); - return klass.readWord(instanceKlassConstantsOffset(), INSTANCE_KLASS_CONSTANTS); - } - - @MethodSubstitution(isStatic = false) - private static int getSize0(@SuppressWarnings("unused") final ConstantPool thisObj, Object constantPoolOop) { - return metaspaceConstantPool(constantPoolOop).readInt(constantPoolLengthOffset()); - } - - @MethodSubstitution(isStatic = false) - private static int getIntAt0(@SuppressWarnings("unused") final ConstantPool thisObj, Object constantPoolOop, int index) { - return metaspaceConstantPool(constantPoolOop).readInt(constantPoolSize() + index * wordSize()); - } - - @MethodSubstitution(isStatic = false) - private static long getLongAt0(@SuppressWarnings("unused") final ConstantPool thisObj, Object constantPoolOop, int index) { - return metaspaceConstantPool(constantPoolOop).readLong(constantPoolSize() + index * wordSize()); - } - - @MethodSubstitution(isStatic = false) - private static float getFloatAt0(@SuppressWarnings("unused") final ConstantPool thisObj, Object constantPoolOop, int index) { - return metaspaceConstantPool(constantPoolOop).readFloat(constantPoolSize() + index * wordSize()); - } - - @MethodSubstitution(isStatic = false) - private static double getDoubleAt0(@SuppressWarnings("unused") final ConstantPool thisObj, Object constantPoolOop, int index) { - return metaspaceConstantPool(constantPoolOop).readDouble(constantPoolSize() + index * wordSize()); - } - -}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyUnrollNode.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.replacements.arraycopy; - -import static jdk.internal.jvmci.meta.LocationIdentity.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.compiler.common.type.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodeinfo.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.memory.*; -import com.oracle.graal.nodes.spi.*; - -@NodeInfo -public class ArrayCopyUnrollNode extends ArrayRangeWriteNode implements MemoryCheckpoint.Single, Lowerable, MemoryAccess { - - public static final NodeClass<ArrayCopyUnrollNode> TYPE = NodeClass.create(ArrayCopyUnrollNode.class); - - @Input protected ValueNode src; - @Input protected ValueNode srcPos; - @Input protected ValueNode dest; - @Input protected ValueNode destPos; - @Input protected ValueNode length; - - private Kind elementKind; - - private int unrolledLength; - - @OptionalInput(InputType.Memory) private MemoryNode lastLocationAccess; - - public ArrayCopyUnrollNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, int unrolledLength, Kind elementKind) { - super(TYPE, StampFactory.forKind(Kind.Void)); - this.src = src; - this.srcPos = srcPos; - this.dest = dest; - this.destPos = destPos; - this.length = length; - this.unrolledLength = unrolledLength; - assert elementKind != null && elementKind != Kind.Illegal; - this.elementKind = elementKind; - } - - public ValueNode getSource() { - return src; - } - - public ValueNode getSourcePosition() { - return srcPos; - } - - public ValueNode getDestination() { - return dest; - } - - public ValueNode getDestinationPosition() { - return destPos; - } - - @Override - public ValueNode getLength() { - return length; - } - - @Override - public ValueNode getArray() { - return dest; - } - - @Override - public ValueNode getIndex() { - return destPos; - } - - @Override - public boolean isObjectArray() { - return elementKind == Kind.Object; - } - - @Override - public boolean isInitialization() { - return false; - } - - @NodeIntrinsic - public static native void arraycopy(Object nonNullSrc, int srcPos, Object nonNullDest, int destPos, int length, @ConstantNodeParameter int unrolledLength, @ConstantNodeParameter Kind elementKind); - - public int getUnrollLength() { - return unrolledLength; - } - - public Kind getElementKind() { - return elementKind; - } - - @Override - public LocationIdentity getLocationIdentity() { - if (elementKind != null) { - return NamedLocationIdentity.getArrayLocation(elementKind); - } - return any(); - } - - @Override - public void lower(LoweringTool tool) { - tool.getLowerer().lower(this, tool); - } - - public MemoryNode getLastLocationAccess() { - return lastLocationAccess; - } - - public void setLastLocationAccess(MemoryNode lla) { - updateUsagesInterface(lastLocationAccess, lla); - lastLocationAccess = lla; - } -}
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/ConstantLoadTest.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.jtt.micro; - -import org.junit.*; - -import com.oracle.graal.jtt.*; - -public class ConstantLoadTest extends JTTTest { - - private static final class MyClass { - public long a; - public long b; - - MyClass(long a, long b) { - this.a = a; - this.b = b; - } - } - - private static final MyClass myClass = new MyClass(Long.MIN_VALUE, Long.MAX_VALUE); - private static final long myLong = Long.MAX_VALUE; - - public static long test(int arg) { - if (arg == 0) { - return myClass.a / arg + myLong; - } - if (arg == 1) { - return myClass.b - arg + myLong; - } - long r = 1; - for (int i = 0; i < arg; i++) { - r *= i; - } - return r; - } - - @Test - public void run0() throws Throwable { - runTest("test", 0); - } - - @Test - public void run1() throws Throwable { - runTest("test", -1); - } - - @Test - public void run2() throws Throwable { - runTest("test", 1); - } - - @Test - public void run3() throws Throwable { - runTest("test", 2); - } - -}
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/VarArgs_Unroll.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.jtt.micro; - -import org.junit.*; - -import com.oracle.graal.jtt.*; - -/* - */ -public class VarArgs_Unroll extends JTTTest { - - public static boolean test(String a, String b) { - return check(a, b); - } - - private static boolean check(String... args) { - if (args.length == 0) { - return true; - } - String s = args[0]; - for (String t : args) { - if (!t.equals(s)) { - return false; - } - } - return true; - } - - @Test - public void run0() throws Throwable { - runTest("test", "ab", "ab"); - } - - @Test - public void run1() throws Throwable { - runTest("test", "ab", "abc"); - } -}
--- a/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/ConstantStackCastTest.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.jtt; - -import static jdk.internal.jvmci.code.ValueUtil.*; -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.common.*; -import jdk.internal.jvmci.meta.*; - -import org.junit.*; - -import com.oracle.graal.lir.framemap.*; -import com.oracle.graal.lir.gen.*; - -/** - * Tests move from a constant to a wider stack slot (e.g. byte constant to integer stack slot). - */ -public class ConstantStackCastTest extends LIRTest { - - private static class LoadConstantStackSpec extends LIRTestSpecification { - protected final LIRKind dstKind; - protected final LIRKind srcKind; - - public LoadConstantStackSpec(LIRKind dstKind, LIRKind srcKind) { - this.dstKind = dstKind; - this.srcKind = srcKind; - } - - @Override - public void generate(LIRGeneratorTool gen, Value value) { - FrameMapBuilder frameMapBuilder = gen.getResult().getFrameMapBuilder(); - // create slots - StackSlotValue s1 = frameMapBuilder.allocateSpillSlot(dstKind); - // move stuff around - Value srcValue = isConstant(value) ? getConstant(srcKind, value) : value; - gen.emitMove(s1, srcValue); - gen.emitBlackhole(s1); - setResult(gen.emitMove(s1)); - } - - private static PrimitiveConstant getConstant(LIRKind srcKind, Value value) { - - switch ((Kind) srcKind.getPlatformKind()) { - case Byte: - return JavaConstant.forByte((byte) asConstant(value).asInt()); - default: - throw JVMCIError.shouldNotReachHere("Kind not supported: " + srcKind); - } - } - } - - private static final LoadConstantStackSpec stackCopyByte = new LoadConstantStackSpec(LIRKind.value(Kind.Int), LIRKind.value(Kind.Byte)); - - @LIRIntrinsic - public static byte testCopyByte(@SuppressWarnings("unused") LoadConstantStackSpec spec, byte value) { - return value; - } - - public byte testByte(byte value) { - return testCopyByte(stackCopyByte, value); - } - - @Test - public void runByte() throws Throwable { - runTest("testByte", (byte) 0); - } - -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LiveValueSet.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import jdk.internal.jvmci.meta.*; - -abstract class LiveValueSet<S extends LiveValueSet<S>> { - - public abstract void put(Value v); - - public abstract void remove(Value v); - - public abstract void putAll(S s); - - public abstract S copy(); -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LocationMarker.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import static jdk.internal.jvmci.code.ValueUtil.*; - -import java.util.*; - -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.debug.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.OperandFlag; -import com.oracle.graal.lir.LIRInstruction.OperandMode; -import com.oracle.graal.lir.framemap.*; - -public abstract class LocationMarker<T extends AbstractBlockBase<T>, S extends LiveValueSet<S>> { - - private final LIR lir; - private final BlockMap<S> liveInMap; - private final BlockMap<S> liveOutMap; - - protected final FrameMap frameMap; - - protected LocationMarker(LIR lir, FrameMap frameMap) { - this.lir = lir; - this.frameMap = frameMap; - liveInMap = new BlockMap<>(lir.getControlFlowGraph()); - liveOutMap = new BlockMap<>(lir.getControlFlowGraph()); - } - - protected abstract S newLiveValueSet(); - - protected abstract boolean shouldProcessValue(Value operand); - - protected abstract void processState(LIRInstruction op, LIRFrameState info, S values); - - @SuppressWarnings("unchecked") - void build() { - UniqueWorkList<T> worklist = new UniqueWorkList<>(lir.getControlFlowGraph().getBlocks().size()); - for (int i = lir.getControlFlowGraph().getBlocks().size() - 1; i >= 0; i--) { - worklist.add((T) lir.getControlFlowGraph().getBlocks().get(i)); - } - for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { - liveInMap.put(block, newLiveValueSet()); - } - while (!worklist.isEmpty()) { - AbstractBlockBase<T> block = worklist.poll(); - processBlock(block, worklist); - } - } - - /** - * Merge outSet with in-set of successors. - */ - private boolean updateOutBlock(AbstractBlockBase<T> block) { - S union = newLiveValueSet(); - for (T succ : block.getSuccessors()) { - union.putAll(liveInMap.get(succ)); - } - S outSet = liveOutMap.get(block); - // check if changed - if (outSet == null || !union.equals(outSet)) { - liveOutMap.put(block, union); - return true; - } - return false; - } - - private void processBlock(AbstractBlockBase<T> block, UniqueWorkList<T> worklist) { - if (updateOutBlock(block)) { - try (Indent indent = Debug.logAndIndent("handle block %s", block)) { - currentSet = liveOutMap.get(block).copy(); - List<LIRInstruction> instructions = lir.getLIRforBlock(block); - for (int i = instructions.size() - 1; i >= 0; i--) { - LIRInstruction inst = instructions.get(i); - processInstructionBottomUp(inst); - } - liveInMap.put(block, currentSet); - currentSet = null; - worklist.addAll(block.getPredecessors()); - } - } - } - - private static final EnumSet<OperandFlag> REGISTER_FLAG_SET = EnumSet.of(OperandFlag.REG); - private static final LIRKind REFERENCE_KIND = LIRKind.reference(Kind.Object); - - private S currentSet; - - /** - * Process all values of an instruction bottom-up, i.e. definitions before usages. Values that - * start or end at the current operation are not included. - */ - private void processInstructionBottomUp(LIRInstruction op) { - try (Indent indent = Debug.logAndIndent("handle op %d, %s", op.id(), op)) { - // kills - - op.visitEachTemp(defConsumer); - op.visitEachOutput(defConsumer); - if (frameMap != null && op.destroysCallerSavedRegisters()) { - for (Register reg : frameMap.getRegisterConfig().getCallerSaveRegisters()) { - defConsumer.visitValue(reg.asValue(REFERENCE_KIND), OperandMode.TEMP, REGISTER_FLAG_SET); - } - } - - // gen - values that are considered alive for this state - op.visitEachAlive(useConsumer); - op.visitEachState(useConsumer); - // mark locations - op.forEachState(stateConsumer); - // gen - op.visitEachInput(useConsumer); - } - } - - InstructionStateProcedure stateConsumer = new InstructionStateProcedure() { - public void doState(LIRInstruction inst, LIRFrameState info) { - processState(inst, info, currentSet); - } - }; - - ValueConsumer useConsumer = new ValueConsumer() { - public void visitValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { - if (shouldProcessValue(operand)) { - // no need to insert values and derived reference - if (Debug.isLogEnabled()) { - Debug.log("set operand: %s", operand); - } - currentSet.put(operand); - } - } - }; - - ValueConsumer defConsumer = new ValueConsumer() { - public void visitValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { - if (shouldProcessValue(operand)) { - if (Debug.isLogEnabled()) { - Debug.log("clear operand: %s", operand); - } - currentSet.remove(operand); - } else { - assert isIllegal(operand) || operand.getPlatformKind() != Kind.Illegal || mode == OperandMode.TEMP : String.format("Illegal PlatformKind is only allowed for TEMP mode: %s, %s", - operand, mode); - } - } - }; -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/LocationMarkerPhase.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import static jdk.internal.jvmci.code.ValueUtil.*; - -import java.util.*; - -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.compiler.common.alloc.*; -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.framemap.*; -import com.oracle.graal.lir.gen.*; -import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; -import com.oracle.graal.lir.phases.*; - -/** - * Mark all live references for a frame state. The frame state use this information to build the OOP - * maps. - */ -public final class LocationMarkerPhase extends AllocationPhase { - - @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, - RegisterAllocationConfig registerAllocationConfig) { - new Marker<B>(lirGenRes.getLIR(), lirGenRes.getFrameMap()).build(); - } - - private static final class Marker<T extends AbstractBlockBase<T>> extends LocationMarker<T, Marker<T>.RegStackValueSet> { - - private final class RegStackValueSet extends LiveValueSet<Marker<T>.RegStackValueSet> { - - private final ValueSet registers; - private final ValueSet stack; - private Set<Value> extraStack; - - public RegStackValueSet() { - registers = new ValueSet(); - stack = new ValueSet(); - } - - private RegStackValueSet(RegStackValueSet s) { - registers = new ValueSet(s.registers); - stack = new ValueSet(s.stack); - if (s.extraStack != null) { - extraStack = new HashSet<>(s.extraStack); - } - } - - @Override - public Marker<T>.RegStackValueSet copy() { - return new RegStackValueSet(this); - } - - @Override - public void put(Value v) { - if (isRegister(v)) { - int index = asRegister(v).getReferenceMapIndex(); - registers.put(index, v); - } else if (isStackSlot(v)) { - int index = frameMap.offsetForStackSlot(asStackSlot(v)); - assert index >= 0; - if (index % 4 == 0) { - stack.put(index / 4, v); - } else { - if (extraStack == null) { - extraStack = new HashSet<>(); - } - extraStack.add(v); - } - } - } - - @Override - public void putAll(RegStackValueSet v) { - registers.putAll(v.registers); - stack.putAll(v.stack); - if (v.extraStack != null) { - if (extraStack == null) { - extraStack = new HashSet<>(); - } - extraStack.addAll(v.extraStack); - } - } - - @Override - public void remove(Value v) { - if (isRegister(v)) { - int index = asRegister(v).getReferenceMapIndex(); - registers.put(index, null); - } else if (isStackSlot(v)) { - int index = frameMap.offsetForStackSlot(asStackSlot(v)); - assert index >= 0; - if (index % 4 == 0) { - stack.put(index / 4, null); - } else if (extraStack != null) { - extraStack.remove(v); - } - } - } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object obj) { - if (obj instanceof Marker.RegStackValueSet) { - RegStackValueSet other = (RegStackValueSet) obj; - return registers.equals(other.registers) && stack.equals(other.stack) && Objects.equals(extraStack, other.extraStack); - } else { - return false; - } - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException(); - } - - public void addLiveValues(ReferenceMapBuilder refMap) { - registers.addLiveValues(refMap); - stack.addLiveValues(refMap); - if (extraStack != null) { - for (Value v : extraStack) { - refMap.addLiveValue(v); - } - } - } - } - - private final RegisterAttributes[] registerAttributes; - - private Marker(LIR lir, FrameMap frameMap) { - super(lir, frameMap); - this.registerAttributes = frameMap.getRegisterConfig().getAttributesMap(); - } - - @Override - protected Marker<T>.RegStackValueSet newLiveValueSet() { - return new RegStackValueSet(); - } - - @Override - protected boolean shouldProcessValue(Value operand) { - return (isRegister(operand) && attributes(asRegister(operand)).isAllocatable() || isStackSlot(operand)) && operand.getPlatformKind() != Kind.Illegal; - } - - /** - * This method does the actual marking. - */ - @Override - protected void processState(LIRInstruction op, LIRFrameState info, RegStackValueSet values) { - if (!info.hasDebugInfo()) { - info.initDebugInfo(frameMap, !op.destroysCallerSavedRegisters() || !frameMap.getRegisterConfig().areAllAllocatableRegistersCallerSaved()); - } - - ReferenceMapBuilder refMap = frameMap.newReferenceMapBuilder(); - frameMap.addLiveValues(refMap); - values.addLiveValues(refMap); - - info.debugInfo().setReferenceMap(refMap.finish(info)); - } - - /** - * Gets an object describing the attributes of a given register according to this register - * configuration. - */ - private RegisterAttributes attributes(Register reg) { - return registerAttributes[reg.number]; - } - - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/MarkBasePointersPhase.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import java.util.*; - -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.compiler.common.alloc.*; -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.framemap.*; -import com.oracle.graal.lir.gen.*; -import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; -import com.oracle.graal.lir.phases.*; - -/** - * Record all derived reference base pointers in a frame state. - */ -public final class MarkBasePointersPhase extends AllocationPhase { - - @Override - protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory, - RegisterAllocationConfig registerAllocationConfig) { - new Marker<B>(lirGenRes.getLIR(), null).build(); - } - - private static final class Marker<T extends AbstractBlockBase<T>> extends LocationMarker<T, Marker<T>.BasePointersSet> { - - private final class BasePointersSet extends LiveValueSet<Marker<T>.BasePointersSet> { - - private final ValueSet variables; - - public BasePointersSet() { - variables = new ValueSet(); - } - - private BasePointersSet(BasePointersSet s) { - variables = new ValueSet(s.variables); - } - - @Override - public Marker<T>.BasePointersSet copy() { - return new BasePointersSet(this); - } - - @Override - public void put(Value v) { - Variable base = (Variable) v.getLIRKind().getDerivedReferenceBase(); - variables.put(base.index, base); - } - - @Override - public void putAll(BasePointersSet v) { - variables.putAll(v.variables); - } - - @Override - public void remove(Value v) { - Variable base = (Variable) v.getLIRKind().getDerivedReferenceBase(); - variables.put(base.index, null); - } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object obj) { - if (obj instanceof Marker.BasePointersSet) { - BasePointersSet other = (BasePointersSet) obj; - return variables.equals(other.variables); - } else { - return false; - } - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException(); - } - } - - private Marker(LIR lir, FrameMap frameMap) { - super(lir, frameMap); - } - - @Override - protected Marker<T>.BasePointersSet newLiveValueSet() { - return new BasePointersSet(); - } - - @Override - protected boolean shouldProcessValue(Value operand) { - return operand.getLIRKind().isDerivedReference(); - } - - @Override - protected void processState(LIRInstruction op, LIRFrameState info, BasePointersSet values) { - info.setLiveBasePointers(new ValueSet(values.variables)); - } - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/UniqueWorkList.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import java.util.*; - -import com.oracle.graal.compiler.common.cfg.*; - -/** - * Ensures that an element is only in the worklist once. - * - * @param <T> - */ -class UniqueWorkList<T extends AbstractBlockBase<T>> extends ArrayDeque<T> { - private static final long serialVersionUID = 8009554570990975712L; - BitSet valid; - - public UniqueWorkList(int size) { - this.valid = new BitSet(size); - } - - @Override - public T poll() { - T result = super.poll(); - if (result != null) { - valid.set(result.getId(), false); - } - return result; - } - - @Override - public boolean add(T pred) { - if (!valid.get(pred.getId())) { - valid.set(pred.getId(), true); - return super.add(pred); - } - return false; - } - - @Override - public boolean addAll(Collection<? extends T> collection) { - boolean changed = false; - for (T element : collection) { - if (!valid.get(element.getId())) { - valid.set(element.getId(), true); - super.add(element); - changed = true; - } - } - return changed; - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/dfa/ValueSet.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.dfa; - -import java.util.*; - -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.OperandFlag; -import com.oracle.graal.lir.LIRInstruction.OperandMode; -import com.oracle.graal.lir.framemap.*; - -public final class ValueSet { - private Value[] values; - - ValueSet() { - values = Value.NO_VALUES; - } - - ValueSet(ValueSet other) { - int limit = other.values.length; - while (limit > 0) { - if (other.values[limit - 1] == null) { - limit--; - continue; - } - break; - } - values = new Value[limit]; - System.arraycopy(other.values, 0, values, 0, values.length); - } - - public Value get(int index) { - return values[index]; - } - - void put(int index, Value value) { - if (value != null && value.getLIRKind().isValue()) { - return; - } - if (values.length <= index) { - if (value == null) { - return; - } - Value[] newValues = new Value[index + 1]; - System.arraycopy(values, 0, newValues, 0, values.length); - values = newValues; - values[index] = value; - } else { - values[index] = value; - } - } - - public void putAll(ValueSet stack) { - Value[] otherValues = stack.values; - int limit = otherValues.length; - if (limit > values.length) { - while (limit > 0) { - if (otherValues[limit - 1] == null) { - limit--; - continue; - } - break; - } - if (limit > values.length) { - Value[] newValues = new Value[limit]; - System.arraycopy(values, 0, newValues, 0, values.length); - values = newValues; - } - } - for (int i = 0; i < limit; i++) { - Value value = otherValues[i]; - if (value != null) { - values[i] = value; - } - } - } - - @Override - public boolean equals(Object other) { - if (other instanceof ValueSet) { - ValueSet that = (ValueSet) other; - int limit = Math.min(values.length, that.values.length); - for (int i = 0; i < limit; i++) { - if (!Objects.equals(values[i], that.values[i])) { - return false; - } - } - for (int i = limit; i < values.length; i++) { - if (values[i] != null) { - return false; - } - } - for (int i = limit; i < that.values.length; i++) { - if (that.values[i] != null) { - return false; - } - } - return true; - } - return false; - } - - public void addLiveValues(ReferenceMapBuilder refMap) { - for (Value v : values) { - if (v != null) { - refMap.addLiveValue(v); - } - } - } - - public void forEach(LIRInstruction inst, OperandMode mode, EnumSet<OperandFlag> flags, InstructionValueProcedure proc) { - for (int i = 0; i < values.length; i++) { - if (values[i] != null) { - values[i] = proc.doValue(inst, values[i], mode, flags); - } - } - } - - public void forEach(LIRInstruction inst, OperandMode mode, EnumSet<OperandFlag> flags, InstructionValueConsumer consumer) { - for (Value v : values) { - if (v != null) { - consumer.visitValue(inst, v, mode, flags); - } - } - } - - @Override - public int hashCode() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("["); - boolean comma = false; - - for (int i = 0; i < values.length; i++) { - if (values[i] != null) { - if (comma) { - sb.append(", "); - } else { - comma = true; - } - - sb.append(i); - sb.append(": "); - sb.append(values[i]); - } - } - sb.append(']'); - return sb.toString(); - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/ReferenceMapBuilder.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.framemap; - -import jdk.internal.jvmci.code.*; -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.lir.*; - -public abstract class ReferenceMapBuilder { - - public abstract void addLiveValue(Value value); - - public abstract ReferenceMap finish(LIRFrameState state); -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/SpillMoveFactoryBase.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.gen; - -import static com.oracle.graal.lir.LIRValueUtil.*; -import static jdk.internal.jvmci.code.ValueUtil.*; - -import java.util.*; - -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.OperandFlag; -import com.oracle.graal.lir.LIRInstruction.OperandMode; -import com.oracle.graal.lir.StandardOp.StackMove; -import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; - -/** - * Base class for {@link SpillMoveFactory} that checks that the instructions created adhere to the - * contract of {@link SpillMoveFactory}. - */ -public abstract class SpillMoveFactoryBase implements SpillMoveFactory { - - public final LIRInstruction createMove(AllocatableValue result, Value input) { - LIRInstruction inst = createMoveIntern(result, input); - assert checkResult(inst, result, input); - return inst; - } - - public final LIRInstruction createStackMove(AllocatableValue result, Value input) { - LIRInstruction inst = createStackMoveIntern(result, input); - assert checkResult(inst, result, input); - return inst; - } - - protected abstract LIRInstruction createMoveIntern(AllocatableValue result, Value input); - - protected LIRInstruction createStackMoveIntern(AllocatableValue result, Value input) { - return new StackMove(result, input); - } - - /** Closure for {@link SpillMoveFactoryBase#checkResult}. */ - @SuppressWarnings("unused") - private static class CheckClosure { - - private final AllocatableValue result; - private final Value input; - - private int tempCount = 0; - private int aliveCount = 0; - private int stateCount = 0; - private int inputCount = 0; - private int outputCount = 0; - - CheckClosure(AllocatableValue result, Value input) { - this.result = result; - this.input = input; - } - - void tempProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { - assert false : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); - tempCount++; - } - - void stateProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { - assert false : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); - stateCount++; - } - - void aliveProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { - assert !isVariable(value) && flags.contains(OperandFlag.UNINITIALIZED) : String.format("SpillMoveFactory: Instruction %s is not allowed to contain operand %s of mode %s", op, value, mode); - aliveCount++; - } - - void inputProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { - assert value.equals(input) || isConstant(value) : String.format("SpillMoveFactory: Instruction %s can only have %s as input, got %s", op, input, value); - inputCount++; - } - - void outputProc(LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) { - assert value.equals(result) : String.format("SpillMoveFactory: Instruction %s can only have %s as input, got %s", op, input, value); - outputCount++; - } - } - - /** Checks that the instructions adheres to the contract of {@link SpillMoveFactory}. */ - private static boolean checkResult(LIRInstruction inst, AllocatableValue result, Value input) { - - SpillMoveFactoryBase.CheckClosure c = new CheckClosure(result, input); - inst.visitEachInput(c::inputProc); - inst.visitEachOutput(c::outputProc); - inst.visitEachAlive(c::aliveProc); - inst.visitEachTemp(c::tempProc); - inst.visitEachState(c::stateProc); - - assert c.outputCount >= 1 : "no output produced" + inst; - assert c.stateCount == 0 : "SpillMoveFactory: instruction must not have a state: " + inst; - return true; - } -}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CanonicalizableLocation.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes; - -import com.oracle.graal.graph.spi.*; -import com.oracle.graal.nodes.memory.address.*; - -public interface CanonicalizableLocation { - ValueNode canonicalizeRead(ValueNode read, AddressNode location, ValueNode object, CanonicalizerTool tool); -}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeValueMap.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.oracle.graal.nodes.spi; - -import jdk.internal.jvmci.meta.*; - -import com.oracle.graal.graph.*; -import com.oracle.graal.nodes.*; - -public interface NodeValueMap { - - /** - * Returns the operand that has been previously initialized by - * {@link #setResult(ValueNode, Value)} with the result of an instruction. It's a code - * generation error to ask for the operand of ValueNode that doesn't have one yet. - * - * @param node A node that produces a result value. - */ - Value operand(Node node); - - /** - * @return {@code true} if there is an {@link Value operand} associated with the {@code node} in - * the current block. - */ - boolean hasOperand(Node node); - - /** - * Associates {@code operand} with the {@code node} in the current block. - * - * @return {@code operand} - */ - Value setResult(ValueNode node, Value operand); - - /** - * Gets the the {@link ValueNode} that produced a {@code value}. If the {@code value} is not - * associated with a {@link ValueNode} {@code null} is returned. - * - * This method is intended for debugging purposes only. - */ - ValueNode valueForOperand(Value value); -}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EnsureVirtualizedNode.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes.virtual; - -import com.oracle.graal.compiler.common.type.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.nodeinfo.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.util.*; - -@NodeInfo -public final class EnsureVirtualizedNode extends FixedWithNextNode implements Virtualizable, Lowerable { - - public static final NodeClass<EnsureVirtualizedNode> TYPE = NodeClass.create(EnsureVirtualizedNode.class); - - @Input ValueNode object; - private final boolean localOnly; - - public EnsureVirtualizedNode(ValueNode object, boolean localOnly) { - super(TYPE, StampFactory.forVoid()); - this.object = object; - this.localOnly = localOnly; - } - - public void virtualize(VirtualizerTool tool) { - State state = tool.getObjectState(object); - if (state != null && state.getState() == EscapeState.Virtual) { - if (state.getVirtualObject() instanceof VirtualBoxingNode) { - Throwable exception = new VerificationError("ensureVirtual is not valid for boxing objects: %s", state.getVirtualObject().type().getName()); - throw GraphUtil.approxSourceException(this, exception); - } - if (!localOnly) { - state.setEnsureVirtualized(true); - } - tool.delete(); - } - } - - public void lower(LoweringTool tool) { - ensureVirtualFailure(this, object.stamp()); - } - - public static void ensureVirtualFailure(Node location, Stamp stamp) { - Throwable exception = new VerificationError("Object should not be materialized (stamp=%s):", stamp); - throw GraphUtil.approxSourceException(location, exception); - } -}
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DerivedOopTest.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.replacements.test; - -import java.util.*; - -import jdk.internal.jvmci.meta.*; - -import org.junit.*; - -import com.oracle.graal.api.directives.*; -import com.oracle.graal.compiler.test.*; -import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins; -import com.oracle.graal.graphbuilderconf.*; -import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration; -import com.oracle.graal.nodes.*; -import com.oracle.graal.replacements.*; -import com.oracle.graal.word.*; -import com.oracle.graal.word.nodes.*; - -/** - * Tests for derived oops in reference maps. - */ -public class DerivedOopTest extends GraalCompilerTest implements Snippets { - - private static class Pointers { - public long basePointer; - public long internalPointer; - - public long delta() { - return internalPointer - basePointer; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Pointers)) { - return false; - } - - Pointers other = (Pointers) obj; - return this.delta() == other.delta(); - } - - @Override - public int hashCode() { - return (int) delta(); - } - } - - private static class Result { - public Pointers beforeGC; - public Pointers afterGC; - - public Result() { - beforeGC = new Pointers(); - afterGC = new Pointers(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((afterGC == null) ? 0 : afterGC.hashCode()); - result = prime * result + ((beforeGC == null) ? 0 : beforeGC.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Result)) { - return false; - } - Result other = (Result) obj; - return Objects.equals(this.beforeGC, other.beforeGC) && Objects.equals(this.afterGC, other.afterGC); - } - } - - @Test - public void testFieldOffset() { - Result r = new Result(); - test("fieldOffsetSnippet", r, 16L); - - Assert.assertEquals(r.beforeGC.delta(), r.afterGC.delta()); - } - - static long getRawPointer(Object obj) { - // fake implementation for interpreter - return obj.hashCode(); - } - - static long getRawPointerIntrinsic(Object obj) { - return Word.fromObject(obj).rawValue(); - } - - public static Result fieldOffsetSnippet(Result obj, long offset) { - long internalPointer = getRawPointer(obj) + offset; - - // make sure the internal pointer is computed before the safepoint - GraalDirectives.blackhole(internalPointer); - - obj.beforeGC.basePointer = getRawPointer(obj); - obj.beforeGC.internalPointer = internalPointer; - - System.gc(); - - obj.afterGC.basePointer = getRawPointer(obj); - obj.afterGC.internalPointer = internalPointer; - - return obj; - } - - @Override - protected Plugins getDefaultGraphBuilderPlugins() { - Plugins plugins = super.getDefaultGraphBuilderPlugins(); - Registration r = new Registration(plugins.getInvocationPlugins(), DerivedOopTest.class); - - ResolvedJavaMethod intrinsic = getResolvedJavaMethod("getRawPointerIntrinsic"); - r.register1("getRawPointer", Object.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) { - b.intrinsify(targetMethod, intrinsic, new ValueNode[]{arg}); - return true; - } - }); - - return plugins; - } - - @Override - protected boolean checkHighTierGraph(StructuredGraph graph) { - assert graph.getNodes().filter(WordCastNode.class).count() > 0 : "DerivedOopTest.toLong should be intrinsified"; - return super.checkHighTierGraph(graph); - } -}
--- a/graal/com.oracle.graal.truffle.test/sl/TestDeoptInInlinedFunction.sl.disable Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* - * This tests that simple arithmetic gets inlined. - */ -function add(a, b) { - deoptimizeWhenCompiled(a == 50); - return a + b; -} - - -function test() { - i = 0; - while (i < 100) { - i = add(i, 1); - } - return i; -} - -function main() { - waitForOptimization(callUntilOptimized(test, 1 == 2)); - test(); -}
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/MockLanguage.java Wed Jul 22 22:45:55 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.truffle.test; - -import com.oracle.truffle.api.TruffleLanguage; - -public abstract class MockLanguage extends TruffleLanguage { - public MockLanguage(Env env) { - super(env); - } -}