diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 20:02:01 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 20:02:01 -0700 |
commit | 19dd573a92ce1ffdd760ee5d4078bf3d664818c4 (patch) | |
tree | 0d87e0a876bf312e5c12199c1de26936214af1c4 | |
parent | e74050ade4ae37f5e2cb2fc09af405dd5f03cd2c (diff) | |
download | mu-19dd573a92ce1ffdd760ee5d4078bf3d664818c4.tar.gz |
.
-rw-r--r-- | shell/evaluate.mu | 70 | ||||
-rw-r--r-- | shell/sandbox.mu | 8 |
2 files changed, 39 insertions, 39 deletions
diff --git a/shell/evaluate.mu b/shell/evaluate.mu index cf9b51d1..20d0496a 100644 --- a/shell/evaluate.mu +++ b/shell/evaluate.mu @@ -98,9 +98,9 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han { break-if-!= trace-text trace, "eval", "symbol" - debug-print "a", 7/fg, 0xc5/bg=blue-bg + debug-print "a", 7/fg, 0/bg lookup-symbol in, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell - debug-print "z", 7/fg, 0xc5/bg=blue-bg + debug-print "z", 7/fg, 0/bg trace-higher trace return } @@ -231,10 +231,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han rest-ah <- get rest, right rest <- lookup *rest-ah var second-arg-ah/edx: (addr handle cell) <- get rest, left - debug-print "P", 4/fg, 0xc5/bg=blue-bg + debug-print "P", 4/fg, 0/bg increment call-number evaluate second-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "Q", 4/fg, 0xc5/bg=blue-bg + debug-print "Q", 4/fg, 0/bg trace-text trace, "eval", "saving global binding" var first-arg/eax: (addr cell) <- lookup *first-arg-ah var first-arg-data-ah/eax: (addr handle stream byte) <- get first-arg, text-data @@ -276,10 +276,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han rest-ah <- get rest, right rest <- lookup *rest-ah var second-arg-ah/edx: (addr handle cell) <- get rest, left - debug-print "P", 4/fg, 0xc5/bg=blue-bg + debug-print "P", 4/fg, 0/bg increment call-number evaluate second-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "Q", 4/fg, 0xc5/bg=blue-bg + debug-print "Q", 4/fg, 0/bg trace-text trace, "eval", "mutating binding" var first-arg/eax: (addr cell) <- lookup *first-arg-ah var first-arg-data-ah/eax: (addr handle stream byte) <- get first-arg, text-data @@ -302,10 +302,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han trace-text trace, "eval", "evaluating first arg" var rest/eax: (addr cell) <- lookup *rest-ah var first-arg-ah/ecx: (addr handle cell) <- get rest, left - debug-print "R2", 4/fg, 0xc5/bg=blue-bg + debug-print "R2", 4/fg, 0/bg increment call-number evaluate first-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "S2", 4/fg, 0xc5/bg=blue-bg + debug-print "S2", 4/fg, 0/bg # if first arg is nil, short-circuit var out-ah/eax: (addr handle cell) <- copy _out-ah var out/eax: (addr cell) <- lookup *out-ah @@ -319,10 +319,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han rest-ah <- get rest, right rest <- lookup *rest-ah var second-ah/eax: (addr handle cell) <- get rest, left - debug-print "T2", 4/fg, 0xc5/bg=blue-bg + debug-print "T2", 4/fg, 0/bg increment call-number evaluate second-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "U2", 4/fg, 0xc5/bg=blue-bg + debug-print "U2", 4/fg, 0/bg trace-higher trace return } @@ -340,10 +340,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han trace-text trace, "eval", "evaluating first arg" var rest/eax: (addr cell) <- lookup *rest-ah var first-arg-ah/ecx: (addr handle cell) <- get rest, left - debug-print "R2", 4/fg, 0xc5/bg=blue-bg + debug-print "R2", 4/fg, 0/bg increment call-number evaluate first-arg-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "S2", 4/fg, 0xc5/bg=blue-bg + debug-print "S2", 4/fg, 0/bg # if first arg is not nil, short-circuit var out-ah/eax: (addr handle cell) <- copy _out-ah var out/eax: (addr cell) <- lookup *out-ah @@ -357,10 +357,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han rest-ah <- get rest, right rest <- lookup *rest-ah var second-ah/eax: (addr handle cell) <- get rest, left - debug-print "T2", 4/fg, 0xc5/bg=blue-bg + debug-print "T2", 4/fg, 0/bg increment call-number evaluate second-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "U2", 4/fg, 0xc5/bg=blue-bg + debug-print "U2", 4/fg, 0/bg trace-higher trace return } @@ -381,10 +381,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han var first-arg-ah/ecx: (addr handle cell) <- get rest, left var guard-h: (handle cell) var guard-ah/esi: (addr handle cell) <- address guard-h - debug-print "R", 4/fg, 0xc5/bg=blue-bg + debug-print "R", 4/fg, 0/bg increment call-number evaluate first-arg-ah, guard-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "S", 4/fg, 0xc5/bg=blue-bg + debug-print "S", 4/fg, 0/bg rest-ah <- get rest, right rest <- lookup *rest-ah var branch-ah/edi: (addr handle cell) <- get rest, left @@ -399,10 +399,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han rest <- lookup *rest-ah branch-ah <- get rest, left } - debug-print "T", 4/fg, 0xc5/bg=blue-bg + debug-print "T", 4/fg, 0/bg increment call-number evaluate branch-ah, _out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "U", 4/fg, 0xc5/bg=blue-bg + debug-print "U", 4/fg, 0/bg trace-higher trace return } @@ -437,10 +437,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han break-if-!= $evaluate:while:loop-execution } trace-text trace, "eval", "loop termination check" - debug-print "V", 4/fg, 0xc5/bg=blue-bg + debug-print "V", 4/fg, 0/bg increment call-number evaluate first-arg-ah, guard-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "W", 4/fg, 0xc5/bg=blue-bg + debug-print "W", 4/fg, 0/bg var guard-a/eax: (addr cell) <- lookup *guard-ah var done?/eax: boolean <- nil? guard-a compare done?, 0/false @@ -468,10 +468,10 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han var curr-out/eax: (addr cell) <- lookup *curr-out-ah var left-out-ah/edi: (addr handle cell) <- get curr-out, left var left-ah/esi: (addr handle cell) <- get curr, left - debug-print "A", 4/fg, 0xc5/bg=blue-bg + debug-print "A", 4/fg, 0/bg increment call-number evaluate left-ah, left-out-ah, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "B", 4/fg, 0xc5/bg=blue-bg + debug-print "B", 4/fg, 0/bg # a trip wire in case we're running without a trace (e.g. when loading the initial state from disk) { compare trace, 0 @@ -494,9 +494,9 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han var evaluated-list/eax: (addr cell) <- lookup *evaluated-list-ah var function-ah/ecx: (addr handle cell) <- get evaluated-list, left var args-ah/edx: (addr handle cell) <- get evaluated-list, right - debug-print "C", 4/fg, 0xc5/bg=blue-bg + debug-print "C", 4/fg, 0/bg apply function-ah, args-ah, _out-ah, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "Y", 4/fg, 0xc5/bg=blue-bg + debug-print "Y", 4/fg, 0/bg trace-higher trace # trace "=> " _out-ah {{{ { @@ -509,7 +509,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han trace trace, "eval", stream } # }}} - debug-print "Z", 4/fg, 0xc5/bg=blue-bg + debug-print "Z", 4/fg, 0/bg } fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr handle cell), globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell), call-number: int { @@ -556,9 +556,9 @@ fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr hand rest <- lookup *rest-ah var params-ah/ecx: (addr handle cell) <- get rest, left var body-ah/eax: (addr handle cell) <- get rest, right - debug-print "D", 7/fg, 0xc5/bg=blue-bg + debug-print "D", 7/fg, 0/bg apply-function params-ah, args-ah, body-ah, out, *callee-env-ah, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "Y", 7/fg, 0xc5/bg=blue-bg + debug-print "Y", 7/fg, 0/bg trace-higher trace return } @@ -588,10 +588,10 @@ fn evaluate-exprs _exprs-ah: (addr handle cell), out: (addr handle cell), env-h: # evaluate each expression, writing result to `out` { var curr-ah/eax: (addr handle cell) <- get exprs, left - debug-print "E", 7/fg, 0xc5/bg=blue-bg + debug-print "E", 7/fg, 0/bg increment call-number evaluate curr-ah, out, env-h, globals, trace, screen-cell, keyboard-cell, call-number - debug-print "X", 7/fg, 0xc5/bg=blue-bg + debug-print "X", 7/fg, 0/bg } # exprs-ah <- get exprs, right @@ -721,9 +721,9 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell) var env-nil?/eax: boolean <- nil? env compare env-nil?, 0/false break-if-= - debug-print "b", 7/fg, 0xc5/bg=blue-bg + debug-print "b", 7/fg, 0/bg lookup-symbol-in-globals sym, out, globals, trace, screen-cell, keyboard-cell - debug-print "x", 7/fg, 0xc5/bg=blue-bg + debug-print "x", 7/fg, 0/bg trace-higher trace # trace "=> " out " (global)" {{{ { @@ -740,7 +740,7 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell) trace trace, "eval", stream } # }}} - debug-print "y", 7/fg, 0xc5/bg=blue-bg + debug-print "y", 7/fg, 0/bg return } # check car @@ -904,9 +904,9 @@ fn mutate-binding name: (addr stream byte), val: (addr handle cell), env-h: (han var env-nil?/eax: boolean <- nil? env compare env-nil?, 0/false break-if-= - debug-print "b", 3/fg, 0xc5/bg=blue-bg + debug-print "b", 3/fg, 0/bg mutate-binding-in-globals name, val, globals, trace - debug-print "x", 3/fg, 0xc5/bg=blue-bg + debug-print "x", 3/fg, 0/bg trace-higher trace # trace "=> " val " (global)" {{{ { @@ -923,7 +923,7 @@ fn mutate-binding name: (addr stream byte), val: (addr handle cell), env-h: (han trace trace, "eval", stream } # }}} - debug-print "y", 3/fg, 0xc5/bg=blue-bg + debug-print "y", 3/fg, 0/bg return } # check car diff --git a/shell/sandbox.mu b/shell/sandbox.mu index f54df22e..737723b9 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -617,9 +617,9 @@ fn run _in-ah: (addr handle gap-buffer), out: (addr stream byte), globals: (addr var eval-result-ah/edi: (addr handle cell) <- address eval-result-h #? set-cursor-position 0/screen, 0 0 #? turn-on-debug-print - debug-print "^", 4/fg, 0xc5/bg=blue-bg + debug-print "^", 4/fg, 0/bg evaluate read-result-ah, eval-result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, 1/call-number - debug-print "$", 4/fg, 0xc5/bg=blue-bg + debug-print "$", 4/fg, 0/bg var error?/eax: boolean <- has-errors? trace { compare error?, 0/false @@ -647,9 +647,9 @@ fn read-evaluate-and-move-to-globals _in-ah: (addr handle gap-buffer), globals: allocate-pair nil-ah var eval-result-storage: (handle cell) var eval-result/edi: (addr handle cell) <- address eval-result-storage - debug-print "^", 4/fg, 0xc5/bg=blue-bg + debug-print "^", 4/fg, 0/bg evaluate read-result-ah, eval-result, *nil-ah, globals, 0/no-trace, 0/no-screen-cell, 0/no-keyboard-cell, 1/call-number - debug-print "$", 4/fg, 0xc5/bg=blue-bg + debug-print "$", 4/fg, 0/bg move-gap-buffer-to-global globals, read-result-ah, _in-ah } |