changeset 22477:07f3efb4e321

Merge with 4a83dc15e774bdf6f01e409982b81d6338296d69
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 07 Dec 2015 21:17:46 -0800
parents 50baaa7da8e8 (diff) 4a83dc15e774 (current diff)
children e4dd15f04c7d
files mx.truffle/mx_truffle.py truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/SourceSection.java truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/debug/SLREPLHandler.java truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/debug/SLREPLServer.java truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/REPLServer.java truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/package.html truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/FrameDebugDescription.java truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServer.java truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServerContext.java
diffstat 162 files changed, 11222 insertions(+), 7762 deletions(-) [+]
line wrap: on
line diff
--- a/mx.truffle/mx_truffle.py	Mon Dec 07 20:48:29 2015 -0800
+++ b/mx.truffle/mx_truffle.py	Mon Dec 07 21:17:46 2015 -0800
@@ -29,6 +29,7 @@
 import mx
 
 from mx_unittest import unittest
+from mx_sigtest import sigtest
 from mx_gate import Task
 import mx_gate
 
@@ -57,6 +58,8 @@
 def _truffle_gate_runner(args, tasks):
     with Task('Truffle UnitTests', tasks) as t:
         if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
+    with Task('Truffle Signature Tests', tasks) as t:
+        if t: sigtest(['--check', 'binary'])
 
 mx_gate.add_gate_runner(_suite, _truffle_gate_runner)
 
--- a/truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/AssumptionsTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/AssumptionsTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -30,6 +30,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.oracle.truffle.api.Assumption;
@@ -40,6 +41,8 @@
 import com.oracle.truffle.api.dsl.NodeField;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
+import com.oracle.truffle.api.dsl.internal.SpecializationNode;
+import com.oracle.truffle.api.dsl.internal.SpecializedNode;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.AssumptionArrayTestFactory;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.CacheAssumptionTestFactory;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.FieldTestFactory;
@@ -47,6 +50,7 @@
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.MultipleAssumptionArraysTestFactory;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.MultipleAssumptionsTestFactory;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.NodeFieldTest2Factory;
+import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.RemoveSpecializationTestFactory;
 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.StaticFieldTestFactory;
 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
 
@@ -319,6 +323,42 @@
 
     }
 
+    @Ignore
+    @Test
+    public void testAssumptionRemovesSpecializationBefore() {
+        // This only test if a specialization on the chain before the matching one is removed.
+        CallTarget root = createCallTarget(RemoveSpecializationTestFactory.getInstance());
+        RemoveSpecializationTest node = getNode(root);
+
+        assertEquals(true, root.call(true));
+        SpecializationNode start0 = ((SpecializedNode) node).getSpecializationNode();
+        assertEquals("ValidAssumptionNode_", start0.getClass().getSimpleName());
+
+        node.assumption.invalidate();
+        // The specialization should be removed on the next call, even if the guard does not pass
+        assertEquals(false, root.call(false));
+        SpecializationNode start1 = ((SpecializedNode) node).getSpecializationNode();
+        assertEquals("InvalidatedNode_", start1.getClass().getSimpleName());
+    }
+
+    @NodeChild
+    @SuppressWarnings("unused")
+    static class RemoveSpecializationTest extends ValueNode {
+
+        protected final Assumption assumption = Truffle.getRuntime().createAssumption();
+
+        @Specialization(guards = "value", assumptions = "assumption")
+        boolean validAssumption(boolean value) {
+            return true;
+        }
+
+        @Specialization
+        boolean invalidated(boolean value) {
+            return false;
+        }
+
+    }
+
     @NodeChild
     static class ErrorIncompatibleReturnType extends ValueNode {
         @ExpectError("Incompatible return type int. Assumptions must be assignable to Assumption or Assumption[].")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.dsl/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,210 @@
+#Signature file v4.1
+#Version 
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.Cached
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[PARAMETER])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.String value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.CreateCast
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.String[] value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.Fallback
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.GenerateNodeFactory
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.GeneratedBy
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.String methodName()
+meth public abstract java.lang.Class<?> value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.ImplicitCast
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.ImportStatic
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?>[] value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.NodeChild
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.Class<?> type()
+meth public abstract !hasdefault java.lang.String value()
+meth public abstract !hasdefault java.lang.String[] executeWith()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.NodeChildren
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault com.oracle.truffle.api.dsl.NodeChild[] value()
+
+CLSS public abstract interface com.oracle.truffle.api.dsl.NodeFactory<%0 extends java.lang.Object>
+meth public abstract !varargs {com.oracle.truffle.api.dsl.NodeFactory%0} createNode(java.lang.Object[])
+meth public abstract java.lang.Class<{com.oracle.truffle.api.dsl.NodeFactory%0}> getNodeClass()
+meth public abstract java.util.List<java.lang.Class<? extends com.oracle.truffle.api.nodes.Node>> getExecutionSignature()
+meth public abstract java.util.List<java.util.List<java.lang.Class<?>>> getNodeSignatures()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.NodeField
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?> type()
+meth public abstract java.lang.String name()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.NodeFields
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault com.oracle.truffle.api.dsl.NodeField[] value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.ShortCircuit
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.String value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.Specialization
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.Class<? extends java.lang.Throwable>[] rewriteOn()
+meth public abstract !hasdefault java.lang.String insertBefore()
+meth public abstract !hasdefault java.lang.String limit()
+meth public abstract !hasdefault java.lang.String[] assumptions()
+meth public abstract !hasdefault java.lang.String[] contains()
+meth public abstract !hasdefault java.lang.String[] guards()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.TypeCast
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?> value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.TypeCheck
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?> value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.TypeSystem
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?>[] value()
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.dsl.TypeSystemReference
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=CLASS)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<?> value()
+
+CLSS public final com.oracle.truffle.api.dsl.UnsupportedSpecializationException
+cons public !varargs init(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node[],java.lang.Object[])
+meth public com.oracle.truffle.api.nodes.Node getNode()
+meth public com.oracle.truffle.api.nodes.Node[] getSuppliedNodes()
+meth public java.lang.Object[] getSuppliedValues()
+meth public java.lang.String getMessage()
+supr java.lang.RuntimeException
+hfds node,serialVersionUID,suppliedNodes,suppliedValues
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public java.lang.RuntimeException
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
--- a/truffle/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/SpecializationNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/SpecializationNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -58,7 +58,7 @@
 
     @Child protected SpecializationNode next;
 
-    final int index;
+    private final int index;
 
     public SpecializationNode() {
         this(-1);
--- a/truffle/com.oracle.truffle.api.interop.java.test/src/com/oracle/truffle/api/interop/java/test/JavaFunctionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api.interop.java.test/src/com/oracle/truffle/api/interop/java/test/JavaFunctionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -41,7 +41,7 @@
                 called[0] = true;
             }
         })).build();
-        engine.findGlobalSymbol("test").invoke(null);
+        engine.findGlobalSymbol("test").execute();
 
         assertTrue("Runnable has been called", called[0]);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.interop.java/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,58 @@
+#Signature file v4.1
+#Version 
+
+CLSS public final com.oracle.truffle.api.interop.java.JavaInterop
+meth public static <%0 extends java.lang.Object> com.oracle.truffle.api.interop.TruffleObject asTruffleFunction(java.lang.Class<{%%0}>,{%%0})
+meth public static <%0 extends java.lang.Object> {%%0} asJavaFunction(java.lang.Class<{%%0}>,com.oracle.truffle.api.interop.TruffleObject)
+meth public static <%0 extends java.lang.Object> {%%0} asJavaObject(java.lang.Class<{%%0}>,com.oracle.truffle.api.interop.TruffleObject)
+meth public static com.oracle.truffle.api.interop.TruffleObject asTruffleObject(java.lang.Object)
+supr java.lang.Object
+hfds EMPTY
+hcls JavaFunctionObject,JavaObject,SingleHandler,TemporaryRoot,TruffleHandler
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.interop.java.MethodMessage
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.String message()
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
--- a/truffle/com.oracle.truffle.api.interop.java/src/com/oracle/truffle/api/interop/java/JavaInterop.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api.interop.java/src/com/oracle/truffle/api/interop/java/JavaInterop.java	Mon Dec 07 21:17:46 2015 -0800
@@ -366,8 +366,7 @@
             }
 
             if (Message.createExecute(0).equals(message)) {
-                List<Object> copy = new ArrayList<>(args.length + 1);
-                // copy.add(obj);
+                List<Object> copy = new ArrayList<>(args.length);
                 copy.addAll(Arrays.asList(args));
                 message = Message.createExecute(copy.size());
                 val = message(message, obj, copy.toArray());
@@ -376,9 +375,9 @@
 
             if (Message.createInvoke(0).equals(message)) {
                 List<Object> copy = new ArrayList<>(args.length + 1);
-                copy.add(obj);
+                copy.add(name);
                 copy.addAll(Arrays.asList(args));
-                message = Message.createInvoke(copy.size());
+                message = Message.createInvoke(args.length);
                 val = message(message, obj, copy.toArray());
                 return toJava(val, method);
             }
@@ -395,7 +394,7 @@
                     List<Object> callArgs = new ArrayList<>(args.length);
                     callArgs.add(name);
                     callArgs.addAll(Arrays.asList(args));
-                    ret = message(Message.createInvoke(callArgs.size()), obj, callArgs.toArray());
+                    ret = message(Message.createInvoke(args.length), obj, callArgs.toArray());
                 } catch (IllegalArgumentException ex) {
                     val = message(Message.READ, obj, name);
                     if (isPrimitive(val)) {
@@ -408,8 +407,7 @@
                         }
                         throw new IllegalArgumentException(attr + " cannot be invoked with " + args.length + " parameters");
                     }
-                    List<Object> callArgs = new ArrayList<>(args.length + 1);
-                    // callArgs.add(attr);
+                    List<Object> callArgs = new ArrayList<>(args.length);
                     callArgs.addAll(Arrays.asList(args));
                     ret = message(Message.createExecute(callArgs.size()), attr, callArgs.toArray());
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.interop/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,73 @@
+#Signature file v4.1
+#Version 
+
+CLSS public final com.oracle.truffle.api.interop.ForeignAccess
+innr public abstract interface static Factory
+innr public abstract interface static Factory10
+meth public !varargs static java.lang.Object execute(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,com.oracle.truffle.api.interop.TruffleObject,java.lang.Object[])
+meth public java.lang.String toString()
+meth public static com.oracle.truffle.api.interop.ForeignAccess create(com.oracle.truffle.api.interop.ForeignAccess$Factory)
+meth public static com.oracle.truffle.api.interop.ForeignAccess create(java.lang.Class<? extends com.oracle.truffle.api.interop.TruffleObject>,com.oracle.truffle.api.interop.ForeignAccess$Factory10)
+meth public static com.oracle.truffle.api.interop.TruffleObject getReceiver(com.oracle.truffle.api.frame.Frame)
+meth public static java.util.List<java.lang.Object> getArguments(com.oracle.truffle.api.frame.Frame)
+supr java.lang.Object
+hfds factory,initThread
+hcls DelegatingFactory
+
+CLSS public abstract interface static com.oracle.truffle.api.interop.ForeignAccess$Factory
+ outer com.oracle.truffle.api.interop.ForeignAccess
+meth public abstract boolean canHandle(com.oracle.truffle.api.interop.TruffleObject)
+meth public abstract com.oracle.truffle.api.CallTarget accessMessage(com.oracle.truffle.api.interop.Message)
+
+CLSS public abstract interface static com.oracle.truffle.api.interop.ForeignAccess$Factory10
+ outer com.oracle.truffle.api.interop.ForeignAccess
+meth public abstract com.oracle.truffle.api.CallTarget accessExecute(int)
+meth public abstract com.oracle.truffle.api.CallTarget accessGetSize()
+meth public abstract com.oracle.truffle.api.CallTarget accessHasSize()
+meth public abstract com.oracle.truffle.api.CallTarget accessInvoke(int)
+meth public abstract com.oracle.truffle.api.CallTarget accessIsBoxed()
+meth public abstract com.oracle.truffle.api.CallTarget accessIsExecutable()
+meth public abstract com.oracle.truffle.api.CallTarget accessIsNull()
+meth public abstract com.oracle.truffle.api.CallTarget accessMessage(com.oracle.truffle.api.interop.Message)
+meth public abstract com.oracle.truffle.api.CallTarget accessNew(int)
+meth public abstract com.oracle.truffle.api.CallTarget accessRead()
+meth public abstract com.oracle.truffle.api.CallTarget accessUnbox()
+meth public abstract com.oracle.truffle.api.CallTarget accessWrite()
+
+CLSS public abstract com.oracle.truffle.api.interop.Message
+cons protected init()
+fld public final static com.oracle.truffle.api.interop.Message GET_SIZE
+fld public final static com.oracle.truffle.api.interop.Message HAS_SIZE
+fld public final static com.oracle.truffle.api.interop.Message IS_BOXED
+fld public final static com.oracle.truffle.api.interop.Message IS_EXECUTABLE
+fld public final static com.oracle.truffle.api.interop.Message IS_NULL
+fld public final static com.oracle.truffle.api.interop.Message READ
+fld public final static com.oracle.truffle.api.interop.Message UNBOX
+fld public static com.oracle.truffle.api.interop.Message WRITE
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public final com.oracle.truffle.api.nodes.Node createNode()
+meth public static com.oracle.truffle.api.interop.Message createExecute(int)
+meth public static com.oracle.truffle.api.interop.Message createInvoke(int)
+meth public static com.oracle.truffle.api.interop.Message createNew(int)
+meth public static com.oracle.truffle.api.interop.Message valueOf(java.lang.String)
+meth public static java.lang.String toString(com.oracle.truffle.api.interop.Message)
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.interop.TruffleObject
+meth public abstract com.oracle.truffle.api.interop.ForeignAccess getForeignAccess()
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.object/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,349 @@
+#Signature file v4.1
+#Version 
+
+CLSS public abstract interface com.oracle.truffle.api.TypedObject
+meth public abstract java.lang.Object getTypeIdentifier()
+
+CLSS public abstract interface com.oracle.truffle.api.interop.TruffleObject
+meth public abstract com.oracle.truffle.api.interop.ForeignAccess getForeignAccess()
+
+CLSS public com.oracle.truffle.api.nodes.SlowPathException
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+meth public java.lang.Throwable fillInStackTrace()
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public abstract interface com.oracle.truffle.api.object.BooleanLocation
+intf com.oracle.truffle.api.object.TypedLocation
+meth public abstract boolean getBoolean(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract boolean getBoolean(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract java.lang.Class<java.lang.Boolean> getType()
+meth public abstract void setBoolean(com.oracle.truffle.api.object.DynamicObject,boolean) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setBoolean(com.oracle.truffle.api.object.DynamicObject,boolean,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setBoolean(com.oracle.truffle.api.object.DynamicObject,boolean,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+
+CLSS public abstract interface com.oracle.truffle.api.object.DoubleLocation
+intf com.oracle.truffle.api.object.TypedLocation
+meth public abstract double getDouble(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract double getDouble(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract java.lang.Class<java.lang.Double> getType()
+meth public abstract void setDouble(com.oracle.truffle.api.object.DynamicObject,double) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setDouble(com.oracle.truffle.api.object.DynamicObject,double,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setDouble(com.oracle.truffle.api.object.DynamicObject,double,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+
+CLSS public abstract com.oracle.truffle.api.object.DynamicObject
+cons public init()
+intf com.oracle.truffle.api.TypedObject
+intf com.oracle.truffle.api.interop.TruffleObject
+meth public abstract boolean delete(java.lang.Object)
+meth public abstract boolean isEmpty()
+meth public abstract boolean set(java.lang.Object,java.lang.Object)
+meth public abstract boolean updateShape()
+meth public abstract com.oracle.truffle.api.object.DynamicObject copy(com.oracle.truffle.api.object.Shape)
+meth public abstract com.oracle.truffle.api.object.Shape getShape()
+meth public abstract int size()
+meth public abstract java.lang.Object get(java.lang.Object,java.lang.Object)
+meth public abstract void define(java.lang.Object,java.lang.Object,int)
+meth public abstract void define(java.lang.Object,java.lang.Object,int,com.oracle.truffle.api.object.LocationFactory)
+meth public abstract void setShapeAndGrow(com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+meth public abstract void setShapeAndResize(com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+meth public final boolean containsKey(java.lang.Object)
+meth public final java.lang.Object get(java.lang.Object)
+meth public final void define(java.lang.Object,java.lang.Object)
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.object.DynamicObjectFactory
+meth public abstract !varargs com.oracle.truffle.api.object.DynamicObject newInstance(java.lang.Object[])
+meth public abstract com.oracle.truffle.api.object.Shape getShape()
+
+CLSS public final com.oracle.truffle.api.object.FinalLocationException
+cons public init()
+supr com.oracle.truffle.api.nodes.SlowPathException
+hfds serialVersionUID
+
+CLSS public final com.oracle.truffle.api.object.HiddenKey
+cons public init(java.lang.String)
+meth public java.lang.String getName()
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds name
+
+CLSS public final com.oracle.truffle.api.object.IncompatibleLocationException
+cons public init()
+supr com.oracle.truffle.api.nodes.SlowPathException
+hfds serialVersionUID
+
+CLSS public abstract interface com.oracle.truffle.api.object.IntLocation
+intf com.oracle.truffle.api.object.TypedLocation
+meth public abstract int getInt(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract int getInt(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract java.lang.Class<java.lang.Integer> getType()
+meth public abstract void setInt(com.oracle.truffle.api.object.DynamicObject,int) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setInt(com.oracle.truffle.api.object.DynamicObject,int,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setInt(com.oracle.truffle.api.object.DynamicObject,int,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+
+CLSS public abstract com.oracle.truffle.api.object.Layout
+cons public init()
+fld public final static java.lang.String OPTION_PREFIX = "truffle.object."
+innr public final static !enum ImplicitCast
+innr public final static Builder
+meth protected static com.oracle.truffle.api.object.LayoutFactory getFactory()
+meth protected static java.util.EnumSet<com.oracle.truffle.api.object.Layout$ImplicitCast> getAllowedImplicitCasts(com.oracle.truffle.api.object.Layout$Builder)
+meth public abstract com.oracle.truffle.api.object.DynamicObject newInstance(com.oracle.truffle.api.object.Shape)
+meth public abstract com.oracle.truffle.api.object.Shape createShape(com.oracle.truffle.api.object.ObjectType)
+meth public abstract com.oracle.truffle.api.object.Shape createShape(com.oracle.truffle.api.object.ObjectType,java.lang.Object)
+meth public abstract com.oracle.truffle.api.object.Shape createShape(com.oracle.truffle.api.object.ObjectType,java.lang.Object,int)
+meth public abstract com.oracle.truffle.api.object.Shape$Allocator createAllocator()
+meth public abstract java.lang.Class<? extends com.oracle.truffle.api.object.DynamicObject> getType()
+meth public static com.oracle.truffle.api.object.Layout createLayout()
+meth public static com.oracle.truffle.api.object.Layout$Builder newLayout()
+supr java.lang.Object
+hfds LAYOUT_FACTORY
+
+CLSS public final static com.oracle.truffle.api.object.Layout$Builder
+ outer com.oracle.truffle.api.object.Layout
+meth public com.oracle.truffle.api.object.Layout build()
+meth public com.oracle.truffle.api.object.Layout$Builder addAllowedImplicitCast(com.oracle.truffle.api.object.Layout$ImplicitCast)
+meth public com.oracle.truffle.api.object.Layout$Builder setAllowedImplicitCasts(java.util.EnumSet<com.oracle.truffle.api.object.Layout$ImplicitCast>)
+supr java.lang.Object
+hfds allowedImplicitCasts
+
+CLSS public final static !enum com.oracle.truffle.api.object.Layout$ImplicitCast
+ outer com.oracle.truffle.api.object.Layout
+fld public final static com.oracle.truffle.api.object.Layout$ImplicitCast IntToDouble
+fld public final static com.oracle.truffle.api.object.Layout$ImplicitCast IntToLong
+meth public static com.oracle.truffle.api.object.Layout$ImplicitCast valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.object.Layout$ImplicitCast[] values()
+supr java.lang.Enum<com.oracle.truffle.api.object.Layout$ImplicitCast>
+
+CLSS public abstract interface com.oracle.truffle.api.object.LayoutFactory
+meth public abstract com.oracle.truffle.api.object.Layout createLayout(com.oracle.truffle.api.object.Layout$Builder)
+meth public abstract com.oracle.truffle.api.object.Property createProperty(java.lang.Object,com.oracle.truffle.api.object.Location)
+meth public abstract com.oracle.truffle.api.object.Property createProperty(java.lang.Object,com.oracle.truffle.api.object.Location,int)
+meth public abstract int getPriority()
+
+CLSS public abstract com.oracle.truffle.api.object.Location
+cons public init()
+meth protected abstract java.lang.Object getInternal(com.oracle.truffle.api.object.DynamicObject)
+meth protected abstract void setInternal(com.oracle.truffle.api.object.DynamicObject,java.lang.Object) throws com.oracle.truffle.api.object.IncompatibleLocationException
+meth protected static boolean checkShape(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth protected static com.oracle.truffle.api.object.FinalLocationException finalLocation() throws com.oracle.truffle.api.object.FinalLocationException
+meth protected static com.oracle.truffle.api.object.IncompatibleLocationException incompatibleLocation() throws com.oracle.truffle.api.object.IncompatibleLocationException
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public boolean canSet(com.oracle.truffle.api.object.DynamicObject,java.lang.Object)
+meth public boolean canSet(java.lang.Object)
+meth public boolean canStore(java.lang.Object)
+meth public boolean isConstant()
+meth public boolean isFinal()
+meth public final java.lang.Object get(com.oracle.truffle.api.object.DynamicObject)
+meth public final java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public final void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object) throws com.oracle.truffle.api.object.FinalLocationException,com.oracle.truffle.api.object.IncompatibleLocationException
+meth public final void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.IncompatibleLocationException
+meth public java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException,com.oracle.truffle.api.object.IncompatibleLocationException
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.object.LocationFactory
+meth public abstract com.oracle.truffle.api.object.Location createLocation(com.oracle.truffle.api.object.Shape,java.lang.Object)
+
+CLSS public final !enum com.oracle.truffle.api.object.LocationModifier
+fld public final static com.oracle.truffle.api.object.LocationModifier Final
+fld public final static com.oracle.truffle.api.object.LocationModifier NonNull
+meth public static com.oracle.truffle.api.object.LocationModifier valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.object.LocationModifier[] values()
+supr java.lang.Enum<com.oracle.truffle.api.object.LocationModifier>
+
+CLSS public abstract interface com.oracle.truffle.api.object.LongLocation
+intf com.oracle.truffle.api.object.TypedLocation
+meth public abstract java.lang.Class<java.lang.Long> getType()
+meth public abstract long getLong(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract long getLong(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract void setLong(com.oracle.truffle.api.object.DynamicObject,long) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setLong(com.oracle.truffle.api.object.DynamicObject,long,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException
+meth public abstract void setLong(com.oracle.truffle.api.object.DynamicObject,long,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+
+CLSS public abstract interface com.oracle.truffle.api.object.ObjectLocation
+intf com.oracle.truffle.api.object.TypedLocation
+meth public abstract boolean isNonNull()
+meth public abstract java.lang.Class<?> getType()
+
+CLSS public com.oracle.truffle.api.object.ObjectType
+cons public init()
+meth public boolean equals(com.oracle.truffle.api.object.DynamicObject,java.lang.Object)
+meth public com.oracle.truffle.api.interop.ForeignAccess getForeignAccessFactory()
+meth public int hashCode(com.oracle.truffle.api.object.DynamicObject)
+meth public java.lang.Object createShapeData(com.oracle.truffle.api.object.Shape)
+meth public java.lang.String toString(com.oracle.truffle.api.object.DynamicObject)
+supr java.lang.Object
+
+CLSS public abstract com.oracle.truffle.api.object.Property
+cons protected init()
+meth public abstract boolean isHidden()
+meth public abstract boolean isSame(com.oracle.truffle.api.object.Property)
+meth public abstract boolean isShadow()
+meth public abstract com.oracle.truffle.api.object.Location getLocation()
+meth public abstract com.oracle.truffle.api.object.Property copyWithFlags(int)
+meth public abstract com.oracle.truffle.api.object.Property copyWithRelocatable(boolean)
+meth public abstract com.oracle.truffle.api.object.Property relocate(com.oracle.truffle.api.object.Location)
+meth public abstract int getFlags()
+meth public abstract java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract java.lang.Object getKey()
+meth public abstract void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException,com.oracle.truffle.api.object.IncompatibleLocationException
+meth public abstract void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.IncompatibleLocationException
+meth public abstract void setGeneric(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape)
+meth public abstract void setGeneric(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+meth public abstract void setInternal(com.oracle.truffle.api.object.DynamicObject,java.lang.Object)
+meth public abstract void setSafe(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape)
+meth public abstract void setSafe(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape)
+meth public static com.oracle.truffle.api.object.Property create(java.lang.Object,com.oracle.truffle.api.object.Location,int)
+supr java.lang.Object
+
+CLSS public abstract com.oracle.truffle.api.object.Shape
+cons public init()
+innr public abstract interface static Pred
+innr public abstract static Allocator
+meth public abstract boolean check(com.oracle.truffle.api.object.DynamicObject)
+meth public abstract boolean hasProperty(java.lang.Object)
+meth public abstract boolean hasTransitionWithKey(java.lang.Object)
+meth public abstract boolean isLeaf()
+meth public abstract boolean isRelated(com.oracle.truffle.api.object.Shape)
+meth public abstract boolean isValid()
+meth public abstract com.oracle.truffle.api.Assumption getLeafAssumption()
+meth public abstract com.oracle.truffle.api.Assumption getValidAssumption()
+meth public abstract com.oracle.truffle.api.object.DynamicObject newInstance()
+meth public abstract com.oracle.truffle.api.object.DynamicObjectFactory createFactory()
+meth public abstract com.oracle.truffle.api.object.Layout getLayout()
+meth public abstract com.oracle.truffle.api.object.ObjectType getObjectType()
+meth public abstract com.oracle.truffle.api.object.Property getLastProperty()
+meth public abstract com.oracle.truffle.api.object.Property getProperty(java.lang.Object)
+meth public abstract com.oracle.truffle.api.object.Shape addProperty(com.oracle.truffle.api.object.Property)
+meth public abstract com.oracle.truffle.api.object.Shape append(com.oracle.truffle.api.object.Property)
+meth public abstract com.oracle.truffle.api.object.Shape changeType(com.oracle.truffle.api.object.ObjectType)
+meth public abstract com.oracle.truffle.api.object.Shape createSeparateShape(java.lang.Object)
+meth public abstract com.oracle.truffle.api.object.Shape defineProperty(java.lang.Object,java.lang.Object,int)
+meth public abstract com.oracle.truffle.api.object.Shape defineProperty(java.lang.Object,java.lang.Object,int,com.oracle.truffle.api.object.LocationFactory)
+meth public abstract com.oracle.truffle.api.object.Shape getParent()
+meth public abstract com.oracle.truffle.api.object.Shape getRoot()
+meth public abstract com.oracle.truffle.api.object.Shape removeProperty(com.oracle.truffle.api.object.Property)
+meth public abstract com.oracle.truffle.api.object.Shape replaceProperty(com.oracle.truffle.api.object.Property,com.oracle.truffle.api.object.Property)
+meth public abstract com.oracle.truffle.api.object.Shape reservePrimitiveExtensionArray()
+meth public abstract com.oracle.truffle.api.object.Shape tryMerge(com.oracle.truffle.api.object.Shape)
+meth public abstract com.oracle.truffle.api.object.Shape$Allocator allocator()
+meth public abstract int getId()
+meth public abstract int getPropertyCount()
+meth public abstract java.lang.Iterable<com.oracle.truffle.api.object.Property> getProperties()
+meth public abstract java.lang.Iterable<java.lang.Object> getKeys()
+meth public abstract java.lang.Object getData()
+meth public abstract java.lang.Object getMutex()
+meth public abstract java.lang.Object getSharedData()
+meth public abstract java.util.List<com.oracle.truffle.api.object.Property> getPropertyList()
+meth public abstract java.util.List<com.oracle.truffle.api.object.Property> getPropertyList(com.oracle.truffle.api.object.Shape$Pred<com.oracle.truffle.api.object.Property>)
+meth public abstract java.util.List<com.oracle.truffle.api.object.Property> getPropertyListInternal(boolean)
+meth public abstract java.util.List<java.lang.Object> getKeyList()
+meth public abstract java.util.List<java.lang.Object> getKeyList(com.oracle.truffle.api.object.Shape$Pred<com.oracle.truffle.api.object.Property>)
+supr java.lang.Object
+
+CLSS public abstract static com.oracle.truffle.api.object.Shape$Allocator
+ outer com.oracle.truffle.api.object.Shape
+cons public init()
+meth protected abstract com.oracle.truffle.api.object.Location locationForType(java.lang.Class<?>,boolean,boolean)
+meth protected abstract com.oracle.truffle.api.object.Location locationForValue(java.lang.Object,boolean,boolean)
+meth public abstract com.oracle.truffle.api.object.Location constantLocation(java.lang.Object)
+meth public abstract com.oracle.truffle.api.object.Location declaredLocation(java.lang.Object)
+meth public abstract com.oracle.truffle.api.object.Shape$Allocator addLocation(com.oracle.truffle.api.object.Location)
+meth public abstract com.oracle.truffle.api.object.Shape$Allocator copy()
+meth public final com.oracle.truffle.api.object.Location locationForType(java.lang.Class<?>)
+meth public final com.oracle.truffle.api.object.Location locationForType(java.lang.Class<?>,java.util.EnumSet<com.oracle.truffle.api.object.LocationModifier>)
+meth public final com.oracle.truffle.api.object.Location locationForValue(java.lang.Object)
+meth public final com.oracle.truffle.api.object.Location locationForValue(java.lang.Object,java.util.EnumSet<com.oracle.truffle.api.object.LocationModifier>)
+supr java.lang.Object
+
+CLSS public abstract interface static com.oracle.truffle.api.object.Shape$Pred<%0 extends java.lang.Object>
+ outer com.oracle.truffle.api.object.Shape
+meth public abstract boolean test({com.oracle.truffle.api.object.Shape$Pred%0})
+
+CLSS public abstract interface com.oracle.truffle.api.object.ShapeListener
+meth public abstract void onPropertyTransition(java.lang.Object)
+
+CLSS public abstract interface com.oracle.truffle.api.object.TypedLocation
+meth public abstract java.lang.Class<?> getType()
+meth public abstract java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,boolean)
+meth public abstract java.lang.Object get(com.oracle.truffle.api.object.DynamicObject,com.oracle.truffle.api.object.Shape)
+meth public abstract void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object) throws com.oracle.truffle.api.object.FinalLocationException,com.oracle.truffle.api.object.IncompatibleLocationException
+meth public abstract void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.FinalLocationException,com.oracle.truffle.api.object.IncompatibleLocationException
+meth public abstract void set(com.oracle.truffle.api.object.DynamicObject,java.lang.Object,com.oracle.truffle.api.object.Shape,com.oracle.truffle.api.object.Shape) throws com.oracle.truffle.api.object.IncompatibleLocationException
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
+meth public abstract int compareTo({java.lang.Comparable%0})
+
+CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
+cons protected init(java.lang.String,int)
+intf java.io.Serializable
+intf java.lang.Comparable<{java.lang.Enum%0}>
+meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected final void finalize()
+meth public final boolean equals(java.lang.Object)
+meth public final int compareTo({java.lang.Enum%0})
+meth public final int hashCode()
+meth public final int ordinal()
+meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
+meth public final java.lang.String name()
+meth public java.lang.String toString()
+meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
+supr java.lang.Object
+hfds name,ordinal
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ArgumentsTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Passing Arguments</h3>
+ *
+ * <p>
+ * When invoking a call target with {@link CallTarget#call(Object[])}, arguments can be passed. A
+ * Truffle node can access the arguments passed into the Truffle method by using
+ * {@link VirtualFrame#getArguments}.
+ * </p>
+ *
+ * <p>
+ * The arguments class should only contain fields that are declared as final. This allows the
+ * Truffle runtime to improve optimizations around guest language method calls. Also, the arguments
+ * object array must never be stored into a field. It should be created immediately before invoking
+ * {@link CallTarget#call(Object[])} and no longer be accessed afterwards.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.FrameTest} .
+ * </p>
+ */
+public class ArgumentsTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestRootNode rootNode = new TestRootNode(new TestArgumentNode[]{new TestArgumentNode(0), new TestArgumentNode(1)});
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Object result = target.call(new Object[]{20, 22});
+        Assert.assertEquals(42, result);
+    }
+
+    private static class TestRootNode extends RootNode {
+
+        @Children private final TestArgumentNode[] children;
+
+        TestRootNode(TestArgumentNode[] children) {
+            super(TestingLanguage.class, null, null);
+            this.children = children;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int sum = 0;
+            for (int i = 0; i < children.length; ++i) {
+                sum += children[i].execute(frame);
+            }
+            return sum;
+        }
+    }
+
+    private static class TestArgumentNode extends Node {
+
+        private final int index;
+
+        TestArgumentNode(int index) {
+            super(null);
+            this.index = index;
+        }
+
+        int execute(VirtualFrame frame) {
+            return (Integer) frame.getArguments()[index];
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/CallTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Calling Another Tree</h3>
+ *
+ * <p>
+ * A guest language implementation can create multiple call targets using the
+ * {@link TruffleRuntime#createCallTarget(RootNode)} method. Those call targets can be passed around
+ * as normal Java objects and used for calling guest language methods.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.ArgumentsTest}.
+ * </p>
+ */
+public class CallTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        CallTarget foo = runtime.createCallTarget(new ConstantRootNode(20));
+        CallTarget bar = runtime.createCallTarget(new ConstantRootNode(22));
+        CallTarget main = runtime.createCallTarget(new DualCallNode(foo, bar));
+        Object result = main.call();
+        Assert.assertEquals(42, result);
+    }
+
+    class DualCallNode extends RootNode {
+
+        private final CallTarget firstTarget;
+        private final CallTarget secondTarget;
+
+        DualCallNode(CallTarget firstTarget, CallTarget secondTarget) {
+            super(TestingLanguage.class, null, null);
+            this.firstTarget = firstTarget;
+            this.secondTarget = secondTarget;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return ((Integer) firstTarget.call()) + ((Integer) secondTarget.call());
+        }
+    }
+
+    class ConstantRootNode extends RootNode {
+
+        private final int value;
+
+        public ConstantRootNode(int value) {
+            super(TestingLanguage.class, null, null);
+            this.value = value;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return value;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ChildNodeTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import java.util.Iterator;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.Node.Child;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Creating a Child Node</h3>
+ *
+ * <p>
+ * Child nodes are stored in the class of the parent node in fields that are marked with the
+ * {@link Child} annotation. The {@link Node#getParent()} method allows access to this field. Every
+ * node also provides the ability to iterate over its children using {@link Node#getChildren()}.
+ * </p>
+ *
+ * <p>
+ * A child node field must be declared private and non-final. It may only be assigned in the
+ * constructor of the parent node. For changing the structure of the tree at run time, the method
+ * {@link Node#replace(Node)} must be used (see {@link ReplaceTest}).
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.ChildrenNodesTest}.
+ * </p>
+ */
+public class ChildNodeTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestChildNode leftChild = new TestChildNode();
+        TestChildNode rightChild = new TestChildNode();
+        TestRootNode rootNode = new TestRootNode(leftChild, rightChild);
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Assert.assertEquals(rootNode, leftChild.getParent());
+        Assert.assertEquals(rootNode, rightChild.getParent());
+        Iterator<Node> iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(leftChild, iterator.next());
+        Assert.assertEquals(rightChild, iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Child private TestChildNode left;
+        @Child private TestChildNode right;
+
+        public TestRootNode(TestChildNode left, TestChildNode right) {
+            super(TestingLanguage.class, null, null);
+            this.left = left;
+            this.right = right;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return left.execute() + right.execute();
+        }
+    }
+
+    class TestChildNode extends Node {
+
+        public TestChildNode() {
+            super(null);
+        }
+
+        public int execute() {
+            return 21;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ChildrenNodesTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import java.util.Iterator;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Creating an Array of Children Nodes</h3>
+ *
+ * <p>
+ * An array of children nodes can be used as a field in a parent node. The field has to be annotated
+ * with {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final.
+ * Before assigning the field in the parent node constructor, {@link Node#adoptChildren} must be
+ * called in order to update the parent pointers in the child nodes. After filling the array with
+ * its first values, it must never be changed. It is only possible to call {@link Node#replace} on a
+ * child node.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.FinalFieldTest}
+ * .
+ * </p>
+ */
+public class ChildrenNodesTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestChildNode firstChild = new TestChildNode();
+        TestChildNode secondChild = new TestChildNode();
+        TestRootNode rootNode = new TestRootNode(new TestChildNode[]{firstChild, secondChild});
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Assert.assertEquals(rootNode, firstChild.getParent());
+        Assert.assertEquals(rootNode, secondChild.getParent());
+        Iterator<Node> iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(firstChild, iterator.next());
+        Assert.assertEquals(secondChild, iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Children private final TestChildNode[] children;
+
+        public TestRootNode(TestChildNode[] children) {
+            super(TestingLanguage.class, null, null);
+            this.children = children;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int sum = 0;
+            for (int i = 0; i < children.length; ++i) {
+                sum += children[i].execute();
+            }
+            return sum;
+        }
+    }
+
+    class TestChildNode extends Node {
+
+        public TestChildNode() {
+            super(null);
+        }
+
+        public int execute() {
+            return 21;
+        }
+    }
+
+    @Test
+    public void testMultipleChildrenFields() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestChildNode firstChild = new TestChildNode();
+        TestChildNode secondChild = new TestChildNode();
+        TestChildNode thirdChild = new TestChildNode();
+        TestChildNode forthChild = new TestChildNode();
+        TestRootNode rootNode = new TestRoot2Node(new TestChildNode[]{firstChild, secondChild}, new TestChildNode[]{thirdChild, forthChild});
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Assert.assertEquals(rootNode, firstChild.getParent());
+        Assert.assertEquals(rootNode, secondChild.getParent());
+        Assert.assertEquals(rootNode, thirdChild.getParent());
+        Assert.assertEquals(rootNode, forthChild.getParent());
+        Iterator<Node> iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(firstChild, iterator.next());
+        Assert.assertEquals(secondChild, iterator.next());
+        Assert.assertEquals(thirdChild, iterator.next());
+        Assert.assertEquals(forthChild, iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        Assert.assertEquals(2 * 42, result);
+    }
+
+    class TestRoot2Node extends TestRootNode {
+        @Children private final TestChildNode[] children1;
+        @Children private final TestChildNode[] children2;
+
+        public TestRoot2Node(TestChildNode[] children1, TestChildNode[] children2) {
+            super(new TestChildNode[0]);
+            this.children1 = children1;
+            this.children2 = children2;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int sum = 0;
+            for (int i = 0; i < children1.length; ++i) {
+                sum += children1[i].execute();
+            }
+            for (int i = 0; i < children2.length; ++i) {
+                sum += children2[i].execute();
+            }
+            return sum;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FinalFieldTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Using Final Fields in Node Classes</h3>
+ *
+ * <p>
+ * The usage of final fields in node classes is highly encouraged. It is beneficial for performance
+ * to declare every field that is not pointing to a child node as final. This gives the Truffle
+ * runtime an increased opportunity to optimize this node.
+ * </p>
+ *
+ * <p>
+ * If a node has a value which may change at run time, but will rarely do so, it is recommended to
+ * speculate on the field being final. This involves starting executing with a node where this field
+ * is final and only if this turns out to be no longer the case, the node is replaced with an
+ * alternative implementation of the operation (see {@link ReplaceTest}).
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.ReplaceTest}.
+ * </p>
+ */
+public class FinalFieldTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestRootNode rootNode = new TestRootNode(new TestChildNode[]{new TestChildNode(20), new TestChildNode(22)});
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+    }
+
+    private static class TestRootNode extends RootNode {
+
+        @Children private final TestChildNode[] children;
+
+        public TestRootNode(TestChildNode[] children) {
+            super(TestingLanguage.class, null, null);
+            this.children = children;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int sum = 0;
+            for (int i = 0; i < children.length; ++i) {
+                sum += children[i].execute();
+            }
+            return sum;
+        }
+    }
+
+    private static class TestChildNode extends Node {
+
+        private final int value;
+
+        public TestChildNode(int value) {
+            super(null);
+            this.value = value;
+        }
+
+        public int execute() {
+            return value;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FrameDescriptorTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import com.oracle.truffle.api.frame.Frame;
+import com.oracle.truffle.api.frame.FrameDescriptor;
+import com.oracle.truffle.api.frame.FrameSlot;
+import com.oracle.truffle.api.frame.FrameSlotKind;
+import com.oracle.truffle.api.frame.FrameSlotTypeException;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class FrameDescriptorTest {
+
+    private FrameSlot s1;
+    private FrameSlot s2;
+    private FrameSlot s3;
+
+    @Test
+    public void localsDefaultValue() throws Exception {
+        Object defaultValue = "default";
+        FrameDescriptor d = new FrameDescriptor(defaultValue);
+        s1 = d.addFrameSlot("v1");
+        s2 = d.addFrameSlot("v2");
+        s3 = d.addFrameSlot("v3");
+        VirtualFrame f = Truffle.getRuntime().createVirtualFrame(new Object[]{1, 2}, d);
+
+        assertFrame(f, d);
+        assertFrame(f.materialize(), d);
+    }
+
+    private void assertFrame(Frame f, FrameDescriptor d) throws FrameSlotTypeException {
+        assertEquals("Three slots", 3, d.getSize());
+        assertEquals("Three slots list", 3, d.getSlots().size());
+        assertEquals("1st slot", d.getSlots().get(0), s1);
+        assertEquals("2nd slot", d.getSlots().get(1), s2);
+        assertEquals("3rd slot", d.getSlots().get(2), s3);
+        assertEquals("default", f.getObject(s1));
+        assertEquals("default", f.getObject(s2));
+        f.setInt(s3, (int) f.getArguments()[0]);
+        assertEquals(1, f.getInt(s3));
+    }
+
+    @Test
+    public void nullDefaultValue() {
+        Assert.assertNull(new FrameDescriptor().getDefaultValue());
+    }
+
+    @Test
+    public void copy() throws Exception {
+        Object defaultValue = "default";
+        FrameDescriptor d = new FrameDescriptor(defaultValue);
+        s1 = d.addFrameSlot("v1", "i1", FrameSlotKind.Boolean);
+        s2 = d.addFrameSlot("v2", "i2", FrameSlotKind.Float);
+
+        assertEquals(2, d.getSize());
+        assertEquals(d.getSlots().get(1).getInfo(), "i2");
+        assertEquals(d.getSlots().get(1).getKind(), FrameSlotKind.Float);
+        assertEquals(d.getSlots().get(1).getIndex(), 1);
+
+        FrameDescriptor copy = d.copy();
+
+        assertEquals(copy.getSlots().get(1).getIndex(), 1);
+
+        assertNull("Info isn't copied!", copy.getSlots().get(1).getInfo());
+        assertEquals("Kind isn't copied!", copy.getSlots().get(1).getKind(), FrameSlotKind.Illegal);
+    }
+
+    @Test
+    public void shallowCopy() {
+        Object defaultValue = "default";
+        FrameDescriptor d = new FrameDescriptor(defaultValue);
+        s1 = d.addFrameSlot("v1", "i1", FrameSlotKind.Boolean);
+        s2 = d.addFrameSlot("v2", "i2", FrameSlotKind.Float);
+
+        assertEquals(2, d.getSize());
+        final FrameSlot first = d.getSlots().get(1);
+        assertEquals(first.getInfo(), "i2");
+        assertEquals(first.getKind(), FrameSlotKind.Float);
+        assertEquals(first.getIndex(), 1);
+
+        FrameDescriptor copy = d.shallowCopy();
+
+        assertEquals(2, copy.getSize());
+        final FrameSlot firstCopy = copy.getSlots().get(1);
+        assertEquals("Info is copied", firstCopy.getInfo(), "i2");
+        assertEquals("Kind is copied", firstCopy.getKind(), FrameSlotKind.Float);
+        assertEquals(firstCopy.getIndex(), 1);
+
+        firstCopy.setKind(FrameSlotKind.Int);
+        assertEquals("Kind is changed", firstCopy.getKind(), FrameSlotKind.Int);
+        assertEquals("Kind is changed in original too!", first.getKind(), FrameSlotKind.Int);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FrameSlotTypeSpecializationTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.FrameDescriptor;
+import com.oracle.truffle.api.frame.FrameSlot;
+import com.oracle.truffle.api.frame.FrameSlotKind;
+import com.oracle.truffle.api.frame.FrameSlotTypeException;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Specializing Frame Slot Types</h3>
+ *
+ * <p>
+ * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run
+ * time to a more generic type if necessary. The new type of a frame slot can be set using the
+ * {@link FrameSlot#setKind(FrameSlotKind)} method.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.ReturnTypeSpecializationTest}.
+ * </p>
+ */
+public class FrameSlotTypeSpecializationTest {
+
+    @Before
+    public void setInstrumentationTestMode() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void unsetInstrumentationTestMode() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        FrameDescriptor frameDescriptor = new FrameDescriptor();
+        FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int);
+        TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot));
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Assert.assertEquals(FrameSlotKind.Int, slot.getKind());
+        Object result = target.call();
+        Assert.assertEquals("42", result);
+        Assert.assertEquals(FrameSlotKind.Object, slot.getKind());
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Child TestChildNode left;
+        @Child TestChildNode right;
+
+        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
+            super(TestingLanguage.class, null, descriptor);
+            this.left = left;
+            this.right = right;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            left.execute(frame);
+            return right.execute(frame);
+        }
+    }
+
+    abstract class TestChildNode extends Node {
+
+        protected TestChildNode() {
+            super(null);
+        }
+
+        abstract Object execute(VirtualFrame frame);
+    }
+
+    abstract class FrameSlotNode extends TestChildNode {
+
+        protected final FrameSlot slot;
+
+        public FrameSlotNode(FrameSlot slot) {
+            this.slot = slot;
+        }
+    }
+
+    class StringTestChildNode extends TestChildNode {
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            return "42";
+        }
+
+    }
+
+    class IntAssignLocal extends FrameSlotNode {
+
+        @Child private TestChildNode value;
+
+        IntAssignLocal(FrameSlot slot, TestChildNode value) {
+            super(slot);
+            this.value = value;
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            Object o = value.execute(frame);
+            if (o instanceof Integer) {
+                frame.setInt(slot, (Integer) o);
+            } else {
+                slot.setKind(FrameSlotKind.Object);
+                frame.setObject(slot, o);
+                this.replace(new ObjectAssignLocal(slot, value));
+            }
+            return null;
+        }
+    }
+
+    class ObjectAssignLocal extends FrameSlotNode {
+
+        @Child private TestChildNode value;
+
+        ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
+            super(slot);
+            this.value = value;
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            Object o = value.execute(frame);
+            slot.setKind(FrameSlotKind.Object);
+            frame.setObject(slot, o);
+            return null;
+        }
+    }
+
+    class IntReadLocal extends FrameSlotNode {
+
+        IntReadLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            try {
+                return frame.getInt(slot);
+            } catch (FrameSlotTypeException e) {
+                return this.replace(new ObjectReadLocal(slot)).execute(frame);
+            }
+        }
+    }
+
+    class ObjectReadLocal extends FrameSlotNode {
+
+        ObjectReadLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            try {
+                return frame.getObject(slot);
+            } catch (FrameSlotTypeException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FrameTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.Frame;
+import com.oracle.truffle.api.frame.FrameDescriptor;
+import com.oracle.truffle.api.frame.FrameInstance;
+import com.oracle.truffle.api.frame.FrameSlot;
+import com.oracle.truffle.api.frame.FrameSlotKind;
+import com.oracle.truffle.api.frame.FrameSlotTypeException;
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Storing Values in Frame Slots</h3>
+ *
+ * <p>
+ * The frame is the preferred data structure for passing values between nodes. It can in particular
+ * be used for storing the values of local variables of the guest language. The
+ * {@link FrameDescriptor} represents the current structure of the frame. The method
+ * {@link FrameDescriptor#addFrameSlot(Object, FrameSlotKind)} can be used to create predefined
+ * frame slots. The setter and getter methods in the {@link Frame} class can be used to access the
+ * current value of a particular frame slot. Values can be removed from a frame via the
+ * {@link FrameDescriptor#removeFrameSlot(Object)} method.
+ * </p>
+ *
+ * <p>
+ * There are five primitive types for slots available: {@link java.lang.Boolean},
+ * {@link java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and
+ * {@link java.lang.Double} . It is encouraged to use those types whenever possible. Dynamically
+ * typed languages can speculate on the type of a value fitting into a primitive (see
+ * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular
+ * primitive types, its value may only be accessed with the respectively typed getter method (
+ * {@link Frame#getBoolean}, {@link Frame#getInt}, {@link Frame#getLong}, {@link Frame#getFloat}, or
+ * {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, {@link Frame#setInt},
+ * {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the {@link Frame}
+ * class.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.FrameSlotTypeSpecializationTest}.
+ * </p>
+ */
+public class FrameTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() throws SecurityException, IllegalArgumentException {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        FrameDescriptor frameDescriptor = new FrameDescriptor();
+        String varName = "localVar";
+        FrameSlot slot = frameDescriptor.addFrameSlot(varName, FrameSlotKind.Int);
+        TestRootNode rootNode = new TestRootNode(frameDescriptor, new AssignLocal(slot), new ReadLocal(slot));
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+        frameDescriptor.removeFrameSlot(varName);
+        boolean slotMissing = false;
+        try {
+            result = target.call();
+        } catch (IllegalArgumentException iae) {
+            slotMissing = true;
+        }
+        Assert.assertTrue(slotMissing);
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Child TestChildNode left;
+        @Child TestChildNode right;
+
+        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
+            super(TestingLanguage.class, null, descriptor);
+            this.left = left;
+            this.right = right;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return left.execute(frame) + right.execute(frame);
+        }
+    }
+
+    abstract class TestChildNode extends Node {
+
+        public TestChildNode() {
+            super(null);
+        }
+
+        abstract int execute(VirtualFrame frame);
+    }
+
+    abstract class FrameSlotNode extends TestChildNode {
+
+        protected final FrameSlot slot;
+
+        public FrameSlotNode(FrameSlot slot) {
+            this.slot = slot;
+        }
+    }
+
+    class AssignLocal extends FrameSlotNode {
+
+        AssignLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            frame.setInt(slot, 42);
+            return 0;
+        }
+    }
+
+    class ReadLocal extends FrameSlotNode {
+
+        ReadLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            try {
+                return frame.getInt(slot);
+            } catch (FrameSlotTypeException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+    }
+
+    @Test
+    public void framesCanBeMaterialized() {
+        final TruffleRuntime runtime = Truffle.getRuntime();
+
+        class FrameRootNode extends RootNode {
+
+            public FrameRootNode() {
+                super(TestingLanguage.class, null, null);
+            }
+
+            @Override
+            public Object execute(VirtualFrame frame) {
+                FrameInstance frameInstance = runtime.getCurrentFrame();
+                Frame readWrite = frameInstance.getFrame(FrameInstance.FrameAccess.READ_WRITE, true);
+                Frame materialized = frameInstance.getFrame(FrameInstance.FrameAccess.MATERIALIZE, true);
+
+                assertTrue("Really materialized: " + materialized, materialized instanceof MaterializedFrame);
+                assertEquals("It's my frame", frame, readWrite);
+                return this;
+            }
+        }
+
+        FrameRootNode frn = new FrameRootNode();
+        Object ret = Truffle.getRuntime().createCallTarget(frn).call();
+        assertEquals("Returns itself", frn, ret);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/InterfaceChildFieldTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,169 @@
+/*
+ * 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.truffle.api;
+
+import java.util.Iterator;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeInterface;
+import com.oracle.truffle.api.nodes.NodeUtil;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * Test child fields declared with interface types instead of {@link Node} subclasses.
+ */
+public class InterfaceChildFieldTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void testChild() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestChildInterface leftChild = new TestLeafNode();
+        TestChildInterface rightChild = new TestLeafNode();
+        TestChildNode parent = new TestChildNode(leftChild, rightChild);
+        TestRootNode rootNode = new TestRootNode(parent);
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Iterator<Node> iterator = parent.getChildren().iterator();
+        Assert.assertEquals(leftChild, iterator.next());
+        Assert.assertEquals(rightChild, iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+
+        Assert.assertEquals(4, NodeUtil.countNodes(rootNode));
+        Assert.assertEquals(4, NodeUtil.countNodes(NodeUtil.cloneNode(rootNode)));
+    }
+
+    @Test
+    public void testChildren() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestChildInterface[] children = new TestChildInterface[5];
+        for (int i = 0; i < children.length; i++) {
+            children[i] = new TestLeafNode();
+        }
+        TestChildrenNode parent = new TestChildrenNode(children);
+        TestRootNode rootNode = new TestRootNode(parent);
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Iterator<Node> iterator = parent.getChildren().iterator();
+        for (int i = 0; i < children.length; i++) {
+            Assert.assertEquals(children[i], iterator.next());
+        }
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        Assert.assertEquals(105, result);
+
+        Assert.assertEquals(2 + children.length, NodeUtil.countNodes(rootNode));
+        Assert.assertEquals(2 + children.length, NodeUtil.countNodes(NodeUtil.cloneNode(rootNode)));
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Child private TestChildInterface child;
+
+        public TestRootNode(TestChildInterface child) {
+            super(TestingLanguage.class, null, null);
+            this.child = child;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return child.executeIntf();
+        }
+    }
+
+    interface TestChildInterface extends NodeInterface {
+        int executeIntf();
+    }
+
+    class TestLeafNode extends Node implements TestChildInterface {
+        public TestLeafNode() {
+            super(null);
+        }
+
+        public int executeIntf() {
+            return this.replace(new TestLeaf2Node()).executeIntf();
+        }
+    }
+
+    class TestLeaf2Node extends Node implements TestChildInterface {
+        public TestLeaf2Node() {
+            super(null);
+        }
+
+        public int executeIntf() {
+            return 21;
+        }
+    }
+
+    class TestChildNode extends Node implements TestChildInterface {
+
+        @Child private TestChildInterface left;
+        @Child private TestChildInterface right;
+
+        public TestChildNode(TestChildInterface left, TestChildInterface right) {
+            super(null);
+            this.left = left;
+            this.right = right;
+        }
+
+        @Override
+        public int executeIntf() {
+            return left.executeIntf() + right.executeIntf();
+        }
+    }
+
+    class TestChildrenNode extends Node implements TestChildInterface {
+
+        @Children private final TestChildInterface[] children;
+
+        public TestChildrenNode(TestChildInterface[] children) {
+            super(null);
+            this.children = children;
+        }
+
+        @Override
+        public int executeIntf() {
+            int sum = 0;
+            for (int i = 0; i < children.length; ++i) {
+                sum += children[i].executeIntf();
+            }
+            return sum;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ReplaceTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Replacing Nodes at Run Time</h3>
+ *
+ * <p>
+ * The structure of the Truffle tree can be changed at run time by replacing nodes using the
+ * {@link Node#replace(Node)} method. This method will automatically change the child pointer in the
+ * parent of the node and replace it with a pointer to the new node.
+ * </p>
+ *
+ * <p>
+ * Replacing nodes is a costly operation, so it should not happen too often. The convention is that
+ * the implementation of the Truffle nodes should ensure that there are maximal a small (and
+ * constant) number of node replacements per Truffle node.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.CallTest}.
+ * </p>
+ */
+public class ReplaceTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        UnresolvedNode leftChild = new UnresolvedNode("20");
+        UnresolvedNode rightChild = new UnresolvedNode("22");
+        TestRootNode rootNode = new TestRootNode(new ValueNode[]{leftChild, rightChild});
+        CallTarget target = runtime.createCallTarget(rootNode);
+        assertEquals(rootNode, leftChild.getParent());
+        assertEquals(rootNode, rightChild.getParent());
+        Iterator<Node> iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(leftChild, iterator.next());
+        Assert.assertEquals(rightChild, iterator.next());
+        Assert.assertFalse(iterator.hasNext());
+        Object result = target.call();
+        assertEquals(42, result);
+        assertEquals(42, target.call());
+        iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(ResolvedNode.class, iterator.next().getClass());
+        Assert.assertEquals(ResolvedNode.class, iterator.next().getClass());
+        Assert.assertFalse(iterator.hasNext());
+        iterator = rootNode.getChildren().iterator();
+        Assert.assertEquals(rootNode, iterator.next().getParent());
+        Assert.assertEquals(rootNode, iterator.next().getParent());
+        Assert.assertFalse(iterator.hasNext());
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Children private final ValueNode[] children;
+
+        public TestRootNode(ValueNode[] children) {
+            super(TestingLanguage.class, null, null);
+            this.children = children;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int sum = 0;
+            for (int i = 0; i < children.length; ++i) {
+                sum += children[i].execute();
+            }
+            return sum;
+        }
+    }
+
+    abstract class ValueNode extends Node {
+
+        public ValueNode() {
+            super(null);
+        }
+
+        abstract int execute();
+    }
+
+    class UnresolvedNode extends ValueNode {
+
+        private final String value;
+
+        public UnresolvedNode(String value) {
+            this.value = value;
+        }
+
+        @Override
+        int execute() {
+            int intValue = Integer.parseInt(value);
+            ResolvedNode newNode = this.replace(new ResolvedNode(intValue));
+            return newNode.execute();
+        }
+    }
+
+    class ResolvedNode extends ValueNode {
+
+        private final int value;
+
+        ResolvedNode(int value) {
+            this.value = value;
+        }
+
+        @Override
+        int execute() {
+            return value;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ReturnTypeSpecializationTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.FrameDescriptor;
+import com.oracle.truffle.api.frame.FrameSlot;
+import com.oracle.truffle.api.frame.FrameSlotKind;
+import com.oracle.truffle.api.frame.FrameSlotTypeException;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.nodes.UnexpectedResultException;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Specializing Return Types</h3>
+ *
+ * <p>
+ * In order to avoid boxing and/or type casts on the return value of a node, the return value the
+ * method for executing a node can have a specific type and need not be of type
+ * {@link java.lang.Object}. For dynamically typed languages, this return type is something that
+ * should be speculated on. When the speculation fails and the child node cannot return the
+ * appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the
+ * result to the caller. In such a case, the caller must rewrite itself to a more general version in
+ * order to avoid future failures of this kind.
+ * </p>
+ */
+public class ReturnTypeSpecializationTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        FrameDescriptor frameDescriptor = new FrameDescriptor();
+        FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int);
+        TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot));
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Assert.assertEquals(FrameSlotKind.Int, slot.getKind());
+        Object result = target.call();
+        Assert.assertEquals("42", result);
+        Assert.assertEquals(FrameSlotKind.Object, slot.getKind());
+    }
+
+    class TestRootNode extends RootNode {
+
+        @Child TestChildNode left;
+        @Child TestChildNode right;
+
+        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
+            super(TestingLanguage.class, null, descriptor);
+            this.left = left;
+            this.right = right;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            left.execute(frame);
+            return right.execute(frame);
+        }
+    }
+
+    abstract class TestChildNode extends Node {
+
+        public TestChildNode() {
+            super(null);
+        }
+
+        abstract Object execute(VirtualFrame frame);
+
+        int executeInt(VirtualFrame frame) throws UnexpectedResultException {
+            Object result = execute(frame);
+            if (result instanceof Integer) {
+                return (Integer) result;
+            }
+            throw new UnexpectedResultException(result);
+        }
+    }
+
+    abstract class FrameSlotNode extends TestChildNode {
+
+        protected final FrameSlot slot;
+
+        public FrameSlotNode(FrameSlot slot) {
+            this.slot = slot;
+        }
+    }
+
+    class StringTestChildNode extends TestChildNode {
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            return "42";
+        }
+
+    }
+
+    class IntAssignLocal extends FrameSlotNode {
+
+        @Child private TestChildNode value;
+
+        IntAssignLocal(FrameSlot slot, TestChildNode value) {
+            super(slot);
+            this.value = value;
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            try {
+                int result = value.executeInt(frame);
+                frame.setInt(slot, result);
+            } catch (UnexpectedResultException e) {
+                slot.setKind(FrameSlotKind.Object);
+                frame.setObject(slot, e.getResult());
+                replace(new ObjectAssignLocal(slot, value));
+            }
+            return null;
+        }
+    }
+
+    class ObjectAssignLocal extends FrameSlotNode {
+
+        @Child private TestChildNode value;
+
+        ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
+            super(slot);
+            this.value = value;
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            Object o = value.execute(frame);
+            slot.setKind(FrameSlotKind.Object);
+            frame.setObject(slot, o);
+            return null;
+        }
+    }
+
+    class IntReadLocal extends FrameSlotNode {
+
+        IntReadLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            try {
+                return frame.getInt(slot);
+            } catch (FrameSlotTypeException e) {
+                return replace(new ObjectReadLocal(slot)).execute(frame);
+            }
+        }
+
+        @Override
+        int executeInt(VirtualFrame frame) throws UnexpectedResultException {
+            try {
+                return frame.getInt(slot);
+            } catch (FrameSlotTypeException e) {
+                return replace(new ObjectReadLocal(slot)).executeInt(frame);
+            }
+        }
+    }
+
+    class ObjectReadLocal extends FrameSlotNode {
+
+        ObjectReadLocal(FrameSlot slot) {
+            super(slot);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            try {
+                return frame.getObject(slot);
+            } catch (FrameSlotTypeException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/RootNodeTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Creating a Root Node</h3>
+ *
+ * <p>
+ * A Truffle root node is the entry point into a Truffle tree that represents a guest language
+ * method. It contains a {@link RootNode#execute(VirtualFrame)} method that can return a
+ * {@link java.lang.Object} value as the result of the guest language method invocation. This method
+ * must however never be called directly. Instead, the Truffle runtime must be used to create a
+ * {@link CallTarget} object from a root node using the
+ * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be
+ * executed using the {@link CallTarget#call(Object...)} method or one of its overloads.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.ChildNodeTest}.
+ * </p>
+ */
+public class RootNodeTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void test() {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestRootNode rootNode = new TestRootNode();
+        CallTarget target = runtime.createCallTarget(rootNode);
+        Object result = target.call();
+        Assert.assertEquals(42, result);
+    }
+
+    class TestRootNode extends RootNode {
+
+        public TestRootNode() {
+            super(TestingLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return 42;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/TestingLanguage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,84 @@
+/*
+ * 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.truffle.api;
+
+import java.io.IOException;
+
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.instrument.Visualizer;
+import com.oracle.truffle.api.instrument.WrapperNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.source.Source;
+
+public final class TestingLanguage extends TruffleLanguage<Object> {
+    public static final TestingLanguage INSTANCE = new TestingLanguage();
+
+    private TestingLanguage() {
+    }
+
+    @Override
+    protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
+        throw new IOException();
+    }
+
+    @Override
+    protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
+        return null;
+    }
+
+    @Override
+    protected Object getLanguageGlobal(Object context) {
+        return null;
+    }
+
+    @Override
+    protected boolean isObjectOfLanguage(Object object) {
+        return false;
+    }
+
+    @Override
+    protected Visualizer getVisualizer() {
+        return null;
+    }
+
+    @Override
+    protected boolean isInstrumentable(Node node) {
+        return false;
+    }
+
+    @Override
+    protected WrapperNode createWrapperNode(Node node) {
+        return null;
+    }
+
+    @Override
+    protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
+        return null;
+    }
+
+    @Override
+    protected Object createContext(Env env) {
+        return null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/ThreadSafetyTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,194 @@
+/*
+ * 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.truffle.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Random;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.DirectCallNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeUtil;
+import com.oracle.truffle.api.nodes.RootNode;
+
+/**
+ * Test node rewriting in a tree shared across multiple threads (run with -ea).
+ */
+public class ThreadSafetyTest {
+
+    @Test
+    @Ignore("sporadic failures with \"expected:<1000000> but was:<999999>\"")
+    public void test() throws InterruptedException {
+        TruffleRuntime runtime = Truffle.getRuntime();
+        TestRootNode rootNode1 = new TestRootNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new ConstNode(42)))))));
+        final CallTarget target1 = runtime.createCallTarget(rootNode1);
+        NodeUtil.verify(rootNode1);
+
+        RecursiveCallNode callNode = new RecursiveCallNode(new ConstNode(42));
+        TestRootNode rootNode2 = new TestRootNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(callNode))))));
+        final CallTarget target2 = runtime.createCallTarget(rootNode2);
+        callNode.setCallNode(runtime.createDirectCallNode(target2));
+        NodeUtil.verify(rootNode2);
+
+        testTarget(target1, 47, 1_000_000);
+        testTarget(target2, 72, 1_000_000);
+    }
+
+    private static void testTarget(final CallTarget target, final int expectedResult, final int numberOfIterations) throws InterruptedException {
+        ExecutorService executorService = Executors.newFixedThreadPool(20);
+        final AtomicInteger ai = new AtomicInteger();
+        for (int i = 0; i < numberOfIterations; i++) {
+            executorService.submit(new Runnable() {
+                public void run() {
+                    try {
+                        Object result = target.call(new Object[]{5});
+                        assertEquals(expectedResult, result);
+                        ai.incrementAndGet();
+                    } catch (Throwable t) {
+                        t.printStackTrace(System.out);
+                    }
+                }
+            });
+        }
+        executorService.shutdown();
+        executorService.awaitTermination(90, TimeUnit.SECONDS);
+        assertTrue("test did not terminate", executorService.isTerminated());
+        assertEquals(numberOfIterations, ai.get());
+    }
+
+    static class TestRootNode extends RootNode {
+
+        @Child private ValueNode child;
+
+        public TestRootNode(ValueNode child) {
+            super(TestingLanguage.class, null, null);
+            this.child = child;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return child.execute(frame);
+        }
+    }
+
+    abstract static class ValueNode extends Node {
+
+        public ValueNode() {
+            super(null);
+        }
+
+        abstract int execute(VirtualFrame frame);
+    }
+
+    static class RewritingNode extends ValueNode {
+
+        @Child private ValueNode child;
+        private final Random random;
+
+        public RewritingNode(ValueNode child) {
+            this(child, new Random());
+        }
+
+        public RewritingNode(ValueNode child, Random random) {
+            this.child = child;
+            this.random = random;
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            boolean replace = random.nextBoolean();
+            if (replace) {
+                ValueNode newNode = this.replace(new OtherRewritingNode(child, random));
+                return newNode.execute(frame);
+            }
+            return 1 + child.execute(frame);
+        }
+    }
+
+    static class OtherRewritingNode extends ValueNode {
+
+        @Child private ValueNode child;
+        private final Random random;
+
+        public OtherRewritingNode(ValueNode child, Random random) {
+            this.child = child;
+            this.random = random;
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            boolean replace = random.nextBoolean();
+            if (replace) {
+                ValueNode newNode = this.replace(new RewritingNode(child, random));
+                return newNode.execute(frame);
+            }
+            return 1 + child.execute(frame);
+        }
+    }
+
+    static class ConstNode extends ValueNode {
+
+        private final int value;
+
+        ConstNode(int value) {
+            this.value = value;
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            return value;
+        }
+    }
+
+    static class RecursiveCallNode extends ValueNode {
+        @Child DirectCallNode callNode;
+        @Child private ValueNode valueNode;
+
+        RecursiveCallNode(ValueNode value) {
+            this.valueNode = value;
+        }
+
+        @Override
+        int execute(VirtualFrame frame) {
+            int arg = (Integer) frame.getArguments()[0];
+            if (arg > 0) {
+                return (int) callNode.call(frame, new Object[]{(arg - 1)});
+            } else {
+                return valueNode.execute(frame);
+            }
+        }
+
+        void setCallNode(DirectCallNode callNode) {
+            this.callNode = insert(callNode);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/TruffleRuntimeTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2012, 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.NodeUtil;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.source.SourceSection;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+/**
+ * <h3>Accessing the Truffle Runtime</h3>
+ *
+ * <p>
+ * The Truffle runtime can be accessed at any point in time globally using the static method
+ * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime
+ * object with an identifying name. A Java Virtual Machine implementation can chose to replace the
+ * default implementation of the {@link TruffleRuntime} interface with its own implementation for
+ * providing improved performance.
+ * </p>
+ *
+ * <p>
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.RootNodeTest}.
+ * </p>
+ */
+public class TruffleRuntimeTest {
+
+    private TruffleRuntime runtime;
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+        this.runtime = Truffle.getRuntime();
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    private static RootNode createTestRootNode(SourceSection sourceSection) {
+        return new RootNode(TestingLanguage.class, sourceSection, null) {
+            @Override
+            public Object execute(VirtualFrame frame) {
+                return 42;
+            }
+        };
+    }
+
+    // @Test
+    public void verifyTheRealRuntimeIsUsedOnRealGraal() {
+        TruffleRuntime r = Truffle.getRuntime();
+        final String name = r.getClass().getName();
+        if (name.endsWith("DefaultTruffleRuntime")) {
+            fail("Wrong name " + name + " with following System.getProperties:\n" + System.getProperties().toString());
+        }
+    }
+
+    @Test
+    public void test() {
+        assertNotNull(runtime);
+        assertNotNull(runtime.getName());
+    }
+
+    @Test
+    public void testCreateCallTarget() {
+        RootNode rootNode = createTestRootNode(null);
+        RootCallTarget target = runtime.createCallTarget(rootNode);
+        assertNotNull(target);
+        assertEquals(target.call(), 42);
+        assertSame(rootNode, target.getRootNode());
+    }
+
+    @Test
+    public void testGetCallTargets1() {
+        RootNode rootNode = createTestRootNode(null);
+        RootCallTarget target = runtime.createCallTarget(rootNode);
+        assertTrue(runtime.getCallTargets().contains(target));
+    }
+
+    @Test
+    public void testGetCallTargets2() {
+        RootNode rootNode = createTestRootNode(null);
+        RootCallTarget target1 = runtime.createCallTarget(rootNode);
+        RootCallTarget target2 = runtime.createCallTarget(rootNode);
+        assertTrue(runtime.getCallTargets().contains(target1));
+        assertTrue(runtime.getCallTargets().contains(target2));
+    }
+
+    /*
+     * This test case documents the use case for profilers and debuggers where they need to access
+     * multiple call targets for the same source section. This case may happen when the optimization
+     * system decides to duplicate call targets to achieve better performance.
+     */
+    @Test
+    public void testGetCallTargets3() {
+        Source source1 = Source.fromText("a\nb\n", "");
+        SourceSection sourceSection1 = source1.createSection("foo", 1);
+        SourceSection sourceSection2 = source1.createSection("bar", 2);
+
+        RootNode rootNode1 = createTestRootNode(sourceSection1);
+        RootNode rootNode2 = createTestRootNode(sourceSection2);
+        RootNode rootNode2Copy = NodeUtil.cloneNode(rootNode2);
+
+        assertSame(rootNode2.getSourceSection(), rootNode2Copy.getSourceSection());
+
+        RootCallTarget target1 = runtime.createCallTarget(rootNode1);
+        RootCallTarget target2 = runtime.createCallTarget(rootNode2);
+        RootCallTarget target2Copy = runtime.createCallTarget(rootNode2Copy);
+
+        Map<SourceSection, List<RootCallTarget>> groupedTargets = groupUniqueCallTargets();
+
+        List<RootCallTarget> targets1 = groupedTargets.get(sourceSection1);
+        assertEquals(1, targets1.size());
+        assertEquals(target1, targets1.get(0));
+
+        List<RootCallTarget> targets2 = groupedTargets.get(sourceSection2);
+        assertEquals(2, targets2.size());
+        // order of targets2 is not guaranteed
+        assertTrue(target2 == targets2.get(0) ^ target2Copy == targets2.get(0));
+        assertTrue(target2 == targets2.get(1) ^ target2Copy == targets2.get(1));
+    }
+
+    private static Map<SourceSection, List<RootCallTarget>> groupUniqueCallTargets() {
+        Map<SourceSection, List<RootCallTarget>> groupedTargets = new HashMap<>();
+        for (RootCallTarget target : Truffle.getRuntime().getCallTargets()) {
+            SourceSection section = target.getRootNode().getSourceSection();
+            if (section == null) {
+                // can not identify root node to a unique call target. Print warning?
+                continue;
+            }
+            List<RootCallTarget> targets = groupedTargets.get(section);
+            if (targets == null) {
+                targets = new ArrayList<>();
+                groupedTargets.put(section, targets);
+            }
+            targets.add(target);
+        }
+        return groupedTargets;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/impl/AccessorTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,62 @@
+/*
+ * 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.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;
+import org.junit.Test;
+
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.vm.ImplicitExplicitExportTest.ExportImportLanguage1;
+import static com.oracle.truffle.api.vm.ImplicitExplicitExportTest.L1;
+import com.oracle.truffle.api.vm.PolyglotEngine;
+
+public class AccessorTest {
+    public static Accessor API;
+
+    @BeforeClass
+    public static void initAccessors() throws Exception {
+        Field f = Accessor.class.getDeclaredField("API");
+        f.setAccessible(true);
+        API = (Accessor) f.get(null);
+    }
+
+    @Test
+    public void canGetAccessToOwnLanguageInstance() throws Exception {
+        PolyglotEngine vm = PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor()).build();
+        PolyglotEngine.Language language = vm.getLanguages().get(L1);
+        assertNotNull("L1 language is defined", language);
+
+        Source s = Source.fromText("return nothing", "nothing");
+        Object ret = language.eval(s).get();
+        assertNull("nothing is returned", ret);
+
+        ExportImportLanguage1 afterInitialization = Accessor.findLanguageByClass(vm, ExportImportLanguage1.class);
+        assertNotNull("Language found", afterInitialization);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/instrument/EvalInstrumentTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,134 @@
+/*
+ * 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.truffle.api.instrument;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.instrument.InstrumentationTestingLanguage.InstrumentTestTag;
+import com.oracle.truffle.api.instrument.impl.DefaultProbeListener;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.vm.PolyglotEngine;
+
+/**
+ * Tests the kind of instrumentation where a client can provide guest language code to be
+ * <em>spliced</em> directly into the AST.
+ */
+public class EvalInstrumentTest {
+
+    PolyglotEngine vm;
+    Instrumenter instrumenter;
+
+    @Before
+    public void before() {
+        // TODO (mlvdv) eventually abstract this
+        try {
+            vm = PolyglotEngine.newBuilder().build();
+            final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
+            field.setAccessible(true);
+            instrumenter = (Instrumenter) field.get(vm);
+            final java.lang.reflect.Field testVMField = Instrumenter.class.getDeclaredField("testVM");
+            testVMField.setAccessible(true);
+            testVMField.set(instrumenter, vm);
+        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
+            fail("Reflective access to Instrumenter for testing");
+        }
+    }
+
+    @After
+    public void after() {
+        vm.dispose();
+        vm = null;
+        instrumenter = null;
+    }
+
+    @Test
+    public void testEvalInstrumentListener() throws IOException {
+
+        instrumenter.registerASTProber(new InstrumentationTestingLanguage.TestASTProber());
+        final Source source13 = InstrumentationTestingLanguage.createAdditionSource13("testEvalInstrumentListener");
+
+        final Probe[] addNodeProbe = new Probe[1];
+        instrumenter.addProbeListener(new DefaultProbeListener() {
+
+            @Override
+            public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
+                if (tag == InstrumentTestTag.ADD_TAG) {
+                    addNodeProbe[0] = probe;
+                }
+            }
+        });
+        assertEquals(vm.eval(source13).get(), 13);
+        assertNotNull("Add node should be probed", addNodeProbe[0]);
+
+        final Source source42 = InstrumentationTestingLanguage.createConstantSource42("testEvalInstrumentListener");
+        final int[] evalResult = {0};
+        final int[] evalCount = {0};
+        final Instrument instrument = instrumenter.attach(addNodeProbe[0], source42, new EvalInstrumentListener() {
+
+            public void onExecution(Node node, VirtualFrame vFrame, Object result) {
+                evalCount[0] = evalCount[0] + 1;
+                if (result instanceof Integer) {
+                    evalResult[0] = (Integer) result;
+                }
+            }
+
+            public void onFailure(Node node, VirtualFrame vFrame, Exception ex) {
+                fail("Eval test evaluates without exception");
+
+            }
+        }, "test EvalInstrument", null);
+
+        assertEquals(vm.eval(source13).get(), 13);
+        assertEquals(evalCount[0], 1);
+        assertEquals(evalResult[0], 42);
+
+        // Second execution; same result
+        assertEquals(vm.eval(source13).get(), 13);
+        assertEquals(evalCount[0], 2);
+        assertEquals(evalResult[0], 42);
+
+        // Add new eval instrument with no listener, no effect on third execution
+        instrumenter.attach(addNodeProbe[0], source42, null, "", null);
+        assertEquals(vm.eval(source13).get(), 13);
+        assertEquals(evalCount[0], 3);
+        assertEquals(evalResult[0], 42);
+
+        // Remove original instrument; no further effect from fourth execution
+        instrument.dispose();
+        evalResult[0] = 0;
+        assertEquals(vm.eval(source13).get(), 13);
+        assertEquals(evalCount[0], 3);
+        assertEquals(evalResult[0], 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/instrument/InstrumentationTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,377 @@
+/*
+ * 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.truffle.api.instrument;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestAdditionNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestLanguageNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestValueNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestingLanguage.InstrumentTestTag;
+import com.oracle.truffle.api.instrument.impl.DefaultProbeListener;
+import com.oracle.truffle.api.instrument.impl.DefaultSimpleInstrumentListener;
+import com.oracle.truffle.api.instrument.impl.DefaultStandardInstrumentListener;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeVisitor;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.vm.PolyglotEngine;
+
+/**
+ * <h3>AST Instrumentation</h3>
+ *
+ * Instrumentation allows the insertion into Truffle ASTs language-specific instances of
+ * {@link WrapperNode} that propagate execution events through a {@link Probe} to any instances of
+ * {@link ProbeInstrument} that might be attached to the particular probe by tools.
+ */
+public class InstrumentationTest {
+
+    @Test
+    public void testProbing() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException {
+        final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
+        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
+        field.setAccessible(true);
+        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
+        instrumenter.registerASTProber(new TestASTProber(instrumenter));
+        final Source source = InstrumentationTestingLanguage.createAdditionSource13("testProbing");
+
+        final Probe[] probes = new Probe[3];
+        instrumenter.addProbeListener(new DefaultProbeListener() {
+
+            @Override
+            public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
+                if (tag == InstrumentTestTag.ADD_TAG) {
+                    assertEquals(probes[0], null);
+                    probes[0] = probe;
+                } else if (tag == InstrumentTestTag.VALUE_TAG) {
+                    if (probes[1] == null) {
+                        probes[1] = probe;
+                    } else if (probes[2] == null) {
+                        probes[2] = probe;
+                    } else {
+                        fail("Should only be three probes");
+                    }
+                }
+            }
+        });
+        assertEquals(vm.eval(source).get(), 13);
+        assertNotNull("Add node should be probed", probes[0]);
+        assertNotNull("Value nodes should be probed", probes[1]);
+        assertNotNull("Value nodes should be probed", probes[2]);
+        // Check instrumentation with the simplest kind of counters.
+        // They should all be removed when the check is finished.
+        checkCounters(probes[0], vm, source, new TestSimpleInstrumentCounter(instrumenter), new TestSimpleInstrumentCounter(instrumenter), new TestSimpleInstrumentCounter(instrumenter));
+
+        // Now try with the more complex flavor of listener
+        checkCounters(probes[0], vm, source, new TestStandardInstrumentCounter(instrumenter), new TestStandardInstrumentCounter(instrumenter), new TestStandardInstrumentCounter(instrumenter));
+
+    }
+
+    @Test
+    public void testTagging() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException {
+
+        final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
+        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
+        field.setAccessible(true);
+        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
+        final Source source = InstrumentationTestingLanguage.createAdditionSource13("testTagging");
+
+        // Applies appropriate tags
+        final TestASTProber astProber = new TestASTProber(instrumenter);
+        instrumenter.registerASTProber(astProber);
+
+        // Listens for probes and tags being added
+        final TestProbeListener probeListener = new TestProbeListener();
+        instrumenter.addProbeListener(probeListener);
+
+        assertEquals(13, vm.eval(source).get());
+
+        // Check that the prober added probes to the tree
+        assertEquals(probeListener.probeCount, 3);
+        assertEquals(probeListener.tagCount, 3);
+
+        assertEquals(instrumenter.findProbesTaggedAs(InstrumentTestTag.ADD_TAG).size(), 1);
+        assertEquals(instrumenter.findProbesTaggedAs(InstrumentTestTag.VALUE_TAG).size(), 2);
+    }
+
+    private static void checkCounters(Probe probe, PolyglotEngine vm, Source source, TestCounter counterA, TestCounter counterB, TestCounter counterC) throws IOException {
+
+        // Attach a counting instrument to the probe
+        counterA.attach(probe);
+
+        // Attach a second counting instrument to the probe
+        counterB.attach(probe);
+
+        // Run it again and check that the two instruments are working
+        assertEquals(13, vm.eval(source).get());
+        assertEquals(counterA.enterCount(), 1);
+        assertEquals(counterA.leaveCount(), 1);
+        assertEquals(counterB.enterCount(), 1);
+        assertEquals(counterB.leaveCount(), 1);
+
+        // Remove counterA
+        counterA.dispose();
+
+        // Run it again and check that instrument B is still working but not A
+        assertEquals(13, vm.eval(source).get());
+        assertEquals(counterA.enterCount(), 1);
+        assertEquals(counterA.leaveCount(), 1);
+        assertEquals(counterB.enterCount(), 2);
+        assertEquals(counterB.leaveCount(), 2);
+
+        // Attach a second instrument to the probe
+        counterC.attach(probe);
+
+        // Run the original and check that instruments B,C working but not A
+        assertEquals(13, vm.eval(source).get());
+        assertEquals(counterA.enterCount(), 1);
+        assertEquals(counterA.leaveCount(), 1);
+        assertEquals(counterB.enterCount(), 3);
+        assertEquals(counterB.leaveCount(), 3);
+        assertEquals(counterC.enterCount(), 1);
+        assertEquals(counterC.leaveCount(), 1);
+
+        // Remove instrumentC
+        counterC.dispose();
+
+        // Run the original and check that instrument B working but not A,C
+        assertEquals(13, vm.eval(source).get());
+        assertEquals(counterA.enterCount(), 1);
+        assertEquals(counterA.leaveCount(), 1);
+        assertEquals(counterB.enterCount(), 4);
+        assertEquals(counterB.leaveCount(), 4);
+        assertEquals(counterC.enterCount(), 1);
+        assertEquals(counterC.leaveCount(), 1);
+
+        // Remove instrumentB
+        counterB.dispose();
+
+        // Check that no instruments working
+        assertEquals(13, vm.eval(source).get());
+        assertEquals(counterA.enterCount(), 1);
+        assertEquals(counterA.leaveCount(), 1);
+        assertEquals(counterB.enterCount(), 4);
+        assertEquals(counterB.leaveCount(), 4);
+        assertEquals(counterC.enterCount(), 1);
+        assertEquals(counterC.leaveCount(), 1);
+    }
+
+    private interface TestCounter {
+
+        int enterCount();
+
+        int leaveCount();
+
+        void attach(Probe probe);
+
+        void dispose();
+    }
+
+    /**
+     * A counter for the number of times execution enters and leaves a probed AST node.
+     */
+    private class TestSimpleInstrumentCounter implements TestCounter {
+
+        public int enterCount = 0;
+        public int leaveCount = 0;
+        public Instrumenter instrumenter;
+        private ProbeInstrument instrument;
+
+        public TestSimpleInstrumentCounter(Instrumenter instrumenter) {
+            this.instrumenter = instrumenter;
+        }
+
+        @Override
+        public int enterCount() {
+            return enterCount;
+        }
+
+        @Override
+        public int leaveCount() {
+            return leaveCount;
+        }
+
+        @Override
+        public void attach(Probe probe) {
+            instrument = instrumenter.attach(probe, new SimpleInstrumentListener() {
+
+                public void onEnter(Probe p) {
+                    enterCount++;
+                }
+
+                public void onReturnVoid(Probe p) {
+                    leaveCount++;
+                }
+
+                public void onReturnValue(Probe p, Object result) {
+                    leaveCount++;
+                }
+
+                public void onReturnExceptional(Probe p, Throwable exception) {
+                    leaveCount++;
+                }
+            }, "Instrumentation Test Counter");
+        }
+
+        @Override
+        public void dispose() {
+            instrument.dispose();
+        }
+    }
+
+    /**
+     * A counter for the number of times execution enters and leaves a probed AST node.
+     */
+    private class TestStandardInstrumentCounter implements TestCounter {
+
+        public int enterCount = 0;
+        public int leaveCount = 0;
+        public final Instrumenter instrumenter;
+        public ProbeInstrument instrument;
+
+        public TestStandardInstrumentCounter(Instrumenter instrumenter) {
+            this.instrumenter = instrumenter;
+        }
+
+        @Override
+        public int enterCount() {
+            return enterCount;
+        }
+
+        @Override
+        public int leaveCount() {
+            return leaveCount;
+        }
+
+        @Override
+        public void attach(Probe probe) {
+            instrument = instrumenter.attach(probe, new StandardInstrumentListener() {
+
+                public void onEnter(Probe p, Node node, VirtualFrame vFrame) {
+                    enterCount++;
+                }
+
+                public void onReturnVoid(Probe p, Node node, VirtualFrame vFrame) {
+                    leaveCount++;
+                }
+
+                public void onReturnValue(Probe p, Node node, VirtualFrame vFrame, Object result) {
+                    leaveCount++;
+                }
+
+                public void onReturnExceptional(Probe p, Node node, VirtualFrame vFrame, Throwable exception) {
+                    leaveCount++;
+                }
+            }, "Instrumentation Test Counter");
+        }
+
+        @Override
+        public void dispose() {
+            instrument.dispose();
+        }
+    }
+
+    /**
+     * Tags selected nodes on newly constructed ASTs.
+     */
+    private static final class TestASTProber implements NodeVisitor, ASTProber {
+
+        private final Instrumenter instrumenter;
+
+        TestASTProber(Instrumenter instrumenter) {
+            this.instrumenter = instrumenter;
+        }
+
+        @Override
+        public boolean visit(Node node) {
+            if (node instanceof TestLanguageNode) {
+
+                final TestLanguageNode testNode = (TestLanguageNode) node;
+
+                if (node instanceof TestValueNode) {
+                    instrumenter.probe(testNode).tagAs(InstrumentTestTag.VALUE_TAG, null);
+
+                } else if (node instanceof TestAdditionNode) {
+                    instrumenter.probe(testNode).tagAs(InstrumentTestTag.ADD_TAG, null);
+
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public void probeAST(Instrumenter inst, RootNode rootNode) {
+            rootNode.accept(this);
+        }
+    }
+
+    /**
+     * Counts the number of "enter" events at probed nodes using the simplest AST listener.
+     */
+    static final class TestSimpleInstrumentListener extends DefaultSimpleInstrumentListener {
+
+        public int counter = 0;
+
+        @Override
+        public void onEnter(Probe probe) {
+            counter++;
+        }
+    }
+
+    /**
+     * Counts the number of "enter" events at probed nodes using the AST listener.
+     */
+    static final class TestASTInstrumentListener extends DefaultStandardInstrumentListener {
+
+        public int counter = 0;
+
+        @Override
+        public void onEnter(Probe probe, Node node, VirtualFrame vFrame) {
+            counter++;
+        }
+    }
+
+    private static final class TestProbeListener extends DefaultProbeListener {
+
+        public int probeCount = 0;
+        public int tagCount = 0;
+
+        @Override
+        public void newProbeInserted(Probe probe) {
+            probeCount++;
+        }
+
+        @Override
+        public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
+            tagCount++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/instrument/InstrumentationTestNodes.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,182 @@
+/*
+ * 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.truffle.api.instrument;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeCost;
+import com.oracle.truffle.api.nodes.NodeInfo;
+import com.oracle.truffle.api.nodes.RootNode;
+
+/**
+ * Tests instrumentation where a client can attach a node that gets attached into the AST.
+ */
+class InstrumentationTestNodes {
+
+    abstract static class TestLanguageNode extends Node {
+        public abstract Object execute(VirtualFrame vFrame);
+
+    }
+
+    @NodeInfo(cost = NodeCost.NONE)
+    static class TestLanguageWrapperNode extends TestLanguageNode implements WrapperNode {
+        @Child private TestLanguageNode child;
+        @Child private EventHandlerNode eventHandlerNode;
+
+        public TestLanguageWrapperNode(TestLanguageNode child) {
+            assert !(child instanceof TestLanguageWrapperNode);
+            this.child = child;
+        }
+
+        @Override
+        public String instrumentationInfo() {
+            return "Wrapper node for testing";
+        }
+
+        @Override
+        public void insertEventHandlerNode(EventHandlerNode eventHandler) {
+            this.eventHandlerNode = eventHandler;
+        }
+
+        @Override
+        public Probe getProbe() {
+            return eventHandlerNode.getProbe();
+        }
+
+        @Override
+        public Node getChild() {
+            return child;
+        }
+
+        @Override
+        public Object execute(VirtualFrame vFrame) {
+            eventHandlerNode.enter(child, vFrame);
+            Object result;
+            try {
+                result = child.execute(vFrame);
+                eventHandlerNode.returnValue(child, vFrame, result);
+            } catch (Exception e) {
+                eventHandlerNode.returnExceptional(child, vFrame, e);
+                throw (e);
+            }
+            return result;
+        }
+    }
+
+    /**
+     * A simple node for our test language to store a value.
+     */
+    static class TestValueNode extends TestLanguageNode {
+        private final int value;
+
+        public TestValueNode(int value) {
+            this.value = value;
+        }
+
+        @Override
+        public Object execute(VirtualFrame vFrame) {
+            return new Integer(this.value);
+        }
+    }
+
+    /**
+     * A node for our test language that adds up two {@link TestValueNode}s.
+     */
+    static class TestAdditionNode extends TestLanguageNode {
+        @Child private TestLanguageNode leftChild;
+        @Child private TestLanguageNode rightChild;
+
+        public TestAdditionNode(TestValueNode leftChild, TestValueNode rightChild) {
+            this.leftChild = insert(leftChild);
+            this.rightChild = insert(rightChild);
+        }
+
+        @Override
+        public Object execute(VirtualFrame vFrame) {
+            return new Integer(((Integer) leftChild.execute(vFrame)).intValue() + ((Integer) rightChild.execute(vFrame)).intValue());
+        }
+    }
+
+    /**
+     * Truffle requires that all guest languages to have a {@link RootNode} which sits atop any AST
+     * of the guest language. This is necessary since creating a {@link CallTarget} is how Truffle
+     * completes an AST. The root nodes serves as our entry point into a program.
+     */
+    static class InstrumentationTestRootNode extends RootNode {
+        @Child private TestLanguageNode body;
+
+        /**
+         * This constructor emulates the global machinery that applies registered probers to every
+         * newly created AST. Global registry is not used, since that would interfere with other
+         * tests run in the same environment.
+         */
+        public InstrumentationTestRootNode(TestLanguageNode body) {
+            super(InstrumentationTestingLanguage.class, null, null);
+            this.body = body;
+        }
+
+        @Override
+        public Object execute(VirtualFrame vFrame) {
+            return body.execute(vFrame);
+        }
+
+        @Override
+        public boolean isCloningAllowed() {
+            return true;
+        }
+    }
+
+    /**
+     * Truffle requires that all guest languages to have a {@link RootNode} which sits atop any AST
+     * of the guest language. This is necessary since creating a {@link CallTarget} is how Truffle
+     * completes an AST. The root nodes serves as our entry point into a program.
+     */
+    static class TestRootNode extends RootNode {
+        @Child private TestLanguageNode body;
+
+        final Instrumenter instrumenter;
+
+        /**
+         * This constructor emulates the global machinery that applies registered probers to every
+         * newly created AST. Global registry is not used, since that would interfere with other
+         * tests run in the same environment.
+         */
+        public TestRootNode(TestLanguageNode body, Instrumenter instrumenter) {
+            super(InstrumentationTestingLanguage.class, null, null);
+            this.instrumenter = instrumenter;
+            this.body = body;
+        }
+
+        @Override
+        public Object execute(VirtualFrame vFrame) {
+            return body.execute(vFrame);
+        }
+
+        @Override
+        public boolean isCloningAllowed() {
+            return true;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/instrument/InstrumentationTestingLanguage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,175 @@
+/*
+ * 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.truffle.api.instrument;
+
+import java.io.IOException;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.TruffleRuntime;
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.InstrumentationTestRootNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestAdditionNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestLanguageNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestLanguageWrapperNode;
+import com.oracle.truffle.api.instrument.InstrumentationTestNodes.TestValueNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeVisitor;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+
+@TruffleLanguage.Registration(name = "instrumentationTestLanguage", version = "0", mimeType = "text/x-instTest")
+public final class InstrumentationTestingLanguage extends TruffleLanguage<Object> {
+
+    public static final InstrumentationTestingLanguage INSTANCE = new InstrumentationTestingLanguage();
+
+    private static final String ADD_SOURCE_TEXT = "Fake source text for testing:  parses to 6 + 7";
+    private static final String CONSTANT_SOURCE_TEXT = "Fake source text for testing: parses to 42";
+
+    /** Use a unique test name to avoid unexpected CallTarget sharing. */
+    static Source createAdditionSource13(String testName) {
+        return Source.fromText(ADD_SOURCE_TEXT, testName).withMimeType("text/x-instTest");
+    }
+
+    /** Use a unique test name to avoid unexpected CallTarget sharing. */
+    static Source createConstantSource42(String testName) {
+        return Source.fromText(CONSTANT_SOURCE_TEXT, testName).withMimeType("text/x-instTest");
+    }
+
+    static enum InstrumentTestTag implements SyntaxTag {
+
+        ADD_TAG("addition", "test language addition node"),
+
+        VALUE_TAG("value", "test language value node");
+
+        private final String name;
+        private final String description;
+
+        private InstrumentTestTag(String name, String description) {
+            this.name = name;
+            this.description = description;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+    }
+
+    private InstrumentationTestingLanguage() {
+    }
+
+    @Override
+    protected CallTarget parse(Source source, Node context, String... argumentNames) throws IOException {
+        if (source.getCode().equals(ADD_SOURCE_TEXT)) {
+            final TestValueNode leftValueNode = new TestValueNode(6);
+            final TestValueNode rightValueNode = new TestValueNode(7);
+            final TestAdditionNode addNode = new TestAdditionNode(leftValueNode, rightValueNode);
+            final InstrumentationTestRootNode rootNode = new InstrumentationTestRootNode(addNode);
+            final TruffleRuntime runtime = Truffle.getRuntime();
+            final CallTarget callTarget = runtime.createCallTarget(rootNode);
+            return callTarget;
+        }
+        if (source.getCode().equals(CONSTANT_SOURCE_TEXT)) {
+            final TestValueNode constantNode = new TestValueNode(42);
+            final InstrumentationTestRootNode rootNode = new InstrumentationTestRootNode(constantNode);
+            final TruffleRuntime runtime = Truffle.getRuntime();
+            final CallTarget callTarget = runtime.createCallTarget(rootNode);
+            return callTarget;
+        }
+        return null;
+    }
+
+    @Override
+    protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
+        return null;
+    }
+
+    @Override
+    protected Object getLanguageGlobal(Object context) {
+        return null;
+    }
+
+    @Override
+    protected boolean isObjectOfLanguage(Object object) {
+        return false;
+    }
+
+    @Override
+    protected Visualizer getVisualizer() {
+        return null;
+    }
+
+    @Override
+    protected boolean isInstrumentable(Node node) {
+        return node instanceof TestAdditionNode || node instanceof TestValueNode;
+    }
+
+    @Override
+    protected WrapperNode createWrapperNode(Node node) {
+        if (isInstrumentable(node)) {
+            return new TestLanguageWrapperNode((TestLanguageNode) node);
+        }
+        return null;
+    }
+
+    @Override
+    protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
+        return null;
+    }
+
+    @Override
+    protected Object createContext(Env env) {
+        return null;
+    }
+
+    static final class TestASTProber implements ASTProber {
+
+        public void probeAST(final Instrumenter instrumenter, RootNode startNode) {
+            startNode.accept(new NodeVisitor() {
+
+                @Override
+                public boolean visit(Node node) {
+                    if (node instanceof TestLanguageNode) {
+
+                        final TestLanguageNode testNode = (TestLanguageNode) node;
+
+                        if (node instanceof TestValueNode) {
+                            instrumenter.probe(testNode).tagAs(InstrumentTestTag.VALUE_TAG, null);
+
+                        } else if (node instanceof TestAdditionNode) {
+                            instrumenter.probe(testNode).tagAs(InstrumentTestTag.ADD_TAG, null);
+
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/interop/ForeignAccessSingleThreadedTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,79 @@
+/*
+ * 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.truffle.api.interop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.nodes.Node;
+
+public class ForeignAccessSingleThreadedTest implements ForeignAccess.Factory, TruffleObject {
+    ForeignAccess fa;
+    private int cnt;
+
+    @Before
+    public void initInDifferentThread() throws InterruptedException {
+        Thread t = new Thread("Initializer") {
+            @Override
+            public void run() {
+                fa = ForeignAccess.create(ForeignAccessSingleThreadedTest.this);
+            }
+        };
+        t.start();
+        t.join();
+    }
+
+    @Test(expected = AssertionError.class)
+    public void accessNodeFromWrongThread() {
+        Node n = Message.IS_EXECUTABLE.createNode();
+        Object ret = ForeignAccess.execute(n, null, this);
+        fail("Should throw an exception: " + ret);
+    }
+
+    @After
+    public void noCallsToFactory() {
+        assertEquals("No calls to accessMessage or canHandle", 0, cnt);
+    }
+
+    @Override
+    public boolean canHandle(TruffleObject obj) {
+        cnt++;
+        return true;
+    }
+
+    @Override
+    public CallTarget accessMessage(Message tree) {
+        cnt++;
+        return null;
+    }
+
+    @Override
+    public ForeignAccess getForeignAccess() {
+        return fa;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/interop/ForeignAccessToStringTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,120 @@
+/*
+ * 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.truffle.api.interop;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.CallTarget;
+
+public class ForeignAccessToStringTest {
+    @Test
+    public void checkRegularFactory() {
+        ForeignAccess fa = ForeignAccess.create(new SimpleTestingFactory());
+        assertEquals("ForeignAccess[" + ForeignAccessToStringTest.class.getName() + "$SimpleTestingFactory]", fa.toString());
+    }
+
+    @Test
+    public void check10Factory() {
+        ForeignAccess fa = ForeignAccess.create(TruffleObject.class, new Simple10TestingFactory());
+        assertEquals("ForeignAccess[" + ForeignAccessToStringTest.class.getName() + "$Simple10TestingFactory]", fa.toString());
+    }
+
+    private static class SimpleTestingFactory implements ForeignAccess.Factory {
+        public SimpleTestingFactory() {
+        }
+
+        @Override
+        public boolean canHandle(TruffleObject obj) {
+            return false;
+        }
+
+        @Override
+        public CallTarget accessMessage(Message tree) {
+            return null;
+        }
+    }
+
+    private static class Simple10TestingFactory implements ForeignAccess.Factory10 {
+        @Override
+        public CallTarget accessIsNull() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessIsExecutable() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessIsBoxed() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessHasSize() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessGetSize() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessUnbox() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessRead() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessWrite() {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessExecute(int argumentsLength) {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessInvoke(int argumentsLength) {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessMessage(Message unknown) {
+            return null;
+        }
+
+        @Override
+        public CallTarget accessNew(int argumentsLength) {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/interop/MessageStringTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,108 @@
+/*
+ * 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.truffle.api.interop;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Locale;
+
+import org.junit.Test;
+
+public class MessageStringTest {
+
+    @Test
+    public void testFields() throws Exception {
+        for (Field f : Message.class.getFields()) {
+            if (f.getType() != Message.class) {
+                continue;
+            }
+            if ((f.getModifiers() & Modifier.STATIC) == 0) {
+                continue;
+            }
+            Message msg = (Message) f.get(null);
+
+            String persistent = Message.toString(msg);
+            assertNotNull("Found name for " + f, persistent);
+            assertEquals("It is in upper case", persistent, persistent.toUpperCase(Locale.ENGLISH));
+
+            Message newMsg = Message.valueOf(persistent);
+
+            assertSame("Same for " + f, msg, newMsg);
+
+            assertEquals("Same toString()", persistent, msg.toString());
+        }
+    }
+
+    @Test
+    public void testFactoryMethods() throws Exception {
+        for (Method m : Message.class.getMethods()) {
+            if (m.getReturnType() != Message.class) {
+                continue;
+            }
+            if (!m.getName().startsWith("create")) {
+                continue;
+            }
+            if ((m.getModifiers() & Modifier.STATIC) == 0) {
+                continue;
+            }
+            Message msg = (Message) m.invoke(null, 0);
+
+            String persistent = Message.toString(msg);
+            assertNotNull("Found name for " + m, persistent);
+            assertEquals("It is in upper case", persistent, persistent.toUpperCase(Locale.ENGLISH));
+
+            Message newMsg = Message.valueOf(persistent);
+
+            assertEquals("Same for " + m, msg, newMsg);
+
+            assertEquals("Same toString()", persistent, msg.toString());
+            assertEquals("Same toString() for new one", persistent, newMsg.toString());
+        }
+    }
+
+    @Test
+    public void specialMessagePersitance() {
+        SpecialMsg msg = new SpecialMsg();
+        String persistent = Message.toString(msg);
+        Message newMsg = Message.valueOf(persistent);
+        assertEquals("Message reconstructed", msg, newMsg);
+    }
+
+    public static final class SpecialMsg extends Message {
+
+        @Override
+        public boolean equals(Object message) {
+            return message instanceof SpecialMsg;
+        }
+
+        @Override
+        public int hashCode() {
+            return 5425432;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/nodes/NodeUtilTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012, 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.nodes;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Iterator;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.TestingLanguage;
+import com.oracle.truffle.api.frame.VirtualFrame;
+
+public class NodeUtilTest {
+
+    @Test
+    public void testRecursiveIterator1() {
+        TestRootNode root = new TestRootNode();
+        root.child0 = new TestNode();
+        root.adoptChildren();
+
+        int count = iterate(NodeUtil.makeRecursiveIterator(root));
+
+        assertThat(count, is(2));
+        assertThat(root.visited, is(0));
+        assertThat(root.child0.visited, is(1));
+    }
+
+    private static int iterate(Iterator<Node> iterator) {
+        int iterationCount = 0;
+        while (iterator.hasNext()) {
+            Node node = iterator.next();
+            if (node == null) {
+                continue;
+            }
+            if (node instanceof TestNode) {
+                ((TestNode) node).visited = iterationCount;
+            } else if (node instanceof TestRootNode) {
+                ((TestRootNode) node).visited = iterationCount;
+            } else {
+                throw new AssertionError();
+            }
+            iterationCount++;
+        }
+        return iterationCount;
+    }
+
+    private static class TestNode extends Node {
+
+        @Child TestNode child0;
+        @Child TestNode child1;
+
+        private int visited;
+
+        public TestNode() {
+        }
+
+    }
+
+    private static class TestRootNode extends RootNode {
+
+        @Child TestNode child0;
+
+        private int visited;
+
+        public TestRootNode() {
+            super(TestingLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return null;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/nodes/SafeReplaceTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,101 @@
+/*
+ * 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.truffle.api.nodes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.TestingLanguage;
+import com.oracle.truffle.api.frame.VirtualFrame;
+
+/**
+ * Tests optional method for ensuring that a node replacement is type safe. Ordinary node
+ * replacement is performed by unsafe assignment of a parent node's child field.
+ */
+public class SafeReplaceTest {
+
+    @Test
+    public void testCorrectReplacement() {
+        TestRootNode root = new TestRootNode();
+        final TestNode oldChild = new TestNode();
+        final TestNode newChild = new TestNode();
+        root.child = oldChild;
+        assertFalse(oldChild.isSafelyReplaceableBy(newChild));  // No parent node
+        root.adoptChildren();
+        assertTrue(oldChild.isSafelyReplaceableBy(newChild));   // Now adopted by parent
+        // new node
+        oldChild.replace(newChild);
+        root.execute(null);
+        assertEquals(root.executed, 1);
+        assertEquals(oldChild.executed, 0);
+        assertEquals(newChild.executed, 1);
+    }
+
+    @Test
+    public void testIncorrectReplacement() {
+        TestRootNode root = new TestRootNode();
+        final TestNode oldChild = new TestNode();
+        root.child = oldChild;
+        root.adoptChildren();
+        final TestNode newChild = new TestNode();
+        final TestNode strayChild = new TestNode();
+        assertFalse(strayChild.isSafelyReplaceableBy(newChild)); // Stray not a child of parent
+        final WrongTestNode wrongTypeNewChild = new WrongTestNode();
+        assertFalse(oldChild.isSafelyReplaceableBy(wrongTypeNewChild));
+    }
+
+    private static class TestNode extends Node {
+
+        private int executed;
+
+        public Object execute() {
+            executed++;
+            return null;
+        }
+    }
+
+    private static class TestRootNode extends RootNode {
+
+        @Child TestNode child;
+
+        private int executed;
+
+        public TestRootNode() {
+            super(TestingLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            executed++;
+            child.execute();
+            return null;
+        }
+    }
+
+    private static class WrongTestNode extends Node {
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/package-info.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,73 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+/*
+ @ApiInfo(
+ group="Test"
+ )
+ */
+
+/**
+ * <p>
+ * This package contains basic tests of the Truffle API and serves at the same time as an
+ * introduction to the Truffle API for language implementors. Every test gives an example on how to
+ * use the construct explained in the class description.
+ * </p>
+ *
+ * <p>
+ * Truffle is a language implementation framework. A guest language method is represented as a tree
+ * of executable nodes. The framework provides mechanisms for those trees to call each other.
+ * Additionally it contains dedicated data structures for storing data local to a tree invocation.
+ * </p>
+ *
+ * <p>
+ * This introduction to Truffle contains items in the following recommended order:
+ *
+ * <ul>
+ * <li>How to get access to the Truffle runtime?
+ * {@link com.oracle.truffle.api.TruffleRuntimeTest}</li>
+ * <li>How to create a root node? {@link com.oracle.truffle.api.RootNodeTest}</li>
+ * <li>How to create a child node and link it with its parent?
+ * {@link com.oracle.truffle.api.ChildNodeTest}</li>
+ * <li>How to create an array of child nodes? {@link com.oracle.truffle.api.ChildrenNodesTest}</li>
+ * <li>Why are final fields in node classes important?
+ * {@link com.oracle.truffle.api.FinalFieldTest}</li>
+ * <li>How to replace one node with another node and what for?
+ * {@link com.oracle.truffle.api.ReplaceTest}</li>
+ * <li>How to let one Truffle tree invoke another one? {@link com.oracle.truffle.api.CallTest}</li>
+ * <li>How to pass arguments when executing a tree?
+ * {@link com.oracle.truffle.api.ArgumentsTest}</li>
+ * <li>How to use frames and frame slots to store values local to an activation?
+ * {@link com.oracle.truffle.api.FrameTest}</li>
+ * <li>How to use type specialization and speculation for frame slots?
+ * {@link com.oracle.truffle.api.FrameSlotTypeSpecializationTest}</li>
+ * <li>How to use type specialization and speculation for node return values?
+ * {@link com.oracle.truffle.api.ReturnTypeSpecializationTest}</li>
+ * <li>How to "instrument" an AST with nodes that can provide access to runtime state from external
+ * tools {@code com.oracle.truffle.api.instrument.InstrumentationTest}</li>
+ * </ul>
+ */
+package com.oracle.truffle.api;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/BytesSourceSectionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012, 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.source;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.charset.StandardCharsets;
+
+import org.junit.Test;
+
+public class BytesSourceSectionTest {
+
+    @Test
+    public void testSectionsFromLineNumberASCII() {
+        final byte[] bytes = "foo\nbar\nbaz\n".getBytes(StandardCharsets.US_ASCII);
+        final Source source = Source.fromBytes(bytes, "description", StandardCharsets.US_ASCII);
+        assertEquals("foo", source.createSection("identifier", 1).getCode());
+        assertEquals("bar", source.createSection("identifier", 2).getCode());
+        assertEquals("baz", source.createSection("identifier", 3).getCode());
+    }
+
+    @Test
+    public void testSectionsFromOffsetsASCII() {
+        final byte[] bytes = "foo\nbar\nbaz\n".getBytes(StandardCharsets.US_ASCII);
+        final Source source = Source.fromBytes(bytes, "description", StandardCharsets.US_ASCII);
+        assertEquals("foo", source.createSection("identifier", 0, 3).getCode());
+        assertEquals("bar", source.createSection("identifier", 4, 3).getCode());
+        assertEquals("baz", source.createSection("identifier", 8, 3).getCode());
+    }
+
+    @Test
+    public void testOffset() {
+        final byte[] bytes = "xxxfoo\nbar\nbaz\nxxx".getBytes(StandardCharsets.US_ASCII);
+        final Source source = Source.fromBytes(bytes, 3, bytes.length - 6, "description", StandardCharsets.US_ASCII);
+        assertEquals("foo", source.createSection("identifier", 0, 3).getCode());
+        assertEquals("bar", source.createSection("identifier", 4, 3).getCode());
+        assertEquals("baz", source.createSection("identifier", 8, 3).getCode());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/JavaRecognizer.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013, 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.truffle.api.source;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.spi.FileTypeDetector;
+
+public final class JavaRecognizer extends FileTypeDetector {
+    @Override
+    public String probeContentType(Path path) throws IOException {
+        if (path.getFileName().toString().endsWith(".java")) {
+            return "text/x-java";
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/SourceSectionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2013, 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.truffle.api.source;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class SourceSectionTest {
+
+    private final Source emptySource = Source.fromText("", null);
+
+    private final Source emptyLineSource = Source.fromText("\n", null);
+
+    private final Source shortSource = Source.fromText("01", null);
+
+    private final Source longSource = Source.fromText("01234\n67\n9\n", "long");
+
+    public void emptySourceTest0() {
+        SourceSection section = emptySource.createSection("test", 0, 0);
+        assertNotNull(section);
+        assertEquals(section.getCode(), "");
+    }
+
+    @Test
+    public void emptyLineTest0() {
+        SourceSection section = emptyLineSource.createSection("test", 0, 0);
+        assertNotNull(section);
+        assertEquals(section.getCode(), "");
+        assertEquals(section.getCharIndex(), 0);
+        assertEquals(section.getCharLength(), 0);
+        assertEquals(section.getStartLine(), 1);
+        assertEquals(section.getStartColumn(), 1);
+    }
+
+    @Test
+    public void emptyLineTest1() {
+        SourceSection section = emptyLineSource.createSection("test", 0, 1);
+        assertNotNull(section);
+        assertEquals(section.getCode(), "\n");
+        assertEquals(section.getCharIndex(), 0);
+        assertEquals(section.getCharLength(), 1);
+        assertEquals(section.getStartLine(), 1);
+        assertEquals(section.getStartColumn(), 1);
+        assertEquals(section.getEndLine(), 1);
+        assertEquals(section.getEndColumn(), 1);
+    }
+
+    @Test
+    public void emptySectionTest2() {
+        SourceSection section = shortSource.createSection("test", 0, 0);
+        assertNotNull(section);
+        assertEquals(section.getCode(), "");
+    }
+
+    @Test
+    public void emptySectionTest3() {
+        SourceSection section = longSource.createSection("test", 0, 0);
+        assertNotNull(section);
+        assertEquals(section.getCode(), "");
+    }
+
+    @Test
+    public void testGetCode() {
+        assertEquals("01234", longSource.createSection("test", 0, 5).getCode());
+        assertEquals("67", longSource.createSection("test", 6, 2).getCode());
+        assertEquals("9", longSource.createSection("test", 9, 1).getCode());
+    }
+
+    @Test
+    public void testGetShortDescription() {
+        assertEquals("long:1", longSource.createSection("test", 0, 5).getShortDescription());
+        assertEquals("long:2", longSource.createSection("test", 6, 2).getShortDescription());
+        assertEquals("long:3", longSource.createSection("test", 9, 1).getShortDescription());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange1() {
+        longSource.createSection("test", 9, 5);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange2() {
+        longSource.createSection("test", -1, 1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange3() {
+        longSource.createSection("test", 1, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange4() {
+        longSource.createSection("test", 3, 1, 9, 5);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange5() {
+        longSource.createSection("test", 1, 1, -1, 1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange6() {
+        longSource.createSection("test", 1, 1, 1, -1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/SourceTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, 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.truffle.api.source;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.Test;
+
+public class SourceTest {
+    @Test
+    public void assignMimeTypeAndIdentity() {
+        Source s1 = Source.fromText("// a comment\n", "Empty comment");
+        assertNull("No mime type assigned", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForApppendable() {
+        Source s1 = Source.fromAppendableText("<stdio>");
+        assertNull("No mime type assigned", s1.getMimeType());
+        s1.appendCode("// Hello");
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForBytes() {
+        String text = "// Hello";
+        Source s1 = Source.fromBytes(text.getBytes(StandardCharsets.UTF_8), "Hello", StandardCharsets.UTF_8);
+        assertNull("No mime type assigned", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForReader() throws IOException {
+        String text = "// Hello";
+        Source s1 = Source.fromReader(new StringReader(text), "Hello");
+        assertNull("No mime type assigned", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForFile() throws IOException {
+        File file = File.createTempFile("Hello", ".java");
+        file.deleteOnExit();
+
+        String text;
+        try (FileWriter w = new FileWriter(file)) {
+            text = "// Hello";
+            w.write(text);
+        }
+
+        // JDK8 default fails on OS X: https://bugs.openjdk.java.net/browse/JDK-8129632
+        Source s1 = Source.fromFileName(file.getPath()).withMimeType("text/x-java");
+        assertEquals("Recognized as Java", "text/x-java", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForVirtualFile() throws IOException {
+        File file = File.createTempFile("Hello", ".java");
+        file.deleteOnExit();
+
+        String text = "// Hello";
+
+        // JDK8 default fails on OS X: https://bugs.openjdk.java.net/browse/JDK-8129632
+        Source s1 = Source.fromFileName(text, file.getPath()).withMimeType("text/x-java");
+        assertEquals("Recognized as Java", "text/x-java", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+
+    @Test
+    public void assignMimeTypeAndIdentityForURL() throws IOException {
+        File file = File.createTempFile("Hello", ".java");
+        file.deleteOnExit();
+
+        String text;
+        try (FileWriter w = new FileWriter(file)) {
+            text = "// Hello";
+            w.write(text);
+        }
+
+        Source s1 = Source.fromURL(file.toURI().toURL(), "Hello.java");
+        assertEquals("Threated as plain", "text/plain", s1.getMimeType());
+        Source s2 = s1.withMimeType("text/x-c");
+        assertEquals("They have the same content", s1.getCode(), s2.getCode());
+        assertEquals("// Hello", s1.getCode());
+        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
+        assertNotEquals("So they are different", s1, s2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/SourceTextTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2013, 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.truffle.api.source;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class SourceTextTest {
+
+    private final Source emptySource = Source.fromText("", null);
+
+    private final Source emptyLineSource = Source.fromText("\n", null);
+
+    private final Source shortSource = Source.fromText("01", null);
+
+    private final Source longSource = Source.fromText("01234\n67\n9\n", null);
+
+    @Test
+    public void emptyTextTest0() {
+        assertEquals(emptySource.getLineCount(), 0);
+    }
+
+    // Temp disable of empty text tests
+
+    // @Test(expected = IllegalArgumentException.class)
+    @Test()
+    public void emptyTextTest1() {
+        emptySource.getLineNumber(0);
+    }
+
+    // @Test(expected = IllegalArgumentException.class)
+    @Test()
+    public void emptyTextTest2() {
+        emptySource.getColumnNumber(0);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void emptyTextTest3() {
+        emptySource.getLineNumber(-1);
+    }
+
+    // @Test(expected = IllegalArgumentException.class)
+    @Test()
+    public void emptyTextTest4() {
+        emptySource.getLineStartOffset(0);
+    }
+
+    // @Test(expected = IllegalArgumentException.class)
+    public void emptyTextTest5() {
+        emptySource.getLineStartOffset(1);
+    }
+
+    // @Test(expected = IllegalArgumentException.class)
+    public void emptyTextTest6() {
+        emptySource.getLineLength(1);
+    }
+
+    @Test
+    public void emptyLineTest0() {
+        assertEquals(emptyLineSource.getLineCount(), 1);
+        assertEquals(emptyLineSource.getLineNumber(0), 1);
+        assertEquals(emptyLineSource.getLineStartOffset(1), 0);
+        assertEquals(emptyLineSource.getColumnNumber(0), 1);
+        assertEquals(emptyLineSource.getLineLength(1), 0);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void emptyLineTest1() {
+        emptyLineSource.getLineNumber(1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void emptyLineTest2() {
+        emptyLineSource.getLineStartOffset(2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void emptyLineTest3() {
+        emptyLineSource.getColumnNumber(1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void emptyLineTest4() {
+        emptyLineSource.getLineLength(2);
+    }
+
+    @Test
+    public void shortTextTest0() {
+
+        assertEquals(shortSource.getLineCount(), 1);
+
+        assertEquals(shortSource.getLineNumber(0), 1);
+        assertEquals(shortSource.getLineStartOffset(1), 0);
+        assertEquals(shortSource.getColumnNumber(0), 1);
+
+        assertEquals(shortSource.getLineNumber(1), 1);
+        assertEquals(shortSource.getColumnNumber(1), 2);
+
+        assertEquals(shortSource.getLineLength(1), 2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest1() {
+        shortSource.getLineNumber(-1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest2() {
+        shortSource.getColumnNumber(-1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest3() {
+        shortSource.getLineNumber(2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest4() {
+        shortSource.getColumnNumber(2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest5() {
+        shortSource.getLineLength(2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shortTextTest6() {
+        shortSource.getLineLength(2);
+    }
+
+    @Test
+    public void longTextTest0() {
+
+        assertEquals(longSource.getLineCount(), 3);
+
+        assertEquals(longSource.getLineNumber(0), 1);
+        assertEquals(longSource.getLineStartOffset(1), 0);
+        assertEquals(longSource.getColumnNumber(0), 1);
+
+        assertEquals(longSource.getLineNumber(4), 1);
+        assertEquals(longSource.getColumnNumber(4), 5);
+
+        assertEquals(longSource.getLineNumber(5), 1); // newline
+        assertEquals(longSource.getColumnNumber(5), 6); // newline
+        assertEquals(longSource.getLineLength(1), 5);
+
+        assertEquals(longSource.getLineNumber(6), 2);
+        assertEquals(longSource.getLineStartOffset(2), 6);
+        assertEquals(longSource.getColumnNumber(6), 1);
+
+        assertEquals(longSource.getLineNumber(7), 2);
+        assertEquals(longSource.getColumnNumber(7), 2);
+
+        assertEquals(longSource.getLineNumber(8), 2); // newline
+        assertEquals(longSource.getLineNumber(8), 2); // newline
+        assertEquals(longSource.getLineLength(2), 2);
+
+        assertEquals(longSource.getLineNumber(9), 3);
+        assertEquals(longSource.getLineStartOffset(3), 9);
+        assertEquals(longSource.getColumnNumber(9), 1);
+
+        assertEquals(longSource.getLineNumber(10), 3); // newline
+        assertEquals(longSource.getColumnNumber(10), 2); // newline
+        assertEquals(longSource.getLineLength(3), 1);
+
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void longTextTest1() {
+        longSource.getLineNumber(11);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void longTextTest2() {
+        longSource.getColumnNumber(11);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void longTextTest3() {
+        longSource.getLineStartOffset(4);
+    }
+
+}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-/**
- * <h3>Passing Arguments</h3>
- *
- * <p>
- * When invoking a call target with {@link CallTarget#call(Object[])}, arguments can be passed. A
- * Truffle node can access the arguments passed into the Truffle method by using
- * {@link VirtualFrame#getArguments}.
- * </p>
- *
- * <p>
- * The arguments class should only contain fields that are declared as final. This allows the
- * Truffle runtime to improve optimizations around guest language method calls. Also, the arguments
- * object array must never be stored into a field. It should be created immediately before invoking
- * {@link CallTarget#call(Object[])} and no longer be accessed afterwards.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FrameTest}
- * .
- * </p>
- */
-public class ArgumentsTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestRootNode rootNode = new TestRootNode(new TestArgumentNode[]{new TestArgumentNode(0), new TestArgumentNode(1)});
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Object result = target.call(new Object[]{20, 22});
-        Assert.assertEquals(42, result);
-    }
-
-    private static class TestRootNode extends RootNode {
-
-        @Children private final TestArgumentNode[] children;
-
-        TestRootNode(TestArgumentNode[] children) {
-            super(TestingLanguage.class, null, null);
-            this.children = children;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int sum = 0;
-            for (int i = 0; i < children.length; ++i) {
-                sum += children[i].execute(frame);
-            }
-            return sum;
-        }
-    }
-
-    private static class TestArgumentNode extends Node {
-
-        private final int index;
-
-        TestArgumentNode(int index) {
-            super(null);
-            this.index = index;
-        }
-
-        int execute(VirtualFrame frame) {
-            return (Integer) frame.getArguments()[index];
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-/**
- * <h3>Calling Another Tree</h3>
- *
- * <p>
- * A guest language implementation can create multiple call targets using the
- * {@link TruffleRuntime#createCallTarget(RootNode)} method. Those call targets can be passed around
- * as normal Java objects and used for calling guest language methods.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.ArgumentsTest}.
- * </p>
- */
-public class CallTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        CallTarget foo = runtime.createCallTarget(new ConstantRootNode(20));
-        CallTarget bar = runtime.createCallTarget(new ConstantRootNode(22));
-        CallTarget main = runtime.createCallTarget(new DualCallNode(foo, bar));
-        Object result = main.call();
-        Assert.assertEquals(42, result);
-    }
-
-    class DualCallNode extends RootNode {
-
-        private final CallTarget firstTarget;
-        private final CallTarget secondTarget;
-
-        DualCallNode(CallTarget firstTarget, CallTarget secondTarget) {
-            super(TestingLanguage.class, null, null);
-            this.firstTarget = firstTarget;
-            this.secondTarget = secondTarget;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return ((Integer) firstTarget.call()) + ((Integer) secondTarget.call());
-        }
-    }
-
-    class ConstantRootNode extends RootNode {
-
-        private final int value;
-
-        public ConstantRootNode(int value) {
-            super(TestingLanguage.class, null, null);
-            this.value = value;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return value;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.Node.Child;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Creating a Child Node</h3>
- *
- * <p>
- * Child nodes are stored in the class of the parent node in fields that are marked with the
- * {@link Child} annotation. The {@link Node#getParent()} method allows access to this field. Every
- * node also provides the ability to iterate over its children using {@link Node#getChildren()}.
- * </p>
- *
- * <p>
- * A child node field must be declared private and non-final. It may only be assigned in the
- * constructor of the parent node. For changing the structure of the tree at run time, the method
- * {@link Node#replace(Node)} must be used (see {@link ReplaceTest}).
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.ChildrenNodesTest}.
- * </p>
- */
-public class ChildNodeTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestChildNode leftChild = new TestChildNode();
-        TestChildNode rightChild = new TestChildNode();
-        TestRootNode rootNode = new TestRootNode(leftChild, rightChild);
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Assert.assertEquals(rootNode, leftChild.getParent());
-        Assert.assertEquals(rootNode, rightChild.getParent());
-        Iterator<Node> iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(leftChild, iterator.next());
-        Assert.assertEquals(rightChild, iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Child private TestChildNode left;
-        @Child private TestChildNode right;
-
-        public TestRootNode(TestChildNode left, TestChildNode right) {
-            super(TestingLanguage.class, null, null);
-            this.left = left;
-            this.right = right;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return left.execute() + right.execute();
-        }
-    }
-
-    class TestChildNode extends Node {
-
-        public TestChildNode() {
-            super(null);
-        }
-
-        public int execute() {
-            return 21;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Creating an Array of Children Nodes</h3>
- *
- * <p>
- * An array of children nodes can be used as a field in a parent node. The field has to be annotated
- * with {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final.
- * Before assigning the field in the parent node constructor, {@link Node#adoptChildren} must be
- * called in order to update the parent pointers in the child nodes. After filling the array with
- * its first values, it must never be changed. It is only possible to call {@link Node#replace} on a
- * child node.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.FinalFieldTest}.
- * </p>
- */
-public class ChildrenNodesTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestChildNode firstChild = new TestChildNode();
-        TestChildNode secondChild = new TestChildNode();
-        TestRootNode rootNode = new TestRootNode(new TestChildNode[]{firstChild, secondChild});
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Assert.assertEquals(rootNode, firstChild.getParent());
-        Assert.assertEquals(rootNode, secondChild.getParent());
-        Iterator<Node> iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(firstChild, iterator.next());
-        Assert.assertEquals(secondChild, iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Children private final TestChildNode[] children;
-
-        public TestRootNode(TestChildNode[] children) {
-            super(TestingLanguage.class, null, null);
-            this.children = children;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int sum = 0;
-            for (int i = 0; i < children.length; ++i) {
-                sum += children[i].execute();
-            }
-            return sum;
-        }
-    }
-
-    class TestChildNode extends Node {
-
-        public TestChildNode() {
-            super(null);
-        }
-
-        public int execute() {
-            return 21;
-        }
-    }
-
-    @Test
-    public void testMultipleChildrenFields() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestChildNode firstChild = new TestChildNode();
-        TestChildNode secondChild = new TestChildNode();
-        TestChildNode thirdChild = new TestChildNode();
-        TestChildNode forthChild = new TestChildNode();
-        TestRootNode rootNode = new TestRoot2Node(new TestChildNode[]{firstChild, secondChild}, new TestChildNode[]{thirdChild, forthChild});
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Assert.assertEquals(rootNode, firstChild.getParent());
-        Assert.assertEquals(rootNode, secondChild.getParent());
-        Assert.assertEquals(rootNode, thirdChild.getParent());
-        Assert.assertEquals(rootNode, forthChild.getParent());
-        Iterator<Node> iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(firstChild, iterator.next());
-        Assert.assertEquals(secondChild, iterator.next());
-        Assert.assertEquals(thirdChild, iterator.next());
-        Assert.assertEquals(forthChild, iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        Assert.assertEquals(2 * 42, result);
-    }
-
-    class TestRoot2Node extends TestRootNode {
-        @Children private final TestChildNode[] children1;
-        @Children private final TestChildNode[] children2;
-
-        public TestRoot2Node(TestChildNode[] children1, TestChildNode[] children2) {
-            super(new TestChildNode[0]);
-            this.children1 = children1;
-            this.children2 = children2;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int sum = 0;
-            for (int i = 0; i < children1.length; ++i) {
-                sum += children1[i].execute();
-            }
-            for (int i = 0; i < children2.length; ++i) {
-                sum += children2[i].execute();
-            }
-            return sum;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Using Final Fields in Node Classes</h3>
- *
- * <p>
- * The usage of final fields in node classes is highly encouraged. It is beneficial for performance
- * to declare every field that is not pointing to a child node as final. This gives the Truffle
- * runtime an increased opportunity to optimize this node.
- * </p>
- *
- * <p>
- * If a node has a value which may change at run time, but will rarely do so, it is recommended to
- * speculate on the field being final. This involves starting executing with a node where this field
- * is final and only if this turns out to be no longer the case, the node is replaced with an
- * alternative implementation of the operation (see {@link ReplaceTest}).
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.ReplaceTest}.
- * </p>
- */
-public class FinalFieldTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestRootNode rootNode = new TestRootNode(new TestChildNode[]{new TestChildNode(20), new TestChildNode(22)});
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-    }
-
-    private static class TestRootNode extends RootNode {
-
-        @Children private final TestChildNode[] children;
-
-        public TestRootNode(TestChildNode[] children) {
-            super(TestingLanguage.class, null, null);
-            this.children = children;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int sum = 0;
-            for (int i = 0; i < children.length; ++i) {
-                sum += children[i].execute();
-            }
-            return sum;
-        }
-    }
-
-    private static class TestChildNode extends Node {
-
-        private final int value;
-
-        public TestChildNode(int value) {
-            super(null);
-            this.value = value;
-        }
-
-        public int execute() {
-            return value;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.FrameDescriptor;
-import com.oracle.truffle.api.frame.FrameSlot;
-import com.oracle.truffle.api.frame.FrameSlotKind;
-import com.oracle.truffle.api.frame.FrameSlotTypeException;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Specializing Frame Slot Types</h3>
- *
- * <p>
- * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run
- * time to a more generic type if necessary. The new type of a frame slot can be set using the
- * {@link FrameSlot#setKind(FrameSlotKind)} method.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}.
- * </p>
- */
-public class FrameSlotTypeSpecializationTest {
-
-    @Before
-    public void setInstrumentationTestMode() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void unsetInstrumentationTestMode() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        FrameDescriptor frameDescriptor = new FrameDescriptor();
-        FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int);
-        TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot));
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Assert.assertEquals(FrameSlotKind.Int, slot.getKind());
-        Object result = target.call();
-        Assert.assertEquals("42", result);
-        Assert.assertEquals(FrameSlotKind.Object, slot.getKind());
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Child TestChildNode left;
-        @Child TestChildNode right;
-
-        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
-            super(TestingLanguage.class, null, descriptor);
-            this.left = left;
-            this.right = right;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            left.execute(frame);
-            return right.execute(frame);
-        }
-    }
-
-    abstract class TestChildNode extends Node {
-
-        protected TestChildNode() {
-            super(null);
-        }
-
-        abstract Object execute(VirtualFrame frame);
-    }
-
-    abstract class FrameSlotNode extends TestChildNode {
-
-        protected final FrameSlot slot;
-
-        public FrameSlotNode(FrameSlot slot) {
-            this.slot = slot;
-        }
-    }
-
-    class StringTestChildNode extends TestChildNode {
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            return "42";
-        }
-
-    }
-
-    class IntAssignLocal extends FrameSlotNode {
-
-        @Child private TestChildNode value;
-
-        IntAssignLocal(FrameSlot slot, TestChildNode value) {
-            super(slot);
-            this.value = value;
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            Object o = value.execute(frame);
-            if (o instanceof Integer) {
-                frame.setInt(slot, (Integer) o);
-            } else {
-                slot.setKind(FrameSlotKind.Object);
-                frame.setObject(slot, o);
-                this.replace(new ObjectAssignLocal(slot, value));
-            }
-            return null;
-        }
-    }
-
-    class ObjectAssignLocal extends FrameSlotNode {
-
-        @Child private TestChildNode value;
-
-        ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
-            super(slot);
-            this.value = value;
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            Object o = value.execute(frame);
-            slot.setKind(FrameSlotKind.Object);
-            frame.setObject(slot, o);
-            return null;
-        }
-    }
-
-    class IntReadLocal extends FrameSlotNode {
-
-        IntReadLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            try {
-                return frame.getInt(slot);
-            } catch (FrameSlotTypeException e) {
-                return this.replace(new ObjectReadLocal(slot)).execute(frame);
-            }
-        }
-    }
-
-    class ObjectReadLocal extends FrameSlotNode {
-
-        ObjectReadLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            try {
-                return frame.getObject(slot);
-            } catch (FrameSlotTypeException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.Frame;
-import com.oracle.truffle.api.frame.FrameDescriptor;
-import com.oracle.truffle.api.frame.FrameInstance;
-import com.oracle.truffle.api.frame.FrameSlot;
-import com.oracle.truffle.api.frame.FrameSlotKind;
-import com.oracle.truffle.api.frame.FrameSlotTypeException;
-import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-/**
- * <h3>Storing Values in Frame Slots</h3>
- *
- * <p>
- * The frame is the preferred data structure for passing values between nodes. It can in particular
- * be used for storing the values of local variables of the guest language. The
- * {@link FrameDescriptor} represents the current structure of the frame. The method
- * {@link FrameDescriptor#addFrameSlot(Object, FrameSlotKind)} can be used to create predefined
- * frame slots. The setter and getter methods in the {@link Frame} class can be used to access the
- * current value of a particular frame slot. Values can be removed from a frame via the
- * {@link FrameDescriptor#removeFrameSlot(Object)} method.
- * </p>
- *
- * <p>
- * There are five primitive types for slots available: {@link java.lang.Boolean},
- * {@link java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and
- * {@link java.lang.Double} . It is encouraged to use those types whenever possible. Dynamically
- * typed languages can speculate on the type of a value fitting into a primitive (see
- * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular
- * primitive types, its value may only be accessed with the respectively typed getter method (
- * {@link Frame#getBoolean}, {@link Frame#getInt}, {@link Frame#getLong}, {@link Frame#getFloat}, or
- * {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, {@link Frame#setInt},
- * {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the {@link Frame}
- * class.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.FrameSlotTypeSpecializationTest}.
- * </p>
- */
-public class FrameTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() throws SecurityException, IllegalArgumentException {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        FrameDescriptor frameDescriptor = new FrameDescriptor();
-        String varName = "localVar";
-        FrameSlot slot = frameDescriptor.addFrameSlot(varName, FrameSlotKind.Int);
-        TestRootNode rootNode = new TestRootNode(frameDescriptor, new AssignLocal(slot), new ReadLocal(slot));
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-        frameDescriptor.removeFrameSlot(varName);
-        boolean slotMissing = false;
-        try {
-            result = target.call();
-        } catch (IllegalArgumentException iae) {
-            slotMissing = true;
-        }
-        Assert.assertTrue(slotMissing);
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Child TestChildNode left;
-        @Child TestChildNode right;
-
-        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
-            super(TestingLanguage.class, null, descriptor);
-            this.left = left;
-            this.right = right;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return left.execute(frame) + right.execute(frame);
-        }
-    }
-
-    abstract class TestChildNode extends Node {
-
-        public TestChildNode() {
-            super(null);
-        }
-
-        abstract int execute(VirtualFrame frame);
-    }
-
-    abstract class FrameSlotNode extends TestChildNode {
-
-        protected final FrameSlot slot;
-
-        public FrameSlotNode(FrameSlot slot) {
-            this.slot = slot;
-        }
-    }
-
-    class AssignLocal extends FrameSlotNode {
-
-        AssignLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            frame.setInt(slot, 42);
-            return 0;
-        }
-    }
-
-    class ReadLocal extends FrameSlotNode {
-
-        ReadLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            try {
-                return frame.getInt(slot);
-            } catch (FrameSlotTypeException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-    }
-
-    @Test
-    public void framesCanBeMaterialized() {
-        final TruffleRuntime runtime = Truffle.getRuntime();
-
-        class FrameRootNode extends RootNode {
-
-            public FrameRootNode() {
-                super(TestingLanguage.class, null, null);
-            }
-
-            @Override
-            public Object execute(VirtualFrame frame) {
-                FrameInstance frameInstance = runtime.getCurrentFrame();
-                Frame readWrite = frameInstance.getFrame(FrameInstance.FrameAccess.READ_WRITE, true);
-                Frame materialized = frameInstance.getFrame(FrameInstance.FrameAccess.MATERIALIZE, true);
-
-                assertTrue("Really materialized: " + materialized, materialized instanceof MaterializedFrame);
-                assertEquals("It's my frame", frame, readWrite);
-                return this;
-            }
-        }
-
-        FrameRootNode frn = new FrameRootNode();
-        Object ret = Truffle.getRuntime().createCallTarget(frn).call();
-        assertEquals("Returns itself", frn, ret);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/InterfaceChildFieldTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +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.truffle.api.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeInterface;
-import com.oracle.truffle.api.nodes.NodeUtil;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test child fields declared with interface types instead of {@link Node} subclasses.
- */
-public class InterfaceChildFieldTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void testChild() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestChildInterface leftChild = new TestLeafNode();
-        TestChildInterface rightChild = new TestLeafNode();
-        TestChildNode parent = new TestChildNode(leftChild, rightChild);
-        TestRootNode rootNode = new TestRootNode(parent);
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Iterator<Node> iterator = parent.getChildren().iterator();
-        Assert.assertEquals(leftChild, iterator.next());
-        Assert.assertEquals(rightChild, iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-
-        Assert.assertEquals(4, NodeUtil.countNodes(rootNode));
-        Assert.assertEquals(4, NodeUtil.countNodes(NodeUtil.cloneNode(rootNode)));
-    }
-
-    @Test
-    public void testChildren() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestChildInterface[] children = new TestChildInterface[5];
-        for (int i = 0; i < children.length; i++) {
-            children[i] = new TestLeafNode();
-        }
-        TestChildrenNode parent = new TestChildrenNode(children);
-        TestRootNode rootNode = new TestRootNode(parent);
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Iterator<Node> iterator = parent.getChildren().iterator();
-        for (int i = 0; i < children.length; i++) {
-            Assert.assertEquals(children[i], iterator.next());
-        }
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        Assert.assertEquals(105, result);
-
-        Assert.assertEquals(2 + children.length, NodeUtil.countNodes(rootNode));
-        Assert.assertEquals(2 + children.length, NodeUtil.countNodes(NodeUtil.cloneNode(rootNode)));
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Child private TestChildInterface child;
-
-        public TestRootNode(TestChildInterface child) {
-            super(TestingLanguage.class, null, null);
-            this.child = child;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return child.executeIntf();
-        }
-    }
-
-    interface TestChildInterface extends NodeInterface {
-        int executeIntf();
-    }
-
-    class TestLeafNode extends Node implements TestChildInterface {
-        public TestLeafNode() {
-            super(null);
-        }
-
-        public int executeIntf() {
-            return this.replace(new TestLeaf2Node()).executeIntf();
-        }
-    }
-
-    class TestLeaf2Node extends Node implements TestChildInterface {
-        public TestLeaf2Node() {
-            super(null);
-        }
-
-        public int executeIntf() {
-            return 21;
-        }
-    }
-
-    class TestChildNode extends Node implements TestChildInterface {
-
-        @Child private TestChildInterface left;
-        @Child private TestChildInterface right;
-
-        public TestChildNode(TestChildInterface left, TestChildInterface right) {
-            super(null);
-            this.left = left;
-            this.right = right;
-        }
-
-        @Override
-        public int executeIntf() {
-            return left.executeIntf() + right.executeIntf();
-        }
-    }
-
-    class TestChildrenNode extends Node implements TestChildInterface {
-
-        @Children private final TestChildInterface[] children;
-
-        public TestChildrenNode(TestChildInterface[] children) {
-            super(null);
-            this.children = children;
-        }
-
-        @Override
-        public int executeIntf() {
-            int sum = 0;
-            for (int i = 0; i < children.length; ++i) {
-                sum += children[i].executeIntf();
-            }
-            return sum;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * <h3>Replacing Nodes at Run Time</h3>
- *
- * <p>
- * The structure of the Truffle tree can be changed at run time by replacing nodes using the
- * {@link Node#replace(Node)} method. This method will automatically change the child pointer in the
- * parent of the node and replace it with a pointer to the new node.
- * </p>
- *
- * <p>
- * Replacing nodes is a costly operation, so it should not happen too often. The convention is that
- * the implementation of the Truffle nodes should ensure that there are maximal a small (and
- * constant) number of node replacements per Truffle node.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.CallTest}.
- * </p>
- */
-public class ReplaceTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        UnresolvedNode leftChild = new UnresolvedNode("20");
-        UnresolvedNode rightChild = new UnresolvedNode("22");
-        TestRootNode rootNode = new TestRootNode(new ValueNode[]{leftChild, rightChild});
-        CallTarget target = runtime.createCallTarget(rootNode);
-        assertEquals(rootNode, leftChild.getParent());
-        assertEquals(rootNode, rightChild.getParent());
-        Iterator<Node> iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(leftChild, iterator.next());
-        Assert.assertEquals(rightChild, iterator.next());
-        Assert.assertFalse(iterator.hasNext());
-        Object result = target.call();
-        assertEquals(42, result);
-        assertEquals(42, target.call());
-        iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(ResolvedNode.class, iterator.next().getClass());
-        Assert.assertEquals(ResolvedNode.class, iterator.next().getClass());
-        Assert.assertFalse(iterator.hasNext());
-        iterator = rootNode.getChildren().iterator();
-        Assert.assertEquals(rootNode, iterator.next().getParent());
-        Assert.assertEquals(rootNode, iterator.next().getParent());
-        Assert.assertFalse(iterator.hasNext());
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Children private final ValueNode[] children;
-
-        public TestRootNode(ValueNode[] children) {
-            super(TestingLanguage.class, null, null);
-            this.children = children;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int sum = 0;
-            for (int i = 0; i < children.length; ++i) {
-                sum += children[i].execute();
-            }
-            return sum;
-        }
-    }
-
-    abstract class ValueNode extends Node {
-
-        public ValueNode() {
-            super(null);
-        }
-
-        abstract int execute();
-    }
-
-    class UnresolvedNode extends ValueNode {
-
-        private final String value;
-
-        public UnresolvedNode(String value) {
-            this.value = value;
-        }
-
-        @Override
-        int execute() {
-            int intValue = Integer.parseInt(value);
-            ResolvedNode newNode = this.replace(new ResolvedNode(intValue));
-            return newNode.execute();
-        }
-    }
-
-    class ResolvedNode extends ValueNode {
-
-        private final int value;
-
-        ResolvedNode(int value) {
-            this.value = value;
-        }
-
-        @Override
-        int execute() {
-            return value;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.FrameDescriptor;
-import com.oracle.truffle.api.frame.FrameSlot;
-import com.oracle.truffle.api.frame.FrameSlotKind;
-import com.oracle.truffle.api.frame.FrameSlotTypeException;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.nodes.UnexpectedResultException;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Specializing Return Types</h3>
- *
- * <p>
- * In order to avoid boxing and/or type casts on the return value of a node, the return value the
- * method for executing a node can have a specific type and need not be of type
- * {@link java.lang.Object}. For dynamically typed languages, this return type is something that
- * should be speculated on. When the speculation fails and the child node cannot return the
- * appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the
- * result to the caller. In such a case, the caller must rewrite itself to a more general version in
- * order to avoid future failures of this kind.
- * </p>
- */
-public class ReturnTypeSpecializationTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        FrameDescriptor frameDescriptor = new FrameDescriptor();
-        FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int);
-        TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot));
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Assert.assertEquals(FrameSlotKind.Int, slot.getKind());
-        Object result = target.call();
-        Assert.assertEquals("42", result);
-        Assert.assertEquals(FrameSlotKind.Object, slot.getKind());
-    }
-
-    class TestRootNode extends RootNode {
-
-        @Child TestChildNode left;
-        @Child TestChildNode right;
-
-        public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) {
-            super(TestingLanguage.class, null, descriptor);
-            this.left = left;
-            this.right = right;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            left.execute(frame);
-            return right.execute(frame);
-        }
-    }
-
-    abstract class TestChildNode extends Node {
-
-        public TestChildNode() {
-            super(null);
-        }
-
-        abstract Object execute(VirtualFrame frame);
-
-        int executeInt(VirtualFrame frame) throws UnexpectedResultException {
-            Object result = execute(frame);
-            if (result instanceof Integer) {
-                return (Integer) result;
-            }
-            throw new UnexpectedResultException(result);
-        }
-    }
-
-    abstract class FrameSlotNode extends TestChildNode {
-
-        protected final FrameSlot slot;
-
-        public FrameSlotNode(FrameSlot slot) {
-            this.slot = slot;
-        }
-    }
-
-    class StringTestChildNode extends TestChildNode {
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            return "42";
-        }
-
-    }
-
-    class IntAssignLocal extends FrameSlotNode {
-
-        @Child private TestChildNode value;
-
-        IntAssignLocal(FrameSlot slot, TestChildNode value) {
-            super(slot);
-            this.value = value;
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            try {
-                int result = value.executeInt(frame);
-                frame.setInt(slot, result);
-            } catch (UnexpectedResultException e) {
-                slot.setKind(FrameSlotKind.Object);
-                frame.setObject(slot, e.getResult());
-                replace(new ObjectAssignLocal(slot, value));
-            }
-            return null;
-        }
-    }
-
-    class ObjectAssignLocal extends FrameSlotNode {
-
-        @Child private TestChildNode value;
-
-        ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
-            super(slot);
-            this.value = value;
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            Object o = value.execute(frame);
-            slot.setKind(FrameSlotKind.Object);
-            frame.setObject(slot, o);
-            return null;
-        }
-    }
-
-    class IntReadLocal extends FrameSlotNode {
-
-        IntReadLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            try {
-                return frame.getInt(slot);
-            } catch (FrameSlotTypeException e) {
-                return replace(new ObjectReadLocal(slot)).execute(frame);
-            }
-        }
-
-        @Override
-        int executeInt(VirtualFrame frame) throws UnexpectedResultException {
-            try {
-                return frame.getInt(slot);
-            } catch (FrameSlotTypeException e) {
-                return replace(new ObjectReadLocal(slot)).executeInt(frame);
-            }
-        }
-    }
-
-    class ObjectReadLocal extends FrameSlotNode {
-
-        ObjectReadLocal(FrameSlot slot) {
-            super(slot);
-        }
-
-        @Override
-        Object execute(VirtualFrame frame) {
-            try {
-                return frame.getObject(slot);
-            } catch (FrameSlotTypeException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * <h3>Creating a Root Node</h3>
- *
- * <p>
- * A Truffle root node is the entry point into a Truffle tree that represents a guest language
- * method. It contains a {@link RootNode#execute(VirtualFrame)} method that can return a
- * {@link java.lang.Object} value as the result of the guest language method invocation. This method
- * must however never be called directly. Instead, the Truffle runtime must be used to create a
- * {@link CallTarget} object from a root node using the
- * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be
- * executed using the {@link CallTarget#call(Object...)} method or one of its overloads.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.ChildNodeTest}.
- * </p>
- */
-public class RootNodeTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void test() {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestRootNode rootNode = new TestRootNode();
-        CallTarget target = runtime.createCallTarget(rootNode);
-        Object result = target.call();
-        Assert.assertEquals(42, result);
-    }
-
-    class TestRootNode extends RootNode {
-
-        public TestRootNode() {
-            super(TestingLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return 42;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TestingLanguage.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +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.truffle.api.test;
-
-import java.io.IOException;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.instrument.Visualizer;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.source.Source;
-
-public final class TestingLanguage extends TruffleLanguage<Object> {
-    public static final TestingLanguage INSTANCE = new TestingLanguage();
-
-    private TestingLanguage() {
-    }
-
-    @Override
-    protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
-        throw new IOException();
-    }
-
-    @Override
-    protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
-        return null;
-    }
-
-    @Override
-    protected Object getLanguageGlobal(Object context) {
-        return null;
-    }
-
-    @Override
-    protected boolean isObjectOfLanguage(Object object) {
-        return false;
-    }
-
-    @Override
-    protected Visualizer getVisualizer() {
-        return null;
-    }
-
-    @Override
-    protected boolean isInstrumentable(Node node) {
-        return false;
-    }
-
-    @Override
-    protected WrapperNode createWrapperNode(Node node) {
-        return null;
-    }
-
-    @Override
-    protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
-        return null;
-    }
-
-    @Override
-    protected Object createContext(Env env) {
-        return null;
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ThreadSafetyTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +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.truffle.api.test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.DirectCallNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeUtil;
-import com.oracle.truffle.api.nodes.RootNode;
-import java.util.Random;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Test node rewriting in a tree shared across multiple threads (run with -ea).
- */
-public class ThreadSafetyTest {
-
-    @Test
-    @Ignore("sporadic failures with \"expected:<1000000> but was:<999999>\"")
-    public void test() throws InterruptedException {
-        TruffleRuntime runtime = Truffle.getRuntime();
-        TestRootNode rootNode1 = new TestRootNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new ConstNode(42)))))));
-        final CallTarget target1 = runtime.createCallTarget(rootNode1);
-        NodeUtil.verify(rootNode1);
-
-        RecursiveCallNode callNode = new RecursiveCallNode(new ConstNode(42));
-        TestRootNode rootNode2 = new TestRootNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(new RewritingNode(callNode))))));
-        final CallTarget target2 = runtime.createCallTarget(rootNode2);
-        callNode.setCallNode(runtime.createDirectCallNode(target2));
-        NodeUtil.verify(rootNode2);
-
-        testTarget(target1, 47, 1_000_000);
-        testTarget(target2, 72, 1_000_000);
-    }
-
-    private static void testTarget(final CallTarget target, final int expectedResult, final int numberOfIterations) throws InterruptedException {
-        ExecutorService executorService = Executors.newFixedThreadPool(20);
-        final AtomicInteger ai = new AtomicInteger();
-        for (int i = 0; i < numberOfIterations; i++) {
-            executorService.submit(new Runnable() {
-                public void run() {
-                    try {
-                        Object result = target.call(new Object[]{5});
-                        assertEquals(expectedResult, result);
-                        ai.incrementAndGet();
-                    } catch (Throwable t) {
-                        t.printStackTrace(System.out);
-                    }
-                }
-            });
-        }
-        executorService.shutdown();
-        executorService.awaitTermination(90, TimeUnit.SECONDS);
-        assertTrue("test did not terminate", executorService.isTerminated());
-        assertEquals(numberOfIterations, ai.get());
-    }
-
-    static class TestRootNode extends RootNode {
-
-        @Child private ValueNode child;
-
-        public TestRootNode(ValueNode child) {
-            super(TestingLanguage.class, null, null);
-            this.child = child;
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return child.execute(frame);
-        }
-    }
-
-    abstract static class ValueNode extends Node {
-
-        public ValueNode() {
-            super(null);
-        }
-
-        abstract int execute(VirtualFrame frame);
-    }
-
-    static class RewritingNode extends ValueNode {
-
-        @Child private ValueNode child;
-        private final Random random;
-
-        public RewritingNode(ValueNode child) {
-            this(child, new Random());
-        }
-
-        public RewritingNode(ValueNode child, Random random) {
-            this.child = child;
-            this.random = random;
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            boolean replace = random.nextBoolean();
-            if (replace) {
-                ValueNode newNode = this.replace(new OtherRewritingNode(child, random));
-                return newNode.execute(frame);
-            }
-            return 1 + child.execute(frame);
-        }
-    }
-
-    static class OtherRewritingNode extends ValueNode {
-
-        @Child private ValueNode child;
-        private final Random random;
-
-        public OtherRewritingNode(ValueNode child, Random random) {
-            this.child = child;
-            this.random = random;
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            boolean replace = random.nextBoolean();
-            if (replace) {
-                ValueNode newNode = this.replace(new RewritingNode(child, random));
-                return newNode.execute(frame);
-            }
-            return 1 + child.execute(frame);
-        }
-    }
-
-    static class ConstNode extends ValueNode {
-
-        private final int value;
-
-        ConstNode(int value) {
-            this.value = value;
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            return value;
-        }
-    }
-
-    static class RecursiveCallNode extends ValueNode {
-        @Child DirectCallNode callNode;
-        @Child private ValueNode valueNode;
-
-        RecursiveCallNode(ValueNode value) {
-            this.valueNode = value;
-        }
-
-        @Override
-        int execute(VirtualFrame frame) {
-            int arg = (Integer) frame.getArguments()[0];
-            if (arg > 0) {
-                return (int) callNode.call(frame, new Object[]{(arg - 1)});
-            } else {
-                return valueNode.execute(frame);
-            }
-        }
-
-        void setCallNode(DirectCallNode callNode) {
-            this.callNode = insert(callNode);
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.RootCallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.NodeUtil;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-/**
- * <h3>Accessing the Truffle Runtime</h3>
- *
- * <p>
- * The Truffle runtime can be accessed at any point in time globally using the static method
- * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime
- * object with an identifying name. A Java Virtual Machine implementation can chose to replace the
- * default implementation of the {@link TruffleRuntime} interface with its own implementation for
- * providing improved performance.
- * </p>
- *
- * <p>
- * The next part of the Truffle API introduction is at
- * {@link com.oracle.truffle.api.test.RootNodeTest}.
- * </p>
- */
-public class TruffleRuntimeTest {
-
-    private TruffleRuntime runtime;
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-        this.runtime = Truffle.getRuntime();
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    private static RootNode createTestRootNode(SourceSection sourceSection) {
-        return new RootNode(TestingLanguage.class, sourceSection, null) {
-            @Override
-            public Object execute(VirtualFrame frame) {
-                return 42;
-            }
-        };
-    }
-
-    // @Test
-    public void verifyTheRealRuntimeIsUsedOnRealGraal() {
-        TruffleRuntime r = Truffle.getRuntime();
-        final String name = r.getClass().getName();
-        if (name.endsWith("DefaultTruffleRuntime")) {
-            fail("Wrong name " + name + " with following System.getProperties:\n" + System.getProperties().toString());
-        }
-    }
-
-    @Test
-    public void test() {
-        assertNotNull(runtime);
-        assertNotNull(runtime.getName());
-    }
-
-    @Test
-    public void testCreateCallTarget() {
-        RootNode rootNode = createTestRootNode(null);
-        RootCallTarget target = runtime.createCallTarget(rootNode);
-        assertNotNull(target);
-        assertEquals(target.call(), 42);
-        assertSame(rootNode, target.getRootNode());
-    }
-
-    @Test
-    public void testGetCallTargets1() {
-        RootNode rootNode = createTestRootNode(null);
-        RootCallTarget target = runtime.createCallTarget(rootNode);
-        assertTrue(runtime.getCallTargets().contains(target));
-    }
-
-    @Test
-    public void testGetCallTargets2() {
-        RootNode rootNode = createTestRootNode(null);
-        RootCallTarget target1 = runtime.createCallTarget(rootNode);
-        RootCallTarget target2 = runtime.createCallTarget(rootNode);
-        assertTrue(runtime.getCallTargets().contains(target1));
-        assertTrue(runtime.getCallTargets().contains(target2));
-    }
-
-    /*
-     * This test case documents the use case for profilers and debuggers where they need to access
-     * multiple call targets for the same source section. This case may happen when the optimization
-     * system decides to duplicate call targets to achieve better performance.
-     */
-    @Test
-    public void testGetCallTargets3() {
-        Source source1 = Source.fromText("a\nb\n", "");
-        SourceSection sourceSection1 = source1.createSection("foo", 1);
-        SourceSection sourceSection2 = source1.createSection("bar", 2);
-
-        RootNode rootNode1 = createTestRootNode(sourceSection1);
-        RootNode rootNode2 = createTestRootNode(sourceSection2);
-        RootNode rootNode2Copy = NodeUtil.cloneNode(rootNode2);
-
-        assertSame(rootNode2.getSourceSection(), rootNode2Copy.getSourceSection());
-
-        RootCallTarget target1 = runtime.createCallTarget(rootNode1);
-        RootCallTarget target2 = runtime.createCallTarget(rootNode2);
-        RootCallTarget target2Copy = runtime.createCallTarget(rootNode2Copy);
-
-        Map<SourceSection, List<RootCallTarget>> groupedTargets = groupUniqueCallTargets();
-
-        List<RootCallTarget> targets1 = groupedTargets.get(sourceSection1);
-        assertEquals(1, targets1.size());
-        assertEquals(target1, targets1.get(0));
-
-        List<RootCallTarget> targets2 = groupedTargets.get(sourceSection2);
-        assertEquals(2, targets2.size());
-        // order of targets2 is not guaranteed
-        assertTrue(target2 == targets2.get(0) ^ target2Copy == targets2.get(0));
-        assertTrue(target2 == targets2.get(1) ^ target2Copy == targets2.get(1));
-    }
-
-    private static Map<SourceSection, List<RootCallTarget>> groupUniqueCallTargets() {
-        Map<SourceSection, List<RootCallTarget>> groupedTargets = new HashMap<>();
-        for (RootCallTarget target : Truffle.getRuntime().getCallTargets()) {
-            SourceSection section = target.getRootNode().getSourceSection();
-            if (section == null) {
-                // can not identify root node to a unique call target. Print warning?
-                continue;
-            }
-            List<RootCallTarget> targets = groupedTargets.get(section);
-            if (targets == null) {
-                targets = new ArrayList<>();
-                groupedTargets.put(section, targets);
-            }
-            targets.add(target);
-        }
-        return groupedTargets;
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/EvalInstrumentTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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.truffle.api.test.instrument;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.EvalInstrumentListener;
-import com.oracle.truffle.api.instrument.Instrument;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.SyntaxTag;
-import com.oracle.truffle.api.instrument.impl.DefaultProbeListener;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestingLanguage.InstrumentTestTag;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-/**
- * Tests the kind of instrumentation where a client can provide guest language code to be
- * <em>spliced</em> directly into the AST.
- */
-public class EvalInstrumentTest {
-
-    PolyglotEngine vm;
-    Instrumenter instrumenter;
-
-    @Before
-    public void before() {
-        // TODO (mlvdv) eventually abstract this
-        try {
-            vm = PolyglotEngine.newBuilder().build();
-            final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
-            field.setAccessible(true);
-            instrumenter = (Instrumenter) field.get(vm);
-            final java.lang.reflect.Field testVMField = Instrumenter.class.getDeclaredField("testVM");
-            testVMField.setAccessible(true);
-            testVMField.set(instrumenter, vm);
-        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
-            fail("Reflective access to Instrumenter for testing");
-        }
-    }
-
-    @After
-    public void after() {
-        vm.dispose();
-        vm = null;
-        instrumenter = null;
-    }
-
-    @Test
-    public void testEvalInstrumentListener() throws IOException {
-
-        instrumenter.registerASTProber(new InstrumentationTestingLanguage.TestASTProber());
-        final Source source13 = InstrumentationTestingLanguage.createAdditionSource13("testEvalInstrumentListener");
-
-        final Probe[] addNodeProbe = new Probe[1];
-        instrumenter.addProbeListener(new DefaultProbeListener() {
-
-            @Override
-            public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
-                if (tag == InstrumentTestTag.ADD_TAG) {
-                    addNodeProbe[0] = probe;
-                }
-            }
-        });
-        assertEquals(vm.eval(source13).get(), 13);
-        assertNotNull("Add node should be probed", addNodeProbe[0]);
-
-        final Source source42 = InstrumentationTestingLanguage.createConstantSource42("testEvalInstrumentListener");
-        final int[] evalResult = {0};
-        final int[] evalCount = {0};
-        final Instrument instrument = instrumenter.attach(addNodeProbe[0], source42, new EvalInstrumentListener() {
-
-            public void onExecution(Node node, VirtualFrame vFrame, Object result) {
-                evalCount[0] = evalCount[0] + 1;
-                if (result instanceof Integer) {
-                    evalResult[0] = (Integer) result;
-                }
-            }
-
-            public void onFailure(Node node, VirtualFrame vFrame, Exception ex) {
-                fail("Eval test evaluates without exception");
-
-            }
-        }, "test EvalInstrument", null);
-
-        assertEquals(vm.eval(source13).get(), 13);
-        assertEquals(evalCount[0], 1);
-        assertEquals(evalResult[0], 42);
-
-        // Second execution; same result
-        assertEquals(vm.eval(source13).get(), 13);
-        assertEquals(evalCount[0], 2);
-        assertEquals(evalResult[0], 42);
-
-        // Add new eval instrument with no listener, no effect on third execution
-        instrumenter.attach(addNodeProbe[0], source42, null, "", null);
-        assertEquals(vm.eval(source13).get(), 13);
-        assertEquals(evalCount[0], 3);
-        assertEquals(evalResult[0], 42);
-
-        // Remove original instrument; no further effect from fourth execution
-        instrument.dispose();
-        evalResult[0] = 0;
-        assertEquals(vm.eval(source13).get(), 13);
-        assertEquals(evalCount[0], 3);
-        assertEquals(evalResult[0], 0);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,385 +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.truffle.api.test.instrument;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-
-import org.junit.Test;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.ASTProber;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.ProbeInstrument;
-import com.oracle.truffle.api.instrument.SimpleInstrumentListener;
-import com.oracle.truffle.api.instrument.StandardInstrumentListener;
-import com.oracle.truffle.api.instrument.SyntaxTag;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.instrument.impl.DefaultProbeListener;
-import com.oracle.truffle.api.instrument.impl.DefaultSimpleInstrumentListener;
-import com.oracle.truffle.api.instrument.impl.DefaultStandardInstrumentListener;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeVisitor;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdditionNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestLanguageNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestValueNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestingLanguage.InstrumentTestTag;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-/**
- * <h3>AST Instrumentation</h3>
- *
- * Instrumentation allows the insertion into Truffle ASTs language-specific instances of
- * {@link WrapperNode} that propagate execution events through a {@link Probe} to any instances of
- * {@link ProbeInstrument} that might be attached to the particular probe by tools.
- */
-public class InstrumentationTest {
-
-    @Test
-    public void testProbing() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException {
-        final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
-        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
-        field.setAccessible(true);
-        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
-        instrumenter.registerASTProber(new TestASTProber(instrumenter));
-        final Source source = InstrumentationTestingLanguage.createAdditionSource13("testProbing");
-
-        final Probe[] probes = new Probe[3];
-        instrumenter.addProbeListener(new DefaultProbeListener() {
-
-            @Override
-            public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
-                if (tag == InstrumentTestTag.ADD_TAG) {
-                    assertEquals(probes[0], null);
-                    probes[0] = probe;
-                } else if (tag == InstrumentTestTag.VALUE_TAG) {
-                    if (probes[1] == null) {
-                        probes[1] = probe;
-                    } else if (probes[2] == null) {
-                        probes[2] = probe;
-                    } else {
-                        fail("Should only be three probes");
-                    }
-                }
-            }
-        });
-        assertEquals(vm.eval(source).get(), 13);
-        assertNotNull("Add node should be probed", probes[0]);
-        assertNotNull("Value nodes should be probed", probes[1]);
-        assertNotNull("Value nodes should be probed", probes[2]);
-        // Check instrumentation with the simplest kind of counters.
-        // They should all be removed when the check is finished.
-        checkCounters(probes[0], vm, source, new TestSimpleInstrumentCounter(instrumenter), new TestSimpleInstrumentCounter(instrumenter), new TestSimpleInstrumentCounter(instrumenter));
-
-        // Now try with the more complex flavor of listener
-        checkCounters(probes[0], vm, source, new TestStandardInstrumentCounter(instrumenter), new TestStandardInstrumentCounter(instrumenter), new TestStandardInstrumentCounter(instrumenter));
-
-    }
-
-    @Test
-    public void testTagging() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException {
-
-        final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
-        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
-        field.setAccessible(true);
-        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
-        final Source source = InstrumentationTestingLanguage.createAdditionSource13("testTagging");
-
-        // Applies appropriate tags
-        final TestASTProber astProber = new TestASTProber(instrumenter);
-        instrumenter.registerASTProber(astProber);
-
-        // Listens for probes and tags being added
-        final TestProbeListener probeListener = new TestProbeListener();
-        instrumenter.addProbeListener(probeListener);
-
-        assertEquals(13, vm.eval(source).get());
-
-        // Check that the prober added probes to the tree
-        assertEquals(probeListener.probeCount, 3);
-        assertEquals(probeListener.tagCount, 3);
-
-        assertEquals(instrumenter.findProbesTaggedAs(InstrumentTestTag.ADD_TAG).size(), 1);
-        assertEquals(instrumenter.findProbesTaggedAs(InstrumentTestTag.VALUE_TAG).size(), 2);
-    }
-
-    private static void checkCounters(Probe probe, PolyglotEngine vm, Source source, TestCounter counterA, TestCounter counterB, TestCounter counterC) throws IOException {
-
-        // Attach a counting instrument to the probe
-        counterA.attach(probe);
-
-        // Attach a second counting instrument to the probe
-        counterB.attach(probe);
-
-        // Run it again and check that the two instruments are working
-        assertEquals(13, vm.eval(source).get());
-        assertEquals(counterA.enterCount(), 1);
-        assertEquals(counterA.leaveCount(), 1);
-        assertEquals(counterB.enterCount(), 1);
-        assertEquals(counterB.leaveCount(), 1);
-
-        // Remove counterA
-        counterA.dispose();
-
-        // Run it again and check that instrument B is still working but not A
-        assertEquals(13, vm.eval(source).get());
-        assertEquals(counterA.enterCount(), 1);
-        assertEquals(counterA.leaveCount(), 1);
-        assertEquals(counterB.enterCount(), 2);
-        assertEquals(counterB.leaveCount(), 2);
-
-        // Attach a second instrument to the probe
-        counterC.attach(probe);
-
-        // Run the original and check that instruments B,C working but not A
-        assertEquals(13, vm.eval(source).get());
-        assertEquals(counterA.enterCount(), 1);
-        assertEquals(counterA.leaveCount(), 1);
-        assertEquals(counterB.enterCount(), 3);
-        assertEquals(counterB.leaveCount(), 3);
-        assertEquals(counterC.enterCount(), 1);
-        assertEquals(counterC.leaveCount(), 1);
-
-        // Remove instrumentC
-        counterC.dispose();
-
-        // Run the original and check that instrument B working but not A,C
-        assertEquals(13, vm.eval(source).get());
-        assertEquals(counterA.enterCount(), 1);
-        assertEquals(counterA.leaveCount(), 1);
-        assertEquals(counterB.enterCount(), 4);
-        assertEquals(counterB.leaveCount(), 4);
-        assertEquals(counterC.enterCount(), 1);
-        assertEquals(counterC.leaveCount(), 1);
-
-        // Remove instrumentB
-        counterB.dispose();
-
-        // Check that no instruments working
-        assertEquals(13, vm.eval(source).get());
-        assertEquals(counterA.enterCount(), 1);
-        assertEquals(counterA.leaveCount(), 1);
-        assertEquals(counterB.enterCount(), 4);
-        assertEquals(counterB.leaveCount(), 4);
-        assertEquals(counterC.enterCount(), 1);
-        assertEquals(counterC.leaveCount(), 1);
-    }
-
-    private interface TestCounter {
-
-        int enterCount();
-
-        int leaveCount();
-
-        void attach(Probe probe);
-
-        void dispose();
-    }
-
-    /**
-     * A counter for the number of times execution enters and leaves a probed AST node.
-     */
-    private class TestSimpleInstrumentCounter implements TestCounter {
-
-        public int enterCount = 0;
-        public int leaveCount = 0;
-        public Instrumenter instrumenter;
-        private ProbeInstrument instrument;
-
-        public TestSimpleInstrumentCounter(Instrumenter instrumenter) {
-            this.instrumenter = instrumenter;
-        }
-
-        @Override
-        public int enterCount() {
-            return enterCount;
-        }
-
-        @Override
-        public int leaveCount() {
-            return leaveCount;
-        }
-
-        @Override
-        public void attach(Probe probe) {
-            instrument = instrumenter.attach(probe, new SimpleInstrumentListener() {
-
-                public void onEnter(Probe p) {
-                    enterCount++;
-                }
-
-                public void onReturnVoid(Probe p) {
-                    leaveCount++;
-                }
-
-                public void onReturnValue(Probe p, Object result) {
-                    leaveCount++;
-                }
-
-                public void onReturnExceptional(Probe p, Throwable exception) {
-                    leaveCount++;
-                }
-            }, "Instrumentation Test Counter");
-        }
-
-        @Override
-        public void dispose() {
-            instrument.dispose();
-        }
-    }
-
-    /**
-     * A counter for the number of times execution enters and leaves a probed AST node.
-     */
-    private class TestStandardInstrumentCounter implements TestCounter {
-
-        public int enterCount = 0;
-        public int leaveCount = 0;
-        public final Instrumenter instrumenter;
-        public ProbeInstrument instrument;
-
-        public TestStandardInstrumentCounter(Instrumenter instrumenter) {
-            this.instrumenter = instrumenter;
-        }
-
-        @Override
-        public int enterCount() {
-            return enterCount;
-        }
-
-        @Override
-        public int leaveCount() {
-            return leaveCount;
-        }
-
-        @Override
-        public void attach(Probe probe) {
-            instrument = instrumenter.attach(probe, new StandardInstrumentListener() {
-
-                public void onEnter(Probe p, Node node, VirtualFrame vFrame) {
-                    enterCount++;
-                }
-
-                public void onReturnVoid(Probe p, Node node, VirtualFrame vFrame) {
-                    leaveCount++;
-                }
-
-                public void onReturnValue(Probe p, Node node, VirtualFrame vFrame, Object result) {
-                    leaveCount++;
-                }
-
-                public void onReturnExceptional(Probe p, Node node, VirtualFrame vFrame, Throwable exception) {
-                    leaveCount++;
-                }
-            }, "Instrumentation Test Counter");
-        }
-
-        @Override
-        public void dispose() {
-            instrument.dispose();
-        }
-    }
-
-    /**
-     * Tags selected nodes on newly constructed ASTs.
-     */
-    private static final class TestASTProber implements NodeVisitor, ASTProber {
-
-        private final Instrumenter instrumenter;
-
-        TestASTProber(Instrumenter instrumenter) {
-            this.instrumenter = instrumenter;
-        }
-
-        @Override
-        public boolean visit(Node node) {
-            if (node instanceof TestLanguageNode) {
-
-                final TestLanguageNode testNode = (TestLanguageNode) node;
-
-                if (node instanceof TestValueNode) {
-                    instrumenter.probe(testNode).tagAs(InstrumentTestTag.VALUE_TAG, null);
-
-                } else if (node instanceof TestAdditionNode) {
-                    instrumenter.probe(testNode).tagAs(InstrumentTestTag.ADD_TAG, null);
-
-                }
-            }
-            return true;
-        }
-
-        @Override
-        public void probeAST(Instrumenter inst, RootNode rootNode) {
-            rootNode.accept(this);
-        }
-    }
-
-    /**
-     * Counts the number of "enter" events at probed nodes using the simplest AST listener.
-     */
-    static final class TestSimpleInstrumentListener extends DefaultSimpleInstrumentListener {
-
-        public int counter = 0;
-
-        @Override
-        public void onEnter(Probe probe) {
-            counter++;
-        }
-    }
-
-    /**
-     * Counts the number of "enter" events at probed nodes using the AST listener.
-     */
-    static final class TestASTInstrumentListener extends DefaultStandardInstrumentListener {
-
-        public int counter = 0;
-
-        @Override
-        public void onEnter(Probe probe, Node node, VirtualFrame vFrame) {
-            counter++;
-        }
-    }
-
-    private static final class TestProbeListener extends DefaultProbeListener {
-
-        public int probeCount = 0;
-        public int tagCount = 0;
-
-        @Override
-        public void newProbeInserted(Probe probe) {
-            probeCount++;
-        }
-
-        @Override
-        public void probeTaggedAs(Probe probe, SyntaxTag tag, Object tagValue) {
-            tagCount++;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTestNodes.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +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.truffle.api.test.instrument;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeCost;
-import com.oracle.truffle.api.nodes.NodeInfo;
-import com.oracle.truffle.api.nodes.RootNode;
-
-/**
- * Tests instrumentation where a client can attach a node that gets attached into the AST.
- */
-class InstrumentationTestNodes {
-
-    abstract static class TestLanguageNode extends Node {
-        public abstract Object execute(VirtualFrame vFrame);
-
-    }
-
-    @NodeInfo(cost = NodeCost.NONE)
-    static class TestLanguageWrapperNode extends TestLanguageNode implements WrapperNode {
-        @Child private TestLanguageNode child;
-        @Child private EventHandlerNode eventHandlerNode;
-
-        public TestLanguageWrapperNode(TestLanguageNode child) {
-            assert !(child instanceof TestLanguageWrapperNode);
-            this.child = child;
-        }
-
-        @Override
-        public String instrumentationInfo() {
-            return "Wrapper node for testing";
-        }
-
-        @Override
-        public void insertEventHandlerNode(EventHandlerNode eventHandler) {
-            this.eventHandlerNode = eventHandler;
-        }
-
-        @Override
-        public Probe getProbe() {
-            return eventHandlerNode.getProbe();
-        }
-
-        @Override
-        public Node getChild() {
-            return child;
-        }
-
-        @Override
-        public Object execute(VirtualFrame vFrame) {
-            eventHandlerNode.enter(child, vFrame);
-            Object result;
-            try {
-                result = child.execute(vFrame);
-                eventHandlerNode.returnValue(child, vFrame, result);
-            } catch (Exception e) {
-                eventHandlerNode.returnExceptional(child, vFrame, e);
-                throw (e);
-            }
-            return result;
-        }
-    }
-
-    /**
-     * A simple node for our test language to store a value.
-     */
-    static class TestValueNode extends TestLanguageNode {
-        private final int value;
-
-        public TestValueNode(int value) {
-            this.value = value;
-        }
-
-        @Override
-        public Object execute(VirtualFrame vFrame) {
-            return new Integer(this.value);
-        }
-    }
-
-    /**
-     * A node for our test language that adds up two {@link TestValueNode}s.
-     */
-    static class TestAdditionNode extends TestLanguageNode {
-        @Child private TestLanguageNode leftChild;
-        @Child private TestLanguageNode rightChild;
-
-        public TestAdditionNode(TestValueNode leftChild, TestValueNode rightChild) {
-            this.leftChild = insert(leftChild);
-            this.rightChild = insert(rightChild);
-        }
-
-        @Override
-        public Object execute(VirtualFrame vFrame) {
-            return new Integer(((Integer) leftChild.execute(vFrame)).intValue() + ((Integer) rightChild.execute(vFrame)).intValue());
-        }
-    }
-
-    /**
-     * Truffle requires that all guest languages to have a {@link RootNode} which sits atop any AST
-     * of the guest language. This is necessary since creating a {@link CallTarget} is how Truffle
-     * completes an AST. The root nodes serves as our entry point into a program.
-     */
-    static class InstrumentationTestRootNode extends RootNode {
-        @Child private TestLanguageNode body;
-
-        /**
-         * This constructor emulates the global machinery that applies registered probers to every
-         * newly created AST. Global registry is not used, since that would interfere with other
-         * tests run in the same environment.
-         */
-        public InstrumentationTestRootNode(TestLanguageNode body) {
-            super(InstrumentationTestingLanguage.class, null, null);
-            this.body = body;
-        }
-
-        @Override
-        public Object execute(VirtualFrame vFrame) {
-            return body.execute(vFrame);
-        }
-
-        @Override
-        public boolean isCloningAllowed() {
-            return true;
-        }
-    }
-
-    /**
-     * Truffle requires that all guest languages to have a {@link RootNode} which sits atop any AST
-     * of the guest language. This is necessary since creating a {@link CallTarget} is how Truffle
-     * completes an AST. The root nodes serves as our entry point into a program.
-     */
-    static class TestRootNode extends RootNode {
-        @Child private TestLanguageNode body;
-
-        final Instrumenter instrumenter;
-
-        /**
-         * This constructor emulates the global machinery that applies registered probers to every
-         * newly created AST. Global registry is not used, since that would interfere with other
-         * tests run in the same environment.
-         */
-        public TestRootNode(TestLanguageNode body, Instrumenter instrumenter) {
-            super(InstrumentationTestingLanguage.class, null, null);
-            this.instrumenter = instrumenter;
-            this.body = body;
-        }
-
-        @Override
-        public Object execute(VirtualFrame vFrame) {
-            return body.execute(vFrame);
-        }
-
-        @Override
-        public boolean isCloningAllowed() {
-            return true;
-        }
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTestingLanguage.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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.truffle.api.test.instrument;
-
-import java.io.IOException;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.TruffleRuntime;
-import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.instrument.ASTProber;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.SyntaxTag;
-import com.oracle.truffle.api.instrument.Visualizer;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeVisitor;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.InstrumentationTestRootNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdditionNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestLanguageNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestLanguageWrapperNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestValueNode;
-
-@TruffleLanguage.Registration(name = "instrumentationTestLanguage", version = "0", mimeType = "text/x-instTest")
-public final class InstrumentationTestingLanguage extends TruffleLanguage<Object> {
-
-    public static final InstrumentationTestingLanguage INSTANCE = new InstrumentationTestingLanguage();
-
-    private static final String ADD_SOURCE_TEXT = "Fake source text for testing:  parses to 6 + 7";
-    private static final String CONSTANT_SOURCE_TEXT = "Fake source text for testing: parses to 42";
-
-    /** Use a unique test name to avoid unexpected CallTarget sharing. */
-    static Source createAdditionSource13(String testName) {
-        return Source.fromText(ADD_SOURCE_TEXT, testName).withMimeType("text/x-instTest");
-    }
-
-    /** Use a unique test name to avoid unexpected CallTarget sharing. */
-    static Source createConstantSource42(String testName) {
-        return Source.fromText(CONSTANT_SOURCE_TEXT, testName).withMimeType("text/x-instTest");
-    }
-
-    static enum InstrumentTestTag implements SyntaxTag {
-
-        ADD_TAG("addition", "test language addition node"),
-
-        VALUE_TAG("value", "test language value node");
-
-        private final String name;
-        private final String description;
-
-        private InstrumentTestTag(String name, String description) {
-            this.name = name;
-            this.description = description;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public String getDescription() {
-            return description;
-        }
-    }
-
-    private InstrumentationTestingLanguage() {
-    }
-
-    @Override
-    protected CallTarget parse(Source source, Node context, String... argumentNames) throws IOException {
-        if (source.getCode().equals(ADD_SOURCE_TEXT)) {
-            final TestValueNode leftValueNode = new TestValueNode(6);
-            final TestValueNode rightValueNode = new TestValueNode(7);
-            final TestAdditionNode addNode = new TestAdditionNode(leftValueNode, rightValueNode);
-            final InstrumentationTestRootNode rootNode = new InstrumentationTestRootNode(addNode);
-            final TruffleRuntime runtime = Truffle.getRuntime();
-            final CallTarget callTarget = runtime.createCallTarget(rootNode);
-            return callTarget;
-        }
-        if (source.getCode().equals(CONSTANT_SOURCE_TEXT)) {
-            final TestValueNode constantNode = new TestValueNode(42);
-            final InstrumentationTestRootNode rootNode = new InstrumentationTestRootNode(constantNode);
-            final TruffleRuntime runtime = Truffle.getRuntime();
-            final CallTarget callTarget = runtime.createCallTarget(rootNode);
-            return callTarget;
-        }
-        return null;
-    }
-
-    @Override
-    protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
-        return null;
-    }
-
-    @Override
-    protected Object getLanguageGlobal(Object context) {
-        return null;
-    }
-
-    @Override
-    protected boolean isObjectOfLanguage(Object object) {
-        return false;
-    }
-
-    @Override
-    protected Visualizer getVisualizer() {
-        return null;
-    }
-
-    @Override
-    protected boolean isInstrumentable(Node node) {
-        return node instanceof TestAdditionNode || node instanceof TestValueNode;
-    }
-
-    @Override
-    protected WrapperNode createWrapperNode(Node node) {
-        if (isInstrumentable(node)) {
-            return new TestLanguageWrapperNode((TestLanguageNode) node);
-        }
-        return null;
-    }
-
-    @Override
-    protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
-        return null;
-    }
-
-    @Override
-    protected Object createContext(Env env) {
-        return null;
-    }
-
-    static final class TestASTProber implements ASTProber {
-
-        public void probeAST(final Instrumenter instrumenter, RootNode startNode) {
-            startNode.accept(new NodeVisitor() {
-
-                @Override
-                public boolean visit(Node node) {
-                    if (node instanceof TestLanguageNode) {
-
-                        final TestLanguageNode testNode = (TestLanguageNode) node;
-
-                        if (node instanceof TestValueNode) {
-                            instrumenter.probe(testNode).tagAs(InstrumentTestTag.VALUE_TAG, null);
-
-                        } else if (node instanceof TestAdditionNode) {
-                            instrumenter.probe(testNode).tagAs(InstrumentTestTag.ADD_TAG, null);
-
-                        }
-                    }
-                    return true;
-                }
-            });
-        }
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/interop/ForeignAccessSingleThreadedTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +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.truffle.api.test.interop;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.interop.ForeignAccess;
-import com.oracle.truffle.api.interop.Message;
-import com.oracle.truffle.api.interop.TruffleObject;
-import com.oracle.truffle.api.nodes.Node;
-import org.junit.After;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ForeignAccessSingleThreadedTest implements ForeignAccess.Factory, TruffleObject {
-    ForeignAccess fa;
-    private int cnt;
-
-    @Before
-    public void initInDifferentThread() throws InterruptedException {
-        Thread t = new Thread("Initializer") {
-            @Override
-            public void run() {
-                fa = ForeignAccess.create(ForeignAccessSingleThreadedTest.this);
-            }
-        };
-        t.start();
-        t.join();
-    }
-
-    @Test(expected = AssertionError.class)
-    public void accessNodeFromWrongThread() {
-        Node n = Message.IS_EXECUTABLE.createNode();
-        Object ret = ForeignAccess.execute(n, null, this);
-        fail("Should throw an exception: " + ret);
-    }
-
-    @After
-    public void noCallsToFactory() {
-        assertEquals("No calls to accessMessage or canHandle", 0, cnt);
-    }
-
-    @Override
-    public boolean canHandle(TruffleObject obj) {
-        cnt++;
-        return true;
-    }
-
-    @Override
-    public CallTarget accessMessage(Message tree) {
-        cnt++;
-        return null;
-    }
-
-    @Override
-    public ForeignAccess getForeignAccess() {
-        return fa;
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/interop/ForeignAccessToStringTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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.truffle.api.test.interop;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.interop.ForeignAccess;
-import com.oracle.truffle.api.interop.Message;
-import com.oracle.truffle.api.interop.TruffleObject;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class ForeignAccessToStringTest {
-    @Test
-    public void checkRegularFactory() {
-        ForeignAccess fa = ForeignAccess.create(new SimpleTestingFactory());
-        assertEquals("ForeignAccess[com.oracle.truffle.api.test.interop.ForeignAccessToStringTest$SimpleTestingFactory]", fa.toString());
-    }
-
-    @Test
-    public void check10Factory() {
-        ForeignAccess fa = ForeignAccess.create(TruffleObject.class, new Simple10TestingFactory());
-        assertEquals("ForeignAccess[com.oracle.truffle.api.test.interop.ForeignAccessToStringTest$Simple10TestingFactory]", fa.toString());
-    }
-
-    private static class SimpleTestingFactory implements ForeignAccess.Factory {
-        public SimpleTestingFactory() {
-        }
-
-        @Override
-        public boolean canHandle(TruffleObject obj) {
-            return false;
-        }
-
-        @Override
-        public CallTarget accessMessage(Message tree) {
-            return null;
-        }
-    }
-
-    private static class Simple10TestingFactory implements ForeignAccess.Factory10 {
-        @Override
-        public CallTarget accessIsNull() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessIsExecutable() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessIsBoxed() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessHasSize() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessGetSize() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessUnbox() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessRead() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessWrite() {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessExecute(int argumentsLength) {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessInvoke(int argumentsLength) {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessMessage(Message unknown) {
-            return null;
-        }
-
-        @Override
-        public CallTarget accessNew(int argumentsLength) {
-            return null;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/interop/MessageStringTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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.truffle.api.test.interop;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Locale;
-
-import org.junit.Test;
-
-import com.oracle.truffle.api.interop.Message;
-
-public class MessageStringTest {
-
-    @Test
-    public void testFields() throws Exception {
-        for (Field f : Message.class.getFields()) {
-            if (f.getType() != Message.class) {
-                continue;
-            }
-            if ((f.getModifiers() & Modifier.STATIC) == 0) {
-                continue;
-            }
-            Message msg = (Message) f.get(null);
-
-            String persistent = Message.toString(msg);
-            assertNotNull("Found name for " + f, persistent);
-            assertEquals("It is in upper case", persistent, persistent.toUpperCase(Locale.ENGLISH));
-
-            Message newMsg = Message.valueOf(persistent);
-
-            assertSame("Same for " + f, msg, newMsg);
-
-            assertEquals("Same toString()", persistent, msg.toString());
-        }
-    }
-
-    @Test
-    public void testFactoryMethods() throws Exception {
-        for (Method m : Message.class.getMethods()) {
-            if (m.getReturnType() != Message.class) {
-                continue;
-            }
-            if (!m.getName().startsWith("create")) {
-                continue;
-            }
-            if ((m.getModifiers() & Modifier.STATIC) == 0) {
-                continue;
-            }
-            Message msg = (Message) m.invoke(null, 0);
-
-            String persistent = Message.toString(msg);
-            assertNotNull("Found name for " + m, persistent);
-            assertEquals("It is in upper case", persistent, persistent.toUpperCase(Locale.ENGLISH));
-
-            Message newMsg = Message.valueOf(persistent);
-
-            assertEquals("Same for " + m, msg, newMsg);
-
-            assertEquals("Same toString()", persistent, msg.toString());
-            assertEquals("Same toString() for new one", persistent, newMsg.toString());
-        }
-    }
-
-    @Test
-    public void specialMessagePersitance() {
-        SpecialMsg msg = new SpecialMsg();
-        String persistent = Message.toString(msg);
-        Message newMsg = Message.valueOf(persistent);
-        assertEquals("Message reconstructed", msg, newMsg);
-    }
-
-    public static final class SpecialMsg extends Message {
-
-        @Override
-        public boolean equals(Object message) {
-            return message instanceof SpecialMsg;
-        }
-
-        @Override
-        public int hashCode() {
-            return 5425432;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/nodes/NodeUtilTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test.nodes;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeUtil;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.TestingLanguage;
-import java.util.Iterator;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import org.junit.Test;
-
-public class NodeUtilTest {
-
-    @Test
-    public void testRecursiveIterator1() {
-        TestRootNode root = new TestRootNode();
-        root.child0 = new TestNode();
-        root.adoptChildren();
-
-        int count = iterate(NodeUtil.makeRecursiveIterator(root));
-
-        assertThat(count, is(2));
-        assertThat(root.visited, is(0));
-        assertThat(root.child0.visited, is(1));
-    }
-
-    private static int iterate(Iterator<Node> iterator) {
-        int iterationCount = 0;
-        while (iterator.hasNext()) {
-            Node node = iterator.next();
-            if (node == null) {
-                continue;
-            }
-            if (node instanceof TestNode) {
-                ((TestNode) node).visited = iterationCount;
-            } else if (node instanceof TestRootNode) {
-                ((TestRootNode) node).visited = iterationCount;
-            } else {
-                throw new AssertionError();
-            }
-            iterationCount++;
-        }
-        return iterationCount;
-    }
-
-    private static class TestNode extends Node {
-
-        @Child TestNode child0;
-        @Child TestNode child1;
-
-        private int visited;
-
-        public TestNode() {
-        }
-
-    }
-
-    private static class TestRootNode extends RootNode {
-
-        @Child TestNode child0;
-
-        private int visited;
-
-        public TestRootNode() {
-            super(TestingLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return null;
-        }
-
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/nodes/SafeReplaceTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +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.truffle.api.test.nodes;
-
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.test.TestingLanguage;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-/**
- * Tests optional method for ensuring that a node replacement is type safe. Ordinary node
- * replacement is performed by unsafe assignment of a parent node's child field.
- */
-public class SafeReplaceTest {
-
-    @Test
-    public void testCorrectReplacement() {
-        TestRootNode root = new TestRootNode();
-        final TestNode oldChild = new TestNode();
-        final TestNode newChild = new TestNode();
-        root.child = oldChild;
-        assertFalse(oldChild.isSafelyReplaceableBy(newChild));  // No parent node
-        root.adoptChildren();
-        assertTrue(oldChild.isSafelyReplaceableBy(newChild));   // Now adopted by parent
-        // new node
-        oldChild.replace(newChild);
-        root.execute(null);
-        assertEquals(root.executed, 1);
-        assertEquals(oldChild.executed, 0);
-        assertEquals(newChild.executed, 1);
-    }
-
-    @Test
-    public void testIncorrectReplacement() {
-        TestRootNode root = new TestRootNode();
-        final TestNode oldChild = new TestNode();
-        root.child = oldChild;
-        root.adoptChildren();
-        final TestNode newChild = new TestNode();
-        final TestNode strayChild = new TestNode();
-        assertFalse(strayChild.isSafelyReplaceableBy(newChild)); // Stray not a child of parent
-        final WrongTestNode wrongTypeNewChild = new WrongTestNode();
-        assertFalse(oldChild.isSafelyReplaceableBy(wrongTypeNewChild));
-    }
-
-    private static class TestNode extends Node {
-
-        private int executed;
-
-        public Object execute() {
-            executed++;
-            return null;
-        }
-    }
-
-    private static class TestRootNode extends RootNode {
-
-        @Child TestNode child;
-
-        private int executed;
-
-        public TestRootNode() {
-            super(TestingLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            executed++;
-            child.execute();
-            return null;
-        }
-    }
-
-    private static class WrongTestNode extends Node {
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/package.html	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-<html>
-    <p>
-    This package contains basic tests of the Truffle API and serves at the same time as an
-    introduction to the Truffle API for language implementors. Every test gives an example on how to
-    use the construct explained in the class description.
-    </p>
-
-    <p>
-    Truffle is a language implementation framework. A guest language method is represented as a tree
-    of executable nodes. The framework provides mechanisms for those trees to call each other.
-    Additionally it contains dedicated data structures for storing data local to a tree invocation.
-    </p>
-
-    <p>
-    This introduction to Truffle contains items in the following recommended order:
-
-    <ul>
-    <li>How to get access to the Truffle runtime?
-    {@link com.oracle.truffle.api.test.TruffleRuntimeTest}</li>
-    <li>How to create a root node? {@link com.oracle.truffle.api.test.RootNodeTest}</li>
-    <li>How to create a child node and link it with its parent?
-    {@link com.oracle.truffle.api.test.ChildNodeTest}</li>
-    <li>How to create an array of child nodes? {@link com.oracle.truffle.api.test.ChildrenNodesTest}
-    </li>
-    <li>Why are final fields in node classes important?
-    {@link com.oracle.truffle.api.test.FinalFieldTest}</li>
-    <li>How to replace one node with another node and what for?
-    {@link com.oracle.truffle.api.test.ReplaceTest}</li>
-    <li>How to let one Truffle tree invoke another one? {@link com.oracle.truffle.api.test.CallTest}
-    </li>
-    <li>How to pass arguments when executing a tree?
-    {@link com.oracle.truffle.api.test.ArgumentsTest}</li>
-    <li>How to use frames and frame slots to store values local to an activation?
-    {@link com.oracle.truffle.api.test.FrameTest}</li>
-    <li>How to use type specialization and speculation for frame slots?
-    {@link com.oracle.truffle.api.test.FrameSlotTypeSpecializationTest}</li>
-    <li>How to use type specialization and speculation for node return values?
-    {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}</li>
-    <li>How to "instrument" an AST with nodes that can provide access to runtime state from external
-    tools {@code com.oracle.truffle.api.test.instrument.InstrumentationTest}</li>
-    </ul>
-</html>
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/BytesSourceSectionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, 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.test.source;
-
-import com.oracle.truffle.api.source.Source;
-import java.nio.charset.StandardCharsets;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class BytesSourceSectionTest {
-
-    @Test
-    public void testSectionsFromLineNumberASCII() {
-        final byte[] bytes = "foo\nbar\nbaz\n".getBytes(StandardCharsets.US_ASCII);
-        final Source source = Source.fromBytes(bytes, "description", StandardCharsets.US_ASCII);
-        assertEquals("foo", source.createSection("identifier", 1).getCode());
-        assertEquals("bar", source.createSection("identifier", 2).getCode());
-        assertEquals("baz", source.createSection("identifier", 3).getCode());
-    }
-
-    @Test
-    public void testSectionsFromOffsetsASCII() {
-        final byte[] bytes = "foo\nbar\nbaz\n".getBytes(StandardCharsets.US_ASCII);
-        final Source source = Source.fromBytes(bytes, "description", StandardCharsets.US_ASCII);
-        assertEquals("foo", source.createSection("identifier", 0, 3).getCode());
-        assertEquals("bar", source.createSection("identifier", 4, 3).getCode());
-        assertEquals("baz", source.createSection("identifier", 8, 3).getCode());
-    }
-
-    @Test
-    public void testOffset() {
-        final byte[] bytes = "xxxfoo\nbar\nbaz\nxxx".getBytes(StandardCharsets.US_ASCII);
-        final Source source = Source.fromBytes(bytes, 3, bytes.length - 6, "description", StandardCharsets.US_ASCII);
-        assertEquals("foo", source.createSection("identifier", 0, 3).getCode());
-        assertEquals("bar", source.createSection("identifier", 4, 3).getCode());
-        assertEquals("baz", source.createSection("identifier", 8, 3).getCode());
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/JavaRecognizer.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2013, 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.truffle.api.test.source;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.spi.FileTypeDetector;
-
-public final class JavaRecognizer extends FileTypeDetector {
-    @Override
-    public String probeContentType(Path path) throws IOException {
-        if (path.getFileName().toString().endsWith(".java")) {
-            return "text/x-java";
-        }
-        return null;
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2013, 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.truffle.api.test.source;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.source.SourceSection;
-
-public class SourceSectionTest {
-
-    private final Source emptySource = Source.fromText("", null);
-
-    private final Source emptyLineSource = Source.fromText("\n", null);
-
-    private final Source shortSource = Source.fromText("01", null);
-
-    private final Source longSource = Source.fromText("01234\n67\n9\n", null);
-
-    public void emptySourceTest0() {
-        SourceSection section = emptySource.createSection("test", 0, 0);
-        assertNotNull(section);
-        assertEquals(section.getCode(), "");
-    }
-
-    @Test
-    public void emptyLineTest0() {
-        SourceSection section = emptyLineSource.createSection("test", 0, 0);
-        assertNotNull(section);
-        assertEquals(section.getCode(), "");
-        assertEquals(section.getCharIndex(), 0);
-        assertEquals(section.getCharLength(), 0);
-        assertEquals(section.getStartLine(), 1);
-        assertEquals(section.getStartColumn(), 1);
-    }
-
-    @Test
-    public void emptyLineTest1() {
-        SourceSection section = emptyLineSource.createSection("test", 0, 1);
-        assertNotNull(section);
-        assertEquals(section.getCode(), "\n");
-        assertEquals(section.getCharIndex(), 0);
-        assertEquals(section.getCharLength(), 1);
-        assertEquals(section.getStartLine(), 1);
-        assertEquals(section.getStartColumn(), 1);
-        assertEquals(section.getEndLine(), 1);
-        assertEquals(section.getEndColumn(), 1);
-    }
-
-    @Test
-    public void emptySectionTest2() {
-        SourceSection section = shortSource.createSection("test", 0, 0);
-        assertNotNull(section);
-        assertEquals(section.getCode(), "");
-    }
-
-    @Test
-    public void emptySectionTest3() {
-        SourceSection section = longSource.createSection("test", 0, 0);
-        assertNotNull(section);
-        assertEquals(section.getCode(), "");
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2013, 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.truffle.api.test.source;
-
-import com.oracle.truffle.api.source.Source;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-import java.nio.charset.StandardCharsets;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
-import org.junit.Test;
-
-public class SourceTest {
-    @Test
-    public void assignMimeTypeAndIdentity() {
-        Source s1 = Source.fromText("// a comment\n", "Empty comment");
-        assertNull("No mime type assigned", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForApppendable() {
-        Source s1 = Source.fromAppendableText("<stdio>");
-        assertNull("No mime type assigned", s1.getMimeType());
-        s1.appendCode("// Hello");
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForBytes() {
-        String text = "// Hello";
-        Source s1 = Source.fromBytes(text.getBytes(StandardCharsets.UTF_8), "Hello", StandardCharsets.UTF_8);
-        assertNull("No mime type assigned", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForReader() throws IOException {
-        String text = "// Hello";
-        Source s1 = Source.fromReader(new StringReader(text), "Hello");
-        assertNull("No mime type assigned", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForFile() throws IOException {
-        File file = File.createTempFile("Hello", ".java");
-        file.deleteOnExit();
-
-        String text;
-        try (FileWriter w = new FileWriter(file)) {
-            text = "// Hello";
-            w.write(text);
-        }
-
-        // JDK8 default fails on OS X: https://bugs.openjdk.java.net/browse/JDK-8129632
-        Source s1 = Source.fromFileName(file.getPath()).withMimeType("text/x-java");
-        assertEquals("Recognized as Java", "text/x-java", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForVirtualFile() throws IOException {
-        File file = File.createTempFile("Hello", ".java");
-        file.deleteOnExit();
-
-        String text = "// Hello";
-
-        // JDK8 default fails on OS X: https://bugs.openjdk.java.net/browse/JDK-8129632
-        Source s1 = Source.fromFileName(text, file.getPath()).withMimeType("text/x-java");
-        assertEquals("Recognized as Java", "text/x-java", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-
-    @Test
-    public void assignMimeTypeAndIdentityForURL() throws IOException {
-        File file = File.createTempFile("Hello", ".java");
-        file.deleteOnExit();
-
-        String text;
-        try (FileWriter w = new FileWriter(file)) {
-            text = "// Hello";
-            w.write(text);
-        }
-
-        Source s1 = Source.fromURL(file.toURI().toURL(), "Hello.java");
-        assertEquals("Threated as plain", "text/plain", s1.getMimeType());
-        Source s2 = s1.withMimeType("text/x-c");
-        assertEquals("They have the same content", s1.getCode(), s2.getCode());
-        assertEquals("// Hello", s1.getCode());
-        assertNotEquals("But different type", s1.getMimeType(), s2.getMimeType());
-        assertNotEquals("So they are different", s1, s2);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceTextTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2013, 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.truffle.api.test.source;
-
-import com.oracle.truffle.api.source.Source;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class SourceTextTest {
-
-    private final Source emptySource = Source.fromText("", null);
-
-    private final Source emptyLineSource = Source.fromText("\n", null);
-
-    private final Source shortSource = Source.fromText("01", null);
-
-    private final Source longSource = Source.fromText("01234\n67\n9\n", null);
-
-    @Test
-    public void emptyTextTest0() {
-        assertEquals(emptySource.getLineCount(), 0);
-    }
-
-    // Temp disable of empty text tests
-
-    // @Test(expected = IllegalArgumentException.class)
-    @Test()
-    public void emptyTextTest1() {
-        emptySource.getLineNumber(0);
-    }
-
-    // @Test(expected = IllegalArgumentException.class)
-    @Test()
-    public void emptyTextTest2() {
-        emptySource.getColumnNumber(0);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void emptyTextTest3() {
-        emptySource.getLineNumber(-1);
-    }
-
-    // @Test(expected = IllegalArgumentException.class)
-    @Test()
-    public void emptyTextTest4() {
-        emptySource.getLineStartOffset(0);
-    }
-
-    // @Test(expected = IllegalArgumentException.class)
-    public void emptyTextTest5() {
-        emptySource.getLineStartOffset(1);
-    }
-
-    // @Test(expected = IllegalArgumentException.class)
-    public void emptyTextTest6() {
-        emptySource.getLineLength(1);
-    }
-
-    @Test
-    public void emptyLineTest0() {
-        assertEquals(emptyLineSource.getLineCount(), 1);
-        assertEquals(emptyLineSource.getLineNumber(0), 1);
-        assertEquals(emptyLineSource.getLineStartOffset(1), 0);
-        assertEquals(emptyLineSource.getColumnNumber(0), 1);
-        assertEquals(emptyLineSource.getLineLength(1), 0);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void emptyLineTest1() {
-        emptyLineSource.getLineNumber(1);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void emptyLineTest2() {
-        emptyLineSource.getLineStartOffset(2);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void emptyLineTest3() {
-        emptyLineSource.getColumnNumber(1);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void emptyLineTest4() {
-        emptyLineSource.getLineLength(2);
-    }
-
-    @Test
-    public void shortTextTest0() {
-
-        assertEquals(shortSource.getLineCount(), 1);
-
-        assertEquals(shortSource.getLineNumber(0), 1);
-        assertEquals(shortSource.getLineStartOffset(1), 0);
-        assertEquals(shortSource.getColumnNumber(0), 1);
-
-        assertEquals(shortSource.getLineNumber(1), 1);
-        assertEquals(shortSource.getColumnNumber(1), 2);
-
-        assertEquals(shortSource.getLineLength(1), 2);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest1() {
-        shortSource.getLineNumber(-1);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest2() {
-        shortSource.getColumnNumber(-1);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest3() {
-        shortSource.getLineNumber(2);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest4() {
-        shortSource.getColumnNumber(2);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest5() {
-        shortSource.getLineLength(2);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void shortTextTest6() {
-        shortSource.getLineLength(2);
-    }
-
-    @Test
-    public void longTextTest0() {
-
-        assertEquals(longSource.getLineCount(), 3);
-
-        assertEquals(longSource.getLineNumber(0), 1);
-        assertEquals(longSource.getLineStartOffset(1), 0);
-        assertEquals(longSource.getColumnNumber(0), 1);
-
-        assertEquals(longSource.getLineNumber(4), 1);
-        assertEquals(longSource.getColumnNumber(4), 5);
-
-        assertEquals(longSource.getLineNumber(5), 1); // newline
-        assertEquals(longSource.getColumnNumber(5), 6); // newline
-        assertEquals(longSource.getLineLength(1), 5);
-
-        assertEquals(longSource.getLineNumber(6), 2);
-        assertEquals(longSource.getLineStartOffset(2), 6);
-        assertEquals(longSource.getColumnNumber(6), 1);
-
-        assertEquals(longSource.getLineNumber(7), 2);
-        assertEquals(longSource.getColumnNumber(7), 2);
-
-        assertEquals(longSource.getLineNumber(8), 2); // newline
-        assertEquals(longSource.getLineNumber(8), 2); // newline
-        assertEquals(longSource.getLineLength(2), 2);
-
-        assertEquals(longSource.getLineNumber(9), 3);
-        assertEquals(longSource.getLineStartOffset(3), 9);
-        assertEquals(longSource.getColumnNumber(9), 1);
-
-        assertEquals(longSource.getLineNumber(10), 3); // newline
-        assertEquals(longSource.getColumnNumber(10), 2); // newline
-        assertEquals(longSource.getLineLength(3), 1);
-
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void longTextTest1() {
-        longSource.getLineNumber(11);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void longTextTest2() {
-        longSource.getColumnNumber(11);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void longTextTest3() {
-        longSource.getLineStartOffset(4);
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/AlwaysValidAssumptionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * 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.test.utilities;
-
-import com.oracle.truffle.api.nodes.InvalidAssumptionException;
-import com.oracle.truffle.api.utilities.AlwaysValidAssumption;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class AlwaysValidAssumptionTest {
-
-    @Test
-    public void testCheck() throws InvalidAssumptionException {
-        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
-        assumption.check();
-    }
-
-    @Test
-    public void testIsValid() {
-        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
-        assertTrue(assumption.isValid());
-    }
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void testCannotInvalidate() {
-        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
-        assumption.invalidate();
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/AssumedValueTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * 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.test.utilities;
-
-import com.oracle.truffle.api.utilities.AssumedValue;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class AssumedValueTest {
-
-    @Test
-    public void testGet() {
-        final AssumedValue<String> assumedValue = new AssumedValue<>("assumed-value", "1");
-        assertEquals("1", assumedValue.get());
-    }
-
-    @Test
-    public void testSet() {
-        final AssumedValue<String> assumedValue = new AssumedValue<>("assumed-value", "1");
-        assertEquals("1", assumedValue.get());
-        assumedValue.set("2");
-        assertEquals("2", assumedValue.get());
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/BinaryConditionProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.utilities.BinaryConditionProfile;
-import com.oracle.truffle.api.utilities.ConditionProfile;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-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)
-public class BinaryConditionProfileTest {
-
-    @DataPoints public static boolean[] data = new boolean[]{true, false};
-
-    private BinaryConditionProfile profile;
-
-    @Before
-    public void create() {
-        profile = (BinaryConditionProfile) ConditionProfile.createBinaryProfile();
-    }
-
-    @Test
-    public void testInitial() {
-        assertThat(profile.wasTrue(), is(false));
-        assertThat(profile.wasFalse(), is(false));
-    }
-
-    @Theory
-    public void testProfileOne(boolean value) {
-        boolean result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertThat(profile.wasTrue(), is(value));
-        assertThat(profile.wasFalse(), is(!value));
-    }
-
-    @Theory
-    public void testProfileTwo(boolean value0, boolean value1) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(profile.wasTrue(), is(value0 || value1));
-        assertThat(profile.wasFalse(), is(!value0 || !value1));
-    }
-
-    @Theory
-    public void testProfileThree(boolean value0, boolean value1, boolean value2) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-        boolean result2 = profile.profile(value2);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(result2, is(value2));
-        assertThat(profile.wasTrue(), is(value0 || value1 || value2));
-        assertThat(profile.wasFalse(), is(!value0 || !value1 || !value2));
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/BranchProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * 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.test.utilities;
-
-import com.oracle.truffle.api.utilities.BranchProfile;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class BranchProfileTest {
-
-    @Test
-    public void testEnter() {
-        BranchProfile profile = BranchProfile.create();
-        profile.enter();
-        profile.enter();
-    }
-
-    @Test
-    public void testToString() {
-        BranchProfile profile = BranchProfile.create();
-        assertTrue(profile.toString().contains(profile.getClass().getSimpleName()));
-        assertTrue(profile.toString().contains("not-visited"));
-        assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode())));
-        profile.enter();
-        assertTrue(profile.toString().contains(profile.getClass().getSimpleName()));
-        assertTrue(profile.toString().contains("visited"));
-        assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode())));
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/CountingConditionProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.utilities.ConditionProfile;
-import com.oracle.truffle.api.utilities.CountingConditionProfile;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-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)
-public class CountingConditionProfileTest {
-
-    @DataPoints public static boolean[] data = new boolean[]{true, false};
-
-    private CountingConditionProfile profile;
-
-    @Before
-    public void create() {
-        profile = (CountingConditionProfile) ConditionProfile.createCountingProfile();
-    }
-
-    @Test
-    public void testInitial() {
-        assertThat(profile.getTrueCount(), is(0));
-        assertThat(profile.getFalseCount(), is(0));
-    }
-
-    @Theory
-    public void testProfileOne(boolean value) {
-        boolean result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertThat(profile.getTrueCount(), is(value ? 1 : 0));
-        assertThat(profile.getFalseCount(), is(!value ? 1 : 0));
-    }
-
-    @Theory
-    public void testProfileTwo(boolean value0, boolean value1) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(profile.getTrueCount(), is((value0 ? 1 : 0) + (value1 ? 1 : 0)));
-        assertThat(profile.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0)));
-    }
-
-    @Theory
-    public void testProfileThree(boolean value0, boolean value1, boolean value2) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-        boolean result2 = profile.profile(value2);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(result2, is(value2));
-        assertThat(profile.getTrueCount(), is((value0 ? 1 : 0) + (value1 ? 1 : 0) + (value2 ? 1 : 0)));
-        assertThat(profile.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0) + (!value2 ? 1 : 0)));
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/CyclicAssumptionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * 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.test.utilities;
-
-import com.oracle.truffle.api.Assumption;
-import com.oracle.truffle.api.utilities.CyclicAssumption;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class CyclicAssumptionTest {
-
-    @Test
-    public void testIsValid() {
-        final CyclicAssumption assumption = new CyclicAssumption("cyclic-assumption");
-        assertTrue(assumption.getAssumption().isValid());
-    }
-
-    @Test
-    public void testInvalidate() {
-        final CyclicAssumption cyclicAssumption = new CyclicAssumption("cyclic-assumption");
-
-        final Assumption firstAssumption = cyclicAssumption.getAssumption();
-        assertEquals("cyclic-assumption", firstAssumption.getName());
-        assertTrue(firstAssumption.isValid());
-
-        cyclicAssumption.invalidate();
-
-        assertFalse(firstAssumption.isValid());
-
-        final Assumption secondAssumption = cyclicAssumption.getAssumption();
-        assertEquals("cyclic-assumption", secondAssumption.getName());
-        assertTrue(secondAssumption.isValid());
-
-        cyclicAssumption.invalidate();
-
-        assertFalse(firstAssumption.isValid());
-        assertFalse(secondAssumption.isValid());
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/ExactClassValueProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.utilities.ValueProfile;
-import java.lang.reflect.Method;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-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)
-public class ExactClassValueProfileTest {
-
-    @DataPoint public static final String O1 = new String();
-    @DataPoint public static final String O2 = new String();
-    @DataPoint public static final Object O3 = new Object();
-    @DataPoint public static final Integer O4 = new Integer(1);
-    @DataPoint public static final Integer O5 = null;
-
-    private ValueProfile profile;
-
-    @Before
-    public void create() {
-        profile = ValueProfile.createClassProfile();
-    }
-
-    @Test
-    public void testInitial() throws Exception {
-        assertThat(isGeneric(profile), is(false));
-        assertThat(isUninitialized(profile), is(true));
-        assertNull(getCachedClass(profile));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOne(Object value) throws Exception {
-        Object result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(getCachedClass(profile), expectedClass(value));
-        assertThat(isUninitialized(profile), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwo(Object value0, Object value1) throws Exception {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-
-        Object expectedClass = expectedClass(value0) == expectedClass(value1) ? expectedClass(value0) : Object.class;
-
-        assertEquals(getCachedClass(profile), expectedClass);
-        assertThat(isUninitialized(profile), is(false));
-        assertThat(isGeneric(profile), is(expectedClass == Object.class));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThree(Object value0, Object value1, Object value2) throws Exception {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-        Object result2 = profile.profile(value2);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(result2, is(value2));
-
-        Object expectedClass = expectedClass(value0) == expectedClass(value1) && expectedClass(value1) == expectedClass(value2) ? expectedClass(value0) : Object.class;
-
-        assertEquals(getCachedClass(profile), expectedClass);
-        assertThat(isUninitialized(profile), is(false));
-        assertThat(isGeneric(profile), is(expectedClass == Object.class));
-        profile.toString(); // test that it is not crashing
-    }
-
-    private static Class<?> expectedClass(Object value) {
-        return value == null ? Object.class : value.getClass();
-    }
-
-    private static Object get(String name, ValueProfile profile) throws Exception {
-        final Method m = profile.getClass().getDeclaredMethod(name);
-        m.setAccessible(true);
-        return m.invoke(profile);
-    }
-
-    private static Object getCachedClass(ValueProfile profile) throws Exception {
-        return get("getCachedClass", profile);
-    }
-
-    private static boolean isUninitialized(ValueProfile profile) throws Exception {
-        return (Boolean) get("isUninitialized", profile);
-    }
-
-    private static boolean isGeneric(ValueProfile profile) throws Exception {
-        return (Boolean) get("isGeneric", profile);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/IdentityValueProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.utilities.ValueProfile;
-import java.lang.reflect.Method;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-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)
-public class IdentityValueProfileTest {
-
-    @DataPoint public static final String O1 = new String();
-    @DataPoint public static final String O2 = O1;
-    @DataPoint public static final Object O3 = new Object();
-    @DataPoint public static final Integer O4 = new Integer(1);
-    @DataPoint public static final Integer O5 = null;
-
-    private ValueProfile profile;
-
-    @Before
-    public void create() {
-        profile = ValueProfile.createIdentityProfile();
-    }
-
-    @Test
-    public void testInitial() throws Exception {
-        assertThat(isGeneric(profile), is(false));
-        assertThat(isUninitialized(profile), is(true));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOne(Object value) throws Exception {
-        Object result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(getCachedValue(profile), value);
-        assertThat(isUninitialized(profile), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwo(Object value0, Object value1) throws Exception {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-
-        if (value0 == value1) {
-            assertThat(getCachedValue(profile), is(value0));
-            assertThat(isGeneric(profile), is(false));
-        } else {
-            assertThat(isGeneric(profile), is(true));
-        }
-        assertThat(isUninitialized(profile), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThree(Object value0, Object value1, Object value2) throws Exception {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-        Object result2 = profile.profile(value2);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(result2, is(value2));
-
-        if (value0 == value1 && value1 == value2) {
-            assertThat(getCachedValue(profile), is(value0));
-            assertThat(isGeneric(profile), is(false));
-        } else {
-            assertThat(isGeneric(profile), is(true));
-        }
-        assertThat(isUninitialized(profile), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    private static Object get(String name, ValueProfile profile) throws Exception {
-        final Method m = profile.getClass().getDeclaredMethod(name);
-        m.setAccessible(true);
-        return m.invoke(profile);
-    }
-
-    private static Object getCachedValue(ValueProfile profile) throws Exception {
-        return get("getCachedValue", profile);
-    }
-
-    private static boolean isUninitialized(ValueProfile profile) throws Exception {
-        return (Boolean) get("isUninitialized", profile);
-    }
-
-    private static boolean isGeneric(ValueProfile profile) throws Exception {
-        return (Boolean) get("isGeneric", profile);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/InstrumentationTestMode.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +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.truffle.api.test.utilities;
-
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Field;
-
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-public class InstrumentationTestMode {
-
-    public static void set(boolean enable) {
-
-        try {
-            final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
-            final Field instrumenterField = vm.getClass().getDeclaredField("instrumenter");
-            instrumenterField.setAccessible(true);
-            final Object instrumenter = instrumenterField.get(vm);
-            final java.lang.reflect.Field testVMField = Instrumenter.class.getDeclaredField("testVM");
-            testVMField.setAccessible(true);
-            if (enable) {
-                testVMField.set(instrumenter, vm);
-            } else {
-                testVMField.set(instrumenter, null);
-            }
-        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
-            fail("Reflective access to Instrumenter for testing");
-        }
-
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/NeverValidAssumptionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2013, 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.nodes.InvalidAssumptionException;
-import com.oracle.truffle.api.utilities.NeverValidAssumption;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-import org.junit.Test;
-
-public class NeverValidAssumptionTest {
-
-    @Test
-    public void testCheck() {
-        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
-
-        try {
-            assumption.check();
-            fail();
-        } catch (InvalidAssumptionException e) {
-        } catch (Exception e) {
-            fail();
-        }
-    }
-
-    @Test
-    public void testIsValid() {
-        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
-        assertFalse(assumption.isValid());
-    }
-
-    @Test
-    public void testInvalidateDoesNothing() {
-        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
-        assumption.invalidate();
-        assumption.invalidate();
-        assumption.invalidate();
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/PrimitiveValueProfileTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,951 +0,0 @@
-/*
- * Copyright (c) 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.truffle.api.test.utilities;
-
-import com.oracle.truffle.api.utilities.PrimitiveValueProfile;
-import com.oracle.truffle.api.utilities.ValueProfile;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-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)
-public class PrimitiveValueProfileTest {
-
-    @DataPoint public static final String O1 = new String();
-    @DataPoint public static final String O2 = O1;
-    @DataPoint public static final Object O3 = new Object();
-    @DataPoint public static final Object O4 = null;
-
-    @DataPoint public static final byte B1 = Byte.MIN_VALUE;
-    @DataPoint public static final byte B2 = 0;
-    @DataPoint public static final byte B3 = 14;
-    @DataPoint public static final byte B4 = Byte.MAX_VALUE;
-
-    @DataPoint public static final short S1 = Short.MIN_VALUE;
-    @DataPoint public static final short S2 = 0;
-    @DataPoint public static final short S3 = 14;
-    @DataPoint public static final short S4 = Short.MAX_VALUE;
-
-    @DataPoint public static final int I1 = Integer.MIN_VALUE;
-    @DataPoint public static final int I2 = 0;
-    @DataPoint public static final int I3 = 14;
-    @DataPoint public static final int I4 = Integer.MAX_VALUE;
-
-    @DataPoint public static final long L1 = Long.MIN_VALUE;
-    @DataPoint public static final long L2 = 0;
-    @DataPoint public static final long L3 = 14;
-    @DataPoint public static final long L4 = Long.MAX_VALUE;
-
-    @DataPoint public static final float F1 = Float.MIN_VALUE;
-    @DataPoint public static final float F2 = -0.0f;
-    @DataPoint public static final float F3 = +0.0f;
-    @DataPoint public static final float F4 = 14.5f;
-    @DataPoint public static final float F5 = Float.MAX_VALUE;
-
-    @DataPoint public static final double D1 = Double.MIN_VALUE;
-    @DataPoint public static final double D2 = -0.0;
-    @DataPoint public static final double D3 = +0.0;
-    @DataPoint public static final double D4 = 14.5;
-    @DataPoint public static final double D5 = Double.MAX_VALUE;
-
-    @DataPoint public static final boolean T1 = false;
-    @DataPoint public static final boolean T2 = true;
-
-    @DataPoint public static final char C1 = Character.MIN_VALUE;
-    @DataPoint public static final char C2 = 0;
-    @DataPoint public static final char C3 = 14;
-    @DataPoint public static final char C4 = Character.MAX_VALUE;
-
-    private static final float FLOAT_DELTA = 0.00001f;
-    private static final double DOUBLE_DELTA = 0.00001;
-
-    private PrimitiveValueProfile profile;
-
-    @Before
-    public void create() {
-        profile = ValueProfile.createPrimitiveProfile();
-    }
-
-    @Test
-    public void testInitial() {
-        assertThat(profile.isGeneric(), is(false));
-        assertThat(profile.isUninitialized(), is(true));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneObject(Object value) {
-        Object result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoObject(Object value0, Object value1) {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-
-        if (value0 == value1) {
-            assertThat(profile.getCachedValue(), is(value0));
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeObject(Object value0, Object value1, Object value2) {
-        Object result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-        Object result2 = profile.profile(value2);
-
-        assertThat(result0, is(value0));
-        assertThat(result1, is(value1));
-        assertThat(result2, is(value2));
-
-        if (value0 == value1 && value1 == value2) {
-            assertThat(profile.getCachedValue(), is(value0));
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneByte(byte value) {
-        byte result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoByte(byte value0, byte value1) {
-        byte result0 = profile.profile(value0);
-        byte result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Byte);
-            assertEquals((byte) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeByte(byte value0, byte value1, byte value2) {
-        byte result0 = profile.profile(value0);
-        byte result1 = profile.profile(value1);
-        byte result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Byte);
-            assertEquals((byte) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneShort(short value) {
-        short result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoShort(short value0, short value1) {
-        short result0 = profile.profile(value0);
-        short result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Short);
-            assertEquals((short) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeShort(short value0, short value1, short value2) {
-        short result0 = profile.profile(value0);
-        short result1 = profile.profile(value1);
-        short result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Short);
-            assertEquals((short) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneInteger(int value) {
-        int result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoInteger(int value0, int value1) {
-        int result0 = profile.profile(value0);
-        int result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Integer);
-            assertEquals((int) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeInteger(int value0, int value1, int value2) {
-        int result0 = profile.profile(value0);
-        int result1 = profile.profile(value1);
-        int result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Integer);
-            assertEquals((int) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneLong(long value) {
-        long result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoLong(long value0, long value1) {
-        long result0 = profile.profile(value0);
-        long result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Long);
-            assertEquals((long) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeLong(long value0, long value1, long value2) {
-        long result0 = profile.profile(value0);
-        long result1 = profile.profile(value1);
-        long result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Long);
-            assertEquals((long) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneFloat(float value) {
-        float result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoFloat(float value0, float value1) {
-        float result0 = profile.profile(value0);
-        float result1 = profile.profile(value1);
-
-        assertEquals(result0, value0, FLOAT_DELTA);
-        assertEquals(result1, value1, FLOAT_DELTA);
-
-        if (PrimitiveValueProfile.exactCompare(value0, value1)) {
-            assertTrue(profile.getCachedValue() instanceof Float);
-            assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeFloat(float value0, float value1, float value2) {
-        float result0 = profile.profile(value0);
-        float result1 = profile.profile(value1);
-        float result2 = profile.profile(value2);
-
-        assertEquals(result0, value0, FLOAT_DELTA);
-        assertEquals(result1, value1, FLOAT_DELTA);
-        assertEquals(result2, value2, FLOAT_DELTA);
-
-        if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) {
-            assertTrue(profile.getCachedValue() instanceof Float);
-            assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneDouble(double value) {
-        double result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoDouble(double value0, double value1) {
-        double result0 = profile.profile(value0);
-        double result1 = profile.profile(value1);
-
-        assertEquals(result0, value0, DOUBLE_DELTA);
-        assertEquals(result1, value1, DOUBLE_DELTA);
-
-        if (PrimitiveValueProfile.exactCompare(value0, value1)) {
-            assertTrue(profile.getCachedValue() instanceof Double);
-            assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeDouble(double value0, double value1, double value2) {
-        double result0 = profile.profile(value0);
-        double result1 = profile.profile(value1);
-        double result2 = profile.profile(value2);
-
-        assertEquals(result0, value0, DOUBLE_DELTA);
-        assertEquals(result1, value1, DOUBLE_DELTA);
-        assertEquals(result2, value2, DOUBLE_DELTA);
-
-        if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) {
-            assertTrue(profile.getCachedValue() instanceof Double);
-            assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneBoolean(boolean value) {
-        boolean result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoBoolean(boolean value0, boolean value1) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Boolean);
-            assertEquals((boolean) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeBoolean(boolean value0, boolean value1, boolean value2) {
-        boolean result0 = profile.profile(value0);
-        boolean result1 = profile.profile(value1);
-        boolean result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Boolean);
-            assertEquals((boolean) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileOneChar(char value) {
-        char result = profile.profile(value);
-
-        assertThat(result, is(value));
-        assertEquals(profile.getCachedValue(), value);
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileTwoChar(char value0, char value1) {
-        char result0 = profile.profile(value0);
-        char result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-
-        if (value0 == value1) {
-            assertTrue(profile.getCachedValue() instanceof Character);
-            assertEquals((char) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testProfileThreeChar(char value0, char value1, char value2) {
-        char result0 = profile.profile(value0);
-        char result1 = profile.profile(value1);
-        char result2 = profile.profile(value2);
-
-        assertEquals(result0, value0);
-        assertEquals(result1, value1);
-        assertEquals(result2, value2);
-
-        if (value0 == value1 && value1 == value2) {
-            assertTrue(profile.getCachedValue() instanceof Character);
-            assertEquals((char) profile.getCachedValue(), value0);
-            assertThat(profile.isGeneric(), is(false));
-        } else {
-            assertThat(profile.isGeneric(), is(true));
-        }
-        assertThat(profile.isUninitialized(), is(false));
-        profile.toString(); // test that it is not crashing
-    }
-
-    @Theory
-    public void testWithBoxedBoxedByte(byte value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Byte);
-        assertEquals((byte) result0, value);
-        assertTrue(result1 instanceof Byte);
-        assertEquals((byte) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedByte(byte value) {
-        byte result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Byte);
-        assertEquals((byte) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedByte(byte value) {
-        Object result0 = profile.profile((Object) value);
-        byte result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Byte);
-        assertEquals((byte) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedShort(short value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Short);
-        assertEquals((short) result0, value);
-        assertTrue(result1 instanceof Short);
-        assertEquals((short) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedShort(short value) {
-        short result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Short);
-        assertEquals((short) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedShort(short value) {
-        Object result0 = profile.profile((Object) value);
-        short result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Short);
-        assertEquals((short) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedInt(int value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Integer);
-        assertEquals((int) result0, value);
-        assertTrue(result1 instanceof Integer);
-        assertEquals((int) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedInt(int value) {
-        int result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Integer);
-        assertEquals((int) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedInt(int value) {
-        Object result0 = profile.profile((Object) value);
-        int result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Integer);
-        assertEquals((int) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedLong(long value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Long);
-        assertEquals((long) result0, value);
-        assertTrue(result1 instanceof Long);
-        assertEquals((long) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedLong(long value) {
-        long result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Long);
-        assertEquals((long) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedLong(long value) {
-        Object result0 = profile.profile((Object) value);
-        long result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Long);
-        assertEquals((long) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedFloat(float value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Float);
-        assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value));
-        assertTrue(result1 instanceof Float);
-        assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedFloat(float value) {
-        float result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(PrimitiveValueProfile.exactCompare(result0, value));
-        assertTrue(result1 instanceof Float);
-        assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedFloat(float value) {
-        Object result0 = profile.profile((Object) value);
-        float result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Float);
-        assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value));
-        assertTrue(PrimitiveValueProfile.exactCompare(result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedDouble(double value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Double);
-        assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value));
-        assertTrue(result1 instanceof Double);
-        assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedDouble(double value) {
-        double result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(PrimitiveValueProfile.exactCompare(result0, value));
-        assertTrue(result1 instanceof Double);
-        assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedDouble(double value) {
-        Object result0 = profile.profile((Object) value);
-        double result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Double);
-        assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value));
-        assertTrue(PrimitiveValueProfile.exactCompare(result1, value));
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedBoolean(boolean value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Boolean);
-        assertEquals((boolean) result0, value);
-        assertTrue(result1 instanceof Boolean);
-        assertEquals((boolean) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedBoolean(boolean value) {
-        boolean result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Boolean);
-        assertEquals((boolean) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedBoolean(boolean value) {
-        Object result0 = profile.profile((Object) value);
-        boolean result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Boolean);
-        assertEquals((boolean) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedBoxedChar(char value) {
-        Object result0 = profile.profile((Object) value);
-        Object result1 = profile.profile((Object) value);
-
-        assertTrue(result0 instanceof Character);
-        assertEquals((char) result0, value);
-        assertTrue(result1 instanceof Character);
-        assertEquals((char) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithUnboxedBoxedChar(char value) {
-        char result0 = profile.profile(value);
-        Object result1 = profile.profile((Object) value);
-
-        assertEquals(result0, value);
-        assertTrue(result1 instanceof Character);
-        assertEquals((char) result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBoxedUnboxedCharacter(char value) {
-        Object result0 = profile.profile((Object) value);
-        char result1 = profile.profile(value);
-
-        assertTrue(result0 instanceof Character);
-        assertEquals((char) result0, value);
-        assertEquals(result1, value);
-        assertFalse(profile.isUninitialized());
-        assertFalse(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithByteThenObject(byte value0, Object value1) {
-        byte result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithShortThenObject(short value0, Object value1) {
-        short result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithIntThenObject(int value0, Object value1) {
-        int result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithLongThenObject(long value0, Object value1) {
-        long result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithFloatThenObject(float value0, Object value1) {
-        float result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertTrue(PrimitiveValueProfile.exactCompare(result0, value0));
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithDoubleThenObject(double value0, Object value1) {
-        double result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertTrue(PrimitiveValueProfile.exactCompare(result0, value0));
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithBooleanThenObject(boolean value0, Object value1) {
-        boolean result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Theory
-    public void testWithCharThenObject(char value0, Object value1) {
-        char result0 = profile.profile(value0);
-        Object result1 = profile.profile(value1);
-
-        assertEquals(result0, value0);
-        assertSame(result1, value1);
-        assertFalse(profile.isUninitialized());
-        assertTrue(profile.isGeneric());
-    }
-
-    @Test
-    public void testNegativeZeroFloat() {
-        profile.profile(-0.0f);
-        profile.profile(+0.0f);
-        assertThat(profile.isGeneric(), is(true));
-    }
-
-    @Test
-    public void testNegativeZeroDouble() {
-        profile.profile(-0.0);
-        profile.profile(+0.0);
-        assertThat(profile.isGeneric(), is(true));
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/UnionAssumptionTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * 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.test.utilities;
-
-import com.oracle.truffle.api.Assumption;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.nodes.InvalidAssumptionException;
-import com.oracle.truffle.api.utilities.UnionAssumption;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-public class UnionAssumptionTest {
-
-    @Test
-    public void testIsValid() {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-        assertTrue(union.isValid());
-    }
-
-    @Test
-    public void testCheck() throws InvalidAssumptionException {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-        union.check();
-    }
-
-    @Test
-    public void testFirstInvalidateIsValid() {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        first.invalidate();
-
-        assertFalse(union.isValid());
-    }
-
-    @Test(expected = InvalidAssumptionException.class)
-    public void testFirstInvalidateCheck() throws InvalidAssumptionException {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        first.invalidate();
-
-        union.check();
-    }
-
-    @Test
-    public void testSecondInvalidateIsValid() {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        second.invalidate();
-
-        assertFalse(union.isValid());
-    }
-
-    @Test(expected = InvalidAssumptionException.class)
-    public void testSecondInvalidateCheck() throws InvalidAssumptionException {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        second.invalidate();
-
-        union.check();
-    }
-
-    @Test
-    public void testBothInvalidateIsValid() {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        first.invalidate();
-        second.invalidate();
-
-        assertFalse(union.isValid());
-    }
-
-    @Test(expected = InvalidAssumptionException.class)
-    public void testBothInvalidateCheck() throws InvalidAssumptionException {
-        final Assumption first = Truffle.getRuntime().createAssumption("first");
-        final Assumption second = Truffle.getRuntime().createAssumption("second");
-        final UnionAssumption union = new UnionAssumption(first, second);
-
-        first.invalidate();
-        second.invalidate();
-
-        union.check();
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/AccessorTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.impl.Accessor;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.ExportImportLanguage1;
-import static com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.L1;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.concurrent.Executors;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AccessorTest {
-    public static Accessor API;
-
-    @BeforeClass
-    public static void initAccessors() throws Exception {
-        Field f = Accessor.class.getDeclaredField("API");
-        f.setAccessible(true);
-        API = (Accessor) f.get(null);
-    }
-
-    @Test
-    public void canGetAccessToOwnLanguageInstance() throws Exception {
-        PolyglotEngine vm = PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor()).build();
-        PolyglotEngine.Language language = vm.getLanguages().get(L1);
-        assertNotNull("L1 language is defined", language);
-
-        Source s = Source.fromText("return nothing", "nothing");
-        Object ret = language.eval(s).get();
-        assertNull("nothing is returned", ret);
-
-        Object afterInitialization = findLanguageByClass(vm);
-        assertNotNull("Language found", afterInitialization);
-        assertTrue("Right instance: " + afterInitialization, afterInitialization instanceof ExportImportLanguage1);
-    }
-
-    Object findLanguageByClass(PolyglotEngine vm) throws IllegalAccessException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
-        Method find = Accessor.class.getDeclaredMethod("findLanguage", Object.class, Class.class);
-        find.setAccessible(true);
-        TruffleLanguage.Env env = (TruffleLanguage.Env) find.invoke(API, vm, ExportImportLanguage1.class);
-        Field f = env.getClass().getDeclaredField("langCtx");
-        f.setAccessible(true);
-        Object langCtx = f.get(env);
-        f = langCtx.getClass().getDeclaredField("lang");
-        f.setAccessible(true);
-        return f.get(langCtx);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ArrayTruffleObject.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.interop.ForeignAccess;
-import com.oracle.truffle.api.interop.Message;
-import com.oracle.truffle.api.interop.TruffleObject;
-import com.oracle.truffle.api.nodes.RootNode;
-import java.util.List;
-import static org.junit.Assert.assertNotEquals;
-
-final class ArrayTruffleObject implements TruffleObject, ForeignAccess.Factory10 {
-    private final ForeignAccess access;
-    private final Object[] values;
-    private final Thread forbiddenDupl;
-
-    ArrayTruffleObject(Object[] values) {
-        this(values, null);
-    }
-
-    ArrayTruffleObject(Object[] values, Thread forbiddenDupl) {
-        this.access = forbiddenDupl == null ? ForeignAccess.create(getClass(), this) : null;
-        this.values = values;
-        this.forbiddenDupl = forbiddenDupl;
-    }
-
-    @Override
-    public ForeignAccess getForeignAccess() {
-        return access != null ? access : ForeignAccess.create(getClass(), this);
-    }
-
-    @Override
-    public CallTarget accessIsNull() {
-        return target(RootNode.createConstantNode(Boolean.FALSE));
-    }
-
-    @Override
-    public CallTarget accessIsExecutable() {
-        return target(RootNode.createConstantNode(Boolean.FALSE));
-    }
-
-    @Override
-    public CallTarget accessIsBoxed() {
-        return target(RootNode.createConstantNode(Boolean.FALSE));
-    }
-
-    @Override
-    public CallTarget accessHasSize() {
-        return target(RootNode.createConstantNode(Boolean.TRUE));
-    }
-
-    @Override
-    public CallTarget accessGetSize() {
-        return target(RootNode.createConstantNode(values.length));
-    }
-
-    @Override
-    public CallTarget accessUnbox() {
-        return null;
-    }
-
-    @Override
-    public CallTarget accessRead() {
-        return target(new IndexNode());
-    }
-
-    @Override
-    public CallTarget accessWrite() {
-        return null;
-    }
-
-    @Override
-    public CallTarget accessExecute(int argumentsLength) {
-        return null;
-    }
-
-    @Override
-    public CallTarget accessInvoke(int argumentsLength) {
-        if (argumentsLength == 1) {
-            return target(new DuplNode());
-        }
-        if (argumentsLength == 2) {
-            return target(new InvokeNode());
-        }
-        return null;
-    }
-
-    @Override
-    public CallTarget accessNew(int argumentsLength) {
-        return null;
-    }
-
-    @Override
-    public CallTarget accessMessage(Message unknown) {
-        return null;
-    }
-
-    private static CallTarget target(RootNode node) {
-        return Truffle.getRuntime().createCallTarget(node);
-    }
-
-    private final class IndexNode extends RootNode {
-        public IndexNode() {
-            super(TruffleLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            int index = ((Number) ForeignAccess.getArguments(frame).get(0)).intValue();
-            if (values[index] instanceof Object[]) {
-                return new ArrayTruffleObject((Object[]) values[index]);
-            } else {
-                return values[index];
-            }
-        }
-    }
-
-    private final class InvokeNode extends RootNode {
-        public InvokeNode() {
-            super(TruffleLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            final List<Object> args = ForeignAccess.getArguments(frame);
-            if (!"get".equals(args.get(0))) {
-                return null;
-            }
-            int index = ((Number) args.get(1)).intValue();
-            if (values[index] instanceof Object[]) {
-                return new ArrayTruffleObject((Object[]) values[index]);
-            } else {
-                return values[index];
-            }
-        }
-    }
-
-    private final class DuplNode extends RootNode {
-        public DuplNode() {
-            super(TruffleLanguage.class, null, null);
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            final List<Object> args = ForeignAccess.getArguments(frame);
-            if (!"dupl".equals(args.get(0))) {
-                return null;
-            }
-            assertNotEquals("Cannot allocate duplicate on forbidden thread", forbiddenDupl, Thread.currentThread());
-            return new ArrayTruffleObject(values);
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/EngineAsynchTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.util.concurrent.Executors;
-import org.junit.Test;
-
-public class EngineAsynchTest extends EngineTest {
-    @Test
-    public void marker() {
-    }
-
-    @Override
-    protected Thread forbiddenThread() {
-        return Thread.currentThread();
-    }
-
-    @Override
-    protected PolyglotEngine.Builder createBuilder() {
-        return PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor());
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/EngineSingleThreadedTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringReader;
-import org.junit.Before;
-import org.junit.Test;
-
-public class EngineSingleThreadedTest {
-    PolyglotEngine tvm;
-
-    @Before
-    public void initInDifferentThread() throws InterruptedException {
-        final PolyglotEngine.Builder b = PolyglotEngine.newBuilder();
-        Thread t = new Thread("Initializer") {
-            @Override
-            public void run() {
-                tvm = b.build();
-            }
-        };
-        t.start();
-        t.join();
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void evalURI() throws IOException {
-        tvm.eval(Source.fromURL(new File(".").toURI().toURL(), "wrong.test"));
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void evalString() throws IOException {
-        tvm.eval(Source.fromText("1 + 1", "wrong.test").withMimeType("text/javascript"));
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void evalReader() throws IOException {
-        try (StringReader sr = new StringReader("1 + 1")) {
-            tvm.eval(Source.fromReader(sr, "wrong.test").withMimeType("text/javascript"));
-        }
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void evalSource() throws IOException {
-        tvm.eval(Source.fromText("", "Empty"));
-    }
-
-    @Test(expected = IllegalStateException.class)
-    public void findGlobalSymbol() {
-        tvm.findGlobalSymbol("doesNotExists");
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/EngineTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
-
-public class EngineTest {
-    protected PolyglotEngine.Builder createBuilder() {
-        return PolyglotEngine.newBuilder();
-    }
-
-    @Test
-    public void npeWhenCastingAs() throws Exception {
-        PolyglotEngine tvm = createBuilder().build();
-
-        PolyglotEngine.Language language1 = tvm.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Language language2 = tvm.getLanguages().get("application/x-test-import-export-2");
-        language2.eval(Source.fromText("explicit.value=42", "define 42"));
-
-        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
-        String res = value.as(String.class);
-        assertNotNull(res);
-    }
-
-    protected Thread forbiddenThread() {
-        return null;
-    }
-
-    private interface AccessArray {
-        AccessArray dupl();
-
-        List<? extends Number> get(int index);
-    }
-
-    @Test
-    public void wrappedAsArray() throws Exception {
-        Object[][] matrix = {{1, 2, 3}};
-
-        PolyglotEngine tvm = createBuilder().globalSymbol("arr", new ArrayTruffleObject(matrix, forbiddenThread())).build();
-        PolyglotEngine.Language language1 = tvm.getLanguages().get("application/x-test-import-export-1");
-        AccessArray access = language1.eval(Source.fromText("return=arr", "get the array")).as(AccessArray.class);
-        assertNotNull("Array converted to list", access);
-        access = access.dupl();
-        List<? extends Number> list = access.get(0);
-        assertEquals("Size 3", 3, list.size());
-        assertEquals(1, list.get(0));
-        assertEquals(2, list.get(1));
-        assertEquals(3, list.get(2));
-        Integer[] arr = list.toArray(new Integer[0]);
-        assertEquals("Three items in array", 3, arr.length);
-        assertEquals(1, arr[0].intValue());
-        assertEquals(2, arr[1].intValue());
-        assertEquals(3, arr[2].intValue());
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ExceptionDuringParsingTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.impl.Accessor;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.Ctx;
-import static com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.L1;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.io.IOException;
-import org.junit.After;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ExceptionDuringParsingTest {
-    public static Accessor API;
-
-    @Before
-    @After
-    public void cleanTheSet() {
-        Ctx.disposed.clear();
-    }
-
-    @Test
-    public void canGetAccessToOwnLanguageInstance() throws Exception {
-        PolyglotEngine vm = PolyglotEngine.newBuilder().build();
-        PolyglotEngine.Language language = vm.getLanguages().get(L1);
-        assertNotNull("L1 language is defined", language);
-
-        final Source src = Source.fromText("parse=No, no, no!", "Fail on parsing").withMimeType(L1);
-        try {
-            vm.eval(src);
-            fail("Exception thrown");
-        } catch (IOException ex) {
-            assertEquals(ex.getMessage(), "No, no, no!");
-        }
-
-        assertEquals("No dispose yet", 0, Ctx.disposed.size());
-
-        vm.dispose();
-
-        assertEquals("One context disposed", 1, Ctx.disposed.size());
-
-        try {
-            vm.eval(src);
-            fail("Should throw an exception");
-        } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
-        }
-        try {
-            vm.findGlobalSymbol("nothing");
-            fail("Should throw an exception");
-        } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
-        }
-        try {
-            vm.dispose();
-            fail("Should throw an exception");
-        } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/GlobalSymbolAsynchTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-import java.util.concurrent.Executors;
-
-import org.junit.Test;
-
-public class GlobalSymbolAsynchTest extends GlobalSymbolTest {
-    @Test
-    public void marker() {
-    }
-
-    @Override
-    protected PolyglotEngine.Builder createEngineBuilder() {
-        return PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor());
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/GlobalSymbolTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.interop.TruffleObject;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.test.utilities.InstrumentationTestMode;
-
-import static com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.L3;
-
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-import java.io.IOException;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class GlobalSymbolTest {
-
-    @Before
-    public void before() {
-        InstrumentationTestMode.set(true);
-    }
-
-    @After
-    public void after() {
-        InstrumentationTestMode.set(false);
-    }
-
-    @Test
-    public void globalSymbolFoundByLanguage() throws IOException {
-        PolyglotEngine vm = createEngineBuilder().globalSymbol("ahoj", "42").build();
-        // @formatter:off
-        Object ret = vm.eval(
-            Source.fromText("return=ahoj", "Return").withMimeType(L3)
-        ).get();
-        // @formatter:on
-        assertEquals("42", ret);
-    }
-
-    @Test
-    public void globalSymbolFoundByVMUser() throws IOException {
-        PolyglotEngine vm = createEngineBuilder().globalSymbol("ahoj", "42").build();
-        PolyglotEngine.Value ret = vm.findGlobalSymbol("ahoj");
-        assertNotNull("Symbol found", ret);
-        assertEquals("42", ret.get());
-    }
-
-    protected PolyglotEngine.Builder createEngineBuilder() {
-        return PolyglotEngine.newBuilder();
-    }
-
-    @Test
-    public void passingArray() throws IOException {
-        PolyglotEngine vm = createEngineBuilder().globalSymbol("arguments", new Object[]{"one", "two", "three"}).build();
-        PolyglotEngine.Value value = vm.findGlobalSymbol("arguments");
-        assertFalse("Not instance of array", value.get() instanceof Object[]);
-        assertTrue("Instance of TruffleObject", value.get() instanceof TruffleObject);
-        List<?> args = value.as(List.class);
-        assertNotNull("Can be converted to List", args);
-        assertEquals("Three items", 3, args.size());
-        assertEquals("one", args.get(0));
-        assertEquals("two", args.get(1));
-        assertEquals("three", args.get(2));
-        String[] arr = args.toArray(new String[0]);
-        assertEquals("Three items in array", 3, arr.length);
-        assertEquals("one", arr[0]);
-        assertEquals("two", arr[1]);
-        assertEquals("three", arr[2]);
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +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.truffle.api.test.vm;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.Executors;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.RootCallTarget;
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.TruffleLanguage.Env;
-import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.instrument.Visualizer;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.util.Objects;
-
-public class ImplicitExplicitExportTest {
-    private static Thread mainThread;
-    private PolyglotEngine vm;
-
-    @Before
-    public void initializeVM() {
-        mainThread = Thread.currentThread();
-        vm = PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor()).build();
-        assertTrue("Found " + L1 + " language", vm.getLanguages().containsKey(L1));
-        assertTrue("Found " + L2 + " language", vm.getLanguages().containsKey(L2));
-        assertTrue("Found " + L3 + " language", vm.getLanguages().containsKey(L3));
-    }
-
-    @After
-    public void cleanThread() {
-        mainThread = null;
-    }
-
-    @Test
-    public void explicitExportFound() throws IOException {
-        // @formatter:off
-        vm.eval(Source.fromText("explicit.ahoj=42", "Fourty two").withMimeType(L1));
-        Object ret = vm.eval(
-            Source.fromText("return=ahoj", "Return").withMimeType(L3)
-        ).get();
-        // @formatter:on
-        assertEquals("42", ret);
-    }
-
-    @Test
-    public void implicitExportFound() throws IOException {
-        // @formatter:off
-        vm.eval(
-            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
-        );
-        Object ret = vm.eval(
-            Source.fromText("return=ahoj", "Return").withMimeType(L3)
-        ).get();
-        // @formatter:on
-        assertEquals("42", ret);
-    }
-
-    @Test
-    public void explicitExportPreferred2() throws IOException {
-        // @formatter:off
-        vm.eval(
-            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
-        );
-        vm.eval(
-            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L2)
-        );
-        Object ret = vm.eval(
-            Source.fromText("return=ahoj", "Return").withMimeType(L3)
-        ).get();
-        // @formatter:on
-        assertEquals("Explicit import from L2 is used", "43", ret);
-        assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").get());
-    }
-
-    @Test
-    public void explicitExportPreferred1() throws IOException {
-        // @formatter:off
-        vm.eval(
-            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L1)
-        );
-        vm.eval(
-            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L2)
-        );
-        Object ret = vm.eval(
-            Source.fromText("return=ahoj", "Return").withMimeType(L3)
-        ).get();
-        // @formatter:on
-        assertEquals("Explicit import from L2 is used", "43", ret);
-        assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").invoke(null).get());
-    }
-
-    static final class Ctx {
-        static final Set<Ctx> disposed = new HashSet<>();
-
-        final Map<String, String> explicit = new HashMap<>();
-        final Map<String, String> implicit = new HashMap<>();
-        final Env env;
-
-        public Ctx(Env env) {
-            this.env = env;
-        }
-
-        void dispose() {
-            disposed.add(this);
-        }
-    }
-
-    private abstract static class AbstractExportImportLanguage extends TruffleLanguage<Ctx> {
-
-        @Override
-        protected Ctx createContext(Env env) {
-            if (mainThread != null) {
-                assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread);
-            }
-            return new Ctx(env);
-        }
-
-        @Override
-        protected void disposeContext(Ctx context) {
-            context.dispose();
-        }
-
-        @Override
-        protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
-            if (code.getCode().startsWith("parse=")) {
-                throw new IOException(code.getCode().substring(6));
-            }
-            return new ValueCallTarget(code, this);
-        }
-
-        @Override
-        protected Object findExportedSymbol(Ctx context, String globalName, boolean onlyExplicit) {
-            if (context.explicit.containsKey(globalName)) {
-                return context.explicit.get(globalName);
-            }
-            if (!onlyExplicit && context.implicit.containsKey(globalName)) {
-                return context.implicit.get(globalName);
-            }
-            return null;
-        }
-
-        @Override
-        protected Object getLanguageGlobal(Ctx context) {
-            return null;
-        }
-
-        @Override
-        protected boolean isObjectOfLanguage(Object object) {
-            return false;
-        }
-
-        @Override
-        protected Visualizer getVisualizer() {
-            return null;
-        }
-
-        @Override
-        protected boolean isInstrumentable(Node node) {
-            return false;
-        }
-
-        @Override
-        protected WrapperNode createWrapperNode(Node node) {
-            return null;
-        }
-
-        @Override
-        protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
-            return null;
-        }
-
-        private Object importExport(Source code) {
-            assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread);
-            final Node node = createFindContextNode();
-            Ctx ctx = findContext(node);
-            Properties p = new Properties();
-            try (Reader r = code.getReader()) {
-                p.load(r);
-            } catch (IOException ex) {
-                throw new IllegalStateException(ex);
-            }
-            Enumeration<Object> en = p.keys();
-            while (en.hasMoreElements()) {
-                Object n = en.nextElement();
-                if (n instanceof String) {
-                    String k = (String) n;
-                    if (k.startsWith("explicit.")) {
-                        ctx.explicit.put(k.substring(9), p.getProperty(k));
-                    }
-                    if (k.startsWith("implicit.")) {
-                        ctx.implicit.put(k.substring(9), p.getProperty(k));
-                    }
-                    if (k.equals("return")) {
-                        return ctx.env.importSymbol(p.getProperty(k));
-                    }
-                }
-            }
-            return null;
-        }
-    }
-
-    private static final class ValueCallTarget implements RootCallTarget {
-        private final Source code;
-        private final AbstractExportImportLanguage language;
-
-        private ValueCallTarget(Source code, AbstractExportImportLanguage language) {
-            this.code = code;
-            this.language = language;
-        }
-
-        @Override
-        public RootNode getRootNode() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Object call(Object... arguments) {
-            return language.importExport(code);
-        }
-    }
-
-    static final String L1 = "application/x-test-import-export-1";
-    static final String L2 = "application/x-test-import-export-2";
-    static final String L3 = "application/x-test-import-export-3";
-
-    @TruffleLanguage.Registration(mimeType = L1, name = "ImportExport1", version = "0")
-    public static final class ExportImportLanguage1 extends AbstractExportImportLanguage {
-        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage1();
-
-        public ExportImportLanguage1() {
-        }
-
-        @Override
-        protected String toString(Ctx ctx, Object value) {
-            if (value instanceof String) {
-                try {
-                    int number = Integer.parseInt((String) value);
-                    return number + ": Int";
-                } catch (NumberFormatException ex) {
-                    // go on
-                }
-            }
-            return Objects.toString(value);
-        }
-    }
-
-    @TruffleLanguage.Registration(mimeType = L2, name = "ImportExport2", version = "0")
-    public static final class ExportImportLanguage2 extends AbstractExportImportLanguage {
-        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage2();
-
-        public ExportImportLanguage2() {
-        }
-
-        @Override
-        protected String toString(Ctx ctx, Object value) {
-            if (value instanceof String) {
-                try {
-                    double number = Double.parseDouble((String) value);
-                    return number + ": Double";
-                } catch (NumberFormatException ex) {
-                    // go on
-                }
-            }
-            return Objects.toString(value);
-        }
-    }
-
-    @TruffleLanguage.Registration(mimeType = L3, name = "ImportExport3", version = "0")
-    public static final class ExportImportLanguage3 extends AbstractExportImportLanguage {
-        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage3();
-
-        private ExportImportLanguage3() {
-        }
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +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.truffle.api.test.vm;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-
-import org.junit.Test;
-
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.TruffleLanguage.Env;
-import com.oracle.truffle.api.debug.Breakpoint;
-import com.oracle.truffle.api.debug.Debugger;
-import com.oracle.truffle.api.debug.ExecutionEvent;
-import com.oracle.truffle.api.frame.MaterializedFrame;
-import com.oracle.truffle.api.frame.VirtualFrame;
-import com.oracle.truffle.api.instrument.ASTProber;
-import com.oracle.truffle.api.instrument.EventHandlerNode;
-import com.oracle.truffle.api.instrument.Instrumenter;
-import com.oracle.truffle.api.instrument.Probe;
-import com.oracle.truffle.api.instrument.StandardSyntaxTag;
-import com.oracle.truffle.api.instrument.Visualizer;
-import com.oracle.truffle.api.instrument.WrapperNode;
-import com.oracle.truffle.api.nodes.Node;
-import com.oracle.truffle.api.nodes.NodeVisitor;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.api.vm.EventConsumer;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-
-/**
- * Bug report validating test.
- * <p>
- * It has been reported that calling {@link Env#importSymbol(java.lang.String)} in
- * {@link TruffleLanguage TruffleLanguage.createContext(env)} yields a {@link NullPointerException}.
- * <p>
- * The other report was related to specifying an abstract language class in the RootNode and
- * problems with debugging later on. That is what the other part of this test - once it obtains
- * Debugger instance simulates.
- */
-public class InitializationTest {
-
-    @Test
-    public void accessProbeForAbstractLanguage() throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
-        final Debugger[] arr = {null};
-        PolyglotEngine vm = PolyglotEngine.newBuilder().onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) {
-            @Override
-            protected void on(ExecutionEvent event) {
-                arr[0] = event.getDebugger();
-            }
-        }).build();
-
-        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
-        field.setAccessible(true);
-        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
-        instrumenter.registerASTProber(new ASTProber() {
-
-            public void probeAST(final Instrumenter inst, RootNode startNode) {
-                startNode.accept(new NodeVisitor() {
-
-                    public boolean visit(Node node) {
-
-                        if (node instanceof ANode) {
-                            inst.probe(node).tagAs(StandardSyntaxTag.STATEMENT, null);
-                        }
-                        return true;
-                    }
-                });
-            }
-        });
-
-        Source source = Source.fromText("accessProbeForAbstractLanguage text", "accessProbeForAbstractLanguage").withMimeType("application/x-abstrlang");
-
-        assertEquals(vm.eval(source).get(), 1);
-
-        assertNotNull("Debugger found", arr[0]);
-
-        Debugger d = arr[0];
-        Breakpoint b = d.setLineBreakpoint(0, source.createLineLocation(1), true);
-        assertTrue(b.isEnabled());
-        b.setCondition("true");
-
-        assertEquals(vm.eval(source).get(), 1);
-        vm.dispose();
-    }
-
-    private static final class MMRootNode extends RootNode {
-        @Child ANode node;
-
-        MMRootNode(SourceSection ss) {
-            super(AbstractLanguage.class, ss, null);
-            node = new ANode(42);
-            adoptChildren();
-        }
-
-        @Override
-        public Object execute(VirtualFrame frame) {
-            return node.constant();
-        }
-    }
-
-    private static class ANode extends Node {
-        private final int constant;
-
-        public ANode(int constant) {
-            this.constant = constant;
-        }
-
-        @Override
-        public SourceSection getSourceSection() {
-            return getRootNode().getSourceSection();
-        }
-
-        Object constant() {
-            return constant;
-        }
-    }
-
-    private static class ANodeWrapper extends ANode implements WrapperNode {
-        @Child ANode child;
-        @Child private EventHandlerNode eventHandlerNode;
-
-        ANodeWrapper(ANode node) {
-            super(1);  // dummy
-            this.child = node;
-        }
-
-        @Override
-        public Node getChild() {
-            return child;
-        }
-
-        @Override
-        public Probe getProbe() {
-            return eventHandlerNode.getProbe();
-        }
-
-        @Override
-        public void insertEventHandlerNode(EventHandlerNode eventHandler) {
-            this.eventHandlerNode = eventHandler;
-        }
-
-        @Override
-        public String instrumentationInfo() {
-            throw new UnsupportedOperationException();
-        }
-    }
-
-    private abstract static class AbstractLanguage extends TruffleLanguage<Object> {
-    }
-
-    @TruffleLanguage.Registration(mimeType = "application/x-abstrlang", name = "AbstrLang", version = "0.1")
-    public static final class TestLanguage extends AbstractLanguage {
-        public static final TestLanguage INSTANCE = new TestLanguage();
-
-        @Override
-        protected Object createContext(Env env) {
-            assertNull("Not defined symbol", env.importSymbol("unknown"));
-            return env;
-        }
-
-        @Override
-        protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
-            return Truffle.getRuntime().createCallTarget(new MMRootNode(code.createSection("1st line", 1)));
-        }
-
-        @Override
-        protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
-            return null;
-        }
-
-        @Override
-        protected Object getLanguageGlobal(Object context) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected boolean isObjectOfLanguage(Object object) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Object evalInContext(Source source, Node node, MaterializedFrame mFrame) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Visualizer getVisualizer() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected boolean isInstrumentable(Node node) {
-            return node instanceof ANode;
-        }
-
-        @Override
-        protected WrapperNode createWrapperNode(Node node) {
-            return node instanceof ANode ? new ANodeWrapper((ANode) node) : null;
-        }
-    }
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ToStringTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class ToStringTest {
-    @Test
-    public void valueToStringValueWith1() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
-        language2.eval(Source.fromText("explicit.value=42", "define 42"));
-        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
-        assertEquals("It's fourtytwo", "42", value.get());
-
-        String textual = value.as(String.class);
-        assertEquals("Nicely formated as by L1", "42: Int", textual);
-    }
-
-    @Test
-    public void valueToStringValueWith2() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
-        language1.eval(Source.fromText("explicit.value=42", "define 42"));
-        PolyglotEngine.Value value = language2.eval(Source.fromText("return=value", "42.value"));
-        assertEquals("It's fourtytwo", "42", value.get());
-
-        String textual = value.as(String.class);
-        assertEquals("Nicely formated as by L2", "42.0: Double", textual);
-    }
-
-}
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ValueTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +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.truffle.api.test.vm;
-
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.PolyglotEngine;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.Executor;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import org.junit.Test;
-
-public class ValueTest implements Executor {
-    private List<Runnable> pending = new LinkedList<>();
-
-    @Test
-    public void valueToStringValue() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
-        language2.eval(Source.fromText("explicit.value=42", "define 42"));
-        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
-        assertEquals("It's fourtytwo", "42", value.get());
-
-        String textual = value.toString();
-        assertTrue("Contains the value " + textual, textual.contains("value=42"));
-        assertTrue("Is computed " + textual, textual.contains("computed=true"));
-        assertTrue("No error " + textual, textual.contains("exception=null"));
-    }
-
-    @Test
-    public void valueToStringException() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Value value = null;
-        try {
-            value = language1.eval(Source.fromText("parse=does not work", "error.value"));
-            Object res = value.get();
-            fail("Should throw an exception: " + res);
-        } catch (IOException ex) {
-            assertTrue("Message contains the right text: " + ex.getMessage(), ex.getMessage().contains("does not work"));
-        }
-
-        assertNull("No value returned", value);
-    }
-
-    @Test
-    public void valueToStringValueAsync() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().executor(this).build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
-        language2.eval(Source.fromText("explicit.value=42", "define 42"));
-        flush();
-
-        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
-
-        String textual = value.toString();
-        assertFalse("Doesn't contain the value " + textual, textual.contains("value=42"));
-        assertTrue("Is not computed " + textual, textual.contains("computed=false"));
-        assertTrue("No error " + textual, textual.contains("exception=null"));
-        assertTrue("No value yet " + textual, textual.contains("value=null"));
-
-        flush();
-
-        textual = value.toString();
-        assertTrue("Is computed " + textual, textual.contains("computed=true"));
-        assertTrue("No error " + textual, textual.contains("exception=null"));
-        assertTrue("value computed " + textual, textual.contains("value=42"));
-    }
-
-    @Test
-    public void valueToStringExceptionAsync() throws Exception {
-        PolyglotEngine engine = PolyglotEngine.newBuilder().executor(this).build();
-        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
-        PolyglotEngine.Value value = language1.eval(Source.fromText("parse=does not work", "error.value"));
-        assertNotNull("Value returned", value);
-
-        String textual = value.toString();
-        assertTrue("Is not computed " + textual, textual.contains("computed=false"));
-        assertTrue("No error " + textual, textual.contains("exception=null"));
-        assertTrue("No value yet " + textual, textual.contains("value=null"));
-
-        flush();
-
-        textual = value.toString();
-        assertTrue("Is computed " + textual, textual.contains("computed=true"));
-        assertTrue("No value at all" + textual, textual.contains("value=null"));
-        assertTrue("Error " + textual, textual.contains("exception=java.io.IOException: does not work"));
-    }
-
-    @Override
-    public void execute(Runnable command) {
-        pending.add(command);
-    }
-
-    private void flush() {
-        for (Runnable r : pending) {
-            r.run();
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/AlwaysValidAssumptionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,51 @@
+/*
+ * 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.utilities;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.nodes.InvalidAssumptionException;
+
+public class AlwaysValidAssumptionTest {
+
+    @Test
+    public void testCheck() throws InvalidAssumptionException {
+        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
+        assumption.check();
+    }
+
+    @Test
+    public void testIsValid() {
+        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
+        assertTrue(assumption.isValid());
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void testCannotInvalidate() {
+        final AlwaysValidAssumption assumption = AlwaysValidAssumption.INSTANCE;
+        assumption.invalidate();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/AssumedValueTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,45 @@
+/*
+ * 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.utilities;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class AssumedValueTest {
+
+    @Test
+    public void testGet() {
+        final AssumedValue<String> assumedValue = new AssumedValue<>("assumed-value", "1");
+        assertEquals("1", assumedValue.get());
+    }
+
+    @Test
+    public void testSet() {
+        final AssumedValue<String> assumedValue = new AssumedValue<>("assumed-value", "1");
+        assertEquals("1", assumedValue.get());
+        assumedValue.set("2");
+        assertEquals("2", assumedValue.get());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/BinaryConditionProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 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.truffle.api.utilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+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)
+public class BinaryConditionProfileTest {
+
+    @DataPoints public static boolean[] data = new boolean[]{true, false};
+
+    private BinaryConditionProfile profile;
+
+    @Before
+    public void create() {
+        profile = (BinaryConditionProfile) ConditionProfile.createBinaryProfile();
+    }
+
+    @Test
+    public void testInitial() {
+        assertThat(profile.wasTrue(), is(false));
+        assertThat(profile.wasFalse(), is(false));
+    }
+
+    @Theory
+    public void testProfileOne(boolean value) {
+        boolean result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertThat(profile.wasTrue(), is(value));
+        assertThat(profile.wasFalse(), is(!value));
+    }
+
+    @Theory
+    public void testProfileTwo(boolean value0, boolean value1) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(profile.wasTrue(), is(value0 || value1));
+        assertThat(profile.wasFalse(), is(!value0 || !value1));
+    }
+
+    @Theory
+    public void testProfileThree(boolean value0, boolean value1, boolean value2) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+        boolean result2 = profile.profile(value2);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(result2, is(value2));
+        assertThat(profile.wasTrue(), is(value0 || value1 || value2));
+        assertThat(profile.wasFalse(), is(!value0 || !value1 || !value2));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/BranchProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,50 @@
+/*
+ * 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.utilities;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class BranchProfileTest {
+
+    @Test
+    public void testEnter() {
+        BranchProfile profile = BranchProfile.create();
+        profile.enter();
+        profile.enter();
+    }
+
+    @Test
+    public void testToString() {
+        BranchProfile profile = BranchProfile.create();
+        assertTrue(profile.toString().contains(profile.getClass().getSimpleName()));
+        assertTrue(profile.toString().contains("not-visited"));
+        assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode())));
+        profile.enter();
+        assertTrue(profile.toString().contains(profile.getClass().getSimpleName()));
+        assertTrue(profile.toString().contains("visited"));
+        assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode())));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/CountingConditionProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 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.truffle.api.utilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+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)
+public class CountingConditionProfileTest {
+
+    @DataPoints public static boolean[] data = new boolean[]{true, false};
+
+    private CountingConditionProfile profile;
+
+    @Before
+    public void create() {
+        profile = (CountingConditionProfile) ConditionProfile.createCountingProfile();
+    }
+
+    @Test
+    public void testInitial() {
+        assertThat(profile.getTrueCount(), is(0));
+        assertThat(profile.getFalseCount(), is(0));
+    }
+
+    @Theory
+    public void testProfileOne(boolean value) {
+        boolean result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertThat(profile.getTrueCount(), is(value ? 1 : 0));
+        assertThat(profile.getFalseCount(), is(!value ? 1 : 0));
+    }
+
+    @Theory
+    public void testProfileTwo(boolean value0, boolean value1) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(profile.getTrueCount(), is((value0 ? 1 : 0) + (value1 ? 1 : 0)));
+        assertThat(profile.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0)));
+    }
+
+    @Theory
+    public void testProfileThree(boolean value0, boolean value1, boolean value2) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+        boolean result2 = profile.profile(value2);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(result2, is(value2));
+        assertThat(profile.getTrueCount(), is((value0 ? 1 : 0) + (value1 ? 1 : 0) + (value2 ? 1 : 0)));
+        assertThat(profile.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0) + (!value2 ? 1 : 0)));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/CyclicAssumptionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -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.utilities;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.Assumption;
+
+public class CyclicAssumptionTest {
+
+    @Test
+    public void testIsValid() {
+        final CyclicAssumption assumption = new CyclicAssumption("cyclic-assumption");
+        assertTrue(assumption.getAssumption().isValid());
+    }
+
+    @Test
+    public void testInvalidate() {
+        final CyclicAssumption cyclicAssumption = new CyclicAssumption("cyclic-assumption");
+
+        final Assumption firstAssumption = cyclicAssumption.getAssumption();
+        assertEquals("cyclic-assumption", firstAssumption.getName());
+        assertTrue(firstAssumption.isValid());
+
+        cyclicAssumption.invalidate();
+
+        assertFalse(firstAssumption.isValid());
+
+        final Assumption secondAssumption = cyclicAssumption.getAssumption();
+        assertEquals("cyclic-assumption", secondAssumption.getName());
+        assertTrue(secondAssumption.isValid());
+
+        cyclicAssumption.invalidate();
+
+        assertFalse(firstAssumption.isValid());
+        assertFalse(secondAssumption.isValid());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/ExactClassValueProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 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.truffle.api.utilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+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)
+public class ExactClassValueProfileTest {
+
+    @DataPoint public static final String O1 = new String();
+    @DataPoint public static final String O2 = new String();
+    @DataPoint public static final Object O3 = new Object();
+    @DataPoint public static final Integer O4 = new Integer(1);
+    @DataPoint public static final Integer O5 = null;
+
+    private ValueProfile profile;
+
+    @Before
+    public void create() {
+        profile = ValueProfile.createClassProfile();
+    }
+
+    @Test
+    public void testInitial() throws Exception {
+        assertThat(isGeneric(profile), is(false));
+        assertThat(isUninitialized(profile), is(true));
+        assertNull(getCachedClass(profile));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOne(Object value) throws Exception {
+        Object result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(getCachedClass(profile), expectedClass(value));
+        assertThat(isUninitialized(profile), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwo(Object value0, Object value1) throws Exception {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+
+        Object expectedClass = expectedClass(value0) == expectedClass(value1) ? expectedClass(value0) : Object.class;
+
+        assertEquals(getCachedClass(profile), expectedClass);
+        assertThat(isUninitialized(profile), is(false));
+        assertThat(isGeneric(profile), is(expectedClass == Object.class));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThree(Object value0, Object value1, Object value2) throws Exception {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+        Object result2 = profile.profile(value2);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(result2, is(value2));
+
+        Object expectedClass = expectedClass(value0) == expectedClass(value1) && expectedClass(value1) == expectedClass(value2) ? expectedClass(value0) : Object.class;
+
+        assertEquals(getCachedClass(profile), expectedClass);
+        assertThat(isUninitialized(profile), is(false));
+        assertThat(isGeneric(profile), is(expectedClass == Object.class));
+        profile.toString(); // test that it is not crashing
+    }
+
+    private static Class<?> expectedClass(Object value) {
+        return value == null ? Object.class : value.getClass();
+    }
+
+    private static Object get(String name, ValueProfile profile) throws Exception {
+        final Method m = profile.getClass().getDeclaredMethod(name);
+        m.setAccessible(true);
+        return m.invoke(profile);
+    }
+
+    private static Object getCachedClass(ValueProfile profile) throws Exception {
+        return get("getCachedClass", profile);
+    }
+
+    private static boolean isUninitialized(ValueProfile profile) throws Exception {
+        return (Boolean) get("isUninitialized", profile);
+    }
+
+    private static boolean isGeneric(ValueProfile profile) throws Exception {
+        return (Boolean) get("isGeneric", profile);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/IdentityValueProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 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.truffle.api.utilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+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)
+public class IdentityValueProfileTest {
+
+    @DataPoint public static final String O1 = new String();
+    @DataPoint public static final String O2 = O1;
+    @DataPoint public static final Object O3 = new Object();
+    @DataPoint public static final Integer O4 = new Integer(1);
+    @DataPoint public static final Integer O5 = null;
+
+    private ValueProfile profile;
+
+    @Before
+    public void create() {
+        profile = ValueProfile.createIdentityProfile();
+    }
+
+    @Test
+    public void testInitial() throws Exception {
+        assertThat(isGeneric(profile), is(false));
+        assertThat(isUninitialized(profile), is(true));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOne(Object value) throws Exception {
+        Object result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(getCachedValue(profile), value);
+        assertThat(isUninitialized(profile), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwo(Object value0, Object value1) throws Exception {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+
+        if (value0 == value1) {
+            assertThat(getCachedValue(profile), is(value0));
+            assertThat(isGeneric(profile), is(false));
+        } else {
+            assertThat(isGeneric(profile), is(true));
+        }
+        assertThat(isUninitialized(profile), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThree(Object value0, Object value1, Object value2) throws Exception {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+        Object result2 = profile.profile(value2);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(result2, is(value2));
+
+        if (value0 == value1 && value1 == value2) {
+            assertThat(getCachedValue(profile), is(value0));
+            assertThat(isGeneric(profile), is(false));
+        } else {
+            assertThat(isGeneric(profile), is(true));
+        }
+        assertThat(isUninitialized(profile), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    private static Object get(String name, ValueProfile profile) throws Exception {
+        final Method m = profile.getClass().getDeclaredMethod(name);
+        m.setAccessible(true);
+        return m.invoke(profile);
+    }
+
+    private static Object getCachedValue(ValueProfile profile) throws Exception {
+        return get("getCachedValue", profile);
+    }
+
+    private static boolean isUninitialized(ValueProfile profile) throws Exception {
+        return (Boolean) get("isUninitialized", profile);
+    }
+
+    private static boolean isGeneric(ValueProfile profile) throws Exception {
+        return (Boolean) get("isGeneric", profile);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/InstrumentationTestMode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,53 @@
+/*
+ * 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.truffle.api.utilities;
+
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+
+import com.oracle.truffle.api.instrument.Instrumenter;
+import com.oracle.truffle.api.vm.PolyglotEngine;
+
+public class InstrumentationTestMode {
+
+    public static void set(boolean enable) {
+
+        try {
+            final PolyglotEngine vm = PolyglotEngine.newBuilder().build();
+            final Field instrumenterField = vm.getClass().getDeclaredField("instrumenter");
+            instrumenterField.setAccessible(true);
+            final Object instrumenter = instrumenterField.get(vm);
+            final java.lang.reflect.Field testVMField = Instrumenter.class.getDeclaredField("testVM");
+            testVMField.setAccessible(true);
+            if (enable) {
+                testVMField.set(instrumenter, vm);
+            } else {
+                testVMField.set(instrumenter, null);
+            }
+        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
+            fail("Reflective access to Instrumenter for testing");
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/NeverValidAssumptionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, 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.truffle.api.utilities;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.nodes.InvalidAssumptionException;
+
+public class NeverValidAssumptionTest {
+
+    @Test
+    public void testCheck() {
+        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
+
+        try {
+            assumption.check();
+            fail();
+        } catch (InvalidAssumptionException e) {
+        } catch (Exception e) {
+            fail();
+        }
+    }
+
+    @Test
+    public void testIsValid() {
+        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
+        assertFalse(assumption.isValid());
+    }
+
+    @Test
+    public void testInvalidateDoesNothing() {
+        final NeverValidAssumption assumption = NeverValidAssumption.INSTANCE;
+        assumption.invalidate();
+        assumption.invalidate();
+        assumption.invalidate();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/PrimitiveValueProfileTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,950 @@
+/*
+ * Copyright (c) 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.truffle.api.utilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+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)
+public class PrimitiveValueProfileTest {
+
+    @DataPoint public static final String O1 = new String();
+    @DataPoint public static final String O2 = O1;
+    @DataPoint public static final Object O3 = new Object();
+    @DataPoint public static final Object O4 = null;
+
+    @DataPoint public static final byte B1 = Byte.MIN_VALUE;
+    @DataPoint public static final byte B2 = 0;
+    @DataPoint public static final byte B3 = 14;
+    @DataPoint public static final byte B4 = Byte.MAX_VALUE;
+
+    @DataPoint public static final short S1 = Short.MIN_VALUE;
+    @DataPoint public static final short S2 = 0;
+    @DataPoint public static final short S3 = 14;
+    @DataPoint public static final short S4 = Short.MAX_VALUE;
+
+    @DataPoint public static final int I1 = Integer.MIN_VALUE;
+    @DataPoint public static final int I2 = 0;
+    @DataPoint public static final int I3 = 14;
+    @DataPoint public static final int I4 = Integer.MAX_VALUE;
+
+    @DataPoint public static final long L1 = Long.MIN_VALUE;
+    @DataPoint public static final long L2 = 0;
+    @DataPoint public static final long L3 = 14;
+    @DataPoint public static final long L4 = Long.MAX_VALUE;
+
+    @DataPoint public static final float F1 = Float.MIN_VALUE;
+    @DataPoint public static final float F2 = -0.0f;
+    @DataPoint public static final float F3 = +0.0f;
+    @DataPoint public static final float F4 = 14.5f;
+    @DataPoint public static final float F5 = Float.MAX_VALUE;
+
+    @DataPoint public static final double D1 = Double.MIN_VALUE;
+    @DataPoint public static final double D2 = -0.0;
+    @DataPoint public static final double D3 = +0.0;
+    @DataPoint public static final double D4 = 14.5;
+    @DataPoint public static final double D5 = Double.MAX_VALUE;
+
+    @DataPoint public static final boolean T1 = false;
+    @DataPoint public static final boolean T2 = true;
+
+    @DataPoint public static final char C1 = Character.MIN_VALUE;
+    @DataPoint public static final char C2 = 0;
+    @DataPoint public static final char C3 = 14;
+    @DataPoint public static final char C4 = Character.MAX_VALUE;
+
+    private static final float FLOAT_DELTA = 0.00001f;
+    private static final double DOUBLE_DELTA = 0.00001;
+
+    private PrimitiveValueProfile profile;
+
+    @Before
+    public void create() {
+        profile = ValueProfile.createPrimitiveProfile();
+    }
+
+    @Test
+    public void testInitial() {
+        assertThat(profile.isGeneric(), is(false));
+        assertThat(profile.isUninitialized(), is(true));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneObject(Object value) {
+        Object result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoObject(Object value0, Object value1) {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+
+        if (value0 == value1) {
+            assertThat(profile.getCachedValue(), is(value0));
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeObject(Object value0, Object value1, Object value2) {
+        Object result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+        Object result2 = profile.profile(value2);
+
+        assertThat(result0, is(value0));
+        assertThat(result1, is(value1));
+        assertThat(result2, is(value2));
+
+        if (value0 == value1 && value1 == value2) {
+            assertThat(profile.getCachedValue(), is(value0));
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneByte(byte value) {
+        byte result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoByte(byte value0, byte value1) {
+        byte result0 = profile.profile(value0);
+        byte result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Byte);
+            assertEquals((byte) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeByte(byte value0, byte value1, byte value2) {
+        byte result0 = profile.profile(value0);
+        byte result1 = profile.profile(value1);
+        byte result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Byte);
+            assertEquals((byte) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneShort(short value) {
+        short result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoShort(short value0, short value1) {
+        short result0 = profile.profile(value0);
+        short result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Short);
+            assertEquals((short) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeShort(short value0, short value1, short value2) {
+        short result0 = profile.profile(value0);
+        short result1 = profile.profile(value1);
+        short result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Short);
+            assertEquals((short) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneInteger(int value) {
+        int result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoInteger(int value0, int value1) {
+        int result0 = profile.profile(value0);
+        int result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Integer);
+            assertEquals((int) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeInteger(int value0, int value1, int value2) {
+        int result0 = profile.profile(value0);
+        int result1 = profile.profile(value1);
+        int result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Integer);
+            assertEquals((int) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneLong(long value) {
+        long result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoLong(long value0, long value1) {
+        long result0 = profile.profile(value0);
+        long result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Long);
+            assertEquals((long) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeLong(long value0, long value1, long value2) {
+        long result0 = profile.profile(value0);
+        long result1 = profile.profile(value1);
+        long result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Long);
+            assertEquals((long) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneFloat(float value) {
+        float result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoFloat(float value0, float value1) {
+        float result0 = profile.profile(value0);
+        float result1 = profile.profile(value1);
+
+        assertEquals(result0, value0, FLOAT_DELTA);
+        assertEquals(result1, value1, FLOAT_DELTA);
+
+        if (PrimitiveValueProfile.exactCompare(value0, value1)) {
+            assertTrue(profile.getCachedValue() instanceof Float);
+            assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeFloat(float value0, float value1, float value2) {
+        float result0 = profile.profile(value0);
+        float result1 = profile.profile(value1);
+        float result2 = profile.profile(value2);
+
+        assertEquals(result0, value0, FLOAT_DELTA);
+        assertEquals(result1, value1, FLOAT_DELTA);
+        assertEquals(result2, value2, FLOAT_DELTA);
+
+        if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) {
+            assertTrue(profile.getCachedValue() instanceof Float);
+            assertEquals((float) profile.getCachedValue(), value0, FLOAT_DELTA);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneDouble(double value) {
+        double result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoDouble(double value0, double value1) {
+        double result0 = profile.profile(value0);
+        double result1 = profile.profile(value1);
+
+        assertEquals(result0, value0, DOUBLE_DELTA);
+        assertEquals(result1, value1, DOUBLE_DELTA);
+
+        if (PrimitiveValueProfile.exactCompare(value0, value1)) {
+            assertTrue(profile.getCachedValue() instanceof Double);
+            assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeDouble(double value0, double value1, double value2) {
+        double result0 = profile.profile(value0);
+        double result1 = profile.profile(value1);
+        double result2 = profile.profile(value2);
+
+        assertEquals(result0, value0, DOUBLE_DELTA);
+        assertEquals(result1, value1, DOUBLE_DELTA);
+        assertEquals(result2, value2, DOUBLE_DELTA);
+
+        if (PrimitiveValueProfile.exactCompare(value0, value1) && PrimitiveValueProfile.exactCompare(value1, value2)) {
+            assertTrue(profile.getCachedValue() instanceof Double);
+            assertEquals((double) profile.getCachedValue(), value0, DOUBLE_DELTA);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneBoolean(boolean value) {
+        boolean result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoBoolean(boolean value0, boolean value1) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Boolean);
+            assertEquals((boolean) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeBoolean(boolean value0, boolean value1, boolean value2) {
+        boolean result0 = profile.profile(value0);
+        boolean result1 = profile.profile(value1);
+        boolean result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Boolean);
+            assertEquals((boolean) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileOneChar(char value) {
+        char result = profile.profile(value);
+
+        assertThat(result, is(value));
+        assertEquals(profile.getCachedValue(), value);
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileTwoChar(char value0, char value1) {
+        char result0 = profile.profile(value0);
+        char result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+
+        if (value0 == value1) {
+            assertTrue(profile.getCachedValue() instanceof Character);
+            assertEquals((char) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testProfileThreeChar(char value0, char value1, char value2) {
+        char result0 = profile.profile(value0);
+        char result1 = profile.profile(value1);
+        char result2 = profile.profile(value2);
+
+        assertEquals(result0, value0);
+        assertEquals(result1, value1);
+        assertEquals(result2, value2);
+
+        if (value0 == value1 && value1 == value2) {
+            assertTrue(profile.getCachedValue() instanceof Character);
+            assertEquals((char) profile.getCachedValue(), value0);
+            assertThat(profile.isGeneric(), is(false));
+        } else {
+            assertThat(profile.isGeneric(), is(true));
+        }
+        assertThat(profile.isUninitialized(), is(false));
+        profile.toString(); // test that it is not crashing
+    }
+
+    @Theory
+    public void testWithBoxedBoxedByte(byte value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Byte);
+        assertEquals((byte) result0, value);
+        assertTrue(result1 instanceof Byte);
+        assertEquals((byte) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedByte(byte value) {
+        byte result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Byte);
+        assertEquals((byte) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedByte(byte value) {
+        Object result0 = profile.profile((Object) value);
+        byte result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Byte);
+        assertEquals((byte) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedShort(short value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Short);
+        assertEquals((short) result0, value);
+        assertTrue(result1 instanceof Short);
+        assertEquals((short) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedShort(short value) {
+        short result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Short);
+        assertEquals((short) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedShort(short value) {
+        Object result0 = profile.profile((Object) value);
+        short result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Short);
+        assertEquals((short) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedInt(int value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Integer);
+        assertEquals((int) result0, value);
+        assertTrue(result1 instanceof Integer);
+        assertEquals((int) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedInt(int value) {
+        int result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Integer);
+        assertEquals((int) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedInt(int value) {
+        Object result0 = profile.profile((Object) value);
+        int result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Integer);
+        assertEquals((int) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedLong(long value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Long);
+        assertEquals((long) result0, value);
+        assertTrue(result1 instanceof Long);
+        assertEquals((long) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedLong(long value) {
+        long result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Long);
+        assertEquals((long) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedLong(long value) {
+        Object result0 = profile.profile((Object) value);
+        long result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Long);
+        assertEquals((long) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedFloat(float value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Float);
+        assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value));
+        assertTrue(result1 instanceof Float);
+        assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedFloat(float value) {
+        float result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(PrimitiveValueProfile.exactCompare(result0, value));
+        assertTrue(result1 instanceof Float);
+        assertTrue(PrimitiveValueProfile.exactCompare((float) result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedFloat(float value) {
+        Object result0 = profile.profile((Object) value);
+        float result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Float);
+        assertTrue(PrimitiveValueProfile.exactCompare((float) result0, value));
+        assertTrue(PrimitiveValueProfile.exactCompare(result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedDouble(double value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Double);
+        assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value));
+        assertTrue(result1 instanceof Double);
+        assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedDouble(double value) {
+        double result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(PrimitiveValueProfile.exactCompare(result0, value));
+        assertTrue(result1 instanceof Double);
+        assertTrue(PrimitiveValueProfile.exactCompare((double) result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedDouble(double value) {
+        Object result0 = profile.profile((Object) value);
+        double result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Double);
+        assertTrue(PrimitiveValueProfile.exactCompare((double) result0, value));
+        assertTrue(PrimitiveValueProfile.exactCompare(result1, value));
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedBoolean(boolean value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Boolean);
+        assertEquals((boolean) result0, value);
+        assertTrue(result1 instanceof Boolean);
+        assertEquals((boolean) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedBoolean(boolean value) {
+        boolean result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Boolean);
+        assertEquals((boolean) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedBoolean(boolean value) {
+        Object result0 = profile.profile((Object) value);
+        boolean result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Boolean);
+        assertEquals((boolean) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedBoxedChar(char value) {
+        Object result0 = profile.profile((Object) value);
+        Object result1 = profile.profile((Object) value);
+
+        assertTrue(result0 instanceof Character);
+        assertEquals((char) result0, value);
+        assertTrue(result1 instanceof Character);
+        assertEquals((char) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithUnboxedBoxedChar(char value) {
+        char result0 = profile.profile(value);
+        Object result1 = profile.profile((Object) value);
+
+        assertEquals(result0, value);
+        assertTrue(result1 instanceof Character);
+        assertEquals((char) result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBoxedUnboxedCharacter(char value) {
+        Object result0 = profile.profile((Object) value);
+        char result1 = profile.profile(value);
+
+        assertTrue(result0 instanceof Character);
+        assertEquals((char) result0, value);
+        assertEquals(result1, value);
+        assertFalse(profile.isUninitialized());
+        assertFalse(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithByteThenObject(byte value0, Object value1) {
+        byte result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithShortThenObject(short value0, Object value1) {
+        short result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithIntThenObject(int value0, Object value1) {
+        int result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithLongThenObject(long value0, Object value1) {
+        long result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithFloatThenObject(float value0, Object value1) {
+        float result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertTrue(PrimitiveValueProfile.exactCompare(result0, value0));
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithDoubleThenObject(double value0, Object value1) {
+        double result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertTrue(PrimitiveValueProfile.exactCompare(result0, value0));
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithBooleanThenObject(boolean value0, Object value1) {
+        boolean result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Theory
+    public void testWithCharThenObject(char value0, Object value1) {
+        char result0 = profile.profile(value0);
+        Object result1 = profile.profile(value1);
+
+        assertEquals(result0, value0);
+        assertSame(result1, value1);
+        assertFalse(profile.isUninitialized());
+        assertTrue(profile.isGeneric());
+    }
+
+    @Test
+    public void testNegativeZeroFloat() {
+        profile.profile(-0.0f);
+        profile.profile(+0.0f);
+        assertThat(profile.isGeneric(), is(true));
+    }
+
+    @Test
+    public void testNegativeZeroDouble() {
+        profile.profile(-0.0);
+        profile.profile(+0.0);
+        assertThat(profile.isGeneric(), is(true));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/utilities/UnionAssumptionTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,120 @@
+/*
+ * 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.utilities;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.Assumption;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.nodes.InvalidAssumptionException;
+
+public class UnionAssumptionTest {
+
+    @Test
+    public void testIsValid() {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+        assertTrue(union.isValid());
+    }
+
+    @Test
+    public void testCheck() throws InvalidAssumptionException {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+        union.check();
+    }
+
+    @Test
+    public void testFirstInvalidateIsValid() {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        first.invalidate();
+
+        assertFalse(union.isValid());
+    }
+
+    @Test(expected = InvalidAssumptionException.class)
+    public void testFirstInvalidateCheck() throws InvalidAssumptionException {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        first.invalidate();
+
+        union.check();
+    }
+
+    @Test
+    public void testSecondInvalidateIsValid() {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        second.invalidate();
+
+        assertFalse(union.isValid());
+    }
+
+    @Test(expected = InvalidAssumptionException.class)
+    public void testSecondInvalidateCheck() throws InvalidAssumptionException {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        second.invalidate();
+
+        union.check();
+    }
+
+    @Test
+    public void testBothInvalidateIsValid() {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        first.invalidate();
+        second.invalidate();
+
+        assertFalse(union.isValid());
+    }
+
+    @Test(expected = InvalidAssumptionException.class)
+    public void testBothInvalidateCheck() throws InvalidAssumptionException {
+        final Assumption first = Truffle.getRuntime().createAssumption("first");
+        final Assumption second = Truffle.getRuntime().createAssumption("second");
+        final UnionAssumption union = new UnionAssumption(first, second);
+
+        first.invalidate();
+        second.invalidate();
+
+        union.check();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/ArrayTruffleObject.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,179 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.List;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.RootNode;
+
+final class ArrayTruffleObject implements TruffleObject, ForeignAccess.Factory10 {
+    private final ForeignAccess access;
+    private final Object[] values;
+    private final Thread forbiddenDupl;
+
+    ArrayTruffleObject(Object[] values) {
+        this(values, null);
+    }
+
+    ArrayTruffleObject(Object[] values, Thread forbiddenDupl) {
+        this.access = forbiddenDupl == null ? ForeignAccess.create(getClass(), this) : null;
+        this.values = values;
+        this.forbiddenDupl = forbiddenDupl;
+    }
+
+    @Override
+    public ForeignAccess getForeignAccess() {
+        return access != null ? access : ForeignAccess.create(getClass(), this);
+    }
+
+    @Override
+    public CallTarget accessIsNull() {
+        return target(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessIsExecutable() {
+        return target(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessIsBoxed() {
+        return target(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessHasSize() {
+        return target(RootNode.createConstantNode(Boolean.TRUE));
+    }
+
+    @Override
+    public CallTarget accessGetSize() {
+        return target(RootNode.createConstantNode(values.length));
+    }
+
+    @Override
+    public CallTarget accessUnbox() {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessRead() {
+        return target(new IndexNode());
+    }
+
+    @Override
+    public CallTarget accessWrite() {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessExecute(int argumentsLength) {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessInvoke(int argumentsLength) {
+        if (argumentsLength == 0) {
+            return target(new DuplNode());
+        }
+        if (argumentsLength == 1) {
+            return target(new InvokeNode());
+        }
+        return null;
+    }
+
+    @Override
+    public CallTarget accessNew(int argumentsLength) {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessMessage(Message unknown) {
+        return null;
+    }
+
+    private static CallTarget target(RootNode node) {
+        return Truffle.getRuntime().createCallTarget(node);
+    }
+
+    private final class IndexNode extends RootNode {
+        public IndexNode() {
+            super(TruffleLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            int index = ((Number) ForeignAccess.getArguments(frame).get(0)).intValue();
+            if (values[index] instanceof Object[]) {
+                return new ArrayTruffleObject((Object[]) values[index]);
+            } else {
+                return values[index];
+            }
+        }
+    }
+
+    private final class InvokeNode extends RootNode {
+        public InvokeNode() {
+            super(TruffleLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            final List<Object> args = ForeignAccess.getArguments(frame);
+            if (!"get".equals(args.get(0))) {
+                return null;
+            }
+            int index = ((Number) args.get(1)).intValue();
+            if (values[index] instanceof Object[]) {
+                return new ArrayTruffleObject((Object[]) values[index]);
+            } else {
+                return values[index];
+            }
+        }
+    }
+
+    private final class DuplNode extends RootNode {
+        public DuplNode() {
+            super(TruffleLanguage.class, null, null);
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            final List<Object> args = ForeignAccess.getArguments(frame);
+            if (!"dupl".equals(args.get(0))) {
+                return null;
+            }
+            assertNotEquals("Cannot allocate duplicate on forbidden thread", forbiddenDupl, Thread.currentThread());
+            return new ArrayTruffleObject(values);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/EngineAsynchTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,43 @@
+/*
+ * 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.truffle.api.vm;
+
+import java.util.concurrent.Executors;
+
+import org.junit.Test;
+
+public class EngineAsynchTest extends EngineTest {
+    @Test
+    public void marker() {
+    }
+
+    @Override
+    protected Thread forbiddenThread() {
+        return Thread.currentThread();
+    }
+
+    @Override
+    protected PolyglotEngine.Builder createBuilder() {
+        return PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/EngineSingleThreadedTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,76 @@
+/*
+ * 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.truffle.api.vm;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.source.Source;
+
+public class EngineSingleThreadedTest {
+    PolyglotEngine tvm;
+
+    @Before
+    public void initInDifferentThread() throws InterruptedException {
+        final PolyglotEngine.Builder b = PolyglotEngine.newBuilder();
+        Thread t = new Thread("Initializer") {
+            @Override
+            public void run() {
+                tvm = b.build();
+            }
+        };
+        t.start();
+        t.join();
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void evalURI() throws IOException {
+        tvm.eval(Source.fromURL(new File(".").toURI().toURL(), "wrong.test"));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void evalString() throws IOException {
+        tvm.eval(Source.fromText("1 + 1", "wrong.test").withMimeType("text/javascript"));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void evalReader() throws IOException {
+        try (StringReader sr = new StringReader("1 + 1")) {
+            tvm.eval(Source.fromReader(sr, "wrong.test").withMimeType("text/javascript"));
+        }
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void evalSource() throws IOException {
+        tvm.eval(Source.fromText("", "Empty"));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void findGlobalSymbol() {
+        tvm.findGlobalSymbol("doesNotExists");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/EngineTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,120 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.source.Source;
+
+public class EngineTest {
+    protected PolyglotEngine.Builder createBuilder() {
+        return PolyglotEngine.newBuilder();
+    }
+
+    @Test
+    public void npeWhenCastingAs() throws Exception {
+        PolyglotEngine tvm = createBuilder().build();
+
+        PolyglotEngine.Language language1 = tvm.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Language language2 = tvm.getLanguages().get("application/x-test-import-export-2");
+        language2.eval(Source.fromText("explicit.value=42", "define 42"));
+
+        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
+        String res = value.as(String.class);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void checkCachingOfNodes() throws IOException {
+        PolyglotEngine vm1 = createBuilder().build();
+        PolyglotEngine vm2 = createBuilder().build();
+
+        PolyglotEngine.Language language1 = vm1.getLanguages().get("application/x-test-hash");
+        PolyglotEngine.Language language2 = vm2.getLanguages().get("application/x-test-hash");
+        PolyglotEngine.Language alt1 = vm1.getLanguages().get("application/x-test-hash-alt");
+        PolyglotEngine.Language alt2 = vm2.getLanguages().get("application/x-test-hash-alt");
+        final Source sharedSource = Source.fromText("anything", "something");
+
+        Object hashIn1Round1 = language1.eval(sharedSource).get();
+        Object hashIn2Round1 = language2.eval(sharedSource).get();
+        Object hashIn1Round2 = language1.eval(sharedSource).get();
+        Object hashIn2Round2 = language2.eval(sharedSource).get();
+
+        Object altIn1Round1 = alt1.eval(sharedSource).get();
+        Object altIn2Round1 = alt2.eval(sharedSource).get();
+        Object altIn1Round2 = alt1.eval(sharedSource).get();
+        Object altIn2Round2 = alt2.eval(sharedSource).get();
+
+        assertEquals("Two executions in 1st engine share the nodes", hashIn1Round1, hashIn1Round2);
+        assertEquals("Two executions in 2nd engine share the nodes", hashIn2Round1, hashIn2Round2);
+
+        assertEquals("Two alternative executions in 1st engine share the nodes", altIn1Round1, altIn1Round2);
+        assertEquals("Two alternative executions in 2nd engine share the nodes", altIn2Round1, altIn2Round2);
+
+        assertNotEquals("Two executions in different languages don't share the nodes", hashIn1Round1, altIn1Round1);
+        assertNotEquals("Two executions in different languages don't share the nodes", hashIn1Round1, altIn2Round1);
+        assertNotEquals("Two executions in different languages don't share the nodes", hashIn2Round2, altIn1Round2);
+        assertNotEquals("Two executions in different languages don't share the nodes", hashIn2Round2, altIn2Round2);
+
+        assertNotEquals("Two executions in different engines don't share the nodes", hashIn1Round1, hashIn2Round1);
+        assertNotEquals("Two executions in different engines don't share the nodes", hashIn2Round2, hashIn1Round2);
+    }
+
+    protected Thread forbiddenThread() {
+        return null;
+    }
+
+    private interface AccessArray {
+        AccessArray dupl();
+
+        List<? extends Number> get(int index);
+    }
+
+    @Test
+    public void wrappedAsArray() throws Exception {
+        Object[][] matrix = {{1, 2, 3}};
+
+        PolyglotEngine tvm = createBuilder().globalSymbol("arr", new ArrayTruffleObject(matrix, forbiddenThread())).build();
+        PolyglotEngine.Language language1 = tvm.getLanguages().get("application/x-test-import-export-1");
+        AccessArray access = language1.eval(Source.fromText("return=arr", "get the array")).as(AccessArray.class);
+        assertNotNull("Array converted to list", access);
+        access = access.dupl();
+        List<? extends Number> list = access.get(0);
+        assertEquals("Size 3", 3, list.size());
+        assertEquals(1, list.get(0));
+        assertEquals(2, list.get(1));
+        assertEquals(3, list.get(2));
+        Integer[] arr = list.toArray(new Integer[0]);
+        assertEquals("Three items in array", 3, arr.length);
+        assertEquals(1, arr[0].intValue());
+        assertEquals(2, arr[1].intValue());
+        assertEquals(3, arr[2].intValue());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/ExceptionDuringParsingTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,89 @@
+/*
+ * 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.truffle.api.vm;
+
+import static com.oracle.truffle.api.vm.ImplicitExplicitExportTest.L1;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.impl.Accessor;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.vm.ImplicitExplicitExportTest.Ctx;
+
+public class ExceptionDuringParsingTest {
+    public static Accessor API;
+
+    @Before
+    @After
+    public void cleanTheSet() {
+        Ctx.disposed.clear();
+    }
+
+    @Test
+    public void canGetAccessToOwnLanguageInstance() throws Exception {
+        PolyglotEngine vm = PolyglotEngine.newBuilder().build();
+        PolyglotEngine.Language language = vm.getLanguages().get(L1);
+        assertNotNull("L1 language is defined", language);
+
+        final Source src = Source.fromText("parse=No, no, no!", "Fail on parsing").withMimeType(L1);
+        try {
+            vm.eval(src);
+            fail("Exception thrown");
+        } catch (IOException ex) {
+            assertEquals(ex.getMessage(), "No, no, no!");
+        }
+
+        assertEquals("No dispose yet", 0, Ctx.disposed.size());
+
+        vm.dispose();
+
+        assertEquals("One context disposed", 1, Ctx.disposed.size());
+
+        try {
+            vm.eval(src);
+            fail("Should throw an exception");
+        } catch (IllegalStateException ex) {
+            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
+        }
+        try {
+            vm.findGlobalSymbol("nothing");
+            fail("Should throw an exception");
+        } catch (IllegalStateException ex) {
+            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
+        }
+        try {
+            vm.dispose();
+            fail("Should throw an exception");
+        } catch (IllegalStateException ex) {
+            assertTrue(ex.getMessage(), ex.getMessage().contains("disposed"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/GlobalSymbolAsynchTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,38 @@
+/*
+ * 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.truffle.api.vm;
+
+import java.util.concurrent.Executors;
+
+import org.junit.Test;
+
+public class GlobalSymbolAsynchTest extends GlobalSymbolTest {
+    @Test
+    public void marker() {
+    }
+
+    @Override
+    protected PolyglotEngine.Builder createEngineBuilder() {
+        return PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/GlobalSymbolTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,95 @@
+/*
+ * 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.truffle.api.vm;
+
+import static com.oracle.truffle.api.vm.ImplicitExplicitExportTest.L3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.utilities.InstrumentationTestMode;
+
+public class GlobalSymbolTest {
+
+    @Before
+    public void before() {
+        InstrumentationTestMode.set(true);
+    }
+
+    @After
+    public void after() {
+        InstrumentationTestMode.set(false);
+    }
+
+    @Test
+    public void globalSymbolFoundByLanguage() throws IOException {
+        PolyglotEngine vm = createEngineBuilder().globalSymbol("ahoj", "42").build();
+        // @formatter:off
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
+        ).get();
+        // @formatter:on
+        assertEquals("42", ret);
+    }
+
+    @Test
+    public void globalSymbolFoundByVMUser() throws IOException {
+        PolyglotEngine vm = createEngineBuilder().globalSymbol("ahoj", "42").build();
+        PolyglotEngine.Value ret = vm.findGlobalSymbol("ahoj");
+        assertNotNull("Symbol found", ret);
+        assertEquals("42", ret.get());
+    }
+
+    protected PolyglotEngine.Builder createEngineBuilder() {
+        return PolyglotEngine.newBuilder();
+    }
+
+    @Test
+    public void passingArray() throws IOException {
+        PolyglotEngine vm = createEngineBuilder().globalSymbol("arguments", new Object[]{"one", "two", "three"}).build();
+        PolyglotEngine.Value value = vm.findGlobalSymbol("arguments");
+        assertFalse("Not instance of array", value.get() instanceof Object[]);
+        assertTrue("Instance of TruffleObject", value.get() instanceof TruffleObject);
+        List<?> args = value.as(List.class);
+        assertNotNull("Can be converted to List", args);
+        assertEquals("Three items", 3, args.size());
+        assertEquals("one", args.get(0));
+        assertEquals("two", args.get(1));
+        assertEquals("three", args.get(2));
+        String[] arr = args.toArray(new String[0]);
+        assertEquals("Three items in array", 3, arr.length);
+        assertEquals("one", arr[0]);
+        assertEquals("two", arr[1]);
+        assertEquals("three", arr[2]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/HashLanguage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,111 @@
+/*
+ * 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.truffle.api.vm;
+
+import java.io.IOException;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.TruffleLanguage.Env;
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.instrument.Visualizer;
+import com.oracle.truffle.api.instrument.WrapperNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+
+@TruffleLanguage.Registration(name = "Hash", mimeType = "application/x-test-hash", version = "1.0")
+public class HashLanguage extends TruffleLanguage<Env> {
+    public static final HashLanguage INSTANCE = new HashLanguage();
+
+    @Override
+    protected Env createContext(Env env) {
+        return env;
+    }
+
+    @Override
+    protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
+        return Truffle.getRuntime().createCallTarget(new HashNode(this, code));
+    }
+
+    @Override
+    protected Object findExportedSymbol(Env context, String globalName, boolean onlyExplicit) {
+        return null;
+    }
+
+    @Override
+    protected Object getLanguageGlobal(Env context) {
+        return null;
+    }
+
+    @Override
+    protected boolean isObjectOfLanguage(Object object) {
+        return false;
+    }
+
+    @Override
+    protected Visualizer getVisualizer() {
+        return null;
+    }
+
+    @Override
+    protected boolean isInstrumentable(Node node) {
+        return false;
+    }
+
+    @Override
+    protected WrapperNode createWrapperNode(Node node) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
+        throw new UnsupportedOperationException("Not supported yet."); // To change body of
+                                                                       // generated methods, choose
+                                                                       // Tools | Templates.
+    }
+
+    private static class HashNode extends RootNode {
+        private static int counter;
+        private final Source code;
+        private final int id;
+
+        public HashNode(HashLanguage hash, Source code) {
+            super(hash.getClass(), null, null);
+            this.code = code;
+            id = ++counter;
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return System.identityHashCode(this) + "@" + code.getCode() + " @ " + id;
+        }
+    }
+
+    @TruffleLanguage.Registration(name = "AltHash", mimeType = "application/x-test-hash-alt", version = "1.0")
+    public static final class SubLang extends HashLanguage {
+        public static final SubLang INSTANCE = new SubLang();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/ImplicitExplicitExportTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,315 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.Executors;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.RootCallTarget;
+import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.TruffleLanguage.Env;
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.instrument.Visualizer;
+import com.oracle.truffle.api.instrument.WrapperNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+
+public class ImplicitExplicitExportTest {
+    private static Thread mainThread;
+    private PolyglotEngine vm;
+
+    @Before
+    public void initializeVM() {
+        mainThread = Thread.currentThread();
+        vm = PolyglotEngine.newBuilder().executor(Executors.newSingleThreadExecutor()).build();
+        assertTrue("Found " + L1 + " language", vm.getLanguages().containsKey(L1));
+        assertTrue("Found " + L2 + " language", vm.getLanguages().containsKey(L2));
+        assertTrue("Found " + L3 + " language", vm.getLanguages().containsKey(L3));
+    }
+
+    @After
+    public void cleanThread() {
+        mainThread = null;
+    }
+
+    @Test
+    public void explicitExportFound() throws IOException {
+        // @formatter:off
+        vm.eval(Source.fromText("explicit.ahoj=42", "Fourty two").withMimeType(L1));
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
+        ).get();
+        // @formatter:on
+        assertEquals("42", ret);
+    }
+
+    @Test
+    public void implicitExportFound() throws IOException {
+        // @formatter:off
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
+        );
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
+        ).get();
+        // @formatter:on
+        assertEquals("42", ret);
+    }
+
+    @Test
+    public void explicitExportPreferred2() throws IOException {
+        // @formatter:off
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
+        );
+        vm.eval(
+            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L2)
+        );
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
+        ).get();
+        // @formatter:on
+        assertEquals("Explicit import from L2 is used", "43", ret);
+        assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").get());
+    }
+
+    @Test
+    public void explicitExportPreferred1() throws IOException {
+        // @formatter:off
+        vm.eval(
+            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L1)
+        );
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L2)
+        );
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
+        ).get();
+        // @formatter:on
+        assertEquals("Explicit import from L2 is used", "43", ret);
+        assertEquals("Global symbol is also 43", "43", vm.findGlobalSymbol("ahoj").execute().get());
+    }
+
+    static final class Ctx {
+        static final Set<Ctx> disposed = new HashSet<>();
+
+        final Map<String, String> explicit = new HashMap<>();
+        final Map<String, String> implicit = new HashMap<>();
+        final Env env;
+
+        public Ctx(Env env) {
+            this.env = env;
+        }
+
+        void dispose() {
+            disposed.add(this);
+        }
+    }
+
+    private abstract static class AbstractExportImportLanguage extends TruffleLanguage<Ctx> {
+
+        @Override
+        protected Ctx createContext(Env env) {
+            if (mainThread != null) {
+                assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread);
+            }
+            return new Ctx(env);
+        }
+
+        @Override
+        protected void disposeContext(Ctx context) {
+            context.dispose();
+        }
+
+        @Override
+        protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
+            if (code.getCode().startsWith("parse=")) {
+                throw new IOException(code.getCode().substring(6));
+            }
+            return new ValueCallTarget(code, this);
+        }
+
+        @Override
+        protected Object findExportedSymbol(Ctx context, String globalName, boolean onlyExplicit) {
+            if (context.explicit.containsKey(globalName)) {
+                return context.explicit.get(globalName);
+            }
+            if (!onlyExplicit && context.implicit.containsKey(globalName)) {
+                return context.implicit.get(globalName);
+            }
+            return null;
+        }
+
+        @Override
+        protected Object getLanguageGlobal(Ctx context) {
+            return null;
+        }
+
+        @Override
+        protected boolean isObjectOfLanguage(Object object) {
+            return false;
+        }
+
+        @Override
+        protected Visualizer getVisualizer() {
+            return null;
+        }
+
+        @Override
+        protected boolean isInstrumentable(Node node) {
+            return false;
+        }
+
+        @Override
+        protected WrapperNode createWrapperNode(Node node) {
+            return null;
+        }
+
+        @Override
+        protected Object evalInContext(Source source, Node node, MaterializedFrame mFrame) throws IOException {
+            return null;
+        }
+
+        private Object importExport(Source code) {
+            assertNotEquals("Should run asynchronously", Thread.currentThread(), mainThread);
+            final Node node = createFindContextNode();
+            Ctx ctx = findContext(node);
+            Properties p = new Properties();
+            try (Reader r = code.getReader()) {
+                p.load(r);
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+            Enumeration<Object> en = p.keys();
+            while (en.hasMoreElements()) {
+                Object n = en.nextElement();
+                if (n instanceof String) {
+                    String k = (String) n;
+                    if (k.startsWith("explicit.")) {
+                        ctx.explicit.put(k.substring(9), p.getProperty(k));
+                    }
+                    if (k.startsWith("implicit.")) {
+                        ctx.implicit.put(k.substring(9), p.getProperty(k));
+                    }
+                    if (k.equals("return")) {
+                        return ctx.env.importSymbol(p.getProperty(k));
+                    }
+                }
+            }
+            return null;
+        }
+    }
+
+    private static final class ValueCallTarget implements RootCallTarget {
+        private final Source code;
+        private final AbstractExportImportLanguage language;
+
+        private ValueCallTarget(Source code, AbstractExportImportLanguage language) {
+            this.code = code;
+            this.language = language;
+        }
+
+        @Override
+        public RootNode getRootNode() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Object call(Object... arguments) {
+            return language.importExport(code);
+        }
+    }
+
+    public static final String L1 = "application/x-test-import-export-1";
+    static final String L2 = "application/x-test-import-export-2";
+    static final String L3 = "application/x-test-import-export-3";
+
+    @TruffleLanguage.Registration(mimeType = L1, name = "ImportExport1", version = "0")
+    public static final class ExportImportLanguage1 extends AbstractExportImportLanguage {
+        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage1();
+
+        public ExportImportLanguage1() {
+        }
+
+        @Override
+        protected String toString(Ctx ctx, Object value) {
+            if (value instanceof String) {
+                try {
+                    int number = Integer.parseInt((String) value);
+                    return number + ": Int";
+                } catch (NumberFormatException ex) {
+                    // go on
+                }
+            }
+            return Objects.toString(value);
+        }
+    }
+
+    @TruffleLanguage.Registration(mimeType = L2, name = "ImportExport2", version = "0")
+    public static final class ExportImportLanguage2 extends AbstractExportImportLanguage {
+        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage2();
+
+        public ExportImportLanguage2() {
+        }
+
+        @Override
+        protected String toString(Ctx ctx, Object value) {
+            if (value instanceof String) {
+                try {
+                    double number = Double.parseDouble((String) value);
+                    return number + ": Double";
+                } catch (NumberFormatException ex) {
+                    // go on
+                }
+            }
+            return Objects.toString(value);
+        }
+    }
+
+    @TruffleLanguage.Registration(mimeType = L3, name = "ImportExport3", version = "0")
+    public static final class ExportImportLanguage3 extends AbstractExportImportLanguage {
+        public static final AbstractExportImportLanguage INSTANCE = new ExportImportLanguage3();
+
+        private ExportImportLanguage3() {
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/InitializationTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,228 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.TruffleLanguage.Env;
+import com.oracle.truffle.api.debug.Breakpoint;
+import com.oracle.truffle.api.debug.Debugger;
+import com.oracle.truffle.api.debug.ExecutionEvent;
+import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.instrument.ASTProber;
+import com.oracle.truffle.api.instrument.EventHandlerNode;
+import com.oracle.truffle.api.instrument.Instrumenter;
+import com.oracle.truffle.api.instrument.Probe;
+import com.oracle.truffle.api.instrument.StandardSyntaxTag;
+import com.oracle.truffle.api.instrument.Visualizer;
+import com.oracle.truffle.api.instrument.WrapperNode;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.NodeVisitor;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.source.SourceSection;
+
+/**
+ * Bug report validating test.
+ * <p>
+ * It has been reported that calling {@link Env#importSymbol(java.lang.String)} in
+ * {@link TruffleLanguage TruffleLanguage.createContext(env)} yields a {@link NullPointerException}.
+ * <p>
+ * The other report was related to specifying an abstract language class in the RootNode and
+ * problems with debugging later on. That is what the other part of this test - once it obtains
+ * Debugger instance simulates.
+ */
+public class InitializationTest {
+
+    @Test
+    public void accessProbeForAbstractLanguage() throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
+        final Debugger[] arr = {null};
+        PolyglotEngine vm = PolyglotEngine.newBuilder().onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) {
+            @Override
+            protected void on(ExecutionEvent event) {
+                arr[0] = event.getDebugger();
+            }
+        }).build();
+
+        final Field field = PolyglotEngine.class.getDeclaredField("instrumenter");
+        field.setAccessible(true);
+        final Instrumenter instrumenter = (Instrumenter) field.get(vm);
+        instrumenter.registerASTProber(new ASTProber() {
+
+            public void probeAST(final Instrumenter inst, RootNode startNode) {
+                startNode.accept(new NodeVisitor() {
+
+                    public boolean visit(Node node) {
+
+                        if (node instanceof ANode) {
+                            inst.probe(node).tagAs(StandardSyntaxTag.STATEMENT, null);
+                        }
+                        return true;
+                    }
+                });
+            }
+        });
+
+        Source source = Source.fromText("accessProbeForAbstractLanguage text", "accessProbeForAbstractLanguage").withMimeType("application/x-abstrlang");
+
+        assertEquals(vm.eval(source).get(), 1);
+
+        assertNotNull("Debugger found", arr[0]);
+
+        Debugger d = arr[0];
+        Breakpoint b = d.setLineBreakpoint(0, source.createLineLocation(1), true);
+        assertTrue(b.isEnabled());
+        b.setCondition("true");
+
+        assertEquals(vm.eval(source).get(), 1);
+        vm.dispose();
+    }
+
+    private static final class MMRootNode extends RootNode {
+        @Child ANode node;
+
+        MMRootNode(SourceSection ss) {
+            super(AbstractLanguage.class, ss, null);
+            node = new ANode(42);
+            adoptChildren();
+        }
+
+        @Override
+        public Object execute(VirtualFrame frame) {
+            return node.constant();
+        }
+    }
+
+    private static class ANode extends Node {
+        private final int constant;
+
+        public ANode(int constant) {
+            this.constant = constant;
+        }
+
+        @Override
+        public SourceSection getSourceSection() {
+            return getRootNode().getSourceSection();
+        }
+
+        Object constant() {
+            return constant;
+        }
+    }
+
+    private static class ANodeWrapper extends ANode implements WrapperNode {
+        @Child ANode child;
+        @Child private EventHandlerNode eventHandlerNode;
+
+        ANodeWrapper(ANode node) {
+            super(1);  // dummy
+            this.child = node;
+        }
+
+        @Override
+        public Node getChild() {
+            return child;
+        }
+
+        @Override
+        public Probe getProbe() {
+            return eventHandlerNode.getProbe();
+        }
+
+        @Override
+        public void insertEventHandlerNode(EventHandlerNode eventHandler) {
+            this.eventHandlerNode = eventHandler;
+        }
+
+        @Override
+        public String instrumentationInfo() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private abstract static class AbstractLanguage extends TruffleLanguage<Object> {
+    }
+
+    @TruffleLanguage.Registration(mimeType = "application/x-abstrlang", name = "AbstrLang", version = "0.1")
+    public static final class TestLanguage extends AbstractLanguage {
+        public static final TestLanguage INSTANCE = new TestLanguage();
+
+        @Override
+        protected Object createContext(Env env) {
+            assertNull("Not defined symbol", env.importSymbol("unknown"));
+            return env;
+        }
+
+        @Override
+        protected CallTarget parse(Source code, Node context, String... argumentNames) throws IOException {
+            return Truffle.getRuntime().createCallTarget(new MMRootNode(code.createSection("1st line", 1)));
+        }
+
+        @Override
+        protected Object findExportedSymbol(Object context, String globalName, boolean onlyExplicit) {
+            return null;
+        }
+
+        @Override
+        protected Object getLanguageGlobal(Object context) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        protected boolean isObjectOfLanguage(Object object) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Object evalInContext(Source source, Node node, MaterializedFrame mFrame) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Visualizer getVisualizer() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        protected boolean isInstrumentable(Node node) {
+            return node instanceof ANode;
+        }
+
+        @Override
+        protected WrapperNode createWrapperNode(Node node) {
+            return node instanceof ANode ? new ANodeWrapper((ANode) node) : null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/ToStringTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,58 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.source.Source;
+
+public class ToStringTest {
+    @Test
+    public void valueToStringValueWith1() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
+        language2.eval(Source.fromText("explicit.value=42", "define 42"));
+        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
+        assertEquals("It's fourtytwo", "42", value.get());
+
+        String textual = value.as(String.class);
+        assertEquals("Nicely formated as by L1", "42: Int", textual);
+    }
+
+    @Test
+    public void valueToStringValueWith2() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
+        language1.eval(Source.fromText("explicit.value=42", "define 42"));
+        PolyglotEngine.Value value = language2.eval(Source.fromText("return=value", "42.value"));
+        assertEquals("It's fourtytwo", "42", value.get());
+
+        String textual = value.as(String.class);
+        assertEquals("Nicely formated as by L2", "42.0: Double", textual);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/vm/ValueTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,129 @@
+/*
+ * 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.truffle.api.vm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Executor;
+
+import org.junit.Test;
+
+import com.oracle.truffle.api.source.Source;
+
+public class ValueTest implements Executor {
+    private List<Runnable> pending = new LinkedList<>();
+
+    @Test
+    public void valueToStringValue() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
+        language2.eval(Source.fromText("explicit.value=42", "define 42"));
+        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
+        assertEquals("It's fourtytwo", "42", value.get());
+
+        String textual = value.toString();
+        assertTrue("Contains the value " + textual, textual.contains("value=42"));
+        assertTrue("Is computed " + textual, textual.contains("computed=true"));
+        assertTrue("No error " + textual, textual.contains("exception=null"));
+    }
+
+    @Test
+    public void valueToStringException() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Value value = null;
+        try {
+            value = language1.eval(Source.fromText("parse=does not work", "error.value"));
+            Object res = value.get();
+            fail("Should throw an exception: " + res);
+        } catch (IOException ex) {
+            assertTrue("Message contains the right text: " + ex.getMessage(), ex.getMessage().contains("does not work"));
+        }
+
+        assertNull("No value returned", value);
+    }
+
+    @Test
+    public void valueToStringValueAsync() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().executor(this).build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Language language2 = engine.getLanguages().get("application/x-test-import-export-2");
+        language2.eval(Source.fromText("explicit.value=42", "define 42"));
+        flush();
+
+        PolyglotEngine.Value value = language1.eval(Source.fromText("return=value", "42.value"));
+
+        String textual = value.toString();
+        assertFalse("Doesn't contain the value " + textual, textual.contains("value=42"));
+        assertTrue("Is not computed " + textual, textual.contains("computed=false"));
+        assertTrue("No error " + textual, textual.contains("exception=null"));
+        assertTrue("No value yet " + textual, textual.contains("value=null"));
+
+        flush();
+
+        textual = value.toString();
+        assertTrue("Is computed " + textual, textual.contains("computed=true"));
+        assertTrue("No error " + textual, textual.contains("exception=null"));
+        assertTrue("value computed " + textual, textual.contains("value=42"));
+    }
+
+    @Test
+    public void valueToStringExceptionAsync() throws Exception {
+        PolyglotEngine engine = PolyglotEngine.newBuilder().executor(this).build();
+        PolyglotEngine.Language language1 = engine.getLanguages().get("application/x-test-import-export-1");
+        PolyglotEngine.Value value = language1.eval(Source.fromText("parse=does not work", "error.value"));
+        assertNotNull("Value returned", value);
+
+        String textual = value.toString();
+        assertTrue("Is not computed " + textual, textual.contains("computed=false"));
+        assertTrue("No error " + textual, textual.contains("exception=null"));
+        assertTrue("No value yet " + textual, textual.contains("value=null"));
+
+        flush();
+
+        textual = value.toString();
+        assertTrue("Is computed " + textual, textual.contains("computed=true"));
+        assertTrue("No value at all" + textual, textual.contains("value=null"));
+        assertTrue("Error " + textual, textual.contains("exception=java.io.IOException: does not work"));
+    }
+
+    @Override
+    public void execute(Runnable command) {
+        pending.add(command);
+    }
+
+    private void flush() {
+        for (Runnable r : pending) {
+            r.run();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api.vm/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,142 @@
+#Signature file v4.1
+#Version 
+
+CLSS public abstract com.oracle.truffle.api.vm.EventConsumer<%0 extends java.lang.Object>
+cons public init(java.lang.Class<{com.oracle.truffle.api.vm.EventConsumer%0}>)
+meth protected abstract void on({com.oracle.truffle.api.vm.EventConsumer%0})
+supr java.lang.Object
+hfds type
+
+CLSS public com.oracle.truffle.api.vm.IncompleteSourceException
+cons public init()
+cons public init(java.lang.Throwable)
+supr java.io.IOException
+
+CLSS public com.oracle.truffle.api.vm.PolyglotEngine
+innr public Builder
+innr public Language
+innr public Value
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Value eval(com.oracle.truffle.api.source.Source) throws java.io.IOException
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Value findGlobalSymbol(java.lang.String)
+meth public java.util.Map<java.lang.String,? extends com.oracle.truffle.api.vm.PolyglotEngine$Language> getLanguages()
+meth public static com.oracle.truffle.api.vm.PolyglotEngine$Builder buildNew()
+meth public void dispose()
+supr java.lang.Object
+hfds JAVA_INTEROP_ENABLED,LOG,SPI,debugger,disposed,err,executor,globals,handlers,in,initThread,instrumenter,langs,out
+hcls SPIAccessor
+
+CLSS public com.oracle.truffle.api.vm.PolyglotEngine$Builder
+ outer com.oracle.truffle.api.vm.PolyglotEngine
+meth public com.oracle.truffle.api.vm.PolyglotEngine build()
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder executor(java.util.concurrent.Executor)
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder globalSymbol(java.lang.String,java.lang.Object)
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder onEvent(com.oracle.truffle.api.vm.EventConsumer<?>)
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder setErr(java.io.OutputStream)
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder setIn(java.io.InputStream)
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Builder setOut(java.io.OutputStream)
+supr java.lang.Object
+hfds err,executor,globals,handlers,in,out
+
+CLSS public com.oracle.truffle.api.vm.PolyglotEngine$Language
+ outer com.oracle.truffle.api.vm.PolyglotEngine
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Value eval(com.oracle.truffle.api.source.Source) throws java.io.IOException
+meth public com.oracle.truffle.api.vm.PolyglotEngine$Value getGlobalObject()
+meth public java.lang.String getName()
+meth public java.lang.String getVersion()
+meth public java.lang.String toString()
+meth public java.util.Set<java.lang.String> getMimeTypes()
+supr java.lang.Object
+hfds env,info
+
+CLSS public com.oracle.truffle.api.vm.PolyglotEngine$Value
+ outer com.oracle.truffle.api.vm.PolyglotEngine
+meth public !varargs com.oracle.truffle.api.vm.PolyglotEngine$Value invoke(java.lang.Object,java.lang.Object[]) throws java.io.IOException
+meth public <%0 extends java.lang.Object> {%%0} as(java.lang.Class<{%%0}>) throws java.io.IOException
+meth public java.lang.Object get() throws java.io.IOException
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds language,ready,result,target
+
+CLSS public java.io.IOException
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
--- a/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java	Mon Dec 07 21:17:46 2015 -0800
@@ -38,7 +38,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Executor;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.oracle.truffle.api.CallTarget;
@@ -62,6 +61,8 @@
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.RootNode;
 import com.oracle.truffle.api.source.Source;
+import java.util.WeakHashMap;
+import java.util.logging.Level;
 
 /**
  * Gate way into the world of {@link TruffleLanguage Truffle languages}. {@link #buildNew()
@@ -422,7 +423,7 @@
         try (Closeable d = SPI.executionStart(this, -1, debugger, s)) {
             TruffleLanguage<?> langImpl = l.getImpl(true);
             fillLang[0] = langImpl;
-            return SPI.eval(langImpl, s);
+            return SPI.eval(langImpl, s, l.cache);
         }
     }
 
@@ -666,7 +667,23 @@
          *         <code>null</code>
          * @throws IOException signals problem during execution
          */
+        @Deprecated
         public Value invoke(final Object thiz, final Object... args) throws IOException {
+            return execute(args);
+        }
+
+        /**
+         * Executes the symbol. If the symbol represents a function, then it should be invoked with
+         * provided arguments. If the symbol represents a field, then first argument (if provided)
+         * should set the value to the field; the return value should be the actual value of the
+         * field when the <code>invoke</code> method returns.
+         *
+         * @param args arguments to pass when invoking the symbol
+         * @return symbol wrapper around the value returned by invoking the symbol, never
+         *         <code>null</code>
+         * @throws IOException signals problem during execution
+         */
+        public Value execute(final Object... args) throws IOException {
             get();
             ComputeInExecutor<Object> invokeCompute = new ComputeInExecutor<Object>(executor) {
                 @SuppressWarnings("try")
@@ -674,16 +691,6 @@
                 protected Object compute() throws IOException {
                     try (final Closeable c = SPI.executionStart(PolyglotEngine.this, -1, debugger, null)) {
                         List<Object> arr = new ArrayList<>();
-                        if (thiz == null) {
-                            if (language[0] != null) {
-                                Object global = SPI.languageGlobal(SPI.findLanguage(PolyglotEngine.this, language[0].getClass()));
-                                if (global != null) {
-                                    arr.add(global);
-                                }
-                            }
-                        } else {
-                            arr.add(thiz);
-                        }
                         arr.addAll(Arrays.asList(args));
                         for (;;) {
                             try {
@@ -724,10 +731,12 @@
      * {@link PolyglotEngine#eval(com.oracle.truffle.api.source.Source) a code is evaluated} in it.
      */
     public class Language {
+        private final Map<Source, CallTarget> cache;
         private final LanguageCache info;
         private TruffleLanguage.Env env;
 
         Language(LanguageCache info) {
+            this.cache = new WeakHashMap<>();
             this.info = info;
         }
 
@@ -885,8 +894,8 @@
         }
 
         @Override
-        public Object eval(TruffleLanguage<?> l, Source s) throws IOException {
-            return super.eval(l, s);
+        protected Object eval(TruffleLanguage<?> l, Source s, Map<Source, CallTarget> cache) throws IOException {
+            return super.eval(l, s, cache);
         }
 
         @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api/snapshot.sigtest	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,1236 @@
+#Signature file v4.1
+#Version 
+
+CLSS public abstract interface com.oracle.truffle.api.Assumption
+meth public abstract boolean isValid()
+meth public abstract java.lang.String getName()
+meth public abstract void check() throws com.oracle.truffle.api.nodes.InvalidAssumptionException
+meth public abstract void invalidate()
+
+CLSS public abstract interface com.oracle.truffle.api.CallTarget
+meth public abstract !varargs java.lang.Object call(java.lang.Object[])
+
+CLSS public final com.oracle.truffle.api.CompilerAsserts
+meth public static <%0 extends java.lang.Object> void compilationConstant(java.lang.Object)
+meth public static <%0 extends java.lang.Object> void partialEvaluationConstant(java.lang.Object)
+meth public static void neverPartOfCompilation()
+meth public static void neverPartOfCompilation(java.lang.String)
+supr java.lang.Object
+
+CLSS public final com.oracle.truffle.api.CompilerDirectives
+cons public init()
+fld public final static double FASTPATH_PROBABILITY = 0.9999
+fld public final static double LIKELY_PROBABILITY = 0.75
+fld public final static double SLOWPATH_PROBABILITY = 1.0E-4
+fld public final static double UNLIKELY_PROBABILITY = 0.25
+innr public abstract interface static !annotation CompilationFinal
+innr public abstract interface static !annotation TruffleBoundary
+innr public abstract interface static !annotation ValueType
+meth public static <%0 extends java.lang.Object> {%%0} interpreterOnly(java.util.concurrent.Callable<{%%0}>) throws java.lang.Exception
+meth public static boolean inCompiledCode()
+meth public static boolean inInterpreter()
+meth public static boolean injectBranchProbability(double,boolean)
+meth public static boolean isCompilationConstant(java.lang.Object)
+meth public static boolean isPartialEvaluationConstant(java.lang.Object)
+meth public static void bailout(java.lang.String)
+meth public static void ensureVirtualized(java.lang.Object)
+meth public static void ensureVirtualizedHere(java.lang.Object)
+meth public static void interpreterOnly(java.lang.Runnable)
+meth public static void materialize(java.lang.Object)
+meth public static void transferToInterpreter()
+meth public static void transferToInterpreterAndInvalidate()
+supr java.lang.Object
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.CompilerDirectives$CompilationFinal
+ outer com.oracle.truffle.api.CompilerDirectives
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.CompilerDirectives$TruffleBoundary
+ outer com.oracle.truffle.api.CompilerDirectives
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD, CONSTRUCTOR])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault boolean throwsControlFlowException()
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.CompilerDirectives$ValueType
+ outer com.oracle.truffle.api.CompilerDirectives
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface com.oracle.truffle.api.CompilerOptions
+meth public abstract boolean supportsOption(java.lang.String)
+meth public abstract void setOption(java.lang.String,java.lang.Object)
+
+CLSS public com.oracle.truffle.api.ExactMath
+cons public init()
+meth public static int addExact(int,int)
+meth public static int multiplyExact(int,int)
+meth public static int multiplyHigh(int,int)
+meth public static int multiplyHighUnsigned(int,int)
+meth public static int subtractExact(int,int)
+meth public static long addExact(long,long)
+meth public static long multiplyExact(long,long)
+meth public static long multiplyHigh(long,long)
+meth public static long multiplyHighUnsigned(long,long)
+meth public static long subtractExact(long,long)
+supr java.lang.Object
+
+CLSS public abstract com.oracle.truffle.api.ExecutionContext
+cons protected init()
+meth public com.oracle.truffle.api.CompilerOptions getCompilerOptions()
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.LoopCountReceiver
+meth public abstract void reportLoopCount(int)
+
+CLSS public com.oracle.truffle.api.OptimizationFailedException
+cons public init(java.lang.Throwable,com.oracle.truffle.api.RootCallTarget)
+meth public com.oracle.truffle.api.RootCallTarget getCallTarget()
+supr java.lang.RuntimeException
+hfds callTarget,serialVersionUID
+
+CLSS public abstract interface com.oracle.truffle.api.ReplaceObserver
+meth public abstract boolean nodeReplaced(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,java.lang.CharSequence)
+
+CLSS public abstract interface com.oracle.truffle.api.RootCallTarget
+intf com.oracle.truffle.api.CallTarget
+meth public abstract com.oracle.truffle.api.nodes.RootNode getRootNode()
+
+CLSS public com.oracle.truffle.api.Truffle
+cons public init()
+meth public static com.oracle.truffle.api.TruffleRuntime getRuntime()
+supr java.lang.Object
+hfds RUNTIME
+
+CLSS public abstract com.oracle.truffle.api.TruffleLanguage<%0 extends java.lang.Object>
+cons protected init()
+innr public abstract interface static !annotation Registration
+innr public final static Env
+meth protected abstract !varargs com.oracle.truffle.api.CallTarget parse(com.oracle.truffle.api.source.Source,com.oracle.truffle.api.nodes.Node,java.lang.String[]) throws java.io.IOException
+meth protected abstract boolean isInstrumentable(com.oracle.truffle.api.nodes.Node)
+meth protected abstract boolean isObjectOfLanguage(java.lang.Object)
+meth protected abstract com.oracle.truffle.api.instrument.Visualizer getVisualizer()
+meth protected abstract com.oracle.truffle.api.instrument.WrapperNode createWrapperNode(com.oracle.truffle.api.nodes.Node)
+meth protected abstract java.lang.Object evalInContext(com.oracle.truffle.api.source.Source,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.MaterializedFrame) throws java.io.IOException
+meth protected abstract java.lang.Object findExportedSymbol({com.oracle.truffle.api.TruffleLanguage%0},java.lang.String,boolean)
+meth protected abstract java.lang.Object getLanguageGlobal({com.oracle.truffle.api.TruffleLanguage%0})
+meth protected abstract {com.oracle.truffle.api.TruffleLanguage%0} createContext(com.oracle.truffle.api.TruffleLanguage$Env)
+meth protected final com.oracle.truffle.api.nodes.Node createFindContextNode()
+meth protected final {com.oracle.truffle.api.TruffleLanguage%0} findContext(com.oracle.truffle.api.nodes.Node)
+meth protected java.lang.String toString({com.oracle.truffle.api.TruffleLanguage%0},java.lang.Object)
+meth protected void disposeContext({com.oracle.truffle.api.TruffleLanguage%0})
+supr java.lang.Object
+hfds API,compiled
+hcls AccessAPI,LangCtx
+
+CLSS public final static com.oracle.truffle.api.TruffleLanguage$Env
+ outer com.oracle.truffle.api.TruffleLanguage
+meth public com.oracle.truffle.api.instrument.Instrumenter instrumenter()
+meth public java.io.InputStream in()
+meth public java.io.OutputStream err()
+meth public java.io.OutputStream out()
+meth public java.lang.Object importSymbol(java.lang.String)
+supr java.lang.Object
+hfds err,in,instrumenter,lang,langCtx,out,vm
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.TruffleLanguage$Registration
+ outer com.oracle.truffle.api.TruffleLanguage
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=SOURCE)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.String name()
+meth public abstract java.lang.String version()
+meth public abstract java.lang.String[] mimeType()
+
+CLSS public final com.oracle.truffle.api.TruffleOptions
+fld public final static boolean DetailedRewriteReasons
+fld public final static boolean TraceASTJSON
+fld public final static boolean TraceRewrites
+fld public final static com.oracle.truffle.api.nodes.NodeCost TraceRewritesFilterFromCost
+fld public final static com.oracle.truffle.api.nodes.NodeCost TraceRewritesFilterToCost
+fld public final static java.lang.String TraceRewritesFilterClass
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.TruffleRuntime
+meth public abstract <%0 extends java.lang.Object> {%%0} getCapability(java.lang.Class<{%%0}>)
+meth public abstract <%0 extends java.lang.Object> {%%0} iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<{%%0}>)
+meth public abstract com.oracle.truffle.api.Assumption createAssumption()
+meth public abstract com.oracle.truffle.api.Assumption createAssumption(java.lang.String)
+meth public abstract com.oracle.truffle.api.CompilerOptions createCompilerOptions()
+meth public abstract com.oracle.truffle.api.RootCallTarget createCallTarget(com.oracle.truffle.api.nodes.RootNode)
+meth public abstract com.oracle.truffle.api.frame.FrameInstance getCallerFrame()
+meth public abstract com.oracle.truffle.api.frame.FrameInstance getCurrentFrame()
+meth public abstract com.oracle.truffle.api.frame.MaterializedFrame createMaterializedFrame(java.lang.Object[])
+meth public abstract com.oracle.truffle.api.frame.MaterializedFrame createMaterializedFrame(java.lang.Object[],com.oracle.truffle.api.frame.FrameDescriptor)
+meth public abstract com.oracle.truffle.api.frame.VirtualFrame createVirtualFrame(java.lang.Object[],com.oracle.truffle.api.frame.FrameDescriptor)
+meth public abstract com.oracle.truffle.api.nodes.DirectCallNode createDirectCallNode(com.oracle.truffle.api.CallTarget)
+meth public abstract com.oracle.truffle.api.nodes.IndirectCallNode createIndirectCallNode()
+meth public abstract com.oracle.truffle.api.nodes.LoopNode createLoopNode(com.oracle.truffle.api.nodes.RepeatingNode)
+meth public abstract java.lang.String getName()
+meth public abstract java.util.Collection<com.oracle.truffle.api.RootCallTarget> getCallTargets()
+meth public abstract void notifyTransferToInterpreter()
+
+CLSS public abstract interface com.oracle.truffle.api.TruffleRuntimeAccess
+meth public abstract com.oracle.truffle.api.TruffleRuntime getRuntime()
+
+CLSS public abstract interface com.oracle.truffle.api.TypedObject
+meth public abstract java.lang.Object getTypeIdentifier()
+
+CLSS public abstract com.oracle.truffle.api.debug.Breakpoint
+innr public final static !enum State
+meth public abstract boolean isEnabled()
+meth public abstract java.lang.String getLocationDescription()
+meth public abstract void dispose()
+meth public abstract void setCondition(java.lang.String) throws java.io.IOException
+meth public abstract void setEnabled(boolean)
+meth public com.oracle.truffle.api.source.Source getCondition()
+meth public final boolean isOneShot()
+meth public final com.oracle.truffle.api.debug.Breakpoint$State getState()
+meth public final int getHitCount()
+meth public final int getIgnoreCount()
+meth public final void setIgnoreCount(int)
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds hitCount,ignoreCount,isOneShot,state
+
+CLSS public final static !enum com.oracle.truffle.api.debug.Breakpoint$State
+ outer com.oracle.truffle.api.debug.Breakpoint
+fld public final static com.oracle.truffle.api.debug.Breakpoint$State DISABLED
+fld public final static com.oracle.truffle.api.debug.Breakpoint$State DISABLED_UNRESOLVED
+fld public final static com.oracle.truffle.api.debug.Breakpoint$State DISPOSED
+fld public final static com.oracle.truffle.api.debug.Breakpoint$State ENABLED
+fld public final static com.oracle.truffle.api.debug.Breakpoint$State ENABLED_UNRESOLVED
+meth public java.lang.String getName()
+meth public java.lang.String toString()
+meth public static com.oracle.truffle.api.debug.Breakpoint$State valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.debug.Breakpoint$State[] values()
+supr java.lang.Enum<com.oracle.truffle.api.debug.Breakpoint$State>
+hfds name
+
+CLSS public final com.oracle.truffle.api.debug.Debugger
+meth public com.oracle.truffle.api.debug.Breakpoint setLineBreakpoint(int,com.oracle.truffle.api.source.LineLocation,boolean) throws java.io.IOException
+meth public com.oracle.truffle.api.debug.Breakpoint setTagBreakpoint(int,com.oracle.truffle.api.instrument.SyntaxTag,boolean) throws java.io.IOException
+meth public java.util.Collection<com.oracle.truffle.api.debug.Breakpoint> getBreakpoints()
+supr java.lang.Object
+hfds ACCESSOR,CALL_TAG,OUT,STEPPING_TAG,TRACE,TRACE_PREFIX,breakpointCallback,debugContext,instrumenter,lastSource,lineBreaks,tagBreaks,vm,warningLog
+hcls AccessorDebug,BreakpointCallback,Continue,DebugExecutionContext,StepInto,StepOut,StepOver,StepOverNested,StepStrategy,WarningLog
+
+CLSS public final com.oracle.truffle.api.debug.ExecutionEvent
+meth public com.oracle.truffle.api.debug.Debugger getDebugger()
+meth public void prepareContinue()
+meth public void prepareStepInto()
+supr java.lang.Object
+hfds debugger
+
+CLSS public final com.oracle.truffle.api.debug.SuspendedEvent
+meth public com.oracle.truffle.api.debug.Debugger getDebugger()
+meth public com.oracle.truffle.api.frame.MaterializedFrame getFrame()
+meth public com.oracle.truffle.api.nodes.Node getNode()
+meth public java.lang.Object eval(java.lang.String,com.oracle.truffle.api.frame.FrameInstance) throws java.io.IOException
+meth public java.util.List<com.oracle.truffle.api.frame.FrameInstance> getStack()
+meth public java.util.List<java.lang.String> getRecentWarnings()
+meth public void prepareContinue()
+meth public void prepareStepInto(int)
+meth public void prepareStepOut()
+meth public void prepareStepOver(int)
+supr java.lang.Object
+hfds astNode,debugger,frames,mFrame,recentWarnings
+
+CLSS public abstract interface com.oracle.truffle.api.frame.Frame
+meth public abstract boolean getBoolean(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract boolean isBoolean(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isByte(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isDouble(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isFloat(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isInt(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isLong(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract boolean isObject(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract byte getByte(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract com.oracle.truffle.api.frame.FrameDescriptor getFrameDescriptor()
+meth public abstract com.oracle.truffle.api.frame.MaterializedFrame materialize()
+meth public abstract double getDouble(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract float getFloat(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract int getInt(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract java.lang.Object getObject(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract java.lang.Object getValue(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract java.lang.Object[] getArguments()
+meth public abstract long getLong(com.oracle.truffle.api.frame.FrameSlot) throws com.oracle.truffle.api.frame.FrameSlotTypeException
+meth public abstract void setBoolean(com.oracle.truffle.api.frame.FrameSlot,boolean)
+meth public abstract void setByte(com.oracle.truffle.api.frame.FrameSlot,byte)
+meth public abstract void setDouble(com.oracle.truffle.api.frame.FrameSlot,double)
+meth public abstract void setFloat(com.oracle.truffle.api.frame.FrameSlot,float)
+meth public abstract void setInt(com.oracle.truffle.api.frame.FrameSlot,int)
+meth public abstract void setLong(com.oracle.truffle.api.frame.FrameSlot,long)
+meth public abstract void setObject(com.oracle.truffle.api.frame.FrameSlot,java.lang.Object)
+
+CLSS public final com.oracle.truffle.api.frame.FrameDescriptor
+cons public init()
+cons public init(java.lang.Object)
+intf java.lang.Cloneable
+meth public com.oracle.truffle.api.Assumption getNotInFrameAssumption(java.lang.Object)
+meth public com.oracle.truffle.api.Assumption getVersion()
+meth public com.oracle.truffle.api.frame.FrameDescriptor copy()
+meth public com.oracle.truffle.api.frame.FrameDescriptor shallowCopy()
+meth public com.oracle.truffle.api.frame.FrameSlot addFrameSlot(java.lang.Object)
+meth public com.oracle.truffle.api.frame.FrameSlot addFrameSlot(java.lang.Object,com.oracle.truffle.api.frame.FrameSlotKind)
+meth public com.oracle.truffle.api.frame.FrameSlot addFrameSlot(java.lang.Object,java.lang.Object,com.oracle.truffle.api.frame.FrameSlotKind)
+meth public com.oracle.truffle.api.frame.FrameSlot findFrameSlot(java.lang.Object)
+meth public com.oracle.truffle.api.frame.FrameSlot findOrAddFrameSlot(java.lang.Object)
+meth public com.oracle.truffle.api.frame.FrameSlot findOrAddFrameSlot(java.lang.Object,com.oracle.truffle.api.frame.FrameSlotKind)
+meth public com.oracle.truffle.api.frame.FrameSlot findOrAddFrameSlot(java.lang.Object,java.lang.Object,com.oracle.truffle.api.frame.FrameSlotKind)
+meth public int getSize()
+meth public java.lang.Object getDefaultValue()
+meth public java.lang.String toString()
+meth public java.util.List<? extends com.oracle.truffle.api.frame.FrameSlot> getSlots()
+meth public java.util.Set<java.lang.Object> getIdentifiers()
+meth public static com.oracle.truffle.api.frame.FrameDescriptor create()
+meth public static com.oracle.truffle.api.frame.FrameDescriptor create(java.lang.Object)
+meth public void removeFrameSlot(java.lang.Object)
+supr java.lang.Object
+hfds defaultValue,identifierToNotInFrameAssumptionMap,identifierToSlotMap,slots,version
+
+CLSS public abstract interface com.oracle.truffle.api.frame.FrameInstance
+innr public final static !enum FrameAccess
+meth public abstract boolean isVirtualFrame()
+meth public abstract com.oracle.truffle.api.CallTarget getCallTarget()
+meth public abstract com.oracle.truffle.api.frame.Frame getFrame(com.oracle.truffle.api.frame.FrameInstance$FrameAccess,boolean)
+meth public abstract com.oracle.truffle.api.nodes.Node getCallNode()
+
+CLSS public final static !enum com.oracle.truffle.api.frame.FrameInstance$FrameAccess
+ outer com.oracle.truffle.api.frame.FrameInstance
+fld public final static com.oracle.truffle.api.frame.FrameInstance$FrameAccess MATERIALIZE
+fld public final static com.oracle.truffle.api.frame.FrameInstance$FrameAccess NONE
+fld public final static com.oracle.truffle.api.frame.FrameInstance$FrameAccess READ_ONLY
+fld public final static com.oracle.truffle.api.frame.FrameInstance$FrameAccess READ_WRITE
+meth public static com.oracle.truffle.api.frame.FrameInstance$FrameAccess valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.frame.FrameInstance$FrameAccess[] values()
+supr java.lang.Enum<com.oracle.truffle.api.frame.FrameInstance$FrameAccess>
+
+CLSS public abstract interface com.oracle.truffle.api.frame.FrameInstanceVisitor<%0 extends java.lang.Object>
+meth public abstract {com.oracle.truffle.api.frame.FrameInstanceVisitor%0} visitFrame(com.oracle.truffle.api.frame.FrameInstance)
+
+CLSS public final com.oracle.truffle.api.frame.FrameSlot
+cons public init(com.oracle.truffle.api.frame.FrameDescriptor,java.lang.Object,java.lang.Object,int,com.oracle.truffle.api.frame.FrameSlotKind)
+intf java.lang.Cloneable
+meth public com.oracle.truffle.api.frame.FrameDescriptor getFrameDescriptor()
+meth public com.oracle.truffle.api.frame.FrameSlotKind getKind()
+meth public int getIndex()
+meth public java.lang.Object getIdentifier()
+meth public java.lang.Object getInfo()
+meth public java.lang.String toString()
+meth public void setKind(com.oracle.truffle.api.frame.FrameSlotKind)
+supr java.lang.Object
+hfds descriptor,identifier,index,info,kind
+
+CLSS public final !enum com.oracle.truffle.api.frame.FrameSlotKind
+fld public final byte tag
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Boolean
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Byte
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Double
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Float
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Illegal
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Int
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Long
+fld public final static com.oracle.truffle.api.frame.FrameSlotKind Object
+meth public static com.oracle.truffle.api.frame.FrameSlotKind valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.frame.FrameSlotKind[] values()
+supr java.lang.Enum<com.oracle.truffle.api.frame.FrameSlotKind>
+
+CLSS public final com.oracle.truffle.api.frame.FrameSlotTypeException
+cons public init()
+supr com.oracle.truffle.api.nodes.SlowPathException
+hfds serialVersionUID
+
+CLSS public final com.oracle.truffle.api.frame.FrameUtil
+cons public init()
+meth public static boolean getBooleanSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static byte getByteSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static double getDoubleSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static float getFloatSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static int getIntSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static java.lang.Object getObjectSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+meth public static long getLongSafe(com.oracle.truffle.api.frame.Frame,com.oracle.truffle.api.frame.FrameSlot)
+supr java.lang.Object
+
+CLSS public abstract interface com.oracle.truffle.api.frame.MaterializedFrame
+intf com.oracle.truffle.api.frame.Frame
+
+CLSS public abstract interface com.oracle.truffle.api.frame.VirtualFrame
+intf com.oracle.truffle.api.frame.Frame
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.ASTPrinter
+meth public abstract java.lang.String printNodeWithInstrumentation(com.oracle.truffle.api.nodes.Node)
+meth public abstract java.lang.String printTreeToString(com.oracle.truffle.api.nodes.Node,int)
+meth public abstract java.lang.String printTreeToString(com.oracle.truffle.api.nodes.Node,int,com.oracle.truffle.api.nodes.Node)
+meth public abstract void printTree(java.io.PrintWriter,com.oracle.truffle.api.nodes.Node,int,com.oracle.truffle.api.nodes.Node)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.ASTProber
+meth public abstract void probeAST(com.oracle.truffle.api.instrument.Instrumenter,com.oracle.truffle.api.nodes.RootNode)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.EvalInstrumentListener
+meth public abstract void onExecution(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Object)
+meth public abstract void onFailure(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Exception)
+
+CLSS public abstract com.oracle.truffle.api.instrument.EventHandlerNode
+cons protected init()
+intf com.oracle.truffle.api.instrument.InstrumentationNode
+meth public abstract com.oracle.truffle.api.instrument.Probe getProbe()
+meth public abstract void enter(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+meth public abstract void returnExceptional(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Throwable)
+meth public abstract void returnValue(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Object)
+meth public abstract void returnVoid(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+supr com.oracle.truffle.api.nodes.Node
+
+CLSS public abstract com.oracle.truffle.api.instrument.Instrument
+meth public boolean isDisposed()
+meth public final java.lang.String getInstrumentInfo()
+meth public void dispose()
+supr java.lang.Object
+hfds instrumentInfo,isDisposed
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.InstrumentationNode
+meth public abstract java.lang.String instrumentationInfo()
+
+CLSS public final com.oracle.truffle.api.instrument.Instrumenter
+innr public abstract static Tool
+meth public com.oracle.truffle.api.instrument.Instrumenter$Tool install(com.oracle.truffle.api.instrument.Instrumenter$Tool)
+meth public com.oracle.truffle.api.instrument.Probe probe(com.oracle.truffle.api.nodes.Node)
+meth public com.oracle.truffle.api.instrument.ProbeInstrument attach(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.instrument.SimpleInstrumentListener,java.lang.String)
+meth public com.oracle.truffle.api.instrument.ProbeInstrument attach(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.instrument.StandardInstrumentListener,java.lang.String)
+meth public com.oracle.truffle.api.instrument.ProbeInstrument attach(com.oracle.truffle.api.instrument.Probe,java.lang.Class<? extends com.oracle.truffle.api.TruffleLanguage>,com.oracle.truffle.api.source.Source,com.oracle.truffle.api.instrument.EvalInstrumentListener,java.lang.String)
+meth public com.oracle.truffle.api.instrument.TagInstrument attach(com.oracle.truffle.api.instrument.SyntaxTag,com.oracle.truffle.api.instrument.StandardAfterInstrumentListener,java.lang.String)
+meth public com.oracle.truffle.api.instrument.TagInstrument attach(com.oracle.truffle.api.instrument.SyntaxTag,com.oracle.truffle.api.instrument.StandardBeforeInstrumentListener,java.lang.String)
+meth public java.util.Collection<com.oracle.truffle.api.instrument.Probe> findProbesTaggedAs(com.oracle.truffle.api.instrument.SyntaxTag)
+meth public void addProbeListener(com.oracle.truffle.api.instrument.ProbeListener)
+meth public void registerASTProber(com.oracle.truffle.api.instrument.ASTProber)
+meth public void removeProbeListener(com.oracle.truffle.api.instrument.ProbeListener)
+meth public void unregisterASTProber(com.oracle.truffle.api.instrument.ASTProber)
+supr java.lang.Object
+hfds ACCESSOR,OUT,TRACE,TRACE_PREFIX,afterTagInstrument,astProbers,beforeTagInstrument,probeListeners,probes,testVM,tools,vm
+hcls AccessorInstrument,ToolState
+
+CLSS public abstract static com.oracle.truffle.api.instrument.Instrumenter$Tool
+ outer com.oracle.truffle.api.instrument.Instrumenter
+cons protected init()
+meth protected abstract boolean internalInstall()
+meth protected abstract void internalDispose()
+meth protected abstract void internalReset()
+meth protected final com.oracle.truffle.api.instrument.Instrumenter getInstrumenter()
+meth protected void internalSetEnabled(boolean)
+meth public final boolean isEnabled()
+meth public final void dispose()
+meth public final void reset()
+meth public final void setEnabled(boolean)
+supr java.lang.Object
+hfds instrumenter,toolState
+
+CLSS public final com.oracle.truffle.api.instrument.KillException
+cons public init()
+supr com.oracle.truffle.api.nodes.ControlFlowException
+hfds serialVersionUID
+
+CLSS public final com.oracle.truffle.api.instrument.Probe
+meth public boolean isTaggedAs(com.oracle.truffle.api.instrument.SyntaxTag)
+meth public com.oracle.truffle.api.source.SourceSection getProbedSourceSection()
+meth public java.lang.String getShortDescription()
+meth public java.util.Collection<com.oracle.truffle.api.instrument.SyntaxTag> getSyntaxTags()
+meth public void tagAs(com.oracle.truffle.api.instrument.SyntaxTag,java.lang.Object)
+supr java.lang.Object
+hfds OUT,TRACE,TRACE_PREFIX,instrumenter,isAfterTagInstrumentActive,isBeforeTagInstrumentActive,language,probeNodeClones,probeStateUnchangedAssumption,probeStateUnchangedCyclic,sourceSection,tags
+
+CLSS public com.oracle.truffle.api.instrument.ProbeException
+cons public init(com.oracle.truffle.api.instrument.ProbeFailure$Reason,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,java.lang.Object)
+meth public com.oracle.truffle.api.instrument.ProbeFailure getFailure()
+meth public java.lang.String toString()
+supr java.lang.RuntimeException
+hfds failure,serialVersionUID
+
+CLSS public final com.oracle.truffle.api.instrument.ProbeFailure
+cons public init(com.oracle.truffle.api.instrument.ProbeFailure$Reason,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,java.lang.Object)
+innr public final static !enum Reason
+meth public com.oracle.truffle.api.instrument.ProbeFailure$Reason getReason()
+meth public com.oracle.truffle.api.nodes.Node getChild()
+meth public com.oracle.truffle.api.nodes.Node getParent()
+meth public java.lang.Object getWrapper()
+meth public java.lang.String getMessage()
+supr java.lang.Object
+hfds child,parent,reason,wrapper
+
+CLSS public final static !enum com.oracle.truffle.api.instrument.ProbeFailure$Reason
+ outer com.oracle.truffle.api.instrument.ProbeFailure
+fld public final static com.oracle.truffle.api.instrument.ProbeFailure$Reason NOT_INSTRUMENTABLE
+fld public final static com.oracle.truffle.api.instrument.ProbeFailure$Reason NO_PARENT
+fld public final static com.oracle.truffle.api.instrument.ProbeFailure$Reason NO_WRAPPER
+fld public final static com.oracle.truffle.api.instrument.ProbeFailure$Reason WRAPPER_NODE
+fld public final static com.oracle.truffle.api.instrument.ProbeFailure$Reason WRAPPER_TYPE
+meth public java.lang.String getMessage()
+meth public static com.oracle.truffle.api.instrument.ProbeFailure$Reason valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.instrument.ProbeFailure$Reason[] values()
+supr java.lang.Enum<com.oracle.truffle.api.instrument.ProbeFailure$Reason>
+hfds message
+
+CLSS public abstract com.oracle.truffle.api.instrument.ProbeInstrument
+fld protected com.oracle.truffle.api.instrument.Probe probe
+innr public abstract interface static TruffleOptListener
+meth protected void innerDispose()
+meth public com.oracle.truffle.api.instrument.Probe getProbe()
+supr com.oracle.truffle.api.instrument.Instrument
+hfds NO_ARGS
+hcls AbstractInstrumentNode,EvalInstrument,SimpleInstrument,StandardInstrument,TruffleOptInstrument
+
+CLSS public abstract interface static com.oracle.truffle.api.instrument.ProbeInstrument$TruffleOptListener
+ outer com.oracle.truffle.api.instrument.ProbeInstrument
+meth public abstract void notifyIsCompiled(boolean)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.ProbeListener
+meth public abstract void endASTProbing(com.oracle.truffle.api.nodes.RootNode)
+meth public abstract void newProbeInserted(com.oracle.truffle.api.instrument.Probe)
+meth public abstract void probeTaggedAs(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.instrument.SyntaxTag,java.lang.Object)
+meth public abstract void startASTProbing(com.oracle.truffle.api.nodes.RootNode)
+
+CLSS public final com.oracle.truffle.api.instrument.QuitException
+cons public init()
+supr com.oracle.truffle.api.nodes.ControlFlowException
+hfds serialVersionUID
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.SimpleInstrumentListener
+meth public abstract void onEnter(com.oracle.truffle.api.instrument.Probe)
+meth public abstract void onReturnExceptional(com.oracle.truffle.api.instrument.Probe,java.lang.Throwable)
+meth public abstract void onReturnValue(com.oracle.truffle.api.instrument.Probe,java.lang.Object)
+meth public abstract void onReturnVoid(com.oracle.truffle.api.instrument.Probe)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.StandardAfterInstrumentListener
+meth public abstract void onReturnExceptional(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Throwable)
+meth public abstract void onReturnValue(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Object)
+meth public abstract void onReturnVoid(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.StandardBeforeInstrumentListener
+meth public abstract void onEnter(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.StandardInstrumentListener
+meth public abstract void onEnter(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+meth public abstract void onReturnExceptional(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Throwable)
+meth public abstract void onReturnValue(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame,java.lang.Object)
+meth public abstract void onReturnVoid(com.oracle.truffle.api.instrument.Probe,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.frame.VirtualFrame)
+
+CLSS public final !enum com.oracle.truffle.api.instrument.StandardSyntaxTag
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag ASSIGNMENT
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag CALL
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag PERIODIC
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag START_LOOP
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag START_METHOD
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag STATEMENT
+fld public final static com.oracle.truffle.api.instrument.StandardSyntaxTag THROW
+intf com.oracle.truffle.api.instrument.SyntaxTag
+meth public java.lang.String getDescription()
+meth public java.lang.String getName()
+meth public static com.oracle.truffle.api.instrument.StandardSyntaxTag valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.instrument.StandardSyntaxTag[] values()
+supr java.lang.Enum<com.oracle.truffle.api.instrument.StandardSyntaxTag>
+hfds description,name
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.SyntaxTag
+meth public abstract java.lang.String getDescription()
+meth public abstract java.lang.String name()
+
+CLSS public abstract com.oracle.truffle.api.instrument.TagInstrument
+cons protected init(com.oracle.truffle.api.instrument.Instrumenter,com.oracle.truffle.api.instrument.SyntaxTag,java.lang.String)
+meth protected final com.oracle.truffle.api.instrument.Instrumenter getInstrumenter()
+meth public final com.oracle.truffle.api.instrument.SyntaxTag getTag()
+supr com.oracle.truffle.api.instrument.Instrument
+hfds instrumenter,tag
+hcls AfterTagInstrument,BeforeTagInstrument
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.Visualizer
+meth public abstract com.oracle.truffle.api.instrument.ASTPrinter getASTPrinter()
+meth public abstract java.lang.String displayCallTargetName(com.oracle.truffle.api.CallTarget)
+meth public abstract java.lang.String displayIdentifier(com.oracle.truffle.api.frame.FrameSlot)
+meth public abstract java.lang.String displayMethodName(com.oracle.truffle.api.nodes.Node)
+meth public abstract java.lang.String displaySourceLocation(com.oracle.truffle.api.nodes.Node)
+meth public abstract java.lang.String displayValue(java.lang.Object,int)
+
+CLSS public abstract interface com.oracle.truffle.api.instrument.WrapperNode
+intf com.oracle.truffle.api.instrument.InstrumentationNode
+meth public abstract com.oracle.truffle.api.instrument.Probe getProbe()
+meth public abstract com.oracle.truffle.api.nodes.Node getChild()
+meth public abstract void insertEventHandlerNode(com.oracle.truffle.api.instrument.EventHandlerNode)
+
+CLSS public com.oracle.truffle.api.nodes.ControlFlowException
+cons public init()
+meth public final java.lang.Throwable fillInStackTrace()
+supr java.lang.RuntimeException
+hfds serialVersionUID
+
+CLSS public abstract com.oracle.truffle.api.nodes.DirectCallNode
+cons protected init(com.oracle.truffle.api.CallTarget)
+fld protected final com.oracle.truffle.api.CallTarget callTarget
+meth public abstract boolean cloneCallTarget()
+meth public abstract boolean isCallTargetCloningAllowed()
+meth public abstract boolean isInlinable()
+meth public abstract boolean isInliningForced()
+meth public abstract com.oracle.truffle.api.CallTarget getClonedCallTarget()
+meth public abstract java.lang.Object call(com.oracle.truffle.api.frame.VirtualFrame,java.lang.Object[])
+meth public abstract void forceInlining()
+meth public com.oracle.truffle.api.CallTarget getCallTarget()
+meth public com.oracle.truffle.api.CallTarget getCurrentCallTarget()
+meth public final boolean isCallTargetCloned()
+meth public final com.oracle.truffle.api.nodes.RootNode getCurrentRootNode()
+meth public java.lang.String toString()
+meth public static com.oracle.truffle.api.nodes.DirectCallNode create(com.oracle.truffle.api.CallTarget)
+supr com.oracle.truffle.api.nodes.Node
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.nodes.ExplodeLoop
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[METHOD])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault boolean merge()
+
+CLSS public com.oracle.truffle.api.nodes.GraphPrintVisitor
+cons public init()
+fld public final static int GraphVisualizerPort = 4444
+fld public final static java.lang.String GraphVisualizerAddress = "127.0.0.1"
+innr public GraphPrintAdapter
+innr public abstract interface static !annotation CustomGraphPrintHandler
+innr public abstract interface static !annotation NullGraphPrintHandler
+innr public abstract interface static GraphPrintHandler
+meth protected java.lang.Object getElementByObject(java.lang.Object)
+meth protected void connectNodes(java.lang.Object,java.lang.Object,java.lang.String)
+meth protected void createElementForNode(java.lang.Object)
+meth protected void setNodeProperty(java.lang.Object,java.lang.String,java.lang.Object)
+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 visit(java.lang.Object)
+meth public java.lang.String toString()
+meth public void printToFile(java.io.File)
+meth public void printToNetwork(boolean)
+meth public void printToSysout()
+supr java.lang.Object
+hfds dom,edgeList,edgesElement,graphDocument,graphElement,groupElement,id,nodeMap,nodesElement,prevNodeMap
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.nodes.GraphPrintVisitor$CustomGraphPrintHandler
+ outer com.oracle.truffle.api.nodes.GraphPrintVisitor
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.Class<? extends com.oracle.truffle.api.nodes.GraphPrintVisitor$GraphPrintHandler> handler()
+
+CLSS public com.oracle.truffle.api.nodes.GraphPrintVisitor$GraphPrintAdapter
+ outer com.oracle.truffle.api.nodes.GraphPrintVisitor
+cons public init(com.oracle.truffle.api.nodes.GraphPrintVisitor)
+meth public void connectNodes(java.lang.Object,java.lang.Object)
+meth public void createElementForNode(java.lang.Object)
+meth public void setNodeProperty(java.lang.Object,java.lang.String,java.lang.Object)
+meth public void visit(java.lang.Object)
+supr java.lang.Object
+
+CLSS public abstract interface static com.oracle.truffle.api.nodes.GraphPrintVisitor$GraphPrintHandler
+ outer com.oracle.truffle.api.nodes.GraphPrintVisitor
+meth public abstract void visit(java.lang.Object,com.oracle.truffle.api.nodes.GraphPrintVisitor$GraphPrintAdapter)
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.nodes.GraphPrintVisitor$NullGraphPrintHandler
+ outer com.oracle.truffle.api.nodes.GraphPrintVisitor
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract com.oracle.truffle.api.nodes.IndirectCallNode
+cons public init()
+meth public abstract java.lang.Object call(com.oracle.truffle.api.frame.VirtualFrame,com.oracle.truffle.api.CallTarget,java.lang.Object[])
+meth public static com.oracle.truffle.api.nodes.IndirectCallNode create()
+supr com.oracle.truffle.api.nodes.Node
+
+CLSS public final com.oracle.truffle.api.nodes.InvalidAssumptionException
+cons public init()
+supr com.oracle.truffle.api.nodes.SlowPathException
+hfds serialVersionUID
+
+CLSS public abstract com.oracle.truffle.api.nodes.LoopNode
+cons public init()
+meth public abstract com.oracle.truffle.api.nodes.RepeatingNode getRepeatingNode()
+meth public abstract void executeLoop(com.oracle.truffle.api.frame.VirtualFrame)
+supr com.oracle.truffle.api.nodes.Node
+
+CLSS public abstract com.oracle.truffle.api.nodes.Node
+cons protected init()
+cons protected init(com.oracle.truffle.api.source.SourceSection)
+innr public abstract interface static !annotation Child
+innr public abstract interface static !annotation Children
+intf com.oracle.truffle.api.nodes.NodeInterface
+intf java.lang.Cloneable
+meth protected final <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} insert({%%0})
+meth protected final <%0 extends com.oracle.truffle.api.nodes.Node> {%%0}[] insert({%%0}[])
+meth protected void onReplace(com.oracle.truffle.api.nodes.Node,java.lang.CharSequence)
+meth public com.oracle.truffle.api.nodes.Node copy()
+meth public com.oracle.truffle.api.nodes.Node deepCopy()
+meth public com.oracle.truffle.api.nodes.NodeCost getCost()
+meth public com.oracle.truffle.api.source.SourceSection getEncapsulatingSourceSection()
+meth public com.oracle.truffle.api.source.SourceSection getSourceSection()
+meth public final <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} replace({%%0})
+meth public final <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} replace({%%0},java.lang.CharSequence)
+meth public final <%0 extends java.lang.Object> {%%0} atomic(java.util.concurrent.Callable<{%%0}>)
+meth public final boolean isSafelyReplaceableBy(com.oracle.truffle.api.nodes.Node)
+meth public final com.oracle.truffle.api.nodes.Node getParent()
+meth public final com.oracle.truffle.api.nodes.RootNode getRootNode()
+meth public final java.lang.Iterable<com.oracle.truffle.api.nodes.Node> getChildren()
+meth public final void accept(com.oracle.truffle.api.nodes.NodeVisitor)
+meth public final void adoptChildren()
+meth public final void atomic(java.lang.Runnable)
+meth public java.lang.String getDescription()
+meth public java.lang.String getLanguage()
+meth public java.lang.String toString()
+meth public java.util.Map<java.lang.String,java.lang.Object> getDebugProperties()
+meth public void assignSourceSection(com.oracle.truffle.api.source.SourceSection)
+meth public void clearSourceSection()
+supr java.lang.Object
+hfds ACCESSOR,GIL,IN_ATOMIC_BLOCK,nodeClass,parent,sourceSection
+hcls AccessorNodes
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.nodes.Node$Child
+ outer com.oracle.truffle.api.nodes.Node
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface static !annotation com.oracle.truffle.api.nodes.Node$Children
+ outer com.oracle.truffle.api.nodes.Node
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[FIELD])
+intf java.lang.annotation.Annotation
+
+CLSS public final com.oracle.truffle.api.nodes.NodeClass
+cons public init(java.lang.Class<? extends com.oracle.truffle.api.nodes.Node>)
+meth public boolean equals(java.lang.Object)
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor getNodeClassField()
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor getParentField()
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor[] getChildFields()
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor[] getChildrenFields()
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor[] getCloneableFields()
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor[] getFields()
+meth public int hashCode()
+meth public java.util.Iterator<com.oracle.truffle.api.nodes.Node> makeIterator(com.oracle.truffle.api.nodes.Node)
+meth public static com.oracle.truffle.api.nodes.NodeClass get(com.oracle.truffle.api.nodes.Node)
+meth public static com.oracle.truffle.api.nodes.NodeClass get(java.lang.Class<? extends com.oracle.truffle.api.nodes.Node>)
+supr java.lang.Object
+hfds childFields,childrenFields,clazz,cloneableFields,fields,nodeClassField,nodeClasses,parentField
+hcls NodeIterator
+
+CLSS public abstract com.oracle.truffle.api.nodes.NodeCloneable
+cons public init()
+intf java.lang.Cloneable
+meth protected java.lang.Object clone()
+supr java.lang.Object
+
+CLSS public final !enum com.oracle.truffle.api.nodes.NodeCost
+fld public final static com.oracle.truffle.api.nodes.NodeCost MEGAMORPHIC
+fld public final static com.oracle.truffle.api.nodes.NodeCost MONOMORPHIC
+fld public final static com.oracle.truffle.api.nodes.NodeCost NONE
+fld public final static com.oracle.truffle.api.nodes.NodeCost POLYMORPHIC
+fld public final static com.oracle.truffle.api.nodes.NodeCost UNINITIALIZED
+meth public boolean isTrivial()
+meth public static com.oracle.truffle.api.nodes.NodeCost valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.nodes.NodeCost[] values()
+supr java.lang.Enum<com.oracle.truffle.api.nodes.NodeCost>
+
+CLSS public abstract com.oracle.truffle.api.nodes.NodeFieldAccessor
+cons protected init(com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind,java.lang.Class<?>,java.lang.String,java.lang.Class<?>)
+fld protected final java.lang.Class<?> type
+innr public abstract static AbstractUnsafeNodeFieldAccessor
+innr public final static !enum NodeFieldKind
+meth protected static com.oracle.truffle.api.nodes.NodeFieldAccessor create(com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind,java.lang.reflect.Field)
+meth public abstract java.lang.Object getObject(com.oracle.truffle.api.nodes.Node)
+meth public abstract java.lang.Object loadValue(com.oracle.truffle.api.nodes.Node)
+meth public abstract void putObject(com.oracle.truffle.api.nodes.Node,java.lang.Object)
+meth public com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind getKind()
+meth public java.lang.Class<?> getDeclaringClass()
+meth public java.lang.Class<?> getType()
+meth public java.lang.String getName()
+supr java.lang.Object
+hfds USE_UNSAFE,declaringClass,kind,name
+hcls ReflectionNodeField,UnsafeNodeField
+
+CLSS public abstract static com.oracle.truffle.api.nodes.NodeFieldAccessor$AbstractUnsafeNodeFieldAccessor
+ outer com.oracle.truffle.api.nodes.NodeFieldAccessor
+cons protected init(com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind,java.lang.Class<?>,java.lang.String,java.lang.Class<?>)
+meth public abstract long getOffset()
+meth public java.lang.Object getObject(com.oracle.truffle.api.nodes.Node)
+meth public java.lang.Object loadValue(com.oracle.truffle.api.nodes.Node)
+meth public void putObject(com.oracle.truffle.api.nodes.Node,java.lang.Object)
+supr com.oracle.truffle.api.nodes.NodeFieldAccessor
+hfds unsafe
+
+CLSS public final static !enum com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind
+ outer com.oracle.truffle.api.nodes.NodeFieldAccessor
+fld public final static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind CHILD
+fld public final static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind CHILDREN
+fld public final static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind DATA
+fld public final static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind NODE_CLASS
+fld public final static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind PARENT
+meth public static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind valueOf(java.lang.String)
+meth public static com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind[] values()
+supr java.lang.Enum<com.oracle.truffle.api.nodes.NodeFieldAccessor$NodeFieldKind>
+
+CLSS public abstract interface !annotation com.oracle.truffle.api.nodes.NodeInfo
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault com.oracle.truffle.api.nodes.NodeCost cost()
+meth public abstract !hasdefault java.lang.String description()
+meth public abstract !hasdefault java.lang.String language()
+meth public abstract !hasdefault java.lang.String shortName()
+
+CLSS public abstract interface com.oracle.truffle.api.nodes.NodeInterface
+
+CLSS public final com.oracle.truffle.api.nodes.NodeUtil
+cons public init()
+innr public abstract interface static NodeCountFilter
+meth public static <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} cloneNode({%%0})
+meth public static <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} nonAtomicReplace(com.oracle.truffle.api.nodes.Node,{%%0},java.lang.CharSequence)
+meth public static <%0 extends java.lang.Object> java.util.List<{%%0}> findAllNodeInstances(com.oracle.truffle.api.nodes.Node,java.lang.Class<{%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.List<{%%0}> findAllParents(com.oracle.truffle.api.nodes.Node,java.lang.Class<{%%0}>)
+meth public static <%0 extends java.lang.Object> {%%0} findFirstNodeInstance(com.oracle.truffle.api.nodes.Node,java.lang.Class<{%%0}>)
+meth public static <%0 extends java.lang.Object> {%%0} findParent(com.oracle.truffle.api.nodes.Node,java.lang.Class<{%%0}>)
+meth public static <%0 extends java.lang.Object> {%%0}[] concat({%%0}[],{%%0}[])
+meth public static <%0 extends java.lang.annotation.Annotation> {%%0} findAnnotation(java.lang.Class<?>,java.lang.Class<{%%0}>)
+meth public static boolean forEachChild(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.NodeVisitor)
+meth public static boolean isReplacementSafe(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node)
+meth public static boolean replaceChild(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node)
+meth public static boolean verify(com.oracle.truffle.api.nodes.Node)
+meth public static com.oracle.truffle.api.nodes.Node getNthParent(com.oracle.truffle.api.nodes.Node,int)
+meth public static com.oracle.truffle.api.nodes.NodeFieldAccessor findChildField(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node)
+meth public static int countNodes(com.oracle.truffle.api.nodes.Node)
+meth public static int countNodes(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.NodeUtil$NodeCountFilter)
+meth public static java.lang.String printCompactTreeToString(com.oracle.truffle.api.nodes.Node)
+meth public static java.lang.String printSourceAttributionTree(com.oracle.truffle.api.nodes.Node)
+meth public static java.lang.String printSyntaxTags(java.lang.Object)
+meth public static java.lang.String printTreeToString(com.oracle.truffle.api.nodes.Node)
+meth public static java.util.Iterator<com.oracle.truffle.api.nodes.Node> makeRecursiveIterator(com.oracle.truffle.api.nodes.Node)
+meth public static java.util.List<com.oracle.truffle.api.nodes.Node> collectNodes(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node)
+meth public static java.util.List<com.oracle.truffle.api.nodes.Node> findNodeChildren(com.oracle.truffle.api.nodes.Node)
+meth public static void printCompactTree(java.io.OutputStream,com.oracle.truffle.api.nodes.Node)
+meth public static void printSourceAttributionTree(java.io.OutputStream,com.oracle.truffle.api.nodes.Node)
+meth public static void printSourceAttributionTree(java.io.PrintWriter,com.oracle.truffle.api.nodes.Node)
+meth public static void printTree(java.io.OutputStream,com.oracle.truffle.api.nodes.Node)
+meth public static void printTree(java.io.PrintWriter,com.oracle.truffle.api.nodes.Node)
+supr java.lang.Object
+hcls NodeCounter,RecursiveNodeIterator
+
+CLSS public abstract interface static com.oracle.truffle.api.nodes.NodeUtil$NodeCountFilter
+ outer com.oracle.truffle.api.nodes.NodeUtil
+fld public final static com.oracle.truffle.api.nodes.NodeUtil$NodeCountFilter NO_FILTER
+meth public abstract boolean isCounted(com.oracle.truffle.api.nodes.Node)
+
+CLSS public abstract interface com.oracle.truffle.api.nodes.NodeVisitor
+meth public abstract boolean visit(com.oracle.truffle.api.nodes.Node)
+
+CLSS public abstract interface com.oracle.truffle.api.nodes.RepeatingNode
+intf com.oracle.truffle.api.nodes.NodeInterface
+meth public abstract boolean executeRepeating(com.oracle.truffle.api.frame.VirtualFrame)
+
+CLSS public abstract com.oracle.truffle.api.nodes.RootNode
+cons protected init(java.lang.Class<? extends com.oracle.truffle.api.TruffleLanguage>,com.oracle.truffle.api.source.SourceSection,com.oracle.truffle.api.frame.FrameDescriptor)
+meth protected boolean isInstrumentable()
+meth public abstract java.lang.Object execute(com.oracle.truffle.api.frame.VirtualFrame)
+meth public boolean isCloningAllowed()
+meth public com.oracle.truffle.api.CompilerOptions getCompilerOptions()
+meth public com.oracle.truffle.api.ExecutionContext getExecutionContext()
+meth public com.oracle.truffle.api.nodes.Node copy()
+meth public final com.oracle.truffle.api.RootCallTarget getCallTarget()
+meth public final com.oracle.truffle.api.frame.FrameDescriptor getFrameDescriptor()
+meth public final void applyInstrumentation()
+meth public final void reportLoopCount(int)
+meth public final void setCallTarget(com.oracle.truffle.api.RootCallTarget)
+meth public static com.oracle.truffle.api.nodes.RootNode createConstantNode(java.lang.Object)
+supr com.oracle.truffle.api.nodes.Node
+hfds callTarget,frameDescriptor,language
+hcls Constant
+
+CLSS public com.oracle.truffle.api.nodes.SlowPathException
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+meth public java.lang.Throwable fillInStackTrace()
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public final com.oracle.truffle.api.nodes.UnexpectedResultException
+cons public init(java.lang.Object)
+meth public java.lang.Object getResult()
+supr com.oracle.truffle.api.nodes.SlowPathException
+hfds result,serialVersionUID
+
+CLSS public final com.oracle.truffle.api.nodes.serial.PostOrderDeserializer
+cons public init(com.oracle.truffle.api.nodes.serial.SerializerConstantPool)
+meth public <%0 extends com.oracle.truffle.api.nodes.Node> {%%0} deserialize(byte[],java.lang.Class<{%%0}>)
+supr java.lang.Object
+hfds cp,stack,unsafe
+hcls FixedSizeNodeStack,HierarchicalStack
+
+CLSS public final com.oracle.truffle.api.nodes.serial.PostOrderSerializer
+cons public init(com.oracle.truffle.api.nodes.serial.SerializerConstantPool)
+meth public byte[] serialize(com.oracle.truffle.api.nodes.Node)
+supr java.lang.Object
+hfds cp,unsafe
+
+CLSS public abstract interface com.oracle.truffle.api.nodes.serial.SerializerConstantPool
+meth public abstract double getDouble(int)
+meth public abstract float getFloat(int)
+meth public abstract int getInt(int)
+meth public abstract int putClass(java.lang.Class<?>)
+meth public abstract int putDouble(double)
+meth public abstract int putFloat(float)
+meth public abstract int putInt(int)
+meth public abstract int putLong(long)
+meth public abstract int putObject(java.lang.Class<?>,java.lang.Object)
+meth public abstract java.lang.Class<?> getClass(int)
+meth public abstract java.lang.Object getObject(java.lang.Class<?>,int)
+meth public abstract long getLong(int)
+
+CLSS public com.oracle.truffle.api.nodes.serial.UnsupportedConstantPoolTypeException
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.RuntimeException
+hfds serialVersionUID
+
+CLSS public com.oracle.truffle.api.nodes.serial.VariableLengthIntBuffer
+cons public init(byte[])
+cons public init(java.nio.ByteBuffer)
+fld public final static int NULL = -1
+meth public boolean hasRemaining()
+meth public byte[] getBytes()
+meth public int get()
+meth public java.nio.ByteBuffer getBuffer()
+meth public void put(int)
+supr java.lang.Object
+hfds buffer
+
+CLSS public final com.oracle.truffle.api.source.LineLocation
+intf java.lang.Comparable<com.oracle.truffle.api.source.LineLocation>
+meth public boolean equals(java.lang.Object)
+meth public com.oracle.truffle.api.source.Source getSource()
+meth public int compareTo(com.oracle.truffle.api.source.LineLocation)
+meth public int getLineNumber()
+meth public int hashCode()
+meth public java.lang.String getShortDescription()
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds line,source
+
+CLSS public abstract com.oracle.truffle.api.source.Source
+meth public abstract java.io.Reader getReader()
+meth public abstract java.lang.String getCode()
+meth public abstract java.lang.String getName()
+meth public abstract java.lang.String getPath()
+meth public abstract java.lang.String getShortName()
+meth public abstract java.net.URL getURL()
+meth public final com.oracle.truffle.api.source.LineLocation createLineLocation(int)
+meth public final com.oracle.truffle.api.source.Source withMimeType(java.lang.String)
+meth public final com.oracle.truffle.api.source.SourceSection createSection(java.lang.String,int)
+meth public final com.oracle.truffle.api.source.SourceSection createSection(java.lang.String,int,int)
+meth public final com.oracle.truffle.api.source.SourceSection createSection(java.lang.String,int,int,int)
+meth public final com.oracle.truffle.api.source.SourceSection createSection(java.lang.String,int,int,int,int)
+meth public final int getColumnNumber(int)
+meth public final int getLength()
+meth public final int getLineCount()
+meth public final int getLineLength(int)
+meth public final int getLineNumber(int)
+meth public final int getLineStartOffset(int)
+meth public final java.io.InputStream getInputStream()
+meth public final java.lang.String getCode(int)
+meth public java.lang.String getCode(int,int)
+meth public java.lang.String getMimeType()
+meth public static com.oracle.truffle.api.source.Source find(java.lang.String)
+meth public static com.oracle.truffle.api.source.Source fromAppendableText(java.lang.String)
+meth public static com.oracle.truffle.api.source.Source fromBytes(byte[],int,int,java.lang.String,java.nio.charset.Charset)
+meth public static com.oracle.truffle.api.source.Source fromBytes(byte[],java.lang.String,java.nio.charset.Charset)
+meth public static com.oracle.truffle.api.source.Source fromFileName(java.lang.CharSequence,java.lang.String) throws java.io.IOException
+meth public static com.oracle.truffle.api.source.Source fromFileName(java.lang.String) throws java.io.IOException
+meth public static com.oracle.truffle.api.source.Source fromFileName(java.lang.String,boolean) throws java.io.IOException
+meth public static com.oracle.truffle.api.source.Source fromNamedAppendableText(java.lang.String)
+meth public static com.oracle.truffle.api.source.Source fromNamedText(java.lang.CharSequence,java.lang.String)
+meth public static com.oracle.truffle.api.source.Source fromReader(java.io.Reader,java.lang.String) throws java.io.IOException
+meth public static com.oracle.truffle.api.source.Source fromText(java.lang.CharSequence,java.lang.String)
+meth public static com.oracle.truffle.api.source.Source fromURL(java.net.URL,java.lang.String) throws java.io.IOException
+meth public static com.oracle.truffle.api.source.Source subSource(com.oracle.truffle.api.source.Source,int)
+meth public static com.oracle.truffle.api.source.Source subSource(com.oracle.truffle.api.source.Source,int,int)
+meth public static void setFileCaching(boolean)
+meth public void appendCode(java.lang.CharSequence)
+supr java.lang.Object
+hfds LOG,fileCacheEnabled,mimeType,nameToSource,textMap
+hcls AppendableLiteralSource,BytesSource,ClientManagedFileSource,FileSource,LiteralSource,SubSource,TextMap,URLSource
+
+CLSS public final com.oracle.truffle.api.source.SourceSection
+meth public boolean equals(java.lang.Object)
+meth public com.oracle.truffle.api.source.LineLocation getLineLocation()
+meth public com.oracle.truffle.api.source.Source getSource()
+meth public int getCharEndIndex()
+meth public int getCharIndex()
+meth public int getCharLength()
+meth public int getEndColumn()
+meth public int getEndLine()
+meth public int getStartColumn()
+meth public int getStartLine()
+meth public int hashCode()
+meth public java.lang.String getCode()
+meth public java.lang.String getIdentifier()
+meth public java.lang.String getShortDescription()
+meth public java.lang.String toString()
+meth public static com.oracle.truffle.api.source.SourceSection createUnavailable(java.lang.String,java.lang.String)
+supr java.lang.Object
+hfds charIndex,charLength,identifier,kind,source,startColumn,startLine
+
+CLSS public final com.oracle.truffle.api.utilities.AlwaysValidAssumption
+fld public final static com.oracle.truffle.api.utilities.AlwaysValidAssumption INSTANCE
+intf com.oracle.truffle.api.Assumption
+meth public boolean isValid()
+meth public java.lang.String getName()
+meth public void check() throws com.oracle.truffle.api.nodes.InvalidAssumptionException
+meth public void invalidate()
+supr java.lang.Object
+
+CLSS public com.oracle.truffle.api.utilities.AssumedValue<%0 extends java.lang.Object>
+cons public init(java.lang.String,{com.oracle.truffle.api.utilities.AssumedValue%0})
+cons public init({com.oracle.truffle.api.utilities.AssumedValue%0})
+meth public void set({com.oracle.truffle.api.utilities.AssumedValue%0})
+meth public {com.oracle.truffle.api.utilities.AssumedValue%0} get()
+supr java.lang.Object
+hfds assumption,name,value
+
+CLSS public final com.oracle.truffle.api.utilities.BinaryConditionProfile
+meth public boolean profile(boolean)
+meth public boolean wasFalse()
+meth public boolean wasTrue()
+meth public java.lang.String toString()
+supr com.oracle.truffle.api.utilities.ConditionProfile
+hfds wasFalse,wasTrue
+
+CLSS public final com.oracle.truffle.api.utilities.BranchProfile
+meth public boolean isVisited()
+meth public java.lang.String toString()
+meth public static com.oracle.truffle.api.utilities.BranchProfile create()
+meth public void enter()
+supr com.oracle.truffle.api.nodes.NodeCloneable
+hfds visited
+
+CLSS public abstract com.oracle.truffle.api.utilities.ConditionProfile
+meth public abstract boolean profile(boolean)
+meth public static com.oracle.truffle.api.utilities.ConditionProfile createBinaryProfile()
+meth public static com.oracle.truffle.api.utilities.ConditionProfile createCountingProfile()
+supr com.oracle.truffle.api.nodes.NodeCloneable
+
+CLSS public final com.oracle.truffle.api.utilities.CountingConditionProfile
+meth public boolean profile(boolean)
+meth public int getFalseCount()
+meth public int getTrueCount()
+meth public java.lang.String toString()
+supr com.oracle.truffle.api.utilities.ConditionProfile
+hfds falseCount,trueCount
+
+CLSS public com.oracle.truffle.api.utilities.CyclicAssumption
+cons public init(java.lang.String)
+meth public com.oracle.truffle.api.Assumption getAssumption()
+meth public void invalidate()
+supr java.lang.Object
+hfds assumption,name
+
+CLSS public com.oracle.truffle.api.utilities.JSONHelper
+cons public init()
+innr public abstract static JSONStringBuilder
+innr public final static JSONArrayBuilder
+innr public final static JSONObjectBuilder
+meth public static com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder array()
+meth public static com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder object()
+meth public static java.lang.String getResult()
+meth public static void dumpNewChild(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node)
+meth public static void dumpNewNode(com.oracle.truffle.api.nodes.Node)
+meth public static void dumpReplaceChild(com.oracle.truffle.api.nodes.Node,com.oracle.truffle.api.nodes.Node,java.lang.CharSequence)
+meth public static void restart()
+supr java.lang.Object
+hfds AstJsonDumpBuilder
+
+CLSS public final static com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder
+ outer com.oracle.truffle.api.utilities.JSONHelper
+meth protected void appendTo(java.lang.StringBuilder)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder add(com.oracle.truffle.api.utilities.JSONHelper$JSONStringBuilder)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder add(java.lang.Boolean)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder add(java.lang.Number)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONArrayBuilder add(java.lang.String)
+supr com.oracle.truffle.api.utilities.JSONHelper$JSONStringBuilder
+hfds contents
+
+CLSS public final static com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder
+ outer com.oracle.truffle.api.utilities.JSONHelper
+meth protected void appendTo(java.lang.StringBuilder)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder add(java.lang.String,com.oracle.truffle.api.utilities.JSONHelper$JSONStringBuilder)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder add(java.lang.String,java.lang.Boolean)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder add(java.lang.String,java.lang.Number)
+meth public com.oracle.truffle.api.utilities.JSONHelper$JSONObjectBuilder add(java.lang.String,java.lang.String)
+supr com.oracle.truffle.api.utilities.JSONHelper$JSONStringBuilder
+hfds contents
+
+CLSS public abstract static com.oracle.truffle.api.utilities.JSONHelper$JSONStringBuilder
+ outer com.oracle.truffle.api.utilities.JSONHelper
+cons public init()
+meth protected abstract void appendTo(java.lang.StringBuilder)
+meth protected static void appendValue(java.lang.StringBuilder,java.lang.Object)
+meth public final java.lang.String toString()
+supr java.lang.Object
+
+CLSS public final com.oracle.truffle.api.utilities.NeverValidAssumption
+fld public final static com.oracle.truffle.api.utilities.NeverValidAssumption INSTANCE
+intf com.oracle.truffle.api.Assumption
+meth public boolean isValid()
+meth public java.lang.String getName()
+meth public void check() throws com.oracle.truffle.api.nodes.InvalidAssumptionException
+meth public void invalidate()
+supr java.lang.Object
+
+CLSS public com.oracle.truffle.api.utilities.PrimitiveValueProfile
+meth public <%0 extends java.lang.Object> {%%0} profile({%%0})
+meth public boolean isGeneric()
+meth public boolean isUninitialized()
+meth public boolean profile(boolean)
+meth public byte profile(byte)
+meth public char profile(char)
+meth public double profile(double)
+meth public float profile(float)
+meth public int profile(int)
+meth public java.lang.Object getCachedValue()
+meth public java.lang.String toString()
+meth public long profile(long)
+meth public short profile(short)
+meth public static boolean exactCompare(double,double)
+meth public static boolean exactCompare(float,float)
+supr com.oracle.truffle.api.utilities.ValueProfile
+hfds GENERIC,UNINITIALIZED,cachedValue
+
+CLSS public com.oracle.truffle.api.utilities.UnionAssumption
+cons public init(com.oracle.truffle.api.Assumption,com.oracle.truffle.api.Assumption)
+cons public init(java.lang.String,com.oracle.truffle.api.Assumption,com.oracle.truffle.api.Assumption)
+intf com.oracle.truffle.api.Assumption
+meth public boolean isValid()
+meth public java.lang.String getName()
+meth public void check() throws com.oracle.truffle.api.nodes.InvalidAssumptionException
+meth public void invalidate()
+supr java.lang.Object
+hfds first,name,second
+
+CLSS public abstract com.oracle.truffle.api.utilities.ValueProfile
+cons public init()
+meth public abstract <%0 extends java.lang.Object> {%%0} profile({%%0})
+meth public static com.oracle.truffle.api.utilities.PrimitiveValueProfile createPrimitiveProfile()
+meth public static com.oracle.truffle.api.utilities.ValueProfile createClassProfile()
+meth public static com.oracle.truffle.api.utilities.ValueProfile createIdentityProfile()
+supr com.oracle.truffle.api.nodes.NodeCloneable
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public abstract interface java.lang.Cloneable
+
+CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
+meth public abstract int compareTo({java.lang.Comparable%0})
+
+CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
+cons protected init(java.lang.String,int)
+intf java.io.Serializable
+intf java.lang.Comparable<{java.lang.Enum%0}>
+meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected final void finalize()
+meth public final boolean equals(java.lang.Object)
+meth public final int compareTo({java.lang.Enum%0})
+meth public final int hashCode()
+meth public final int ordinal()
+meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
+meth public final java.lang.String name()
+meth public java.lang.String toString()
+meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
+supr java.lang.Object
+hfds name,ordinal
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public java.lang.RuntimeException
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Mon Dec 07 21:17:46 2015 -0800
@@ -180,7 +180,8 @@
 
     /**
      * Marks fields that should be considered final for a Truffle compilation although they are not
-     * final while executing in the interpreter.
+     * final while executing in the interpreter. If the field type is an array type, the compiler
+     * considers reads with a constant index as constants.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target({ElementType.FIELD})
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -31,10 +31,8 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.util.Collections;
 import java.util.Map;
 import java.util.Objects;
-import java.util.WeakHashMap;
 
 import com.oracle.truffle.api.debug.Debugger;
 import com.oracle.truffle.api.debug.SuspendedEvent;
@@ -73,8 +71,6 @@
  */
 @SuppressWarnings("javadoc")
 public abstract class TruffleLanguage<C> {
-    private final Map<Source, CallTarget> compiled = Collections.synchronizedMap(new WeakHashMap<Source, CallTarget>());
-
     /**
      * Constructor to be called by subclasses.
      */
@@ -162,8 +158,10 @@
 
     /**
      * Parses the provided source and generates appropriate AST. The parsing should execute no user
-     * code, it should only create the {@link Node} tree to represent the source. The parsing may be
-     * performed in a context (specified as another {@link Node}) or without context. The
+     * code, it should only create the {@link Node} tree to represent the source. If the provided
+     * source does not correspond naturally to a call target, the returned call target should create
+     * and if necessary initialize the corresponding language entity and return it. The parsing may
+     * be performed in a context (specified as another {@link Node}) or without context. The
      * {@code argumentNames} may contain symbolic names for actual parameters of the call to the
      * returned value. The result should be a call target with method
      * {@link CallTarget#call(java.lang.Object...)} that accepts as many arguments as were provided
@@ -199,6 +197,7 @@
      * asks all known languages for <code>onlyExplicit</code> symbols and only when none is found,
      * it does one more round with <code>onlyExplicit</code> set to <code>false</code>.
      *
+     * @param context context to locate the global symbol in
      * @param globalName the name of the global symbol to find
      * @param onlyExplicit should the language seek for implicitly exported object or only consider
      *            the explicitly exported ones?
@@ -214,6 +213,7 @@
      * language) but technically it can be one of Java primitive wrappers ({@link Integer},
      * {@link Double}, {@link Short}, etc.).
      *
+     * @param context context to find the language global in
      * @return the global object or <code>null</code> if the language does not support such concept
      */
     protected abstract Object getLanguageGlobal(C context);
@@ -460,14 +460,14 @@
         }
 
         @Override
-        protected Object eval(TruffleLanguage<?> language, Source source) throws IOException {
-            CallTarget target = language.compiled.get(source);
+        protected Object eval(TruffleLanguage<?> language, Source source, Map<Source, CallTarget> cache) throws IOException {
+            CallTarget target = cache.get(source);
             if (target == null) {
                 target = language.parse(source, null);
                 if (target == null) {
                     throw new IOException("Parsing has not produced a CallTarget for " + source);
                 }
-                language.compiled.put(source, target);
+                cache.put(source, target);
             }
             try {
                 return target.call();
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java	Mon Dec 07 21:17:46 2015 -0800
@@ -24,10 +24,11 @@
  */
 package com.oracle.truffle.api;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 import com.oracle.truffle.api.nodes.NodeCost;
 import com.oracle.truffle.api.nodes.NodeInfo;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 /**
  * Class containing general Truffle options.
@@ -57,7 +58,7 @@
      * <p>
      * Can be set with {@code -Dtruffle.TraceRewritesFilterClass=name}.
      */
-    public static String TraceRewritesFilterClass;
+    public static final String TraceRewritesFilterClass;
 
     /**
      * Filters rewrites which does not contain the {@link NodeCost} in its source {@link NodeInfo}.
@@ -66,7 +67,7 @@
      * Can be set with
      * {@code -Dtruffle.TraceRewritesFilterFromCost=NONE|MONOMORPHIC|POLYMORPHIC|MEGAMORPHIC}.
      */
-    public static NodeCost TraceRewritesFilterFromCost;
+    public static final NodeCost TraceRewritesFilterFromCost;
 
     /**
      * Filters rewrites which does not contain the {@link NodeCost} in its target {@link NodeInfo}.
@@ -75,7 +76,7 @@
      * Can be set with
      * {@code -Dtruffle.TraceRewritesFilterToKind=UNINITIALIZED|SPECIALIZED|POLYMORPHIC|GENERIC}.
      */
-    public static NodeCost TraceRewritesFilterToCost;
+    public static final NodeCost TraceRewritesFilterToCost;
 
     /**
      * Enables the dumping of Node creations and AST rewrites in JSON format.
@@ -99,12 +100,13 @@
 
     static {
         final boolean[] values = new boolean[4];
+        final Object[] objs = new Object[3];
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
                 values[0] = Boolean.getBoolean("truffle.TraceRewrites");
-                TraceRewritesFilterClass = System.getProperty("truffle.TraceRewritesFilterClass");
-                TraceRewritesFilterFromCost = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterFromCost"));
-                TraceRewritesFilterToCost = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterToCost"));
+                objs[0] = System.getProperty("truffle.TraceRewritesFilterClass");
+                objs[1] = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterFromCost"));
+                objs[2] = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterToCost"));
                 values[1] = Boolean.getBoolean("truffle.DetailedRewriteReasons");
                 values[2] = Boolean.getBoolean("truffle.TraceASTJSON");
                 values[3] = Boolean.getBoolean("com.oracle.truffle.aot");
@@ -115,5 +117,8 @@
         DetailedRewriteReasons = values[1];
         TraceASTJSON = values[2];
         AOT = values[3];
+        TraceRewritesFilterClass = (String) objs[0];
+        TraceRewritesFilterFromCost = (NodeCost) objs[1];
+        TraceRewritesFilterToCost = (NodeCost) objs[2];
     }
 }
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Mon Dec 07 21:17:46 2015 -0800
@@ -45,10 +45,18 @@
     private Assumption version;
     private HashMap<Object, Assumption> identifierToNotInFrameAssumptionMap;
 
+    /**
+     * Constructs empty descriptor. The {@link #getDefaultValue()} is <code>null</code>.
+     */
     public FrameDescriptor() {
         this(null);
     }
 
+    /**
+     * Constructs new descriptor with specified {@link #getDefaultValue()}.
+     * 
+     * @param defaultValue to be returned from {@link #getDefaultValue()}
+     */
     public FrameDescriptor(Object defaultValue) {
         CompilerAsserts.neverPartOfCompilation();
         this.defaultValue = defaultValue;
@@ -57,22 +65,65 @@
         version = createVersion();
     }
 
+    /**
+     * Use {@link #FrameDescriptor()}.
+     * 
+     * @return new instance of the descriptor
+     * @deprecated
+     */
+    @Deprecated
     public static FrameDescriptor create() {
         return new FrameDescriptor();
     }
 
+    /**
+     * Use {@link #FrameDescriptor(java.lang.Object) }.
+     * 
+     * @return new instance of the descriptor
+     * @deprecated
+     */
+    @Deprecated
     public static FrameDescriptor create(Object defaultValue) {
         return new FrameDescriptor(defaultValue);
     }
 
+    /**
+     * Adds frame slot. Delegates to
+     * {@link #addFrameSlot(java.lang.Object, java.lang.Object, com.oracle.truffle.api.frame.FrameSlotKind)
+     * addFrameSlot}(identifier, <code>null</code>, {@link FrameSlotKind#Illegal}). This is slow
+     * operation that switches to interpreter mode.
+     * 
+     * @param identifier key for the slot
+     * @return the newly created slot
+     */
     public FrameSlot addFrameSlot(Object identifier) {
         return addFrameSlot(identifier, null, FrameSlotKind.Illegal);
     }
 
+    /**
+     * Adds frame slot. Delegates to
+     * {@link #addFrameSlot(java.lang.Object, java.lang.Object, com.oracle.truffle.api.frame.FrameSlotKind)
+     * addFrameSlot}(identifier, <code>null</code>, <code>kind</code>). This is slow operation that
+     * switches to interpreter mode.
+     * 
+     * @param identifier key for the slot
+     * @param kind the kind of the new slot
+     * @return the newly created slot
+     */
     public FrameSlot addFrameSlot(Object identifier, FrameSlotKind kind) {
         return addFrameSlot(identifier, null, kind);
     }
 
+    /**
+     * Adds new frame slot to {@link #getSlots()} list. This is slow operation that switches to
+     * interpreter mode.
+     * 
+     * @param identifier key for the slot - it needs proper {@link #equals(java.lang.Object)} and
+     *            {@link Object#hashCode()} implementations
+     * @param info additional {@link FrameSlot#getInfo() information for the slot}
+     * @param kind the kind of the new slot
+     * @return the newly created slot
+     */
     public FrameSlot addFrameSlot(Object identifier, Object info, FrameSlotKind kind) {
         CompilerAsserts.neverPartOfCompilation("interpreter-only.  includes hashmap operations.");
         assert !identifierToSlotMap.containsKey(identifier);
@@ -84,11 +135,23 @@
         return slot;
     }
 
+    /**
+     * Finds an existing slot. This is slow operation.
+     * 
+     * @param identifier the key of the slot to search for
+     * @return the slot or <code>null</code>
+     */
     public FrameSlot findFrameSlot(Object identifier) {
         CompilerAsserts.neverPartOfCompilation("interpreter-only.  includes hashmap operations.");
         return identifierToSlotMap.get(identifier);
     }
 
+    /**
+     * Finds an existing slot or creates new one. This is slow operation.
+     * 
+     * @param identifier the key of the slot to search for
+     * @return the slot
+     */
     public FrameSlot findOrAddFrameSlot(Object identifier) {
         FrameSlot result = findFrameSlot(identifier);
         if (result != null) {
@@ -97,6 +160,13 @@
         return addFrameSlot(identifier);
     }
 
+    /**
+     * Finds an existing slot or creates new one. This is slow operation.
+     * 
+     * @param identifier the key of the slot to search for
+     * @param kind the kind for the newly created slot
+     * @return the found or newly created slot
+     */
     public FrameSlot findOrAddFrameSlot(Object identifier, FrameSlotKind kind) {
         FrameSlot result = findFrameSlot(identifier);
         if (result != null) {
@@ -105,6 +175,14 @@
         return addFrameSlot(identifier, kind);
     }
 
+    /**
+     * Finds an existing slot or creates new one. This is slow operation.
+     * 
+     * @param identifier the key of the slot to search for
+     * @param info info for the newly created slot
+     * @param kind the kind for the newly created slot
+     * @return the found or newly created slot
+     */
     public FrameSlot findOrAddFrameSlot(Object identifier, Object info, FrameSlotKind kind) {
         FrameSlot result = findFrameSlot(identifier);
         if (result != null) {
@@ -113,6 +191,12 @@
         return addFrameSlot(identifier, info, kind);
     }
 
+    /**
+     * Removes a slot. If the identifier is found, its slot is removed from this descriptor. This is
+     * slow operation.
+     * 
+     * @param identifier identifies the slot to remove
+     */
     public void removeFrameSlot(Object identifier) {
         CompilerAsserts.neverPartOfCompilation("interpreter-only.  includes hashmap operations.");
         assert identifierToSlotMap.containsKey(identifier);
@@ -122,10 +206,20 @@
         getNotInFrameAssumption(identifier);
     }
 
+    /**
+     * Returns number of slots in the descriptor.
+     * 
+     * @return the same value as {@link #getSlots()}.{@link List#size()} would return
+     */
     public int getSize() {
         return slots.size();
     }
 
+    /**
+     * Current set of slots in the descriptor.
+     * 
+     * @return unmodifiable list of {@link FrameSlot}
+     */
     public List<? extends FrameSlot> getSlots() {
         return Collections.unmodifiableList(slots);
     }
@@ -139,6 +233,12 @@
         return Collections.unmodifiableSet(identifierToSlotMap.keySet());
     }
 
+    /**
+     * Deeper copy of the descriptor. Copies all slots in the descriptor, but only their identifiers
+     * - not their {@link FrameSlot#getInfo()} neither their {@link FrameSlot#getKind()}!
+     * 
+     * @return new instance of a descriptor with copies of values from this one
+     */
     public FrameDescriptor copy() {
         FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue);
         for (int i = 0; i < this.getSlots().size(); i++) {
@@ -148,6 +248,13 @@
         return clonedFrameDescriptor;
     }
 
+    /**
+     * Shallow copy of the descriptor. Re-uses the existing slots in new descriptor. As a result, if
+     * you {@link FrameSlot#setKind(com.oracle.truffle.api.frame.FrameSlotKind) change kind} of one
+     * of the slots it is changed in the original as well as in the shallow copy.
+     * 
+     * @return new instance of a descriptor with copies of values from this one
+     */
     public FrameDescriptor shallowCopy() {
         FrameDescriptor clonedFrameDescriptor = new FrameDescriptor(this.defaultValue);
         clonedFrameDescriptor.slots.addAll(slots);
@@ -168,6 +275,11 @@
         return Truffle.getRuntime().createAssumption("frame version");
     }
 
+    /**
+     * Default value for the created slots.
+     * 
+     * @return value provided to {@link #FrameDescriptor(java.lang.Object)}
+     */
     public Object getDefaultValue() {
         return defaultValue;
     }
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Mon Dec 07 21:17:46 2015 -0800
@@ -48,6 +48,7 @@
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.RootNode;
 import com.oracle.truffle.api.source.Source;
+import java.util.Map;
 
 /**
  * Communication between PolyglotEngine, TruffleLanguage API/SPI, and other services.
@@ -152,8 +153,8 @@
         return API.attachEnv(vm, language, stdOut, stdErr, stdIn, instrumenter);
     }
 
-    protected Object eval(TruffleLanguage<?> l, Source s) throws IOException {
-        return API.eval(l, s);
+    protected Object eval(TruffleLanguage<?> l, Source s, Map<Source, CallTarget> cache) throws IOException {
+        return API.eval(l, s, cache);
     }
 
     protected Object evalInContext(Object vm, SuspendedEvent ev, String code, Node node, MaterializedFrame frame) throws IOException {
@@ -344,4 +345,10 @@
     protected String toString(TruffleLanguage<?> language, Env env, Object obj) {
         return API.toString(language, env, obj);
     }
+
+    static <T extends TruffleLanguage<?>> T findLanguageByClass(Object vm, Class<T> languageClass) {
+        Env env = API.findLanguage(vm, languageClass);
+        TruffleLanguage<?> language = API.findLanguage(env);
+        return languageClass.cast(language);
+    }
 }
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java	Mon Dec 07 21:17:46 2015 -0800
@@ -142,7 +142,7 @@
         private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
         private final XMLStreamWriter xmlstream;
 
-        protected XMLImpl(OutputStream outputStream) {
+        XMLImpl(OutputStream outputStream) {
             try {
                 this.xmlstream = XML_OUTPUT_FACTORY.createXMLStreamWriter(outputStream);
             } catch (XMLStreamException | FactoryConfigurationError e) {
@@ -435,25 +435,37 @@
         }
     }
 
-    protected NodeElement getElementByObject(Object obj) {
+    /**
+     * @deprecated to be removed
+     */
+    @Deprecated
+    protected Object getElementByObject(Object obj) {
+        return getElementByObjectImpl(obj);
+    }
+
+    final NodeElement getElementByObjectImpl(Object obj) {
         return nodeMap.get(obj);
     }
 
+    /**
+     * @deprecated to be removed
+     */
+    @Deprecated
     protected void createElementForNode(Object node) {
         boolean exists = nodeMap.containsKey(node);
         if (!exists) {
             int nodeId = !exists ? oldOrNextId(node) : nextId();
             nodeMap.put(node, new NodeElement(nodeId));
 
-            setNodeProperty(node, "name", node.getClass().getSimpleName().replaceFirst("Node$", ""));
+            setNodePropertyImpl(node, "name", node.getClass().getSimpleName().replaceFirst("Node$", ""));
             NodeInfo nodeInfo = node.getClass().getAnnotation(NodeInfo.class);
             if (nodeInfo != null) {
-                setNodeProperty(node, "cost", nodeInfo.cost());
+                setNodePropertyImpl(node, "cost", nodeInfo.cost());
                 if (!nodeInfo.shortName().isEmpty()) {
-                    setNodeProperty(node, "shortName", nodeInfo.shortName());
+                    setNodePropertyImpl(node, "shortName", nodeInfo.shortName());
                 }
             }
-            setNodeProperty(node, "class", node.getClass().getSimpleName());
+            setNodePropertyImpl(node, "class", node.getClass().getSimpleName());
             if (node instanceof Node) {
                 readNodeProperties((Node) node);
                 copyDebugProperties((Node) node);
@@ -461,15 +473,23 @@
         }
     }
 
+    /**
+     * @deprecated to be removed
+     */
+    @Deprecated
     protected void setNodeProperty(Object node, String propertyName, Object value) {
-        NodeElement nodeElem = getElementByObject(node);
+        setNodePropertyImpl(node, propertyName, value);
+    }
+
+    final void setNodePropertyImpl(Object node, String propertyName, Object value) {
+        NodeElement nodeElem = getElementByObjectImpl(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()) {
-            setNodeProperty(node, property.getKey(), property.getValue());
+            setNodePropertyImpl(node, property.getKey(), property.getValue());
         }
     }
 
@@ -478,17 +498,25 @@
         for (NodeFieldAccessor field : fields) {
             if (field.getKind() == NodeFieldKind.DATA) {
                 String key = field.getName();
-                if (!getElementByObject(node).getProperties().containsKey(key)) {
+                if (!getElementByObjectImpl(node).getProperties().containsKey(key)) {
                     Object value = field.loadValue(node);
-                    setNodeProperty(node, key, value);
+                    setNodePropertyImpl(node, key, value);
                 }
             }
         }
     }
 
+    /**
+     * @deprecated to be removed
+     */
+    @Deprecated
     protected void connectNodes(Object a, Object b, String label) {
-        NodeElement fromNode = getElementByObject(a);
-        NodeElement toNode = getElementByObject(b);
+        connectNodesImpl(a, b, label);
+    }
+
+    final void connectNodesImpl(Object a, Object b, String label) {
+        NodeElement fromNode = getElementByObjectImpl(a);
+        NodeElement toNode = getElementByObjectImpl(b);
         if (fromNode == null || toNode == null) {
             return;
         }
@@ -510,7 +538,7 @@
         }
 
         // if node is visited once again, skip
-        if (getElementByObject(node) != null) {
+        if (getElementByObjectImpl(node) != null) {
             return this;
         }
 
@@ -593,19 +621,19 @@
         }
 
         public void connectNodes(Object node, Object child) {
-            GraphPrintVisitor.this.connectNodes(node, child, null);
+            GraphPrintVisitor.this.connectNodesImpl(node, child, null);
         }
 
         public void connectNodes(Object node, Object child, String label) {
-            GraphPrintVisitor.this.connectNodes(node, child, label);
+            GraphPrintVisitor.this.connectNodesImpl(node, child, label);
         }
 
         public void setNodeProperty(Object node, String propertyName, Object value) {
-            GraphPrintVisitor.this.setNodeProperty(node, propertyName, value);
+            GraphPrintVisitor.this.setNodePropertyImpl(node, propertyName, value);
         }
 
         public boolean visited(Object node) {
-            return GraphPrintVisitor.this.getElementByObject(node) != null;
+            return GraphPrintVisitor.this.getElementByObjectImpl(node) != null;
         }
     }
 
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Mon Dec 07 21:17:46 2015 -0800
@@ -430,6 +430,9 @@
 
     public final void atomic(Runnable closure) {
         RootNode rootNode = getRootNode();
+        // Major Assumption: parent is never null after a node got adopted
+        // it is never reset to null, and thus, rootNode is always reachable.
+        // GIL: used for nodes that are replace in ASTs that are not yet adopted
         synchronized (rootNode != null ? rootNode : GIL) {
             assert enterAtomic();
             try {
@@ -443,6 +446,9 @@
     public final <T> T atomic(Callable<T> closure) {
         try {
             RootNode rootNode = getRootNode();
+            // Major Assumption: parent is never null after a node got adopted
+            // it is never reset to null, and thus, rootNode is always reachable.
+            // GIL: used for nodes that are replace in ASTs that are not yet adopted
             synchronized (rootNode != null ? rootNode : GIL) {
                 assert enterAtomic();
                 try {
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeClass.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeClass.java	Mon Dec 07 21:17:46 2015 -0800
@@ -24,22 +24,15 @@
  */
 package com.oracle.truffle.api.nodes;
 
-import com.oracle.truffle.api.nodes.Node.Child;
-import com.oracle.truffle.api.nodes.Node.Children;
-import com.oracle.truffle.api.nodes.NodeFieldAccessor.NodeFieldKind;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
 
 /**
  * Information about a {@link Node} class. A single instance of this class is allocated for every
  * subclass of {@link Node} that is used.
  */
-public final class NodeClass {
+public abstract class NodeClass {
     private static final ClassValue<NodeClass> nodeClasses = new ClassValue<NodeClass>() {
         @SuppressWarnings("unchecked")
         @Override
@@ -47,25 +40,12 @@
             assert Node.class.isAssignableFrom(clazz);
             return AccessController.doPrivileged(new PrivilegedAction<NodeClass>() {
                 public NodeClass run() {
-                    return new NodeClass((Class<? extends Node>) clazz);
+                    return new NodeClassImpl((Class<? extends Node>) clazz);
                 }
             });
         }
     };
 
-    private static final NodeFieldAccessor[] EMPTY_NODE_FIELD_ARRAY = new NodeFieldAccessor[0];
-
-    // The comprehensive list of all fields.
-    private final NodeFieldAccessor[] fields;
-    // Separate arrays for the frequently accessed fields.
-    private final NodeFieldAccessor parentField;
-    private final NodeFieldAccessor nodeClassField;
-    private final NodeFieldAccessor[] childFields;
-    private final NodeFieldAccessor[] childrenFields;
-    private final NodeFieldAccessor[] cloneableFields;
-
-    private final Class<? extends Node> clazz;
-
     public static NodeClass get(Class<? extends Node> clazz) {
         return nodeClasses.get(clazz);
     }
@@ -74,185 +54,29 @@
         return node.getNodeClass();
     }
 
-    NodeClass(Class<? extends Node> clazz) {
-        List<NodeFieldAccessor> fieldsList = new ArrayList<>();
-        NodeFieldAccessor parentFieldTmp = null;
-        NodeFieldAccessor nodeClassFieldTmp = null;
-        List<NodeFieldAccessor> childFieldList = new ArrayList<>();
-        List<NodeFieldAccessor> childrenFieldList = new ArrayList<>();
-        List<NodeFieldAccessor> cloneableFieldList = new ArrayList<>();
-
-        for (Field field : NodeUtil.getAllFields(clazz)) {
-            if (Modifier.isStatic(field.getModifiers()) || field.isSynthetic()) {
-                continue;
-            }
-
-            NodeFieldAccessor nodeField;
-            if (field.getDeclaringClass() == Node.class && field.getName().equals("parent")) {
-                assert Node.class.isAssignableFrom(field.getType());
-                nodeField = NodeFieldAccessor.create(NodeFieldKind.PARENT, field);
-                parentFieldTmp = nodeField;
-            } else if (field.getDeclaringClass() == Node.class && field.getName().equals("nodeClass")) {
-                assert NodeClass.class.isAssignableFrom(field.getType());
-                nodeField = NodeFieldAccessor.create(NodeFieldKind.NODE_CLASS, field);
-                nodeClassFieldTmp = nodeField;
-            } else if (field.getAnnotation(Child.class) != null) {
-                checkChildField(field);
-                nodeField = NodeFieldAccessor.create(NodeFieldKind.CHILD, field);
-                childFieldList.add(nodeField);
-            } else if (field.getAnnotation(Children.class) != null) {
-                checkChildrenField(field);
-                nodeField = NodeFieldAccessor.create(NodeFieldKind.CHILDREN, field);
-                childrenFieldList.add(nodeField);
-            } else {
-                nodeField = NodeFieldAccessor.create(NodeFieldKind.DATA, field);
-                if (NodeCloneable.class.isAssignableFrom(field.getType())) {
-                    cloneableFieldList.add(nodeField);
-                }
-            }
-            fieldsList.add(nodeField);
-        }
-
-        if (parentFieldTmp == null) {
-            throw new AssertionError("parent field not found");
-        }
-
-        this.fields = fieldsList.toArray(EMPTY_NODE_FIELD_ARRAY);
-        this.nodeClassField = nodeClassFieldTmp;
-        this.parentField = parentFieldTmp;
-        this.childFields = childFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
-        this.childrenFields = childrenFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
-        this.cloneableFields = cloneableFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
-        this.clazz = clazz;
-    }
-
-    public NodeFieldAccessor getNodeClassField() {
-        return nodeClassField;
-    }
-
-    public NodeFieldAccessor[] getCloneableFields() {
-        return cloneableFields;
-    }
-
-    private static boolean isNodeType(Class<?> clazz) {
-        return Node.class.isAssignableFrom(clazz) || (clazz.isInterface() && NodeInterface.class.isAssignableFrom(clazz));
-    }
-
-    private static void checkChildField(Field field) {
-        if (!isNodeType(field.getType())) {
-            throw new AssertionError("@Child field type must be a subclass of Node or an interface extending NodeInterface (" + field + ")");
-        }
-        if (Modifier.isFinal(field.getModifiers())) {
-            throw new AssertionError("@Child field must not be final (" + field + ")");
-        }
-    }
-
-    private static void checkChildrenField(Field field) {
-        if (!(field.getType().isArray() && isNodeType(field.getType().getComponentType()))) {
-            throw new AssertionError("@Children field type must be an array of a subclass of Node or an interface extending NodeInterface (" + field + ")");
-        }
-        if (!Modifier.isFinal(field.getModifiers())) {
-            throw new AssertionError("@Children field must be final (" + field + ")");
-        }
-    }
-
-    public NodeFieldAccessor[] getFields() {
-        return fields;
-    }
-
-    public NodeFieldAccessor getParentField() {
-        return parentField;
+    @SuppressWarnings("unused")
+    public NodeClass(Class<? extends Node> clazz) {
     }
 
-    public NodeFieldAccessor[] getChildFields() {
-        return childFields;
-    }
+    public abstract NodeFieldAccessor getNodeClassField();
 
-    public NodeFieldAccessor[] getChildrenFields() {
-        return childrenFields;
-    }
-
-    @Override
-    public int hashCode() {
-        return clazz.hashCode();
-    }
+    public abstract NodeFieldAccessor[] getCloneableFields();
 
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof NodeClass) {
-            NodeClass other = (NodeClass) obj;
-            return clazz.equals(other.clazz);
-        }
-        return false;
-    }
-
-    public Iterator<Node> makeIterator(Node node) {
-        assert clazz.isInstance(node);
-        return new NodeIterator(this, node);
-    }
+    public abstract NodeFieldAccessor[] getFields();
 
-    private static final class NodeIterator implements Iterator<Node> {
-        private final NodeFieldAccessor[] childFields;
-        private final NodeFieldAccessor[] childrenFields;
-        private final Node node;
-        private final int childrenCount;
-        private int index;
+    public abstract NodeFieldAccessor getParentField();
 
-        protected NodeIterator(NodeClass nodeClass, Node node) {
-            this.childFields = nodeClass.getChildFields();
-            this.childrenFields = nodeClass.getChildrenFields();
-            this.node = node;
-            this.childrenCount = childrenCount();
-            this.index = 0;
-        }
+    public abstract NodeFieldAccessor[] getChildFields();
 
-        private int childrenCount() {
-            int nodeCount = childFields.length;
-            for (NodeFieldAccessor childrenField : childrenFields) {
-                Object[] children = ((Object[]) childrenField.getObject(node));
-                if (children != null) {
-                    nodeCount += children.length;
-                }
-            }
-            return nodeCount;
-        }
+    public abstract NodeFieldAccessor[] getChildrenFields();
+
+    public abstract Iterator<Node> makeIterator(Node node);
 
-        private Node nodeAt(int idx) {
-            int nodeCount = childFields.length;
-            if (idx < nodeCount) {
-                return (Node) childFields[idx].getObject(node);
-            } else {
-                for (NodeFieldAccessor childrenField : childrenFields) {
-                    Object[] nodeArray = (Object[]) childrenField.getObject(node);
-                    if (idx < nodeCount + nodeArray.length) {
-                        return (Node) nodeArray[idx - nodeCount];
-                    }
-                    nodeCount += nodeArray.length;
-                }
-            }
-            return null;
-        }
-
-        private void forward() {
-            if (index < childrenCount) {
-                index++;
-            }
-        }
-
-        public boolean hasNext() {
-            return index < childrenCount;
-        }
-
-        public Node next() {
-            try {
-                return nodeAt(index);
-            } finally {
-                forward();
-            }
-        }
-
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-    }
+    /**
+     * The {@link Class} this <code>NodeClass</code> has been {@link #NodeClass(java.lang.Class)
+     * created for}.
+     * 
+     * @return the clazz of node this <code>NodeClass</code> describes
+     */
+    public abstract Class<? extends Node> getType();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeClassImpl.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,263 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.nodes;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.oracle.truffle.api.nodes.Node.Child;
+import com.oracle.truffle.api.nodes.Node.Children;
+import com.oracle.truffle.api.nodes.NodeFieldAccessor.NodeFieldKind;
+
+/**
+ * Information about a {@link Node} class. A single instance of this class is allocated for every
+ * subclass of {@link Node} that is used.
+ */
+final class NodeClassImpl extends NodeClass {
+    private static final NodeFieldAccessor[] EMPTY_NODE_FIELD_ARRAY = new NodeFieldAccessor[0];
+
+    // The comprehensive list of all fields.
+    private final NodeFieldAccessor[] fields;
+    // Separate arrays for the frequently accessed fields.
+    private final NodeFieldAccessor parentField;
+    private final NodeFieldAccessor nodeClassField;
+    private final NodeFieldAccessor[] childFields;
+    private final NodeFieldAccessor[] childrenFields;
+    private final NodeFieldAccessor[] cloneableFields;
+
+    private final Class<? extends Node> clazz;
+
+    NodeClassImpl(Class<? extends Node> clazz) {
+        super(clazz);
+        if (!Node.class.isAssignableFrom(clazz)) {
+            throw new IllegalArgumentException();
+        }
+
+        List<NodeFieldAccessor> fieldsList = new ArrayList<>();
+        NodeFieldAccessor parentFieldTmp = null;
+        NodeFieldAccessor nodeClassFieldTmp = null;
+        List<NodeFieldAccessor> childFieldList = new ArrayList<>();
+        List<NodeFieldAccessor> childrenFieldList = new ArrayList<>();
+        List<NodeFieldAccessor> cloneableFieldList = new ArrayList<>();
+
+        try {
+            Field field = Node.class.getDeclaredField("parent");
+            assert Node.class.isAssignableFrom(field.getType());
+            parentFieldTmp = NodeFieldAccessor.create(NodeFieldKind.PARENT, field);
+            field = Node.class.getDeclaredField("nodeClass");
+            assert NodeClass.class.isAssignableFrom(field.getType());
+            nodeClassFieldTmp = NodeFieldAccessor.create(NodeFieldKind.NODE_CLASS, field);
+        } catch (NoSuchFieldException e) {
+            throw new AssertionError("Node field not found", e);
+        }
+
+        collectInstanceFields(clazz, fieldsList, childFieldList, childrenFieldList, cloneableFieldList);
+
+        this.fields = fieldsList.toArray(EMPTY_NODE_FIELD_ARRAY);
+        this.nodeClassField = nodeClassFieldTmp;
+        this.parentField = parentFieldTmp;
+        this.childFields = childFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
+        this.childrenFields = childrenFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
+        this.cloneableFields = cloneableFieldList.toArray(EMPTY_NODE_FIELD_ARRAY);
+        this.clazz = clazz;
+    }
+
+    private static void collectInstanceFields(Class<? extends Object> clazz, List<NodeFieldAccessor> fieldsList, List<NodeFieldAccessor> childFieldList, List<NodeFieldAccessor> childrenFieldList,
+                    List<NodeFieldAccessor> cloneableFieldList) {
+        if (clazz.getSuperclass() != null) {
+            collectInstanceFields(clazz.getSuperclass(), fieldsList, childFieldList, childrenFieldList, cloneableFieldList);
+        }
+        Field[] declaredFields = clazz.getDeclaredFields();
+        for (Field field : declaredFields) {
+            if (Modifier.isStatic(field.getModifiers()) || field.isSynthetic()) {
+                continue;
+            }
+
+            NodeFieldAccessor nodeField;
+            if (field.getDeclaringClass() == Node.class && (field.getName().equals("parent") || field.getName().equals("nodeClass"))) {
+                continue;
+            } else if (field.getAnnotation(Child.class) != null) {
+                checkChildField(field);
+                nodeField = NodeFieldAccessor.create(NodeFieldKind.CHILD, field);
+                childFieldList.add(nodeField);
+            } else if (field.getAnnotation(Children.class) != null) {
+                checkChildrenField(field);
+                nodeField = NodeFieldAccessor.create(NodeFieldKind.CHILDREN, field);
+                childrenFieldList.add(nodeField);
+            } else {
+                nodeField = NodeFieldAccessor.create(NodeFieldKind.DATA, field);
+                if (NodeCloneable.class.isAssignableFrom(field.getType())) {
+                    cloneableFieldList.add(nodeField);
+                }
+            }
+            fieldsList.add(nodeField);
+        }
+    }
+
+    @Override
+    public NodeFieldAccessor getNodeClassField() {
+        return nodeClassField;
+    }
+
+    @Override
+    public NodeFieldAccessor[] getCloneableFields() {
+        return cloneableFields;
+    }
+
+    private static boolean isNodeType(Class<?> clazz) {
+        return Node.class.isAssignableFrom(clazz) || (clazz.isInterface() && NodeInterface.class.isAssignableFrom(clazz));
+    }
+
+    private static void checkChildField(Field field) {
+        if (!isNodeType(field.getType())) {
+            throw new AssertionError("@Child field type must be a subclass of Node or an interface extending NodeInterface (" + field + ")");
+        }
+        if (Modifier.isFinal(field.getModifiers())) {
+            throw new AssertionError("@Child field must not be final (" + field + ")");
+        }
+    }
+
+    private static void checkChildrenField(Field field) {
+        if (!(field.getType().isArray() && isNodeType(field.getType().getComponentType()))) {
+            throw new AssertionError("@Children field type must be an array of a subclass of Node or an interface extending NodeInterface (" + field + ")");
+        }
+        if (!Modifier.isFinal(field.getModifiers())) {
+            throw new AssertionError("@Children field must be final (" + field + ")");
+        }
+    }
+
+    @Override
+    public NodeFieldAccessor[] getFields() {
+        return fields;
+    }
+
+    @Override
+    public NodeFieldAccessor getParentField() {
+        return parentField;
+    }
+
+    @Override
+    public NodeFieldAccessor[] getChildFields() {
+        return childFields;
+    }
+
+    @Override
+    public NodeFieldAccessor[] getChildrenFields() {
+        return childrenFields;
+    }
+
+    @Override
+    public int hashCode() {
+        return clazz.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof NodeClassImpl) {
+            NodeClassImpl other = (NodeClassImpl) obj;
+            return clazz.equals(other.clazz);
+        }
+        return false;
+    }
+
+    @Override
+    public Iterator<Node> makeIterator(Node node) {
+        assert clazz.isInstance(node);
+        return new NodeIterator(this, node);
+    }
+
+    @Override
+    public Class<? extends Node> getType() {
+        return clazz;
+    }
+
+    private static final class NodeIterator implements Iterator<Node> {
+        private final NodeFieldAccessor[] childFields;
+        private final NodeFieldAccessor[] childrenFields;
+        private final Node node;
+        private final int childrenCount;
+        private int index;
+
+        protected NodeIterator(NodeClassImpl nodeClass, Node node) {
+            this.childFields = nodeClass.getChildFields();
+            this.childrenFields = nodeClass.getChildrenFields();
+            this.node = node;
+            this.childrenCount = childrenCount();
+            this.index = 0;
+        }
+
+        private int childrenCount() {
+            int nodeCount = childFields.length;
+            for (NodeFieldAccessor childrenField : childrenFields) {
+                Object[] children = ((Object[]) childrenField.getObject(node));
+                if (children != null) {
+                    nodeCount += children.length;
+                }
+            }
+            return nodeCount;
+        }
+
+        private Node nodeAt(int idx) {
+            int nodeCount = childFields.length;
+            if (idx < nodeCount) {
+                return (Node) childFields[idx].getObject(node);
+            } else {
+                for (NodeFieldAccessor childrenField : childrenFields) {
+                    Object[] nodeArray = (Object[]) childrenField.getObject(node);
+                    if (idx < nodeCount + nodeArray.length) {
+                        return (Node) nodeArray[idx - nodeCount];
+                    }
+                    nodeCount += nodeArray.length;
+                }
+            }
+            return null;
+        }
+
+        private void forward() {
+            if (index < childrenCount) {
+                index++;
+            }
+        }
+
+        public boolean hasNext() {
+            return index < childrenCount;
+        }
+
+        public Node next() {
+            try {
+                return nodeAt(index);
+            } finally {
+                forward();
+            }
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+}
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java	Mon Dec 07 21:17:46 2015 -0800
@@ -30,7 +30,6 @@
 import java.io.StringWriter;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -383,15 +382,6 @@
         return true;
     }
 
-    /** Returns all declared fields in the class hierarchy. */
-    static Field[] getAllFields(Class<? extends Object> clazz) {
-        Field[] declaredFields = clazz.getDeclaredFields();
-        if (clazz.getSuperclass() != null) {
-            return concat(getAllFields(clazz.getSuperclass()), declaredFields);
-        }
-        return declaredFields;
-    }
-
     public static <T> T[] concat(T[] first, T[] second) {
         T[] result = Arrays.copyOf(first, first.length + second.length);
         System.arraycopy(second, 0, result, first.length, second.length);
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java	Mon Dec 07 21:17:46 2015 -0800
@@ -43,7 +43,7 @@
      * @param result the alternative result
      */
     public UnexpectedResultException(Object result) {
-        CompilerDirectives.transferToInterpreter();
+        CompilerDirectives.transferToInterpreterAndInvalidate();
         this.result = result;
     }
 
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Mon Dec 07 21:17:46 2015 -0800
@@ -229,7 +229,6 @@
      */
     public static Source fromText(CharSequence chars, String description) {
         CompilerAsserts.neverPartOfCompilation();
-        assert chars != null;
         return new LiteralSource(description, chars.toString());
     }
 
@@ -833,7 +832,6 @@
         private final String path;  // Normalized path description of an actual file
 
         private String code = null;  // A cache of the file's contents
-        private long timeStamp;      // timestamp of the cache in the file system
 
         public FileSource(File file, String name, String path) {
             this.file = file.getAbsoluteFile();
@@ -859,10 +857,9 @@
         @Override
         public String getCode() {
             if (fileCacheEnabled) {
-                if (code == null || timeStamp != file.lastModified()) {
+                if (code == null) {
                     try {
                         code = read(getReader());
-                        timeStamp = file.lastModified();
                     } catch (IOException e) {
                     }
                 }
@@ -887,7 +884,7 @@
 
         @Override
         public Reader getReader() {
-            if (code != null && timeStamp == file.lastModified()) {
+            if (code != null) {
                 return new StringReader(code);
             }
             try {
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/SourceSection.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/SourceSection.java	Mon Dec 07 21:17:46 2015 -0800
@@ -170,9 +170,10 @@
     }
 
     /**
-     * Returns text described by this section.
+     * Returns the source code fragment described by this section.
      *
-     * @return the code as a String object
+     * @return the code as a string, or {@code "<unavailable>"} if the SourceSection was created
+     *         using {@link #createUnavailable}.
      */
     public String getCode() {
         return source == null ? "<unavailable>" : source.getCode(charIndex, charLength);
@@ -182,7 +183,7 @@
      * Returns a short description of the source section, using just the file name, rather than its
      * full path.
      *
-     * @return a short description of the source section
+     * @return a short description of the source section formatted as {@code <filename>:<line>}.
      */
     public String getShortDescription() {
         if (source == null) {
@@ -191,9 +192,21 @@
         return String.format("%s:%d", source.getShortName(), startLine);
     }
 
+    /**
+     * Returns an implementation-defined string representation of this source section to be used for
+     * debugging purposes only.
+     *
+     * @see #getCode()
+     * @see #getShortDescription()
+     */
     @Override
     public String toString() {
-        return getShortDescription();
+        if (source == null) {
+            return kind + ": " + identifier;
+        } else {
+            return "source=" + source.getShortName() + " pos=" + charIndex + " len=" + charLength + " line=" + startLine + " col=" + startColumn +
+                            (identifier != null ? " identifier=" + identifier : "") + " code=" + getCode();
+        }
     }
 
     @Override
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java	Mon Dec 07 21:17:46 2015 -0800
@@ -52,14 +52,18 @@
                 CompilerDirectives.transferToInterpreterAndInvalidate();
             }
             if (CompilerDirectives.inInterpreter()) {
-                trueCount++;
+                if (trueCount < Integer.MAX_VALUE) {
+                    trueCount++;
+                }
             }
         } else {
             if (falseCount == 0) {
                 CompilerDirectives.transferToInterpreterAndInvalidate();
             }
             if (CompilerDirectives.inInterpreter()) {
-                falseCount++;
+                if (falseCount < Integer.MAX_VALUE) {
+                    falseCount++;
+                }
             }
         }
         return CompilerDirectives.injectBranchProbability((double) trueCount / (double) (trueCount + falseCount), value);
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ExactClassValueProfile.java	Mon Dec 07 21:17:46 2015 -0800
@@ -40,12 +40,17 @@
     @SuppressWarnings("unchecked")
     @Override
     public <T> T profile(T value) {
-        if (cachedClass != Object.class) {
-            if (cachedClass != null && cachedClass.isInstance(value)) {
-                return (T) cachedClass.cast(value);
+        Class<?> c = cachedClass;
+        if (c != Object.class) {
+            if (c != null && value != null && c == value.getClass()) {
+                if (CompilerDirectives.inInterpreter()) {
+                    return value;
+                } else {
+                    return (T) c.cast(value);
+                }
             } else {
                 CompilerDirectives.transferToInterpreterAndInvalidate();
-                if (cachedClass == null && value != null) {
+                if (c == null && value != null) {
                     cachedClass = value.getClass();
                 } else {
                     cachedClass = Object.class;
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java	Mon Dec 07 21:17:46 2015 -0800
@@ -57,7 +57,13 @@
     }
 
     /**
-     * Returns a {@link ValueProfile} that speculates on the exact class of a value.
+     * Returns a {@link ValueProfile} that speculates on the exact class of a value. It will check
+     * the class of the profiled value and provide additional information to the compiler if only
+     * non-null values of exactly one concrete Java class are passed as a parameter to the
+     * {@link ValueProfile#profile} method. This can be beneficial if subsequent code can take
+     * advantage of knowing the concrete class of the value. The profile will degrade to the generic
+     * case if a null value or if at least two instances of two different Java classes are
+     * registered.
      */
     public static ValueProfile createClassProfile() {
         return new ExactClassValueProfile();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ParsingCachedTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.test;
+
+import com.oracle.truffle.api.source.Source;
+import com.oracle.truffle.api.vm.PolyglotEngine;
+import com.oracle.truffle.sl.SLLanguage;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class ParsingCachedTest {
+
+    @Test
+    public void stepInStepOver() throws Throwable {
+        Source nullSrc = Source.fromText("function main() {}", "yields null").withMimeType("application/x-sl");
+
+        PolyglotEngine engine = PolyglotEngine.newBuilder().build();
+        int cnt = SLLanguage.parsingCount();
+        Object res = engine.eval(nullSrc).get();
+        assertNull("Is null", res);
+        assertEquals("One parsing happened", cnt + 1, SLLanguage.parsingCount());
+
+        Object res2 = engine.eval(nullSrc).get();
+        assertNull("Still null", res2);
+        assertEquals("No more parsing happened", cnt + 1, SLLanguage.parsingCount());
+    }
+
+}
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLDebugTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLDebugTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -168,7 +168,7 @@
         });
 
         PolyglotEngine.Value main = engine.findGlobalSymbol("main");
-        value = main.invoke(null);
+        value = main.execute();
 
         assertExecutedOK();
 
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java	Mon Dec 07 21:17:46 2015 -0800
@@ -180,7 +180,7 @@
 
     @Override
     protected String evaluateSource() {
-        return "interopEval";
+        return "eval";
     }
 
     //
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Mon Dec 07 21:17:46 2015 -0800
@@ -257,7 +257,7 @@
                 }
 
                 PolyglotEngine.Value main = vm.findGlobalSymbol("main");
-                main.invoke(null);
+                main.execute();
             } else {
                 notifier.fireTestFailure(new Failure(testCase.name, new UnsupportedOperationException("No instrumentation found.")));
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl.test/src/tests/Eval.output	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,1 @@
+16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl.test/src/tests/Eval.sl	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,4 @@
+function main() {  
+  eval("application/x-sl", "function foo() { return 14 + 2; }");
+  println(foo());
+}
--- a/truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/SLCoverage.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/SLCoverage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -81,7 +81,7 @@
             throw new IOException("No function main() defined in SL source file.");
         }
         while (repeats-- > 0) {
-            main.invoke(null);
+            main.execute();
         }
         coverageTracker.print(System.out);
     }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java	Mon Dec 07 21:17:46 2015 -0800
@@ -50,7 +50,7 @@
 import java.util.List;
 
 import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.RootCallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.TruffleLanguage;
@@ -114,6 +114,8 @@
 import com.oracle.truffle.sl.runtime.SLFunction;
 import com.oracle.truffle.sl.runtime.SLFunctionRegistry;
 import com.oracle.truffle.sl.runtime.SLNull;
+import java.util.Map;
+import java.util.WeakHashMap;
 
 /**
  * SL is a simple language to demonstrate and showcase features of Truffle. The implementation is as
@@ -193,8 +195,12 @@
     public static final String builtinKind = "SL builtin";
     private static List<NodeFactory<? extends SLBuiltinNode>> builtins = Collections.emptyList();
     private static Visualizer visualizer = new SLDefaultVisualizer();
+    private static int parsingCount;
+
+    private final Map<Source, CallTarget> compiled;
 
     private SLLanguage() {
+        compiled = Collections.synchronizedMap(new WeakHashMap<Source, CallTarget>());
     }
 
     public static final SLLanguage INSTANCE = new SLLanguage();
@@ -235,10 +241,14 @@
             throw new SLException("No function main() defined in SL source file.");
         }
         while (repeats-- > 0) {
-            main.invoke(null);
+            main.execute();
         }
     }
 
+    public static int parsingCount() {
+        return parsingCount;
+    }
+
     /**
      * Parse and run the specified SL source. Factored out in a separate method so that it can also
      * be used by the unit test harness.
@@ -278,7 +288,7 @@
                 long start = System.nanoTime();
                 /* Call the main entry point, without any arguments. */
                 try {
-                    result = main.invoke(null).get();
+                    result = main.execute().get();
                     if (result != null) {
                         out.println(result);
                     }
@@ -396,6 +406,11 @@
 
     @Override
     protected CallTarget parse(Source code, final Node node, String... argumentNames) throws IOException {
+        CallTarget cached = compiled.get(code);
+        if (cached != null) {
+            return cached;
+        }
+        parsingCount++;
         final SLContext c = new SLContext(this);
         final Exception[] failed = {null};
         try {
@@ -405,9 +420,16 @@
             failed[0] = e;
         }
         RootNode rootNode = new RootNode(SLLanguage.class, null, null) {
-            @TruffleBoundary
             @Override
             public Object execute(VirtualFrame frame) {
+                /*
+                 * We do not expect this node to be part of anything that gets compiled for
+                 * performance reason. It can be compiled though when doing compilation stress
+                 * testing. But in this case it is fine to just deoptimize. Note that we cannot
+                 * declare the method as @TruffleBoundary because it has a VirtualFrame parameter.
+                 */
+                CompilerDirectives.transferToInterpreter();
+
                 if (failed[0] instanceof RuntimeException) {
                     throw (RuntimeException) failed[0];
                 }
@@ -436,7 +458,9 @@
                 return null;
             }
         };
-        return Truffle.getRuntime().createCallTarget(rootNode);
+        cached = Truffle.getRuntime().createCallTarget(rootNode);
+        compiled.put(code, cached);
+        return cached;
     }
 
     @Override
@@ -461,9 +485,6 @@
 
     @Override
     protected Visualizer getVisualizer() {
-        if (visualizer == null) {
-            visualizer = new SLDefaultVisualizer();
-        }
         return visualizer;
     }
 
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLEvalBuiltin.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLEvalBuiltin.java	Mon Dec 07 21:17:46 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * The Universal Permissive License (UPL), Version 1.0
@@ -40,7 +40,12 @@
  */
 package com.oracle.truffle.sl.builtins;
 
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Specialization;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.nodes.DirectCallNode;
 import com.oracle.truffle.api.nodes.NodeInfo;
 import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.api.source.SourceSection;
@@ -48,22 +53,44 @@
 import java.io.IOException;
 
 /**
- * Builtin function to parse a text in other language.
+ * Builtin function to evaluate source code in any supported language.
+ * <p>
+ * The call target is cached against the mime type and the source code, so that if they are the same
+ * each time then a direct call will be made to a cached AST, allowing it to be compiled and
+ * possibly inlined.
  */
-@NodeInfo(shortName = "interopEval")
+@NodeInfo(shortName = "eval")
 public abstract class SLEvalBuiltin extends SLBuiltinNode {
 
     public SLEvalBuiltin() {
-        super(SourceSection.createUnavailable(SLLanguage.builtinKind, "interopEval"));
+        super(SourceSection.createUnavailable(SLLanguage.builtinKind, "eval"));
+    }
+
+    @SuppressWarnings("unused")
+    @Specialization(guards = {"stringsEqual(mimeType, cachedMimeType)", "stringsEqual(code, cachedCode)"})
+    public Object evalCached(VirtualFrame frame, String mimeType, String code, @Cached("mimeType") String cachedMimeType, @Cached("code") String cachedCode,
+                    @Cached("create(parse(mimeType, code))") DirectCallNode callNode) {
+        return callNode.call(frame, new Object[]{});
     }
 
-    @Specialization
-    public Object interopEval(String mimeType, String code) {
-        Source source = Source.fromText(code, "<unknown>").withMimeType(mimeType);
+    @TruffleBoundary
+    @Specialization(contains = "evalCached")
+    public Object evalUncached(String mimeType, String code) {
+        return parse(mimeType, code).call();
+    }
+
+    protected CallTarget parse(String mimeType, String code) {
+        final Source source = Source.fromText(code, "(eval)").withMimeType(mimeType);
+
         try {
-            return getContext().evalAny(source);
+            return getContext().parse(source);
         } catch (IOException ex) {
             throw new IllegalArgumentException(ex);
         }
     }
+
+    protected boolean stringsEqual(String a, String b) {
+        return a.equals(b);
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLImportBuiltin.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.builtins;
+
+import com.oracle.truffle.api.dsl.Specialization;
+import com.oracle.truffle.api.nodes.NodeInfo;
+import com.oracle.truffle.api.source.SourceSection;
+import com.oracle.truffle.sl.SLLanguage;
+
+/**
+ * Built-in function that goes through the other registered languages to find an exported global
+ * symbol of the specified name. See <link>SLContext#import(String)</link>.
+ */
+@NodeInfo(shortName = "import")
+public abstract class SLImportBuiltin extends SLBuiltinNode {
+
+    public SLImportBuiltin() {
+        super(SourceSection.createUnavailable(SLLanguage.builtinKind, "import"));
+    }
+
+    @Specialization
+    public Object importSymbol(String name) {
+        return getContext().importSymbol(name);
+    }
+}
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLExpressionNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -44,7 +44,9 @@
 import com.oracle.truffle.api.frame.VirtualFrame;
 import com.oracle.truffle.api.nodes.NodeInfo;
 import com.oracle.truffle.api.nodes.UnexpectedResultException;
+import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.source.SourceSection;
+import com.oracle.truffle.sl.runtime.SLContext;
 import com.oracle.truffle.sl.runtime.SLFunction;
 
 /**
@@ -92,4 +94,8 @@
     public boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException {
         return SLTypesGen.expectBoolean(executeGeneric(frame));
     }
+
+    protected static boolean isSLObject(DynamicObject object) {
+        return SLContext.isSLObject(object);
+    }
 }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -97,7 +97,7 @@
 
     @Override
     public String toString() {
-        return name;
+        return "root " + name;
     }
 
     public Node getBodyNode() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLTargetableNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.nodes;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.source.SourceSection;
+
+public abstract class SLTargetableNode extends SLExpressionNode {
+    public SLTargetableNode(SourceSection src) {
+        super(src);
+    }
+
+    public abstract Object executeWithTarget(VirtualFrame frame, Object target);
+}
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLReadPropertyNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLReadPropertyNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -41,12 +41,19 @@
 package com.oracle.truffle.sl.nodes.access;
 
 import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.dsl.NodeChild;
+import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeInfo;
+import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.api.utilities.ConditionProfile;
-import com.oracle.truffle.sl.SLException;
 import com.oracle.truffle.sl.nodes.SLExpressionNode;
+import com.oracle.truffle.sl.nodes.interop.SLForeignToSLTypeNode;
+import com.oracle.truffle.sl.nodes.interop.SLForeignToSLTypeNodeGen;
 import com.oracle.truffle.sl.runtime.SLContext;
 
 /**
@@ -54,30 +61,35 @@
  * object expression on the left side of the dot operator and then reads the named property.
  */
 @NodeInfo(shortName = ".")
-public final class SLReadPropertyNode extends SLExpressionNode {
+@NodeChild(value = "receiver", type = SLExpressionNode.class)
+public abstract class SLReadPropertyNode extends SLExpressionNode {
 
-    public static SLReadPropertyNode create(SourceSection src, SLExpressionNode receiverNode, String propertyName) {
-        return new SLReadPropertyNode(src, receiverNode, propertyName);
+    @Child private SLReadPropertyCacheNode cacheNode;
+    private final String propertyName;
+
+    public SLReadPropertyNode(SourceSection src, String propertyName) {
+        super(src);
+        this.propertyName = propertyName;
+        this.cacheNode = SLReadPropertyCacheNode.create(propertyName);
     }
 
-    @Child private SLExpressionNode receiverNode;
-    @Child private SLReadPropertyCacheNode cacheNode;
-    private final ConditionProfile receiverTypeCondition = ConditionProfile.createBinaryProfile();
-
-    private SLReadPropertyNode(SourceSection src, SLExpressionNode receiverNode, String propertyName) {
-        super(src);
-        this.receiverNode = receiverNode;
-        this.cacheNode = SLReadPropertyCacheNodeGen.create(propertyName);
+    @Specialization(guards = "isSLObject(object)")
+    public Object doSLObject(DynamicObject object) {
+        return cacheNode.executeObject(SLContext.castSLObject(object));
     }
 
-    @Override
-    public Object executeGeneric(VirtualFrame frame) {
-        Object object = receiverNode.executeGeneric(frame);
-        if (receiverTypeCondition.profile(SLContext.isSLObject(object))) {
-            return cacheNode.executeObject(SLContext.castSLObject(object));
-        } else {
-            CompilerDirectives.transferToInterpreter();
-            throw new SLException("unexpected receiver type");
+    @Child private Node foreignRead;
+    @Child private SLForeignToSLTypeNode toSLType;
+
+    @Specialization
+    public Object doForeignObject(VirtualFrame frame, TruffleObject object) {
+        if (foreignRead == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            this.foreignRead = insert(Message.READ.createNode());
+            this.toSLType = insert(SLForeignToSLTypeNodeGen.create(getSourceSection(), null));
         }
+        Object result = ForeignAccess.execute(foreignRead, frame, object, new Object[]{propertyName});
+        Object slValue = toSLType.executeWithTarget(frame, result);
+        return slValue;
     }
 }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyCacheNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyCacheNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -40,11 +40,10 @@
  */
 package com.oracle.truffle.sl.nodes.access;
 
-import com.oracle.truffle.api.Assumption;
+import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Specialization;
-import com.oracle.truffle.api.nodes.InvalidAssumptionException;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.object.FinalLocationException;
@@ -52,8 +51,6 @@
 import com.oracle.truffle.api.object.Location;
 import com.oracle.truffle.api.object.Property;
 import com.oracle.truffle.api.object.Shape;
-import com.oracle.truffle.api.utilities.AlwaysValidAssumption;
-import com.oracle.truffle.api.utilities.NeverValidAssumption;
 
 public abstract class SLWritePropertyCacheNode extends Node {
     protected static final int CACHE_LIMIT = 3;
@@ -66,17 +63,10 @@
 
     public abstract void executeObject(DynamicObject receiver, Object value);
 
-    @Specialization(guards = {"location != null", "shape.check(receiver)", "canSet(location, receiver, value)"}, assumptions = {"shape.getValidAssumption()"}, limit = "CACHE_LIMIT")
+    @Specialization(guards = {"location != null", "shape.check(receiver)", "canSet(location, receiver, value)"}, assumptions = "shape.getValidAssumption()", limit = "CACHE_LIMIT")
     public void writeExistingPropertyCached(DynamicObject receiver, Object value, //
                     @Cached("lookupLocation(receiver, value)") Location location, //
-                    @Cached("receiver.getShape()") Shape shape, //
-                    @Cached("ensureValid(receiver)") Assumption validAssumption) {
-        try {
-            validAssumption.check();
-        } catch (InvalidAssumptionException e) {
-            executeObject(receiver, value);
-            return;
-        }
+                    @Cached("receiver.getShape()") Shape shape) {
         try {
             location.set(receiver, value, shape);
         } catch (IncompatibleLocationException | FinalLocationException e) {
@@ -84,36 +74,33 @@
         }
     }
 
-    @Specialization(guards = {"existing == null", "shapeBefore.check(receiver)", "canSet(newLocation, receiver, value)"}, assumptions = {"shapeBefore.getValidAssumption()",
-                    "shapeAfter.getValidAssumption()"}, limit = "CACHE_LIMIT")
+    @Specialization(guards = {"existingLocation == null", "oldShape.check(receiver)", "canSet(newLocation, receiver, value)"}, assumptions = {"oldShape.getValidAssumption()",
+                    "newShape.getValidAssumption()"}, limit = "CACHE_LIMIT")
     public void writeNewPropertyCached(DynamicObject receiver, Object value, //
-                    @Cached("lookupLocation(receiver, value)") @SuppressWarnings("unused") Location existing, //
-                    @Cached("receiver.getShape()") Shape shapeBefore, //
-                    @Cached("defineProperty(receiver, value)") Shape shapeAfter, //
-                    @Cached("getLocation(shapeAfter)") Location newLocation, //
-                    @Cached("ensureValid(receiver)") Assumption validAssumption) {
+                    @Cached("lookupLocation(receiver, value)") @SuppressWarnings("unused") Location existingLocation, //
+                    @Cached("receiver.getShape()") Shape oldShape, //
+                    @Cached("defineProperty(oldShape, value)") Shape newShape, //
+                    @Cached("getLocation(newShape)") Location newLocation) {
         try {
-            validAssumption.check();
-        } catch (InvalidAssumptionException e) {
-            executeObject(receiver, value);
-            return;
-        }
-        try {
-            newLocation.set(receiver, value, shapeBefore, shapeAfter);
+            newLocation.set(receiver, value, oldShape, newShape);
         } catch (IncompatibleLocationException e) {
             throw new IllegalStateException(e);
         }
     }
 
-    @Specialization(contains = {"writeExistingPropertyCached", "writeNewPropertyCached"})
+    @Specialization(guards = "updateShape(receiver)")
+    public void updateShape(DynamicObject receiver, Object value) {
+        executeObject(receiver, value);
+    }
+
     @TruffleBoundary
+    @Specialization(contains = {"writeExistingPropertyCached", "writeNewPropertyCached", "updateShape"})
     public void writeUncached(DynamicObject receiver, Object value) {
         receiver.define(propertyName, value);
     }
 
     protected final Location lookupLocation(DynamicObject object, Object value) {
-        final Shape oldShape = object.getShape();
-        final Property property = oldShape.getProperty(propertyName);
+        final Property property = object.getShape().getProperty(propertyName);
 
         if (property != null && property.getLocation().canSet(object, value)) {
             return property.getLocation();
@@ -122,22 +109,21 @@
         }
     }
 
-    protected final Shape defineProperty(DynamicObject receiver, Object value) {
-        Shape oldShape = receiver.getShape();
-        Shape newShape = oldShape.defineProperty(propertyName, value, 0);
-        return newShape;
+    protected final Shape defineProperty(Shape oldShape, Object value) {
+        return oldShape.defineProperty(propertyName, value, 0);
     }
 
     protected final Location getLocation(Shape newShape) {
         return newShape.getProperty(propertyName).getLocation();
     }
 
-    protected static Assumption ensureValid(DynamicObject receiver) {
-        return receiver.updateShape() ? NeverValidAssumption.INSTANCE : AlwaysValidAssumption.INSTANCE;
-    }
-
     protected static boolean canSet(Location location, DynamicObject receiver, Object value) {
         return location.canSet(receiver, value);
     }
 
+    protected static boolean updateShape(DynamicObject object) {
+        CompilerDirectives.transferToInterpreter();
+        return object.updateShape();
+    }
+
 }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyNode.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -41,11 +41,17 @@
 package com.oracle.truffle.sl.nodes.access;
 
 import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.dsl.NodeChild;
+import com.oracle.truffle.api.dsl.NodeChildren;
+import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.NodeInfo;
+import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.source.SourceSection;
-import com.oracle.truffle.api.utilities.ConditionProfile;
-import com.oracle.truffle.sl.SLException;
 import com.oracle.truffle.sl.nodes.SLExpressionNode;
 import com.oracle.truffle.sl.runtime.SLContext;
 
@@ -56,36 +62,34 @@
  * value if the property already exists or adds a new property. Finally, it returns the new value.
  */
 @NodeInfo(shortName = ".=")
-public final class SLWritePropertyNode extends SLExpressionNode {
-
-    public static SLWritePropertyNode create(SourceSection src, SLExpressionNode receiverNode, String propertyName, SLExpressionNode valueNode) {
-        return new SLWritePropertyNode(src, receiverNode, propertyName, valueNode);
-    }
+@NodeChildren({@NodeChild(value = "receiver", type = SLExpressionNode.class), @NodeChild(value = "value", type = SLExpressionNode.class)})
+public abstract class SLWritePropertyNode extends SLExpressionNode {
 
     @Child protected SLExpressionNode receiverNode;
     protected final String propertyName;
     @Child protected SLExpressionNode valueNode;
     @Child protected SLWritePropertyCacheNode cacheNode;
-    private final ConditionProfile receiverTypeCondition = ConditionProfile.createBinaryProfile();
 
-    private SLWritePropertyNode(SourceSection src, SLExpressionNode receiverNode, String propertyName, SLExpressionNode valueNode) {
+    SLWritePropertyNode(SourceSection src, String propertyName) {
         super(src);
-        this.receiverNode = receiverNode;
         this.propertyName = propertyName;
-        this.valueNode = valueNode;
         this.cacheNode = SLWritePropertyCacheNodeGen.create(propertyName);
     }
 
-    @Override
-    public Object executeGeneric(VirtualFrame frame) {
-        Object value = valueNode.executeGeneric(frame);
-        Object object = receiverNode.executeGeneric(frame);
-        if (receiverTypeCondition.profile(SLContext.isSLObject(object))) {
-            cacheNode.executeObject(SLContext.castSLObject(object), value);
-        } else {
-            CompilerDirectives.transferToInterpreter();
-            throw new SLException("unexpected receiver type");
-        }
+    @Specialization(guards = "isSLObject(object)")
+    public Object doSLObject(DynamicObject object, Object value) {
+        cacheNode.executeObject(SLContext.castSLObject(object), value);
         return value;
     }
+
+    @Child private Node foreignWrite;
+
+    @Specialization
+    public Object doForeignObject(VirtualFrame frame, TruffleObject object, Object value) {
+        if (foreignWrite == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            this.foreignWrite = insert(Message.WRITE.createNode());
+        }
+        return ForeignAccess.execute(foreignWrite, frame, object, new Object[]{propertyName, value});
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/interop/SLForeignReadNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.nodes.interop;
+
+import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.object.DynamicObject;
+import com.oracle.truffle.api.object.Property;
+import com.oracle.truffle.sl.SLLanguage;
+import com.oracle.truffle.sl.nodes.access.SLReadPropertyCacheNode;
+import com.oracle.truffle.sl.nodes.access.SLReadPropertyCacheNodeGen;
+
+public class SLForeignReadNode extends RootNode {
+
+    @Child private SLMonomorphicNameReadNode read;
+
+    public SLForeignReadNode() {
+        super(SLLanguage.class, null, null);
+    }
+
+    @Override
+    public Object execute(VirtualFrame frame) {
+        if (read == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            String name = (String) ForeignAccess.getArguments(frame).get(0);
+            read = insert(new SLMonomorphicNameReadNode(name));
+        }
+        return read.execute(frame);
+    }
+
+    private abstract static class SLReadNode extends Node {
+        abstract Object execute(VirtualFrame frame);
+    }
+
+    private static final class SLMonomorphicNameReadNode extends SLReadNode {
+
+        private final String name;
+        @Child private SLReadPropertyCacheNode readPropertyCacheNode;
+
+        SLMonomorphicNameReadNode(String name) {
+            this.name = name;
+            this.readPropertyCacheNode = SLReadPropertyCacheNodeGen.create(name);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            if (name.equals(ForeignAccess.getArguments(frame).get(0))) {
+                return readPropertyCacheNode.executeObject((DynamicObject) ForeignAccess.getReceiver(frame));
+            } else {
+                CompilerDirectives.transferToInterpreterAndInvalidate();
+                return this.replace(new SLPolymorphicNameReadNode()).execute(frame);
+            }
+        }
+    }
+
+    private static final class SLPolymorphicNameReadNode extends SLReadNode {
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            String name = (String) ForeignAccess.getArguments(frame).get(0);
+            DynamicObject obj = (DynamicObject) ForeignAccess.getReceiver(frame);
+            Property property = obj.getShape().getProperty(name);
+            return obj.get(property.getKey());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/interop/SLForeignToSLTypeNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.nodes.interop;
+
+import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.dsl.NodeChild;
+import com.oracle.truffle.api.dsl.Specialization;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.source.SourceSection;
+import com.oracle.truffle.sl.nodes.SLExpressionNode;
+import com.oracle.truffle.sl.nodes.SLTargetableNode;
+import com.oracle.truffle.sl.runtime.SLContext;
+
+@NodeChild(type = SLExpressionNode.class)
+public abstract class SLForeignToSLTypeNode extends SLTargetableNode {
+
+    public SLForeignToSLTypeNode(SourceSection src) {
+        super(src);
+    }
+
+    @Specialization
+    public Object fromObject(Number value) {
+        return SLContext.fromForeignValue(value);
+    }
+
+    @Specialization
+    public Object fromString(String value) {
+        return value;
+    }
+
+    @Specialization(guards = "isBoxedPrimitive(frame, value)")
+    public Object unbox(VirtualFrame frame, TruffleObject value) {
+        Object unboxed = doUnbox(frame, value);
+        return SLContext.fromForeignValue(unboxed);
+    }
+
+    @Specialization(guards = "!isBoxedPrimitive(frame, value)")
+    public Object fromTruffleObject(@SuppressWarnings("unused") VirtualFrame frame, TruffleObject value) {
+        return value;
+    }
+
+    @Child private Node isBoxed;
+
+    protected final boolean isBoxedPrimitive(VirtualFrame frame, TruffleObject object) {
+        if (isBoxed == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            isBoxed = insert(Message.IS_BOXED.createNode());
+        }
+        return (boolean) ForeignAccess.execute(isBoxed, frame, object);
+    }
+
+    protected final Object doUnbox(VirtualFrame frame, TruffleObject value) {
+        initializeUnbox();
+        Object object = ForeignAccess.execute(unbox, frame, value);
+        return object;
+    }
+
+    @Child private Node unbox;
+
+    private void initializeUnbox() {
+        if (unbox == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            unbox = insert(Message.UNBOX.createNode());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/interop/SLForeignWriteNode.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.oracle.truffle.sl.nodes.interop;
+
+import com.oracle.truffle.api.CompilerDirectives;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
+import com.oracle.truffle.api.object.DynamicObject;
+import com.oracle.truffle.api.object.Property;
+import com.oracle.truffle.sl.SLLanguage;
+import com.oracle.truffle.sl.nodes.access.SLWritePropertyCacheNode;
+import com.oracle.truffle.sl.nodes.access.SLWritePropertyCacheNodeGen;
+
+public class SLForeignWriteNode extends RootNode {
+
+    @Child private SLMonomorphicNameWriteNode write;
+
+    public SLForeignWriteNode() {
+        super(SLLanguage.class, null, null);
+    }
+
+    @Override
+    public Object execute(VirtualFrame frame) {
+        if (write == null) {
+            CompilerDirectives.transferToInterpreterAndInvalidate();
+            String name = (String) ForeignAccess.getArguments(frame).get(0);
+            write = insert(new SLMonomorphicNameWriteNode(name));
+        }
+        return write.execute(frame);
+    }
+
+    private abstract static class SLWriteNode extends Node {
+        @Child protected SLForeignToSLTypeNode toSLType = SLForeignToSLTypeNodeGen.create(getSourceSection(), null);
+
+        abstract Object execute(VirtualFrame frame);
+    }
+
+    private static final class SLMonomorphicNameWriteNode extends SLWriteNode {
+
+        private final String name;
+        @Child private SLWritePropertyCacheNode writePropertyCacheNode;
+
+        SLMonomorphicNameWriteNode(String name) {
+            this.name = name;
+            this.writePropertyCacheNode = SLWritePropertyCacheNodeGen.create(name);
+        }
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            if (name.equals(ForeignAccess.getArguments(frame).get(0))) {
+                Object value = toSLType.executeWithTarget(frame, ForeignAccess.getArguments(frame).get(1));
+                DynamicObject receiver = (DynamicObject) ForeignAccess.getReceiver(frame);
+                writePropertyCacheNode.executeObject(receiver, value);
+                return receiver;
+            } else {
+                CompilerDirectives.transferToInterpreterAndInvalidate();
+                return this.replace(new SLPolymorphicNameWriteNode()).execute(frame);
+            }
+        }
+    }
+
+    private static final class SLPolymorphicNameWriteNode extends SLWriteNode {
+
+        @Override
+        Object execute(VirtualFrame frame) {
+            String name = (String) ForeignAccess.getArguments(frame).get(0);
+            DynamicObject obj = (DynamicObject) ForeignAccess.getReceiver(frame);
+            Property property = obj.getShape().getProperty(name);
+            Object value = toSLType.executeWithTarget(frame, ForeignAccess.getArguments(frame).get(0));
+            return obj.set(property.getKey(), value);
+        }
+    }
+}
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java	Mon Dec 07 21:17:46 2015 -0800
@@ -56,7 +56,9 @@
 import com.oracle.truffle.sl.nodes.SLRootNode;
 import com.oracle.truffle.sl.nodes.SLStatementNode;
 import com.oracle.truffle.sl.nodes.access.SLReadPropertyNode;
+import com.oracle.truffle.sl.nodes.access.SLReadPropertyNodeGen;
 import com.oracle.truffle.sl.nodes.access.SLWritePropertyNode;
+import com.oracle.truffle.sl.nodes.access.SLWritePropertyNodeGen;
 import com.oracle.truffle.sl.nodes.call.SLInvokeNode;
 import com.oracle.truffle.sl.nodes.call.SLInvokeNodeGen;
 import com.oracle.truffle.sl.nodes.controlflow.SLBlockNode;
@@ -406,7 +408,7 @@
         final int startPos = receiverNode.getSourceSection().getCharIndex();
         final int endPos = nameToken.charPos + nameToken.val.length();
         final SourceSection src = source.createSection(".", startPos, endPos - startPos);
-        return SLReadPropertyNode.create(src, receiverNode, nameToken.val);
+        return SLReadPropertyNodeGen.create(src, nameToken.val, receiverNode);
     }
 
     /**
@@ -421,7 +423,7 @@
         final int start = receiverNode.getSourceSection().getCharIndex();
         final int length = valueNode.getSourceSection().getCharEndIndex() - start;
         SourceSection src = source.createSection("=", start, length);
-        return SLWritePropertyNode.create(src, receiverNode, nameToken.val, valueNode);
+        return SLWritePropertyNodeGen.create(src, nameToken.val, receiverNode, valueNode);
     }
 
     /**
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java	Mon Dec 07 21:17:46 2015 -0800
@@ -40,10 +40,12 @@
  */
 package com.oracle.truffle.sl.runtime;
 
+import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.ExecutionContext;
 import com.oracle.truffle.api.TruffleLanguage;
 import com.oracle.truffle.api.dsl.NodeFactory;
 import com.oracle.truffle.api.frame.FrameDescriptor;
+import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.nodes.NodeInfo;
 import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.object.Layout;
@@ -57,6 +59,7 @@
 import com.oracle.truffle.sl.builtins.SLDefineFunctionBuiltinFactory;
 import com.oracle.truffle.sl.builtins.SLEvalBuiltinFactory;
 import com.oracle.truffle.sl.builtins.SLHelloEqualsWorldBuiltinFactory;
+import com.oracle.truffle.sl.builtins.SLImportBuiltinFactory;
 import com.oracle.truffle.sl.builtins.SLNanoTimeBuiltinFactory;
 import com.oracle.truffle.sl.builtins.SLNewObjectBuiltinFactory;
 import com.oracle.truffle.sl.builtins.SLPrintlnBuiltin;
@@ -156,6 +159,7 @@
         installBuiltin(SLAssertFalseBuiltinFactory.getInstance(), registerRootNodes);
         installBuiltin(SLNewObjectBuiltinFactory.getInstance(), registerRootNodes);
         installBuiltin(SLEvalBuiltinFactory.getInstance(), registerRootNodes);
+        installBuiltin(SLImportBuiltinFactory.getInstance(), registerRootNodes);
     }
 
     public void installBuiltin(NodeFactory<? extends SLBuiltinNode> factory, boolean registerRootNodes) {
@@ -217,8 +221,12 @@
         return LAYOUT.newInstance(emptyShape);
     }
 
-    public static boolean isSLObject(Object value) {
-        return LAYOUT.getType().isInstance(value);
+    public static boolean isSLObject(TruffleObject value) {
+        return value instanceof DynamicObject && isSLObject((DynamicObject) value);
+    }
+
+    public static boolean isSLObject(DynamicObject value) {
+        return value.getShape().getObjectType() instanceof SLObjectType;
     }
 
     public static DynamicObject castSLObject(Object value) {
@@ -226,15 +234,33 @@
     }
 
     public static Object fromForeignValue(Object a) {
-        if (a instanceof Long || a instanceof BigInteger) {
+        if (a instanceof Long || a instanceof BigInteger || a instanceof String) {
             return a;
         } else if (a instanceof Number) {
             return ((Number) a).longValue();
+        } else if (a instanceof TruffleObject) {
+            return a;
+        } else if (a instanceof SLContext) {
+            return a;
         }
-        return a;
+        throw new IllegalStateException(a + " is not a Truffle value");
+    }
+
+    public CallTarget parse(Source source) throws IOException {
+        return env.parse(source);
     }
 
-    public Object evalAny(Source source) throws IOException {
-        return env.parse(source).call();
+    /**
+     * Goes through the other registered languages to find an exported global symbol of the
+     * specified name. The expected return type is either <code>TruffleObject</code>, or one of
+     * wrappers of Java primitive types ({@link Integer}, {@link Double}).
+     *
+     * @param name the name of the symbol to search for
+     * @return object representing the symbol or <code>null</code>
+     */
+    public Object importSymbol(String name) {
+        Object object = env.importSymbol(name);
+        Object slValue = fromForeignValue(object);
+        return slValue;
     }
 }
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunctionForeignAccess.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunctionForeignAccess.java	Mon Dec 07 21:17:46 2015 -0800
@@ -40,6 +40,10 @@
  */
 package com.oracle.truffle.sl.runtime;
 
+import static com.oracle.truffle.sl.runtime.SLContext.fromForeignValue;
+
+import java.util.List;
+
 import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.frame.VirtualFrame;
@@ -50,8 +54,6 @@
 import com.oracle.truffle.sl.SLLanguage;
 import com.oracle.truffle.sl.nodes.call.SLDispatchNode;
 import com.oracle.truffle.sl.nodes.call.SLDispatchNodeGen;
-import static com.oracle.truffle.sl.runtime.SLContext.fromForeignValue;
-import java.util.List;
 
 /**
  * Implementation of foreign access for {@link SLFunction}.
@@ -77,6 +79,8 @@
             return Truffle.getRuntime().createCallTarget(new SLForeignNullCheckNode());
         } else if (Message.IS_EXECUTABLE.equals(tree)) {
             return Truffle.getRuntime().createCallTarget(new SLForeignExecutableCheckNode());
+        } else if (Message.IS_BOXED.equals(tree)) {
+            return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(false));
         } else {
             throw new IllegalArgumentException(tree.toString() + " not supported");
         }
@@ -92,20 +96,13 @@
         @Override
         public Object execute(VirtualFrame frame) {
             SLFunction function = (SLFunction) ForeignAccess.getReceiver(frame);
-            // the calling convention of interop passes the receiver of a
-            // function call (the this object)
-            // as an implicit 1st argument; we need to ignore this argument for SL
             List<Object> args = ForeignAccess.getArguments(frame);
-            Object[] arr;
-            if (args.size() > 0 && args.get(0) instanceof SLContext) {
-                arr = args.subList(1, args.size()).toArray();
-            } else {
-                arr = args.toArray();
-            }
+            Object[] arr = args.toArray();
             for (int i = 0; i < arr.length; i++) {
                 arr[i] = fromForeignValue(arr[i]);
             }
-            return dispatch.executeDispatch(frame, function, arr);
+            Object result = dispatch.executeDispatch(frame, function, arr);
+            return result;
         }
     }
 
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLObjectType.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLObjectType.java	Mon Dec 07 21:17:46 2015 -0800
@@ -40,6 +40,10 @@
  */
 package com.oracle.truffle.sl.runtime;
 
+import static com.oracle.truffle.sl.runtime.SLContext.fromForeignValue;
+
+import java.util.List;
+
 import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.frame.VirtualFrame;
@@ -49,8 +53,11 @@
 import com.oracle.truffle.api.nodes.RootNode;
 import com.oracle.truffle.api.object.DynamicObject;
 import com.oracle.truffle.api.object.ObjectType;
-import com.oracle.truffle.api.object.Property;
 import com.oracle.truffle.sl.SLLanguage;
+import com.oracle.truffle.sl.nodes.call.SLDispatchNode;
+import com.oracle.truffle.sl.nodes.call.SLDispatchNodeGen;
+import com.oracle.truffle.sl.nodes.interop.SLForeignReadNode;
+import com.oracle.truffle.sl.nodes.interop.SLForeignWriteNode;
 
 final class SLObjectType extends ObjectType implements ForeignAccess.Factory10, ForeignAccess.Factory {
     private final ForeignAccess access;
@@ -101,7 +108,7 @@
 
     @Override
     public CallTarget accessWrite() {
-        throw new UnsupportedOperationException();
+        return Truffle.getRuntime().createCallTarget(new SLForeignWriteNode());
     }
 
     @Override
@@ -111,7 +118,7 @@
 
     @Override
     public CallTarget accessInvoke(int argumentsLength) {
-        return null;
+        return Truffle.getRuntime().createCallTarget(new SLForeignInvokeRootNode());
     }
 
     @Override
@@ -129,19 +136,31 @@
         return SLContext.isSLObject(obj);
     }
 
-    private static class SLForeignReadNode extends RootNode {
+    private static class SLForeignInvokeRootNode extends RootNode {
+        @Child private SLDispatchNode dispatch = SLDispatchNodeGen.create();
 
-        public SLForeignReadNode() {
+        public SLForeignInvokeRootNode() {
             super(SLLanguage.class, null, null);
         }
 
         @Override
         public Object execute(VirtualFrame frame) {
-            String fieldName = (String) ForeignAccess.getArguments(frame).get(0);
-            DynamicObject obj = (DynamicObject) ForeignAccess.getReceiver(frame);
-            Property property = obj.getShape().getProperty(fieldName);
-            return obj.get(property.getKey());
+            DynamicObject receiver = (DynamicObject) ForeignAccess.getReceiver(frame);
+            String name = (String) ForeignAccess.getArguments(frame).get(0);
+            Object property = receiver.get(name);
+            if (property instanceof SLFunction) {
+                SLFunction function = (SLFunction) property;
+                List<Object> args = ForeignAccess.getArguments(frame);
+                Object[] arr = new Object[args.size() - 1];
+                for (int i = 1; i < args.size(); i++) {
+                    arr[i - 1] = fromForeignValue(args.get(i));
+                }
+                Object result = dispatch.executeDispatch(frame, function, arr);
+                return result;
+            } else {
+                throw new IllegalArgumentException();
+            }
         }
+    }
 
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/BoxedValue.java	Mon Dec 07 21:17:46 2015 -0800
@@ -0,0 +1,113 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.tck;
+
+import com.oracle.truffle.api.CallTarget;
+import com.oracle.truffle.api.Truffle;
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.Message;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.RootNode;
+
+final class BoxedValue implements TruffleObject, ForeignAccess.Factory10 {
+    private final Object value;
+
+    BoxedValue(Object v) {
+        v.getClass();
+        this.value = v;
+    }
+
+    @Override
+    public ForeignAccess getForeignAccess() {
+        return ForeignAccess.create(BoxedValue.class, this);
+    }
+
+    @Override
+    public CallTarget accessIsNull() {
+        return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessIsExecutable() {
+        return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessIsBoxed() {
+        return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(Boolean.TRUE));
+    }
+
+    @Override
+    public CallTarget accessHasSize() {
+        return Truffle.getRuntime().createCallTarget(RootNode.createConstantNode(Boolean.FALSE));
+    }
+
+    @Override
+    public CallTarget accessGetSize() {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessUnbox() {
+        return Truffle.getRuntime().createCallTarget(new RootNode(TckLanguage.class, null, null) {
+            @Override
+            public Object execute(VirtualFrame frame) {
+                BoxedValue boxed = (BoxedValue) ForeignAccess.getReceiver(frame);
+                return boxed.value;
+            }
+        });
+    }
+
+    @Override
+    public CallTarget accessRead() {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessWrite() {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessExecute(int argumentsLength) {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessInvoke(int argumentsLength) {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessNew(int argumentsLength) {
+        return null;
+    }
+
+    @Override
+    public CallTarget accessMessage(Message unknown) {
+        return null;
+    }
+}
--- a/truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java	Mon Dec 07 21:17:46 2015 -0800
@@ -109,7 +109,7 @@
 
     /**
      * Name of function to add two numbers together. The symbol will be invoked with two parameters
-     * of <code>type1</code> and <code>type2</code> and expects result of type {@link Number} 
+     * of <code>type1</code> and <code>type2</code> and expects result of type {@link Number}
      * which's {@link Number#intValue()} is equivalent of <code>param1 + param2</code>. As some
      * languages may have different operations for different types of numbers, the actual types are
      * passed to the method and the implementation can decide to return different symbol based on
@@ -208,7 +208,7 @@
     /**
      * Name of a function that returns a compound object with members representing certain
      * operations. In the JavaScript the object should look like:
-     * 
+     *
      * <pre>
      * <b>var</b> obj = {
      *   'fourtyTwo': function {@link #fourtyTwo()},
@@ -218,7 +218,7 @@
      * };
      * <b>return</b> obj;
      * </pre>
-     * 
+     *
      * The returned object shall have three functions that will be obtained and used exactly as
      * described in their Javadoc - e.g. {@link #fourtyTwo()}, {@link #plusInt()} and
      * {@link #returnsNull()}. In addition to that there should be one more function
@@ -245,7 +245,7 @@
     public void testFortyTwo() throws Exception {
         PolyglotEngine.Value fourtyTwo = findGlobalSymbol(fourtyTwo());
 
-        Object res = fourtyTwo.invoke(null).get();
+        Object res = fourtyTwo.execute().get();
 
         assert res instanceof Number : "should yield a number, but was: " + res;
 
@@ -268,7 +268,7 @@
     public void testNull() throws Exception {
         PolyglotEngine.Value retNull = findGlobalSymbol(returnsNull());
 
-        Object res = retNull.invoke(null).get();
+        Object res = retNull.execute().get();
 
         assertNull("Should yield real Java null", res);
     }
@@ -277,7 +277,7 @@
     public void testNullCanBeCastToAnything() throws Exception {
         PolyglotEngine.Value retNull = findGlobalSymbol(returnsNull());
 
-        Object res = retNull.invoke(null).as(CompoundObject.class);
+        Object res = retNull.execute().as(CompoundObject.class);
 
         assertNull("Should yield real Java null", res);
     }
@@ -299,7 +299,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(int.class, int.class));
 
-        Number n = plus.invoke(null, a, b).as(Number.class);
+        Number n = plus.execute(a, b).as(Number.class);
         assert a + b == n.intValue() : "The value is correct: (" + a + " + " + b + ") =  " + n.intValue();
     }
 
@@ -310,7 +310,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(byte.class, byte.class));
 
-        Number n = plus.invoke(null, (byte) a, (byte) b).as(Number.class);
+        Number n = plus.execute((byte) a, (byte) b).as(Number.class);
         assert a + b == n.intValue() : "The value is correct: (" + a + " + " + b + ") =  " + n.intValue();
     }
 
@@ -321,7 +321,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(short.class, short.class));
 
-        Number n = plus.invoke(null, (short) a, (short) b).as(Number.class);
+        Number n = plus.execute((short) a, (short) b).as(Number.class);
         assert a + b == n.intValue() : "The value is correct: (" + a + " + " + b + ") =  " + n.intValue();
     }
 
@@ -332,7 +332,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(long.class, long.class));
 
-        Number n = plus.invoke(null, a, b).as(Number.class);
+        Number n = plus.execute(a, b).as(Number.class);
         assert a + b == n.longValue() : "The value is correct: (" + a + " + " + b + ") =  " + n.longValue();
     }
 
@@ -343,7 +343,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(float.class, float.class));
 
-        Number n = plus.invoke(null, a, b).as(Number.class);
+        Number n = plus.execute(a, b).as(Number.class);
         assertEquals("Correct value computed", a + b, n.floatValue(), 0.01f);
     }
 
@@ -354,7 +354,7 @@
 
         PolyglotEngine.Value plus = findGlobalSymbol(plus(float.class, float.class));
 
-        Number n = plus.invoke(null, a, b).as(Number.class);
+        Number n = plus.execute(a, b).as(Number.class);
         assertEquals("Correct value computed", a + b, n.doubleValue(), 0.01);
     }
 
@@ -385,7 +385,7 @@
         PolyglotEngine.Value apply = findGlobalSymbol(applyNumbers());
 
         TruffleObject fn = JavaInterop.asTruffleFunction(LongBinaryOperation.class, new MaxMinObject(true));
-        Object res = apply.invoke(null, fn).get();
+        Object res = apply.execute(fn).get();
 
         assert res instanceof Number : "result should be a number: " + res;
 
@@ -399,7 +399,7 @@
         PolyglotEngine.Value apply = findGlobalSymbol(applyNumbers());
 
         TruffleObject fn = JavaInterop.asTruffleFunction(LongBinaryOperation.class, new MaxMinObject(false));
-        final PolyglotEngine.Value result = apply.invoke(null, fn);
+        final PolyglotEngine.Value result = apply.execute(fn);
 
         try {
             Boolean res = result.as(Boolean.class);
@@ -419,7 +419,7 @@
         byte value = (byte) RANDOM.nextInt(100);
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.byteValue());
     }
 
@@ -430,7 +430,7 @@
         short value = (short) RANDOM.nextInt(100);
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.shortValue());
     }
 
@@ -441,7 +441,7 @@
         int value = RANDOM.nextInt(100);
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.intValue());
     }
 
@@ -452,7 +452,7 @@
         long value = RANDOM.nextInt(1000);
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.longValue());
     }
 
@@ -463,7 +463,7 @@
         float value = RANDOM.nextInt(1000) + RANDOM.nextFloat();
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.floatValue(), 0.01);
     }
 
@@ -474,7 +474,7 @@
         double value = RANDOM.nextInt(1000) + RANDOM.nextDouble();
 
         TruffleObject fn = JavaInterop.asTruffleFunction(ObjectBinaryOperation.class, new ConstantFunction(value));
-        Number n = apply.invoke(null, fn).as(Number.class);
+        Number n = apply.execute(fn).as(Number.class);
         assertEquals("The same value returned", value + 10, n.doubleValue(), 0.01);
     }
 
@@ -488,7 +488,22 @@
 
         byte value = (byte) RANDOM.nextInt(100);
 
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.byteValue());
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedByte() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        byte value = (byte) RANDOM.nextInt(100);
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.byteValue());
     }
 
@@ -501,7 +516,22 @@
         PolyglotEngine.Value apply = findGlobalSymbol(id);
 
         short value = (short) RANDOM.nextInt(100);
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.shortValue());
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedShort() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        short value = (short) RANDOM.nextInt(100);
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.shortValue());
     }
 
@@ -515,7 +545,22 @@
 
         int value = RANDOM.nextInt(100);
 
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.intValue());
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedInt() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        int value = RANDOM.nextInt(100);
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.intValue());
     }
 
@@ -529,7 +574,22 @@
 
         long value = RANDOM.nextInt(1000);
 
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.longValue());
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedLong() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        long value = RANDOM.nextInt(1000);
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.longValue());
     }
 
@@ -543,7 +603,22 @@
 
         float value = RANDOM.nextInt(1000) + RANDOM.nextFloat();
 
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.floatValue(), 0.01);
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedFloat() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        float value = RANDOM.nextInt(1000) + RANDOM.nextFloat();
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.floatValue(), 0.01);
     }
 
@@ -557,11 +632,55 @@
 
         double value = RANDOM.nextInt(1000) + RANDOM.nextDouble();
 
-        Number n = (Number) apply.invoke(null, value).get();
+        Number n = (Number) apply.execute(value).get();
+        assertEquals("The same value returned", value, n.doubleValue(), 0.01);
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedDouble() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        double value = RANDOM.nextInt(1000) + RANDOM.nextDouble();
+        BoxedValue boxed = new BoxedValue(value);
+
+        Number n = (Number) apply.execute(boxed).get();
         assertEquals("The same value returned", value, n.doubleValue(), 0.01);
     }
 
     @Test
+    public void testPrimitiveidentityString() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        String value = "Value" + RANDOM.nextInt(1000) + RANDOM.nextDouble();
+
+        String ret = (String) apply.execute(value).get();
+        assertEquals("The same value returned", value, ret);
+    }
+
+    @Test
+    public void testPrimitiveidentityBoxedString() throws Exception {
+        String id = identity();
+        if (id == null) {
+            return;
+        }
+        PolyglotEngine.Value apply = findGlobalSymbol(id);
+
+        String value = "Value" + RANDOM.nextInt(1000) + RANDOM.nextDouble();
+        BoxedValue boxed = new BoxedValue(value);
+
+        String ret = (String) apply.execute(boxed).get();
+        assertEquals("The same value returned", value, ret);
+    }
+
+    @Test
     public void testPrimitiveIdentityForeignObject() throws Exception {
         String id = identity();
         if (id == null) {
@@ -571,7 +690,7 @@
 
         TruffleObject fn = JavaInterop.asTruffleFunction(LongBinaryOperation.class, new MaxMinObject(true));
 
-        Object ret = apply.invoke(null, fn).get();
+        Object ret = apply.execute(fn).get();
         assertSameTruffleObject("The same value returned", fn, ret);
     }
 
@@ -591,13 +710,13 @@
         for (int i = 0; i < 10; i++) {
             int quantum = RANDOM.nextInt(10);
             for (int j = 0; j < quantum; j++) {
-                Object res = count1.invoke(null).get();
+                Object res = count1.execute().get();
                 assert res instanceof Number : "expecting number: " + res;
                 ++prev1;
                 assert ((Number) res).intValue() == prev1 : "expecting " + prev1 + " but was " + res;
             }
             for (int j = 0; j < quantum; j++) {
-                Object res = count2.invoke(null).get();
+                Object res = count2.execute().get();
                 assert res instanceof Number : "expecting number: " + res;
                 ++prev2;
                 assert ((Number) res).intValue() == prev2 : "expecting " + prev2 + " but was " + res;
@@ -617,7 +736,7 @@
         assertNotNull("Langugage for " + mimeType() + " found", language);
 
         PolyglotEngine.Value function = vm().findGlobalSymbol(globalObjectFunction);
-        Object global = function.invoke(null).get();
+        Object global = function.execute().get();
         assertEquals("Global from the language same with Java obtained one", language.getGlobalObject().get(), global);
     }
 
@@ -630,7 +749,7 @@
         assertNotNull(evaluateSource() + " found", function);
 
         double expect = Math.floor(RANDOM.nextDouble() * 100000.0) / 10.0;
-        Object parsed = function.invoke(null, "application/x-tck", "" + expect).get();
+        Object parsed = function.execute("application/x-tck", "" + expect).get();
         assertTrue("Expecting numeric result, was:" + expect, parsed instanceof Number);
         double value = ((Number) parsed).doubleValue();
         assertEquals("Gets the double", expect, value, 0.01);
@@ -643,7 +762,7 @@
         String mulCode = multiplyCode(firstVar, secondVar);
         Source source = Source.fromText("TCK42:" + mimeType() + ":" + mulCode, "evaluate " + firstVar + " * " + secondVar).withMimeType("application/x-tck");
         final PolyglotEngine.Value evalSource = vm().eval(source);
-        final PolyglotEngine.Value invokeMul = evalSource.invoke(null, firstVar, secondVar);
+        final PolyglotEngine.Value invokeMul = evalSource.execute(firstVar, secondVar);
         Object result = invokeMul.get();
         assertTrue("Expecting numeric result, was:" + result, result instanceof Number);
         assertEquals("Right value", 42, ((Number) result).intValue());
@@ -659,7 +778,7 @@
         final String compoundObjectName = compoundObject();
         PolyglotEngine.Value s = vm().findGlobalSymbol(compoundObjectName);
         assert s != null : "Symbol " + compoundObjectName + " is not found!";
-        final PolyglotEngine.Value value = s.invoke(null);
+        final PolyglotEngine.Value value = s.execute();
         CompoundObject obj = value.as(CompoundObject.class);
         assertNotNull("Compound object for " + value + " found", obj);
         int traverse = RANDOM.nextInt(10);
--- a/truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServer.java	Mon Dec 07 20:48:29 2015 -0800
+++ b/truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServer.java	Mon Dec 07 21:17:46 2015 -0800
@@ -304,7 +304,7 @@
             }
             this.steppingInto = stepInto;
             try {
-                return symbol.invoke(null, args.toArray(new Object[0])).get();
+                return symbol.execute(args.toArray(new Object[0])).get();
             } finally {
                 this.steppingInto = false;
             }