diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-10-26 11:40:12 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-10-26 11:40:12 +0000 |
| commit | efedec187cef6e422c4dbcd50454dd2e29f1a3f8 (patch) | |
| tree | b98d59e2fc86dddb3d85aae46685d6186e3b312c /src/compiler/GF/Compile/GenerateBC.hs | |
| parent | 6986f1acd776e177e53332d3d1a9b4a582ceb5ef (diff) | |
an explicit SAVE instruction
Diffstat (limited to 'src/compiler/GF/Compile/GenerateBC.hs')
| -rw-r--r-- | src/compiler/GF/Compile/GenerateBC.hs | 10 |
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 |
