X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftop%2FExpressionEvaluator.java;h=f14a3be967438af2e93d134e9e1024513e5eb193;hp=b51b188cda117823c4d8b0308f13eb607615aa91;hb=0861b325fcbbfa8c5985f1e11cfc39154a3808d1;hpb=edb5c89575392565d23dbfc7083617c981048c1e 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