use of com.googlecode.aviator.runtime.LambdaFunctionBootstrap in project aviatorscript by killme2008.
the class InterpretCodeGenerator method onLambdaBodyEnd.
@Override
public void onLambdaBodyEnd(final Token<?> lookhead) {
// this.lambdaGenerator.compileCallMethod();
LambdaFunctionBootstrap bootstrap = this.lambdaGenerator.getLmabdaBootstrap();
if (this.lambdaBootstraps == null) {
// keep in order
this.lambdaBootstraps = new LinkedHashMap<String, LambdaFunctionBootstrap>();
}
this.lambdaBootstraps.put(bootstrap.getName(), bootstrap);
genNewLambdaCode(bootstrap);
this.parser.restoreScope(this.lambdaGenerator.getScopeInfo());
this.lambdaGenerator = null;
this.parser.setCodeGenerator(this.parentCodeGenerator);
}
use of com.googlecode.aviator.runtime.LambdaFunctionBootstrap in project aviatorscript by killme2008.
the class OptimizeCodeGenerator method onLambdaBodyEnd.
@Override
public void onLambdaBodyEnd(final Token<?> lookhead) {
// this.lambdaGenerator.compileCallMethod();
LambdaFunctionBootstrap bootstrap = this.lambdaGenerator.getLmabdaBootstrap();
if (this.lambdaBootstraps == null) {
this.lambdaBootstraps = new HashMap<String, LambdaFunctionBootstrap>();
}
this.lambdaBootstraps.put(bootstrap.getName(), bootstrap);
DelegateToken token = new DelegateToken(lookhead, DelegateTokenType.Lambda_New);
token.setLambdaFunctionBootstrap(bootstrap);
this.tokenList.add(token);
this.parser.restoreScope(this.lambdaGenerator.getScopeInfo());
this.lambdaGenerator = null;
this.parser.setCodeGenerator(this.parentCodeGenerator);
}
use of com.googlecode.aviator.runtime.LambdaFunctionBootstrap in project aviatorscript by killme2008.
the class ASMCodeGenerator method onLambdaBodyEnd.
@Override
public void onLambdaBodyEnd(final Token<?> lookhead) {
// this.lambdaGenerator.compileCallMethod();
LambdaFunctionBootstrap bootstrap = this.lambdaGenerator.getLmabdaBootstrap();
if (this.lambdaBootstraps == null) {
// keep in order
this.lambdaBootstraps = new LinkedHashMap<String, LambdaFunctionBootstrap>();
}
this.lambdaBootstraps.put(bootstrap.getName(), bootstrap);
visitLineNumber(lookhead);
genNewLambdaCode(bootstrap);
this.parser.restoreScope(this.lambdaGenerator.getScopeInfo());
this.lambdaGenerator = null;
this.parser.setCodeGenerator(this.parentCodeGenerator);
}
use of com.googlecode.aviator.runtime.LambdaFunctionBootstrap 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);
}
}
}
}
Aggregations