diff --git a/simulator.rkt b/simulator.rkt index 7b2e834..a795b56 100644 --- a/simulator.rkt +++ b/simulator.rkt @@ -235,7 +235,8 @@ (error 'lookup-toplevel "not a toplevel: ~s" a-top)]))] [(GetControlStackLabel? op) - m]))) + (target-updater m (frame-return (first (machine-control m))))]))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/test-simulator.rkt b/test-simulator.rkt index 3a5cf1a..58f4dfc 100644 --- a/test-simulator.rkt +++ b/test-simulator.rkt @@ -36,6 +36,7 @@ m])) +;; Infinite loop (let ([m (new-machine `(hello world ,(make-GotoStatement (make-Label 'hello))))]) (test (machine-pc (step-n m 0)) 0) (test (machine-pc (step-n m 1)) 1) @@ -415,10 +416,9 @@ (list 126389 42 (make-toplevel (list (lookup-primitive '+)))))) - -#;(let ([m (new-machine `(,(make-AssignPrimOpStatement (make-LookupLexicalAddress))))]) - (test ...)) -#;(let ([m (new-machine `(,(make-AssignPrimOpStatement (make-LookupToplevelAddress))))]) - (test ...)) -#;(let ([m (new-machine `(,(make-AssignPrimOpStatement (make-GetControlStackLabel))))]) - (test ...)) \ No newline at end of file +;; GetControlStackLabel +(let ([m (new-machine `(foo + ,(make-PushControlFrame 'foo) + ,(make-AssignPrimOpStatement 'proc (make-GetControlStackLabel))))]) + (test (machine-proc (run m)) + 'foo)) \ No newline at end of file