Mercurial > hg > truffle
changeset 22546:e77bcc4e4af6
TruffleTCK.assertDouble to give languages control over comparing doubles in their TCK subclasses
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Thu, 14 Jan 2016 14:12:46 +0100 |
parents | bfa145c84dde (diff) 17fe5ef92696 (current diff) |
children | c3a7ad415a8a |
files | truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java |
diffstat | 26 files changed, 145 insertions(+), 163 deletions(-) [+] |
line wrap: on
line diff
--- a/mx.truffle/suite.py Thu Jan 14 14:09:27 2016 +0100 +++ b/mx.truffle/suite.py Thu Jan 14 14:12:46 2016 +0100 @@ -1,5 +1,5 @@ suite = { - "mxversion" : "5.5.7", + "mxversion" : "5.6.6", "name" : "truffle", "url" : "http://openjdk.java.net/projects/graal", "developer" : { @@ -25,6 +25,8 @@ "https://search.maven.org/remotecontent?filepath=jline/jline/2.11/jline-2.11.jar", ], "sha1" : "9504d5e2da5d78237239c5226e8200ec21182040", + "sourcePath" : "https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/jline-2.11-sources.jar", + "sourceSha1" : "ef2539b992e5605be966b6db7cfc83930f0da39b", "maven" : { "groupId" : "jline", "artifactId" : "jline", @@ -280,6 +282,7 @@ ], "description" : """Truffle is a multi-language framework for executing dynamic languages that achieves high performance when combined with Graal.""", + "javadocType": "api", }, "TRUFFLE_TCK" : { @@ -330,6 +333,7 @@ "TRUFFLE_API", ], "description" : "Experimental REPL server to build your debugger console for your language.", + "allowsJavadocWarnings": True, } }, }
--- a/truffle/com.oracle.truffle.api.interop.java.test/src/com/oracle/truffle/api/interop/java/test/JavaInteropSpeedTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.interop.java.test/src/com/oracle/truffle/api/interop/java/test/JavaInteropSpeedTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -101,7 +101,7 @@ if (javaTime < 1) { javaTime = 1; } - if (interopTime > 6 * javaTime) { + if (interopTime > 10 * javaTime) { fail("Interop took too long: " + interopTime + " ms, while java only " + javaTime + " ms"); } }
--- a/truffle/com.oracle.truffle.api.interop.java/src/com/oracle/truffle/api/interop/java/JavaFunctionNode.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.interop.java/src/com/oracle/truffle/api/interop/java/JavaFunctionNode.java Thu Jan 14 14:12:46 2016 +0100 @@ -24,9 +24,11 @@ */ package com.oracle.truffle.api.interop.java; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.interop.ForeignAccess; import com.oracle.truffle.api.nodes.RootNode; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; @@ -48,6 +50,7 @@ } @SuppressWarnings("paramAssign") + @TruffleBoundary static Object execute(Method method, Object obj, Object[] args) { for (int i = 0; i < args.length; i++) { if (args[i] instanceof JavaInterop.JavaObject) {
--- a/truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/Profile.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.profiles/src/com/oracle/truffle/api/profiles/Profile.java Thu Jan 14 14:12:46 2016 +0100 @@ -91,8 +91,7 @@ * @see Assumption */ public abstract class Profile extends NodeCloneable { - private static final boolean ENABLED; - static { + static boolean isProfilingEnabled() { boolean enabled; try { enabled = Truffle.getRuntime().isProfilingEnabled(); @@ -100,11 +99,7 @@ // running on old version of Graal enabled = true; } - ENABLED = enabled; - } - - static boolean isProfilingEnabled() { - return ENABLED; + return enabled; } Profile() {
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/impl/AccessorTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/impl/AccessorTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -22,10 +22,6 @@ */ package com.oracle.truffle.api.impl; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.lang.reflect.Field; import java.util.concurrent.Executors; import org.junit.BeforeClass; @@ -35,15 +31,17 @@ import com.oracle.truffle.api.vm.ImplicitExplicitExportTest.ExportImportLanguage1; import static com.oracle.truffle.api.vm.ImplicitExplicitExportTest.L1; import com.oracle.truffle.api.vm.PolyglotEngine; +import java.lang.reflect.Method; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; public class AccessorTest { - public static Accessor API; + public static Method find; @BeforeClass public static void initAccessors() throws Exception { - Field f = Accessor.class.getDeclaredField("API"); - f.setAccessible(true); - API = (Accessor) f.get(null); + find = Accessor.class.getDeclaredMethod("findLanguageByClass", Object.class, Class.class); + find.setAccessible(true); } @Test @@ -56,7 +54,7 @@ Object ret = language.eval(s).get(); assertNull("nothing is returned", ret); - ExportImportLanguage1 afterInitialization = Accessor.findLanguageByClass(vm, ExportImportLanguage1.class); + ExportImportLanguage1 afterInitialization = (ExportImportLanguage1) find.invoke(null, vm, ExportImportLanguage1.class); assertNotNull("Language found", afterInitialization); } }
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BinaryConditionProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BinaryConditionProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -28,11 +28,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoints; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class BinaryConditionProfileTest { @DataPoints public static boolean[] data = new boolean[]{true, false};
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -26,7 +26,9 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; +import org.junit.runner.RunWith; +@RunWith(SeparateClassloaderTestRunner.class) public class BranchProfileTest { @Test
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ByteValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ByteValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -30,11 +30,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class ByteValueProfileTest { @DataPoint public static final byte VALUE0 = Byte.MIN_VALUE;
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/CountingConditionProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/CountingConditionProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -28,11 +28,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoints; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class CountingConditionProfileTest { @DataPoints public static boolean[] data = new boolean[]{true, false};
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/DoubleValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/DoubleValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -29,11 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class DoubleValueProfileTest { @DataPoint public static final double VALUE0 = Double.MIN_VALUE;
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/EqualityValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/EqualityValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -30,11 +30,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class EqualityValueProfileTest { @DataPoint public static final String O1 = new String();
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ExactClassValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/ExactClassValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -31,11 +31,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class ExactClassValueProfileTest { @DataPoint public static final String O1 = new String();
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/FloatValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/FloatValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -29,11 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class FloatValueProfileTest { @DataPoint public static final float VALUE0 = Float.MIN_VALUE;
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/IdentityValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/IdentityValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -29,11 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class IdentityValueProfileTest { @DataPoint public static final String O1 = new String();
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/IntValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/IntValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -29,11 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class IntValueProfileTest { @DataPoint public static final int VALUE0 = Integer.MIN_VALUE;
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LazyProfileLoadingTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LazyProfileLoadingTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -24,16 +24,12 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.net.URLClassLoader; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.model.InitializationError; import com.oracle.truffle.api.Truffle; -import com.oracle.truffle.api.profiles.LazyProfileLoadingTest.SeparateClassloaderTestRunner; @RunWith(SeparateClassloaderTestRunner.class) public class LazyProfileLoadingTest { @@ -105,34 +101,4 @@ } } - public static class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner { - - public SeparateClassloaderTestRunner(Class<?> clazz) throws InitializationError { - super(getFromTestClassloader(clazz)); - } - - private static Class<?> getFromTestClassloader(Class<?> clazz) throws InitializationError { - try { - ClassLoader testClassLoader = new TestClassLoader(); - return Class.forName(clazz.getName(), true, testClassLoader); - } catch (ClassNotFoundException e) { - throw new InitializationError(e); - } - } - - public static class TestClassLoader extends URLClassLoader { - public TestClassLoader() { - super(((URLClassLoader) getSystemClassLoader()).getURLs()); - } - - @Override - public Class<?> loadClass(String name) throws ClassNotFoundException { - if (name.startsWith(Profile.class.getPackage().getName())) { - return super.findClass(name); - } - return super.loadClass(name); - } - } - } - }
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LongValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LongValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -29,11 +29,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class LongValueProfileTest { @DataPoint public static final long VALUE0 = Long.MIN_VALUE;
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LoopConditionProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/LoopConditionProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -28,11 +28,10 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoints; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class LoopConditionProfileTest { @DataPoints public static boolean[] data = new boolean[]{true, false};
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/PrimitiveValueProfileTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/PrimitiveValueProfileTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -32,12 +32,11 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.theories.DataPoint; -import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; @SuppressWarnings("deprecation") -@RunWith(Theories.class) +@RunWith(SeparateClassloaderTestRunner.Theories.class) public class PrimitiveValueProfileTest { @DataPoint public static final String O1 = new String();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/SeparateClassloaderTestRunner.java Thu Jan 14 14:12:46 2016 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2013, 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.truffle.api.profiles; + +import java.net.URLClassLoader; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; + +public final class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner { + public SeparateClassloaderTestRunner(Class<?> clazz) throws InitializationError { + super(getFromTestClassloader(clazz)); + } + + private static Class<?> getFromTestClassloader(Class<?> clazz) throws InitializationError { + try { + ClassLoader testClassLoader = new TestClassLoader(); + return Class.forName(clazz.getName(), true, testClassLoader); + } catch (ClassNotFoundException e) { + throw new InitializationError(e); + } + } + + public static final class Theories extends org.junit.experimental.theories.Theories { + public Theories(Class<?> clazz) throws InitializationError { + super(getFromTestClassloader(clazz)); + } + } + + private static class TestClassLoader extends URLClassLoader { + public TestClassLoader() { + super(((URLClassLoader) getSystemClassLoader()).getURLs()); + } + + @Override + public Class<?> loadClass(String name) throws ClassNotFoundException { + if (name.startsWith(Profile.class.getPackage().getName())) { + return super.findClass(name); + } + return super.loadClass(name); + } + } + +}
--- a/truffle/com.oracle.truffle.api/snapshot.sigtest Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api/snapshot.sigtest Thu Jan 14 14:12:46 2016 +0100 @@ -604,14 +604,6 @@ innr public abstract interface static !annotation NullGraphPrintHandler innr public abstract interface static GraphPrintHandler intf java.io.Closeable -meth protected java.lang.Object getElementByObject(java.lang.Object) - anno 0 java.lang.Deprecated() -meth protected void connectNodes(java.lang.Object,java.lang.Object,java.lang.String) - anno 0 java.lang.Deprecated() -meth protected void createElementForNode(java.lang.Object) - anno 0 java.lang.Deprecated() -meth protected void setNodeProperty(java.lang.Object,java.lang.String,java.lang.Object) - anno 0 java.lang.Deprecated() meth public com.oracle.truffle.api.nodes.GraphPrintVisitor beginGraph(java.lang.String) meth public com.oracle.truffle.api.nodes.GraphPrintVisitor beginGroup(java.lang.String) meth public com.oracle.truffle.api.nodes.GraphPrintVisitor endGraph()
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Thu Jan 14 14:12:46 2016 +0100 @@ -435,37 +435,25 @@ } } - /** - * @deprecated to be removed - */ - @Deprecated - protected Object getElementByObject(Object obj) { - return getElementByObjectImpl(obj); - } - - final NodeElement getElementByObjectImpl(Object obj) { + final NodeElement getElementByObject(Object obj) { return nodeMap.get(obj); } - /** - * @deprecated to be removed - */ - @Deprecated - protected void createElementForNode(Object node) { + final void createElementForNode(Object node) { boolean exists = nodeMap.containsKey(node); if (!exists) { int nodeId = !exists ? oldOrNextId(node) : nextId(); nodeMap.put(node, new NodeElement(nodeId)); - setNodePropertyImpl(node, "name", node.getClass().getSimpleName().replaceFirst("Node$", "")); + setNodeProperty(node, "name", node.getClass().getSimpleName().replaceFirst("Node$", "")); NodeInfo nodeInfo = node.getClass().getAnnotation(NodeInfo.class); if (nodeInfo != null) { - setNodePropertyImpl(node, "cost", nodeInfo.cost()); + setNodeProperty(node, "cost", nodeInfo.cost()); if (!nodeInfo.shortName().isEmpty()) { - setNodePropertyImpl(node, "shortName", nodeInfo.shortName()); + setNodeProperty(node, "shortName", nodeInfo.shortName()); } } - setNodePropertyImpl(node, "class", node.getClass().getSimpleName()); + setNodeProperty(node, "class", node.getClass().getSimpleName()); if (node instanceof Node) { readNodeProperties((Node) node); copyDebugProperties((Node) node); @@ -473,23 +461,15 @@ } } - /** - * @deprecated to be removed - */ - @Deprecated - protected void setNodeProperty(Object node, String propertyName, Object value) { - setNodePropertyImpl(node, propertyName, value); - } - - final void setNodePropertyImpl(Object node, String propertyName, Object value) { - NodeElement nodeElem = getElementByObjectImpl(node); + final void setNodeProperty(Object node, String propertyName, Object value) { + NodeElement nodeElem = getElementByObject(node); nodeElem.getProperties().put(propertyName, value); } private void copyDebugProperties(Node node) { Map<String, Object> debugProperties = node.getDebugProperties(); for (Map.Entry<String, Object> property : debugProperties.entrySet()) { - setNodePropertyImpl(node, property.getKey(), property.getValue()); + setNodeProperty(node, property.getKey(), property.getValue()); } } @@ -498,25 +478,17 @@ for (NodeFieldAccessor field : fields) { if (field.getKind() == NodeFieldKind.DATA) { String key = field.getName(); - if (!getElementByObjectImpl(node).getProperties().containsKey(key)) { + if (!getElementByObject(node).getProperties().containsKey(key)) { Object value = field.loadValue(node); - setNodePropertyImpl(node, key, value); + setNodeProperty(node, key, value); } } } } - /** - * @deprecated to be removed - */ - @Deprecated - protected void connectNodes(Object a, Object b, String label) { - connectNodesImpl(a, b, label); - } - - final void connectNodesImpl(Object a, Object b, String label) { - NodeElement fromNode = getElementByObjectImpl(a); - NodeElement toNode = getElementByObjectImpl(b); + final void connectNodes(Object a, Object b, String label) { + NodeElement fromNode = getElementByObject(a); + NodeElement toNode = getElementByObject(b); if (fromNode == null || toNode == null) { return; } @@ -538,7 +510,7 @@ } // if node is visited once again, skip - if (getElementByObjectImpl(node) != null) { + if (getElementByObject(node) != null) { return this; } @@ -621,19 +593,19 @@ } public void connectNodes(Object node, Object child) { - GraphPrintVisitor.this.connectNodesImpl(node, child, null); + GraphPrintVisitor.this.connectNodes(node, child, null); } public void connectNodes(Object node, Object child, String label) { - GraphPrintVisitor.this.connectNodesImpl(node, child, label); + GraphPrintVisitor.this.connectNodes(node, child, label); } public void setNodeProperty(Object node, String propertyName, Object value) { - GraphPrintVisitor.this.setNodePropertyImpl(node, propertyName, value); + GraphPrintVisitor.this.setNodeProperty(node, propertyName, value); } public boolean visited(Object node) { - return GraphPrintVisitor.this.getElementByObjectImpl(node) != null; + return GraphPrintVisitor.this.getElementByObject(node) != null; } }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java Thu Jan 14 14:12:46 2016 +0100 @@ -209,7 +209,7 @@ protected SLContext createContext(Env env) { final BufferedReader in = new BufferedReader(new InputStreamReader(env.in())); final PrintWriter out = new PrintWriter(env.out(), true); - SLContext context = new SLContext(this, env, in, out); + SLContext context = new SLContext(env, in, out); for (NodeFactory<? extends SLBuiltinNode> builtin : builtins) { context.installBuiltin(builtin, true); } @@ -411,7 +411,7 @@ return cached; } parsingCount++; - final SLContext c = new SLContext(this); + final SLContext c = new SLContext(); final Exception[] failed = {null}; try { c.evalSource(code);
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Thu Jan 14 14:12:46 2016 +0100 @@ -92,23 +92,21 @@ public final class SLContext extends ExecutionContext { private static final Layout LAYOUT = Layout.createLayout(); - private final SLLanguage language; private final BufferedReader input; private final PrintWriter output; private final SLFunctionRegistry functionRegistry; private final Shape emptyShape; private final TruffleLanguage.Env env; - public SLContext(SLLanguage language, TruffleLanguage.Env env, BufferedReader input, PrintWriter output) { - this(language, env, input, output, true); + public SLContext(TruffleLanguage.Env env, BufferedReader input, PrintWriter output) { + this(env, input, output, true); } - public SLContext(SLLanguage language) { - this(language, null, null, null, false); + public SLContext() { + this(null, null, null, false); } - private SLContext(SLLanguage language, TruffleLanguage.Env env, BufferedReader input, PrintWriter output, boolean installBuiltins) { - this.language = language; + private SLContext(TruffleLanguage.Env env, BufferedReader input, PrintWriter output, boolean installBuiltins) { this.input = input; this.output = output; this.env = env; @@ -141,10 +139,6 @@ return functionRegistry; } - public SLLanguage getLanguage() { - return language; - } - /** * Adds all builtin functions to the {@link SLFunctionRegistry}. This method lists all * {@link SLBuiltinNode builtin implementation classes}. @@ -218,8 +212,11 @@ Parser.parseSL(this, source); } + /** + * Allocate an empty object. + */ public DynamicObject createObject() { - return LAYOUT.newInstance(emptyShape); + return emptyShape.newInstance(); } public static boolean isSLObject(TruffleObject value) {
--- a/truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java Thu Jan 14 14:12:46 2016 +0100 @@ -60,7 +60,7 @@ * {@link TruffleLanguage language implementation} compliance. If you want your language to be * compliant with most recent requirements of the Truffle infrastructure and tooling, subclass, * implement <b>protected</b> methods and include in your test suite: - * + * * <pre> * <b>public class</b> MyLanguageTCKTest <b>extends</b> {@link TruffleTCK} { * {@link Override @Override} @@ -77,7 +77,7 @@ * <em>// and so on...</em> * } * </pre> - * + * * The <em>TCK</em> is carefully designed to accommodate differences between languages. The * <em>TCK</em> doesn't dictate what object your language is using to represent {@link Number * numbers} or {@link String strings} internally. The <em>TCK</em> doesn't prescribe the precise @@ -89,7 +89,7 @@ * <em>TCK</em> should be applicable to wide range of languages. Should there be a test that cannot * be implemented in your language, it can be suppressed by overriding its test method and doing * nothing: - * + * * <pre> * {@link Override @Override} * <b>public void</b> {@link #testFortyTwo() testFortyTwo}() { @@ -1021,7 +1021,7 @@ } Language language = vm().getLanguages().get(mimeType()); - assertNotNull("Langugage for " + mimeType() + " found", language); + assertNotNull("Language for " + mimeType() + " found", language); PolyglotEngine.Value function = vm().findGlobalSymbol(globalObjectFunction); Object global = function.execute().get(); @@ -1031,7 +1031,7 @@ @Test public void testEvaluateSource() throws Exception { Language language = vm().getLanguages().get(mimeType()); - assertNotNull("Langugage for " + mimeType() + " found", language); + assertNotNull("Language for " + mimeType() + " found", language); PolyglotEngine.Value function = vm().findGlobalSymbol(evaluateSource()); assertNotNull(evaluateSource() + " found", function);
--- a/truffle/com.oracle.truffle.tools.test/src/com/oracle/truffle/tools/test/NodeExecCounterTest.java Thu Jan 14 14:09:27 2016 +0100 +++ b/truffle/com.oracle.truffle.tools.test/src/com/oracle/truffle/tools/test/NodeExecCounterTest.java Thu Jan 14 14:12:46 2016 +0100 @@ -30,6 +30,7 @@ import java.io.IOException; import java.lang.reflect.Field; +import org.junit.Ignore; import org.junit.Test; import com.oracle.truffle.api.instrument.Instrumenter; @@ -47,33 +48,34 @@ field.setAccessible(true); final Instrumenter instrumenter = (Instrumenter) field.get(vm); final NodeExecCounter tool = new NodeExecCounter(); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); instrumenter.install(tool); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); tool.setEnabled(false); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); tool.setEnabled(true); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); tool.reset(); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); tool.dispose(); - assertEquals(tool.getCounts().length, 0); + assertEquals(0, tool.getCounts().length); } void checkCounts(NodeExecCounter execTool, int addCount, int valueCount) { NodeExecutionCount[] counts = execTool.getCounts(); - assertEquals(counts.length, 2); + assertEquals(2, counts.length); for (NodeExecutionCount counter : counts) { if (counter.nodeClass() == ToolTestUtil.TestAdditionNode.class) { - assertEquals(counter.executionCount(), addCount); + assertEquals(addCount, counter.executionCount()); } else if (counter.nodeClass() == ToolTestUtil.TestValueNode.class) { - assertEquals(counter.executionCount(), valueCount); + assertEquals(valueCount, counter.executionCount()); } else { fail("correct classes counted"); } } } + @Ignore("GRAAL-1385") @Test public void testCounting() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException { final PolyglotEngine vm = PolyglotEngine.newBuilder().build(); @@ -84,19 +86,19 @@ final NodeExecCounter execTool = new NodeExecCounter(); instrumenter.install(execTool); - assertEquals(execTool.getCounts().length, 0); + assertEquals(0, execTool.getCounts().length); - assertEquals(vm.eval(source).get(), 13); + assertEquals(13, vm.eval(source).get()); checkCounts(execTool, 1, 2); for (int i = 0; i < 99; i++) { - assertEquals(vm.eval(source).get(), 13); + assertEquals(13, vm.eval(source).get()); } checkCounts(execTool, 100, 200); execTool.setEnabled(false); - assertEquals(vm.eval(source).get(), 13); + assertEquals(13, vm.eval(source).get()); checkCounts(execTool, 100, 200); execTool.dispose();