From c026dba0067d2ce476d9777087f233dacf868f92 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 17 Apr 2021 22:28:38 -0700 Subject: shell: reenable the trace We now have a couple of protections: - if we get close to running out of space in the trace we drop in an error - if we run out of space in the trace we stop trying to append - if there are errors we cancel future evaluations This is already much nicer. You can't do much on the Mu computer, but at least it gracefully gives up and shows its limitations. On my computer the Mu shell tries to run computations for about 20s before giving up. That seems at the outer limit of what interactivity supports. If things take too long, test smaller chunks. --- shell/trace.mu | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'shell/trace.mu') diff --git a/shell/trace.mu b/shell/trace.mu index 410429e6..267b3ebe 100644 --- a/shell/trace.mu +++ b/shell/trace.mu @@ -89,11 +89,23 @@ fn trace _self: (addr trace), label: (addr array byte), message: (addr stream by var data-ah/eax: (addr handle array trace-line) <- get self, data var data/eax: (addr array trace-line) <- lookup *data-ah var index-addr/edi: (addr int) <- get self, first-free + { + compare *index-addr, 0x8000/lines + break-if-< + return + } var index/ecx: int <- copy *index-addr var offset/ecx: (offset trace-line) <- compute-offset data, index var dest/eax: (addr trace-line) <- index data, offset var depth/ecx: (addr int) <- get self, curr-depth rewind-stream message + { + compare *index-addr, 0x7ffe/lines + break-if-< + initialize-trace-line 0/depth, "error", message, dest + increment *index-addr + return + } initialize-trace-line *depth, label, message, dest increment *index-addr } -- cgit 1.4.1-2-gfad0