about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-17 19:35:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-17 19:35:02 -0700
commit1154db7a74f95ddf73d28070dea8d57d4bf4afdc (patch)
tree40c0741e0534be44f006f557b009bcf6b49e824d
parent412ec38f30517fae6230b68ddcc970994a86a65b (diff)
downloadmu-1154db7a74f95ddf73d28070dea8d57d4bf4afdc.tar.gz
load sandbox even if there are no globals
-rw-r--r--shell/main.mu20
1 files changed, 9 insertions, 11 deletions
diff --git a/shell/main.mu b/shell/main.mu
index 96aafbf5..6aecadbd 100644
--- a/shell/main.mu
+++ b/shell/main.mu
@@ -58,12 +58,11 @@ fn load-state data-disk: (addr disk), _sandbox: (addr sandbox), globals: (addr g
   var globals-cell-ah/edx: (addr handle cell) <- address globals-cell-storage
   lookup-symbol globals-literal, globals-cell-ah, *initial-root, 0/no-globals, 0/no-trace, 0/no-screen, 0/no-keyboard
   var globals-cell/eax: (addr cell) <- lookup *globals-cell-ah
-  compare globals-cell, 0
   {
-    break-if-!=
-    return
+    compare globals-cell, 0
+    break-if-=
+    load-globals globals-cell-ah, globals
   }
-  load-globals globals-cell-ah, globals
   # sandbox = assoc(initial-root, 'sandbox)
   var sandbox-literal-storage: (handle cell)
   var sandbox-literal-ah/eax: (addr handle cell) <- address sandbox-literal-storage
@@ -73,15 +72,14 @@ fn load-state data-disk: (addr disk), _sandbox: (addr sandbox), globals: (addr g
   var sandbox-cell-ah/edx: (addr handle cell) <- address sandbox-cell-storage
   lookup-symbol sandbox-literal, sandbox-cell-ah, *initial-root, 0/no-globals, 0/no-trace, 0/no-screen, 0/no-keyboard
   var sandbox-cell/eax: (addr cell) <- lookup *sandbox-cell-ah
-  compare sandbox-cell, 0
   {
-    break-if-!=
-    return
+    compare sandbox-cell, 0
+    break-if-=
+    # print: cell -> stream
+    print-cell sandbox-cell-ah, s, 0/no-trace
+    # stream -> gap-buffer
+    load-gap-buffer-from-stream data, s
   }
-  # print: cell -> stream
-  print-cell sandbox-cell-ah, s, 0/no-trace
-  # stream -> gap-buffer
-  load-gap-buffer-from-stream data, s
 }
 
 # Save state as an alist of alists: