Search in sources :

Example 1 with IR

use of com.googlecode.aviator.code.interpreter.IR in project aviatorscript by killme2008.

the class InterpretExpression method traceInstruments.

private void traceInstruments(final Map<String, Object> env, final String name, final boolean traceLambda) {
    int pc = 0;
    RuntimeUtils.printlnTrace(env, (name == null ? this.sourceFile : name) + " instruments: ");
    for (IR ir : this.instruments) {
        RuntimeUtils.printlnTrace(env, "    " + (pc++) + " " + ir.toString());
    }
    RuntimeUtils.printlnTrace(env, "    " + pc + " return");
    if (this.lambdaBootstraps != null) {
        final List<LambdaFunctionBootstrap> bootstraps = new ArrayList<>(this.lambdaBootstraps.values());
        Collections.sort(bootstraps);
        for (LambdaFunctionBootstrap bootstrap : bootstraps) {
            final Expression exp = bootstrap.getExpression();
            if (exp instanceof InterpretExpression) {
                InterpretExpression iexp = (InterpretExpression) exp;
                iexp.traceInstruments(env, bootstrap.getName(), traceLambda);
            } else {
                RuntimeUtils.printlnTrace(env, bootstrap.getName() + " instruments: " + exp);
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) LoadIR(com.googlecode.aviator.code.interpreter.ir.LoadIR) IR(com.googlecode.aviator.code.interpreter.IR) LambdaFunctionBootstrap(com.googlecode.aviator.runtime.LambdaFunctionBootstrap)

Aggregations

IR (com.googlecode.aviator.code.interpreter.IR)1 LoadIR (com.googlecode.aviator.code.interpreter.ir.LoadIR)1 LambdaFunctionBootstrap (com.googlecode.aviator.runtime.LambdaFunctionBootstrap)1 ArrayList (java.util.ArrayList)1