summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GenerateBC.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/GF/Compile/GenerateBC.hs')
-rw-r--r--src/compiler/GF/Compile/GenerateBC.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/GF/Compile/GenerateBC.hs b/src/compiler/GF/Compile/GenerateBC.hs
index d8edac270..7050abd55 100644
--- a/src/compiler/GF/Compile/GenerateBC.hs
+++ b/src/compiler/GF/Compile/GenerateBC.hs
@@ -60,19 +60,21 @@ compileEquations gr arity st (i:is) eqs fl bs = whilePP eqs Map.empty
(bs2,instrs2) = compileEquations gr arity st (i:is) eqs fl (instrs2:bs1)
in (bs2,instrs1)
- case_instr t n =
+ case_instr t =
case t of
- (Q (_,id)) -> CASE (i2i id) n
+ (Q (_,id)) -> CASE (i2i id)
(EInt n) -> CASE_LIT (LInt n)
(K s) -> CASE_LIT (LStr s)
(EFloat d) -> CASE_LIT (LFlt d)
+ saves n = reverse [SAVE i | i <- [0..n-1]]
+
compileBranch0 fl bs ((t,n),eqs) =
let (bs1,instrs) = compileEquations gr arity (st+n) (push_is (st+n-1) n is) eqs fl bs
- in (bs1, case_instr t n (length bs1) : instrs)
+ in (bs1, case_instr t (length bs1) : saves n ++ instrs)
compileBranch l bs ((t,n),eqs) =
- let (bs1,instrs) = compileEquations gr arity (st+n) (push_is (st+n-1) n is) eqs fl ((case_instr t n (length bs1) : instrs) : bs)
+ let (bs1,instrs) = compileEquations gr arity (st+n) (push_is (st+n-1) n is) eqs fl ((case_instr t (length bs1) : saves n ++ instrs) : bs)
in bs1
mkFail arity st1 Nothing