From 0861b325fcbbfa8c5985f1e11cfc39154a3808d1 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 12 Feb 2020 13:52:18 +0200 Subject: [PATCH] Make it possible to debug SCL compiler in production builds gitlab #465 Change-Id: Ie032c198f9e9aa9d21a41c0b223c6534a2b070f5 --- .../compiler/compilation/CodeGeneration.java | 52 ++++++++++--------- .../scl/compiler/constants/Constant.java | 8 ++- .../scl/compiler/constants/FunctionValue.java | 18 ++++--- .../expressions/ETransformation.java | 7 ++- .../internal/codegen/ssa/SSAModule.java | 11 ++-- .../internal/codegen/utils/ClassBuilder.java | 8 ++- .../codegen/utils/LoggingOutputStream.java | 50 ++++++++++++++++++ .../internal/codegen/utils/ModuleBuilder.java | 11 ++-- .../utils/SSASimplificationContext.java | 6 +-- .../constraints/ConstraintSolver.java | 32 +++++++----- .../module/repository/ModuleRepository.java | 11 ++-- .../scl/compiler/runtime/RuntimeModule.java | 14 ++--- .../scl/compiler/top/ExpressionEvaluator.java | 24 +++++---- .../top/SCLCompilerConfiguration.java | 47 +++++++++-------- 14 files changed, 201 insertions(+), 98 deletions(-) create mode 100644 bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/LoggingOutputStream.java diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CodeGeneration.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CodeGeneration.java index 082fa2f6d..f0b9f735e 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CodeGeneration.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CodeGeneration.java @@ -53,12 +53,16 @@ import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.exceptions.MatchException; import org.simantics.scl.compiler.types.util.MultiFunction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.procedure.TObjectObjectProcedure; import gnu.trove.procedure.TObjectProcedure; public class CodeGeneration { - + + private static final Logger LOGGER = LoggerFactory.getLogger(CodeGeneration.class); + public static final int OPTIMIZATION_PHASES = 2; CompilationContext compilationContext; @@ -85,11 +89,11 @@ public class CodeGeneration { } public void simplifyValues() { - //System.out.println("===== Simplify values ====="); + //LOGGER.info("===== Simplify values ====="); Collection values = module.getValues(); SimplificationContext simplificationContext = new SimplificationContext(compilationContext, validator); - //System.out.println("-----------------------------------------------"); + //LOGGER.info("-----------------------------------------------"); SCLValue[] valueArray = values.toArray(new SCLValue[values.size()]); for(SCLValue value : valueArray) { @@ -101,16 +105,16 @@ public class CodeGeneration { // Simplify for(SCLValue value : valueArray) { - //System.out.println("BEFORE " + value.getName() + " = " + value.getExpression()); + //LOGGER.info("BEFORE " + value.getName() + " = " + value.getExpression()); value.getSimplifiedExpression(simplificationContext); - //System.out.println("AFTER " + value.getName() + " = " + value.getExpression()); + //LOGGER.info("AFTER " + value.getName() + " = " + value.getExpression()); } } public void convertToSSA() { ModuleWriter mw = new ModuleWriter(compilationContext.namingPolicy.getModuleClassName(), compilationContext.lineLocator); for(SCLValue value : module.getValues()) { - //System.out.println(value.getName().name + " :: " + value.getType()); + //LOGGER.info(value.getName().name + " :: " + value.getType()); Expression expression = value.getExpression(); if(expression == null) continue; @@ -149,7 +153,7 @@ public class CodeGeneration { if(constant.getTypeParameters().length > 0) continue; - //System.out.println(value.getName() + " <- " + constant.getValue().getName()); + //LOGGER.info(value.getName() + " <- " + constant.getValue().getName()); value.setValue(constant.getValue().getValue()); value.setExpression(null); // HMM?? }*/ @@ -190,24 +194,24 @@ public class CodeGeneration { public void optimizeSSA() { if(SCLCompilerConfiguration.SHOW_SSA_BEFORE_OPTIMIZATION && SCLCompilerConfiguration.debugFilter(module.getName())) { - System.out.println("=== SSA before optimization ===================================="); - System.out.println(ssaModule); + LOGGER.info("=== SSA before optimization ===================================="); + LOGGER.info("{}", ssaModule); } if(SCLCompilerConfiguration.DEBUG) ssaModule.validate(); int optCount = 0; for(int phase=0;phase functions = new THashMap(); ArrayList staticFields = new ArrayList(); public ArrayList closuresToGenerate = new ArrayList(); @@ -70,11 +75,11 @@ public class SSAModule { try { function.getDefinition().validate(context); } catch(RuntimeException e) { - System.out.println("-- VALIDATE " + function.getName() + " ----------------"); + LOGGER.info("-- VALIDATE " + function.getName() + " ----------------"); PrintingContext printingContext = new PrintingContext(); printingContext.setErrorMarker(context.errorMarker); function.getDefinition().toString(printingContext); - System.out.println(printingContext.toString()); + LOGGER.info(printingContext.toString()); throw e; } } @@ -104,7 +109,7 @@ public class SSAModule { public void generateCode(final ModuleBuilder moduleBuilder) throws CodeBuildingException { final String moduleClassName = moduleBuilder.getNamingPolicy().getModuleClassName(); if(SCLCompilerConfiguration.TRACE_METHOD_CREATION) - System.out.println("Create class " + moduleClassName); + LOGGER.info("Create class " + moduleClassName); final ClassBuilder classFile = new ClassBuilder(moduleBuilder, Opcodes.ACC_PUBLIC, moduleClassName, "java/lang/Object"); classFile.setSourceFile(moduleBuilder.getNamingPolicy().getModuleName()); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ClassBuilder.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ClassBuilder.java index 5316b861d..e0571dbd3 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ClassBuilder.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ClassBuilder.java @@ -11,9 +11,15 @@ import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.CodeSizeEvaluator; import org.objectweb.asm.util.TraceClassVisitor; +import org.simantics.scl.compiler.internal.codegen.utils.LoggingOutputStream.LogLevel; import org.simantics.scl.compiler.top.SCLCompilerConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ClassBuilder { + + private static final Logger LOGGER = LoggerFactory.getLogger(ClassBuilder.class); + ModuleBuilder moduleBuilder; String className; String superClassName; @@ -30,7 +36,7 @@ public class ClassBuilder { this.classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS); this.classVisitor = SCLCompilerConfiguration.SHOW_COMPILED_BYTECODE && SCLCompilerConfiguration.debugFilter(moduleBuilder.namingPolicy.getModuleName()) - ? new TraceClassVisitor(classWriter, new PrintWriter(System.out)) + ? new TraceClassVisitor(classWriter, new PrintWriter(new LoggingOutputStream(LOGGER, LogLevel.INFO))) : classWriter; classVisitor.visit(Opcodes.V1_5, access, className, null, superClassName, interfaces); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/LoggingOutputStream.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/LoggingOutputStream.java new file mode 100644 index 000000000..cc87e84bd --- /dev/null +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/LoggingOutputStream.java @@ -0,0 +1,50 @@ +package org.simantics.scl.compiler.internal.codegen.utils; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.slf4j.Logger; + +public class LoggingOutputStream extends OutputStream { + + private final ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); + private final Logger logger; + private final LogLevel level; + + public enum LogLevel { + TRACE, DEBUG, INFO, WARN, ERROR, + } + + public LoggingOutputStream(Logger logger, LogLevel level) { + this.logger = logger; + this.level = level; + } + + @Override + public void write(int b) { + if (b == '\n') { + String line = baos.toString(); + baos.reset(); + + switch (level) { + case TRACE: + logger.trace(line); + break; + case DEBUG: + logger.debug(line); + break; + case ERROR: + logger.error(line); + break; + case INFO: + logger.info(line); + break; + case WARN: + logger.warn(line); + break; + } + } else { + baos.write(b); + } + } +} diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ModuleBuilder.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ModuleBuilder.java index 32d428339..3008cac78 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ModuleBuilder.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ModuleBuilder.java @@ -13,10 +13,15 @@ import org.simantics.scl.compiler.internal.codegen.references.Val; import org.simantics.scl.compiler.internal.codegen.types.JavaTypeTranslator; import org.simantics.scl.compiler.top.SCLCompilerConfiguration; import org.simantics.scl.compiler.types.Type; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.THashMap; public class ModuleBuilder { + + private static final Logger LOGGER = LoggerFactory.getLogger(ModuleBuilder.class); + JavaNamingPolicy namingPolicy; JavaTypeTranslator javaTypeTranslator; @@ -29,7 +34,7 @@ public class ModuleBuilder { public void addClass(ClassBuilder cb) { byte[] bytecode = cb.finishClass(); classes.put(cb.getClassName(), bytecode); - //System.out.println("Added " + cb.getClassName()); + //LOGGER.info("Added " + cb.getClassName()); } public JavaTypeTranslator getJavaTypeTranslator() { @@ -86,7 +91,7 @@ public class ModuleBuilder { ClassBuilder classBuilder; if(remainingArity <= Constants.MAX_FUNCTION_PARAMETER_COUNT) { if(SCLCompilerConfiguration.TRACE_METHOD_CREATION) - System.out.println("Create class " + className); + LOGGER.info("Create class " + className); classBuilder = new ClassBuilder(this, Opcodes.ACC_PUBLIC, className, MethodBuilderBase.getClassName(Constants.FUNCTION_IMPL[remainingArity])); classBuilder.setSourceFile("_SCL_Closure"); @@ -114,7 +119,7 @@ public class ModuleBuilder { } else { if(SCLCompilerConfiguration.TRACE_METHOD_CREATION) - System.out.println("Create class " + className); + LOGGER.info("Create class " + className); classBuilder = new ClassBuilder(this, Opcodes.ACC_PUBLIC, className, MethodBuilderBase.getClassName(Constants.FUNCTION_N_IMPL)); classBuilder.setSourceFile("_SCL_Closure"); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SSASimplificationContext.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SSASimplificationContext.java index aea1c033b..f7c6d3097 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SSASimplificationContext.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SSASimplificationContext.java @@ -25,7 +25,7 @@ public class SSASimplificationContext { public void markModified(String description) { if(SCLCompilerConfiguration.PRINT_OPTIMIZATION_TRANSFORMATIONS) - System.out.println("(" + modiId + ") DID " + description); + LOGGER.info("(" + modiId + ") DID " + description); modified = true; if(SCLCompilerConfiguration.VALIDATE_AFTER_OPTIMIZATIONS) module.validate(); @@ -55,8 +55,8 @@ public class SSASimplificationContext { } public void printConstant(Name name) { - System.out.println("--- " + name + " ---------------------------"); - System.out.println(module.get(name)); + LOGGER.info("--- " + name + " ---------------------------"); + LOGGER.info("{}", module.get(name)); } public void validate() { diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSolver.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSolver.java index 69b8e7e64..1cdeea71d 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSolver.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSolver.java @@ -16,12 +16,16 @@ import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.exceptions.UnificationException; import org.simantics.scl.compiler.types.util.TConComparator; import org.simantics.scl.compiler.types.util.TypeUnparsingContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; public class ConstraintSolver { + private static final Logger LOGGER = LoggerFactory.getLogger(ConstraintSolver.class); + public static THashSet DEFAULTS_IGNORE = new THashSet(); public static THashMap, Type> DEFAULTS = new THashMap, Type>(); @@ -60,14 +64,14 @@ public class ConstraintSolver { TypeUnparsingContext tuc = SCLCompilerConfiguration.TRACE_CONSTRAINT_SOLVER ? new TypeUnparsingContext() : null; if(SCLCompilerConfiguration.TRACE_CONSTRAINT_SOLVER) { - System.out.println(); - System.out.println("GIVEN:"); + LOGGER.info(""); + LOGGER.info("GIVEN:"); for(TPred g : given) - System.out.println(" " + g.toString(tuc)); - System.out.println("DEMANDS:"); + LOGGER.info(" " + g.toString(tuc)); + LOGGER.info("DEMANDS:"); for(EVariable demand : demands) - System.out.println(" " + demand.getType().toString(tuc)); - System.out.println("==>"); + LOGGER.info(" " + demand.getType().toString(tuc)); + LOGGER.info("==>"); } ConstraintSet cs = new ConstraintSet(environment); @@ -91,11 +95,11 @@ public class ConstraintSolver { ArrayList> groups = groupConstraintsByCommonMetavars(unsolvedConstraints); if(SCLCompilerConfiguration.TRACE_CONSTRAINT_SOLVER) { - System.out.println("DEFAULT GROUPS:"); + LOGGER.info("DEFAULT GROUPS:"); for(ArrayList group : groups) { for(Constraint c : group) - System.out.println(" " + c.constraint.toString(tuc)); - System.out.println(" --"); + LOGGER.info(" " + c.constraint.toString(tuc)); + LOGGER.info(" --"); } } @@ -173,13 +177,13 @@ public class ConstraintSolver { } if(SCLCompilerConfiguration.TRACE_CONSTRAINT_SOLVER) { - System.out.println("UNSOLVED:"); + LOGGER.info("UNSOLVED:"); for(Constraint c : unsolvedConstraints) - System.out.println(" " + c.constraint.toString(tuc)); - System.out.println("SOLVED:"); + LOGGER.info(" " + c.constraint.toString(tuc)); + LOGGER.info("SOLVED:"); for(Constraint c : solvedConstraints) - System.out.println(" " + c.constraint.toString(tuc) + " <= " + c.generator); - //System.out.println("APPLY DEFAULTS: " + applyDefaults); + LOGGER.info(" " + c.constraint.toString(tuc) + " <= " + c.generator); + //LOGGER.info("APPLY DEFAULTS: " + applyDefaults); } return new ReducedConstraints(givenConstraints, diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java index a6650e9a4..79b596908 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepository.java @@ -37,6 +37,8 @@ import org.simantics.scl.compiler.top.ModuleInitializer; import org.simantics.scl.compiler.top.SCLCompilerConfiguration; import org.simantics.scl.compiler.top.ValueNotFound; import org.simantics.scl.compiler.types.Types; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TObjectLongHashMap; @@ -49,6 +51,9 @@ import gnu.trove.set.hash.THashSet; * @author Hannu Niemistö */ public class ModuleRepository { + + private static final Logger LOGGER = LoggerFactory.getLogger(ModuleRepository.class); + private final ModuleRepository parentRepository; private final ModuleSourceRepository sourceRepository; private ConcurrentHashMap moduleCache = new ConcurrentHashMap(); @@ -120,9 +125,9 @@ public class ModuleRepository { if(moduleCache.get(moduleName) == this) { moduleCache.remove(moduleName); if(SCLCompilerConfiguration.TRACE_MODULE_UPDATE) { - System.out.println("Invalidate " + moduleName); + LOGGER.info("Invalidate " + moduleName); for(UpdateListener l : listenersCopy) - System.out.println(" " + l); + LOGGER.info(" " + l); } for(UpdateListener l : listenersCopy) if(!l.stopListening()) @@ -141,7 +146,7 @@ public class ModuleRepository { compilationResult = DoesNotExist.getInstance(); else { if(SCLCompilerConfiguration.TRACE_MODULE_UPDATE) - System.out.println("Compile " + source); + LOGGER.info("Compile " + source); beginModuleCompilation(moduleName); compilationResult = source.compileModule(ModuleRepository.this, this, advisor == null ? null : advisor.getOptions(moduleName)); finishModuleCompilation(moduleName); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java index 5ae73c412..4893f6840 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java @@ -13,6 +13,8 @@ import org.simantics.scl.compiler.environment.Environment; import org.simantics.scl.compiler.environment.GlobalOnlyEnvironment; import org.simantics.scl.compiler.internal.codegen.types.JavaTypeTranslator; import org.simantics.scl.compiler.internal.codegen.utils.JavaNamingPolicy; +import org.simantics.scl.compiler.internal.codegen.utils.LoggingOutputStream; +import org.simantics.scl.compiler.internal.codegen.utils.LoggingOutputStream.LogLevel; import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder; import org.simantics.scl.compiler.internal.decompilation.DecompilerFactory; import org.simantics.scl.compiler.internal.decompilation.IDecompiler; @@ -50,7 +52,7 @@ public class RuntimeModule { public synchronized void addClass(String name, byte[] class_) { if(TRACE_CLASS_CREATION) - System.out.println("addClass " + name + " (" + class_.length + " bytes)"); + LOGGER.info("addClass " + name + " (" + class_.length + " bytes)"); if(VALIDATE_CLASS_NAMES) validateClassName(name); localClasses.put(name, class_); @@ -59,7 +61,7 @@ public class RuntimeModule { public synchronized void addClasses(Map classes) { if(TRACE_CLASS_CREATION) for(String name : classes.keySet()) - System.out.println("addClass " + name + " (" + classes.get(name).length + " bytes)"); + LOGGER.info("addClass " + name + " (" + classes.get(name).length + " bytes)"); if(VALIDATE_CLASS_NAMES) for(String name : classes.keySet()) validateClassName(name); @@ -67,7 +69,7 @@ public class RuntimeModule { } private void validateClassName(String name) { - //System.out.println(name); + //LOGGER.info(name); /*if(!name.startsWith(SCL_PACKAGE_PREFIX) || !extractClassLoaderId(name).equals(moduleName)) throw new IllegalArgumentException("Class name " + name + " does not start with '" + SCL_PACKAGE_PREFIX + moduleName + "$'."); @@ -123,7 +125,7 @@ public class RuntimeModule { } private Class getClass(String name) throws ClassNotFoundException { - //System.out.println("getClass " + name); + //LOGGER.info("getClass " + name); // If the class is not generated from SCL, use parent class loader if(!name.startsWith(SCL_PACKAGE_PREFIX)) { @@ -169,7 +171,7 @@ public class RuntimeModule { } public Module getModule(String moduleName) { - //System.out.println("ModuleClassLoader.getModule(" + moduleName + ")"); + //LOGGER.info("ModuleClassLoader.getModule(" + moduleName + ")"); if(moduleName.equals(this.moduleName)) return module; else { @@ -203,7 +205,7 @@ public class RuntimeModule { IDecompiler decompiler = DecompilerFactory.getDecompiler(); if(decompiler == null) return; - decompiler.decompile(this, className, new OutputStreamWriter(System.out)); + decompiler.decompile(this, className, new OutputStreamWriter(new LoggingOutputStream(LOGGER, LogLevel.INFO))); } } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java index b51b188cd..f14a3be96 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java @@ -58,11 +58,15 @@ import org.simantics.scl.compiler.types.util.Polarity; import org.simantics.scl.compiler.types.util.ProcedureType; import org.simantics.scl.runtime.function.FunctionImpl1; import org.simantics.scl.runtime.tuple.Tuple0; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; import gnu.trove.set.hash.THashSet; public class ExpressionEvaluator { + private static final Logger LOGGER = LoggerFactory.getLogger(ExpressionEvaluator.class); + public static final boolean TRACE_INTERPRETATION_VS_COMPILATION = false; private static final String COMPUTATION_METHOD_NAME = "main"; @@ -225,7 +229,7 @@ public class ExpressionEvaluator { } } catch(SCLSyntaxErrorException e) { errorLog.log(e.location, e.getMessage()); - //System.out.println(errorLog.getErrorsAsString()); + //LOGGER.info(errorLog.getErrorsAsString()); throw new SCLExpressionCompilationException(errorLog.getErrors()); } catch(Exception e) { errorLog.log(e); @@ -348,7 +352,7 @@ public class ExpressionEvaluator { throw new SCLExpressionCompilationException(errorLog.getErrors()); if(SCLCompilerConfiguration.SHOW_EXPRESSION_BEFORE_EVALUATION) - System.out.println(expression); + LOGGER.info("{}", expression); if(interpretIfPossible) { // Try to interpret @@ -358,9 +362,9 @@ public class ExpressionEvaluator { new TransientClassBuilder(classLoader, javaTypeTranslator)); IExpression iexp = expression.toIExpression(expressionInterpretationContext); if(TRACE_INTERPRETATION_VS_COMPILATION) - System.out.println("INTERPRETED " + expressionText); + LOGGER.info("INTERPRETED " + expressionText); if(SCLCompilerConfiguration.SHOW_INTERPRETED_EXPRESSION) - System.out.println("INTERPRETED AS: " + iexp); + LOGGER.info("INTERPRETED AS: " + iexp); return iexp.execute(new Object[expressionInterpretationContext.getMaxVariableId()]); } catch(UnsupportedOperationException e) { // This is normal when expression cannot be interpreted. We compile it instead. @@ -400,8 +404,8 @@ public class ExpressionEvaluator { SSAModule ssaModule = mw.getModule(); if(SCLCompilerConfiguration.SHOW_SSA_BEFORE_OPTIMIZATION) { - System.out.println("=== SSA before optimization =================================="); - System.out.println(ssaModule); + LOGGER.info("=== SSA before optimization =================================="); + LOGGER.info("{}", ssaModule); } if(SCLCompilerConfiguration.DEBUG) ssaModule.validate(); @@ -412,12 +416,12 @@ public class ExpressionEvaluator { for(int phase=0;phase