diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-12-13 13:51:19 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-12-13 13:51:19 +0100 |
commit | a436e9d7c7c4115ecc397b4b103573e75aa6c8bc (patch) | |
tree | 839632246cf198da810ede9cbf757d224bdf4950 /VM.hs | |
parent | 19465d7ad8e913f2807a3512dae1cda71f2f8467 (diff) |
Honour some IDiscard instructions
Diffstat (limited to 'VM.hs')
-rw-r--r-- | VM.hs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -81,8 +81,10 @@ vmRunInstr info@(Info _ _ datas) state (dest, instr) = case instr of IAllocClo name clrefs -> let cloVals = (map (findRef (sTempMap state)) clrefs) in return (assignRef state dest (RVClosure name cloVals)) - IDiscard _ -> - return state -- TODO: erase temporary from state for IDiscard (RTemp i) + IDiscard ref -> + case ref of + RTemp i -> return (state { sTempMap = IMap.delete i (sTempMap state) }) + _ -> return state IPush refs -> return (state { sStack = map (findRef (sTempMap state)) refs ++ sStack state }) IPop refs -> |