Commit 418c23de authored by Sapphie's avatar Sapphie
Browse files

Fix halt untagging

parent a38f59ae
......@@ -34,7 +34,6 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
case H.AtomL(CharLit(c)) => L.Halt(L.AtomL(c.toInt))
case H.AtomL(BooleanLit(b)) => L.Halt(L.AtomL(if (b) 1 else 0))
case v1 @ H.AtomN(_) =>
return L.Halt(rewrite(v))
val haltContName = Symbol.fresh("c-halt")
val haltContArgs = Seq(Symbol.fresh("halt_arg"))
val haltContBody = L.Halt(L.AtomN(haltContArgs(0)))
......@@ -65,9 +64,9 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
val contName = Symbol.fresh("c-" + name)
val argName = Symbol.fresh(name + "_arg")
val shiftedName = Symbol.fresh(name + "_arg_untagged")
L.Cnt(contName, Seq(argName),
L.Cnt(contName, Seq(),
L.LetP(shiftedName, CPS.ShiftRight,
Seq(L.AtomN(argName), L.AtomL(nBitsShift)),
Seq(rewrite(v), L.AtomL(nBitsShift)),
L.AppC(haltCont, Seq(L.AtomN(shiftedName)))))
}
......@@ -94,7 +93,7 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
transformIf(L3.CharP, Seq(v), untagCharCont.name, boolCheckCont.name))
//etc
val letCBody = transformIf(L3.IntP, Seq(v), untagIntCont.name, haltCont)
val letCBody = transformIf(L3.IntP, Seq(v), untagIntCont.name, charCheckCont.name)
val conts = Seq(untagIntCont,
untagCharCont,
......
(halt (@- 1 1))
\ No newline at end of file
(let ((p (@byte-read))) (let ((p_1 (@- p 48))) (halt p_1)))
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment