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%2Finternal%2Fcodegen%2Fssa%2Fstatements%2FLetApply.java;h=2733868cf06d312ac82f0a687840b4ca4a2420ff;hp=210e3ded3243fc20755dd4553dd19bd309f0d0ba;hb=cc611d5d42a8d44c967dccdc201e0569b692e0c9;hpb=5d9fc12394233b008d38f43105d971a6ab8dfae6 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java index 210e3ded3..2733868cf 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java @@ -15,6 +15,7 @@ import org.simantics.scl.compiler.internal.codegen.ssa.SSAExit; import org.simantics.scl.compiler.internal.codegen.ssa.SSAFunction; import org.simantics.scl.compiler.internal.codegen.ssa.SSAStatement; import org.simantics.scl.compiler.internal.codegen.ssa.binders.BoundVarBinder; +import org.simantics.scl.compiler.internal.codegen.ssa.binders.ClosureBinder; import org.simantics.scl.compiler.internal.codegen.ssa.binders.ValRefBinder; import org.simantics.scl.compiler.internal.codegen.ssa.exits.Jump; import org.simantics.scl.compiler.internal.codegen.ssa.exits.Switch; @@ -30,8 +31,12 @@ 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; public class LetApply extends LetStatement implements ValRefBinder { + private static final Logger LOGGER = LoggerFactory.getLogger(LetApply.class); + private ValRef function; private ValRef[] parameters; Type effect; @@ -356,8 +361,17 @@ public class LetApply extends LetStatement implements ValRefBinder { SSABlock headBlock = getParent(); SSAFunction thisFunction = headBlock.getParent(); - if(thisFunction == function) - return; + { + SSAFunction curParent=thisFunction; + while(true) { + if(curParent == function) + return; + ClosureBinder binder = curParent.getParent(); + if(binder == null) + break; + curParent = binder.getParentFunction(); + } + } /*System.out.println("--- INLINING -------------------------------"); System.out.println(thisFunction);