summaryrefslogtreecommitdiff
path: root/VM.hs
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2019-11-20 22:47:52 +0100
committerTom Smeding <tom.smeding@gmail.com>2019-11-20 23:06:45 +0100
commitd541e0f84ae8f82f70e2393207d359975841facf (patch)
tree7a1618c9379b05d6645e67db29af6b7171194c20 /VM.hs
parent2cafab14203878f355a531fc6a3763881a52b108 (diff)
lambdarec for singly-recursive lambda's
Diffstat (limited to 'VM.hs')
-rw-r--r--VM.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/VM.hs b/VM.hs
index 1250c1e..7762b75 100644
--- a/VM.hs
+++ b/VM.hs
@@ -81,7 +81,8 @@ vmRunInstr info@(Info bbmap gfds datas) state@(State { sTempMap = tmap, sArgs =
(rv, _) <- vmRunBB info (state { sArgs = map (findRef tmap) as, sCloVals = clvals }) bb
return (assignRef state dest rv)
Nothing -> do
- (rv, state') <- vmRunBuiltin state clname (map (findRef tmap) as)
+ -- Take 'tail as' to skip the first self-link argument
+ (rv, state') <- vmRunBuiltin state clname (map (findRef tmap) (tail as))
return (assignRef state' dest rv)
obj -> error $ "VM: Cannot call non-closure object: " ++ show obj
IAllocClo name clrefs -> return (assignRef state dest (RVClosure name (map (findRef tmap) clrefs)))