(refs #7250) Merging master, minor CHR bugfixes 90/590/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 2 Jun 2017 13:39:28 +0000 (16:39 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 2 Jun 2017 14:34:55 +0000 (17:34 +0300)
Change-Id: I11c76beee0e73ff78370f72bbfb88fdbdf6c7616

1  2 
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CodeGeneration.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRRuleset.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/SSAFunction.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java
bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/info/SCLInfo.java
tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java

index d5f61965454e80006631d98d76621fc56ba94e50,bb5491ad17111c79aa7fc30ee2742cd2ef782149..bb00f08850f8fa3cd6f21586a8b60a6e052ff640
@@@ -207,18 -123,16 +207,19 @@@ public class CHRRuleset extends Symbol 
              constraints.remove(0);
              initConstraint = null;
          }
 +    }
 +
 +    private void applyExtensibleDefaults() {
          for(CHRConstraint constraint : constraints) {
 -            constraint.plans.sort((PrioritizedPlan a, PrioritizedPlan b) -> {
 -                return Integer.compare(a.priority, b.priority);
 -            });
 -            /*System.out.println(constraint.name);
 -            for(PrioritizedPlan plan : constraint.plans) {
 -                System.out.println("  priority " + plan.priority);
 -                for(PlanOp op : plan.ops)
 -                    System.out.println("    " + op);
 -            }*/
 +            // FIXME Too much indexing!!!
 +            int max = 1 << constraint.parameterTypes.length;
 +            for(int i=0;i<max;++i)
 +                constraint.getOrCreateIndex(cachedContext, i);
++            constraint.setMayBeRemoved();
 +            /*
 +            constraint.getOrCreateIndex(cachedContext, 0);
 +            if(constraint.parameterTypes.length > 0)
 +                constraint.getOrCreateIndex(cachedContext, 1);*/
          }
      }
  
index ab643f9a15b1669be060ae165c07a403cb3888c3,ab643f9a15b1669be060ae165c07a403cb3888c3..b9e8bfbb398e0803977e305533259eb0eb6d4982
@@@ -359,6 -359,6 +359,8 @@@ public final class SSAFunction extends 
      }
  
      public void mergeBlocks(SSAFunction function) {
++        if(this == function)
++            throw new InternalCompilerError();
          SSABlock block = function.firstBlock;
          while(block != null) {
              SSABlock next = block.next;
index 6d139a4d6fda4f1927ac84b9a99f550456503d49,b8b7def598175705f4beb2cb1f3b768688afe873..400cb6e4e373f78c480e8fc37c1da3dc203a47f2
@@@ -399,7 -399,7 +399,7 @@@ public class LetApply extends LetStatem
          tailBlock.setExit(headBlock.getExit());
          
          // Merge blocks        
--        thisFunction.mergeBlocks(function);           
++        thisFunction.mergeBlocks(function);
          
          headBlock.setExit(new Jump(function.getFirstBlock().createOccurrence(), 
                  parameters));
index 33b5fc7e998fa150536ffebca29295bd08cf9f3c,63b2338f4754ff825ab57c35d16957cc9360c21b..c37a9421f53bacb3f4c310381b160e7716d32727
@@@ -35,7 -33,6 +35,8 @@@ public class SCLInfo 
          "as",
          "forall",
          "rule",
 +        "ruleset",
++        "constraint",
          "extends",
          "by",
          "select",