shithub: MicroHs

Download patch

ref: 7bfdb88963c69e5bb738ad914549c4cb20d6db10
parent: bd9e211f7c14b4d8c5cc527321a2645e9f4bb1ad
parent: d3c2b26e200148d7e5861f80e6c66ff7e9eca2b8
author: Lennart Augustsson <lennart@augustsson.net>
date: Thu Jan 18 03:19:57 EST 2024

Merge pull request #24 from jmaessen/parse-fewer-indirs

Don't create indirections for unreferenced labels during deserialization

--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1300,16 +1300,15 @@
       l = parse_int(f);  /* The label */
       if (!gobble(f, ' ')) ERR("parse ' '");
       nodep = find_label(l);
+      x = TOP(0);
       if (*nodep == NIL) {
-        /* not referenced yet, so create a node */
-        *nodep = alloc_node(T_IND);
-        INDIR(*nodep) = NIL;
+        /* not referenced yet, so add a direct reference */
+        *nodep = x;
       } else {
         /* Sanity check */
         if (INDIR(*nodep) != NIL) ERR("shared != NIL");
+        INDIR(*nodep) = x;
       }
-      x = TOP(0);
-      INDIR(*nodep) = x;
       break;
     case '"' :
       /* Everything up to the next " is a string.
--