Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java @ 16960:e01b0b9a5f88
SL/Instrumentation: Fixing SLContext to use SLInstrumenter
author | David Piorkowski <david.piorkowski@oracle.com> |
---|---|
date | Tue, 26 Aug 2014 18:22:31 -0700 |
parents | 997899955e72 |
children | 8fd42ea95f64 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Tue Aug 26 15:48:37 2014 -0700 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Tue Aug 26 18:22:31 2014 -0700 @@ -23,6 +23,7 @@ package com.oracle.truffle.sl.runtime; import java.io.*; +import java.util.*; import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; @@ -33,6 +34,7 @@ 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.*; @@ -154,6 +156,17 @@ 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); }