diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java @ 18485:e3c95cbbb50c

Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Sun, 23 Nov 2014 16:07:23 -0800
parents 997bc9764a9a
children 0ef23ff7d5a1
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java	Fri Nov 21 13:16:02 2014 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java	Sun Nov 23 16:07:23 2014 -0800
@@ -23,19 +23,16 @@
 package com.oracle.truffle.sl.runtime;
 
 import java.io.*;
-import java.util.*;
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.instrument.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.object.*;
 import com.oracle.truffle.api.source.*;
 import com.oracle.truffle.sl.*;
 import com.oracle.truffle.sl.builtins.*;
 import com.oracle.truffle.sl.nodes.*;
-import com.oracle.truffle.sl.nodes.instrument.*;
 import com.oracle.truffle.sl.nodes.local.*;
 import com.oracle.truffle.sl.parser.*;
 
@@ -56,7 +53,6 @@
     private final PrintStream output;
     private final SLFunctionRegistry functionRegistry;
     private final Shape emptyShape;
-    private SourceCallback sourceCallback = null;
 
     public SLContext(BufferedReader input, PrintStream output) {
         this.input = input;
@@ -72,11 +68,6 @@
         return "Simple";
     }
 
-    @Override
-    public void setSourceCallback(SourceCallback sourceCallback) {
-        this.sourceCallback = sourceCallback;
-    }
-
     /**
      * Returns the default input, i.e., the source for the {@link SLReadlnBuiltin}. To allow unit
      * testing, we do not use {@link System#in} directly.
@@ -100,10 +91,6 @@
         return functionRegistry;
     }
 
-    public SourceCallback getSourceCallback() {
-        return sourceCallback;
-    }
-
     /**
      * Adds all builtin functions to the {@link SLFunctionRegistry}. This method lists all
      * {@link SLBuiltinNode builtin implementation classes}.
@@ -158,28 +145,7 @@
      * @param source The {@link Source} to execute.
      */
     public void executeMain(Source source) {
-
-        if (sourceCallback != null) {
-            sourceCallback.startLoading(source);
-        }
-
         Parser.parseSL(this, source);
-
-        List<SLFunction> functionList = getFunctionRegistry().getFunctions();
-
-        // Since only functions can be global in SL, this guarantees that we instrument
-        // everything of interest. Parsing must occur before accepting the visitors since
-        // the visitor which creates our instrumentation points expects a complete AST.
-
-        for (SLFunction function : functionList) {
-            RootCallTarget rootCallTarget = function.getCallTarget();
-            rootCallTarget.getRootNode().accept(new SLInstrumenter());
-        }
-
-        if (sourceCallback != null) {
-            sourceCallback.endLoading(source);
-        }
-
         SLFunction main = getFunctionRegistry().lookup("main");
         if (main.getCallTarget() == null) {
             throw new SLException("No function main() defined in SL source file.");