diff options
-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 -> |