]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/FunctionValue.java
Make it possible to debug SCL compiler in production builds
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / constants / FunctionValue.java
index dcef289f02763d9521532f30bc02bd7242714e52..60f54ea3c2b440fa06dd705e9682262de090c6e9 100644 (file)
@@ -21,11 +21,15 @@ import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import gnu.trove.map.hash.THashMap;
 
 public abstract class FunctionValue extends Constant {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(FunctionValue.class);
+
     TVar[] typeParameters;
     Type returnType;
     protected Type[] parameterTypes;
@@ -66,10 +70,10 @@ public abstract class FunctionValue extends Constant {
     public Type apply(MethodBuilder mb, Type[] typeParameters, Val... parameters) {
         int arity = getArity();
         
-        /*System.out.println("MONADIC APPLICATION " + this);
-        System.out.println("    call arity: " + parameters.length);
-        System.out.println("    func arity: " + arity);
-        System.out.println("    func monadic: " + isMonadic());
+        /*LOGGER.info("MONADIC APPLICATION " + this);
+        LOGGER.info("    call arity: " + parameters.length);
+        LOGGER.info("    func arity: " + arity);
+        LOGGER.info("    func monadic: " + isMonadic());
         */
         if(parameters.length < arity) {
             ModuleBuilder moduleBuilder = mb.getModuleBuilder();            
@@ -127,7 +131,7 @@ public abstract class FunctionValue extends Constant {
         ClassBuilder classFile;
         if(arity <= Constants.MAX_FUNCTION_PARAMETER_COUNT) {
             if(SCLCompilerConfiguration.TRACE_METHOD_CREATION)
-                System.out.println("Create class " + policy.getModuleClassName());
+                LOGGER.info("Create class " + policy.getModuleClassName());
             classFile = new ClassBuilder(moduleBuilder, Opcodes.ACC_PUBLIC, policy.getModuleClassName(), 
                     MethodBuilderBase.getClassName(Constants.FUNCTION_IMPL[arity]));
             classFile.setSourceFile("_SCL_FunctionValue");
@@ -144,7 +148,7 @@ public abstract class FunctionValue extends Constant {
         }
         else {
             if(SCLCompilerConfiguration.TRACE_METHOD_CREATION)
-                System.out.println("Create class " + policy.getModuleClassName());
+                LOGGER.info("Create class " + policy.getModuleClassName());
             classFile = new ClassBuilder(moduleBuilder, Opcodes.ACC_PUBLIC, policy.getModuleClassName(), 
                     MethodBuilderBase.getClassName(Constants.FUNCTION_N_IMPL));
             classFile.setSourceFile("_SCL_FunctionValue");
@@ -187,7 +191,7 @@ public abstract class FunctionValue extends Constant {
             if(valueCache != null) {
                 valueCache.put(this, result);
                 if(TRACE_REALIZATION)
-                    System.out.println("/REALIZED/ " + this + " " + getClass().getSimpleName());
+                    LOGGER.info("/REALIZED/ " + this + " " + getClass().getSimpleName());
             }
             return result;
         } catch (InstantiationException e) {