diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java @ 22240:f78c72e2e0b6

Truffle/Instrumentation: clean up, better encapsulate how the application of ASTProbers is managed - Guest Language RootNode implementations no longer involved - ASTProbers are now applied only to RootNodes - Methods renamed to clarify flow of control - Allowed removal of one Accessor instance - Remove tracing overhead when there are no ASTProbers registered
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 22 Sep 2015 20:25:58 -0700
parents cccb1ac700bd
children 3c73d029b651
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Tue Sep 22 15:10:25 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Tue Sep 22 20:25:58 2015 -0700
@@ -59,7 +59,6 @@
     private static Accessor API;
     private static Accessor SPI;
     private static Accessor NODES;
-    private static Accessor INTEROP;
     private static Accessor INSTRUMENT;
     private static Accessor DEBUG;
     private static final ThreadLocal<Object> CURRENT_VM = new ThreadLocal<>();
@@ -162,11 +161,6 @@
                 throw new IllegalStateException();
             }
             NODES = this;
-        } else if (this.getClass().getSimpleName().endsWith("Interop")) {
-            if (INTEROP != null) {
-                throw new IllegalStateException();
-            }
-            INTEROP = this;
         } else if (this.getClass().getSimpleName().endsWith("Instrument")) {
             if (INSTRUMENT != null) {
                 throw new IllegalStateException();
@@ -268,7 +262,7 @@
         if (known == null) {
             vm = CURRENT_VM.get();
             if (vm == null) {
-                throw new IllegalStateException();
+                throw new IllegalStateException("Accessor.findLanguage access to vm");
             }
             if (languageClass == null) {
                 return null;
@@ -284,7 +278,7 @@
         if (known == null) {
             vm = CURRENT_VM.get();
             if (vm == null) {
-                throw new IllegalStateException();
+                throw new IllegalStateException("Accessor.findLanguageImpl access to vm");
             }
         } else {
             vm = known;
@@ -297,7 +291,7 @@
         if (known == null) {
             vm = CURRENT_VM.get();
             if (vm == null) {
-                throw new IllegalStateException();
+                throw new IllegalStateException("Accessor.getInstrumenter access to vm");
             }
         } else {
             vm = known;
@@ -367,7 +361,8 @@
         return API.findLanguage(env);
     }
 
-    protected void applyInstrumentation(Node node) {
-        INSTRUMENT.applyInstrumentation(node);
+    /** Applies all registered {@linkplain ASTProber probers} to the AST. */
+    protected void probeAST(RootNode rootNode) {
+        INSTRUMENT.probeAST(rootNode);
     }
 }