diff options
-rw-r--r-- | mu.arc | 1 | ||||
-rw-r--r-- | mu.arc.t | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/mu.arc b/mu.arc index ef813034..757208c7 100644 --- a/mu.arc +++ b/mu.arc @@ -335,6 +335,7 @@ (point return (for ninstrs 0 (< ninstrs time-slice) (++ ninstrs) (if (empty body.routine*) (err "@stack.routine*.0!fn-name not defined")) + ; falling out of end of function = implicit reply (while (>= pc.routine* (len body.routine*)) (pop-stack routine*) (if empty.routine* (return ninstrs)) diff --git a/mu.arc.t b/mu.arc.t index 4ef4338a..b6788d9a 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -1044,6 +1044,24 @@ ;? (quit) (reset) +(new-trace "reply-increments-caller-pc") +(add-code + '((function callee [ + (reply) + ]) + (function caller [ + (1:integer <- copy 0:literal) + (2:integer <- copy 0:literal) + ]))) +(freeze-functions) +(= routine* (make-routine 'caller)) +(assert (is 0 pc.routine*)) +(push-stack routine* 'callee) ; pretend call was at first instruction of caller +(run-for-time-slice 1) +(if (~is 1 pc.routine*) + (prn "F - 'reply' should increment pc in caller (to move past calling instruction)")) + +(reset) (new-trace "new-fn-arg-sequential") (add-code '((function test1 [ @@ -2131,8 +2149,6 @@ (prn "F - an example function that checks that its oarg is an integer")) ;? (quit) -; todo - test that reply increments pc for caller frame after popping current frame - (reset) (new-trace "dispatch-otype-multiple-clauses") ;? (set dump-trace*) |