From ebd62b387d77502f685fcacbb701adc1cdce26a7 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 25 Dec 2018 02:04:48 +0100 Subject: Don't generate pop 0 --- Sjit/Compile.icl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sjit/Compile.icl b/Sjit/Compile.icl index 55b8ff3..8fd81a2 100644 --- a/Sjit/Compile.icl +++ b/Sjit/Compile.icl @@ -156,7 +156,9 @@ where # args = if (args=:[]) [Int 0] args = foldM (flip expr) cs (reverse args) >>= \cs -> case get f cs.funs of Nothing -> Left ("undefined function '" +++ toString f +++ "'") - Just f -> gen [Pop (length args-1),Call f] cs + Just f -> case length args of + 1 -> gen [Call f] cs + n -> gen [Pop (n-1),Call f] cs expr (If b t e) cs = expr b cs >>= reserve -1 >>= \(jmptrue,cs=:{sp=orgsp}) -> -- cgit v1.2.3