From c3b17f066f3cc8d142b63c4e8e1ccf987397ce02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 27 Nov 2000 01:02:08 +0100
Subject: [PATCH] More fixes for PIKE_DEBUG.

Rev: src/las.c:1.225
---
 src/las.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/las.c b/src/las.c
index d29fe67206..cf0e38d541 100644
--- a/src/las.c
+++ b/src/las.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: las.c,v 1.224 2000/11/26 14:20:24 grubba Exp $");
+RCSID("$Id: las.c,v 1.225 2000/11/27 00:02:08 grubba Exp $");
 
 #include "language.h"
 #include "interpret.h"
@@ -434,7 +434,7 @@ static node *freeze_node(node *orig)
   if (orig->tree_info & OPT_NOT_SHARED) {
     /* No need to have this node in the hash-table. */
     /* add_node(orig); */
-    return check_node_hash(dmalloc_touch(node *, orig));
+    return orig;
   }
 
   /* free_node() wants a correct hash */
@@ -4269,9 +4269,28 @@ static void optimize(node *n)
     lex.current_file = n->current_file;
 #endif /* PIKE_DEBUG */
 
-    n->tree_info = n->node_info;
-    if(car_is_node(n)) n->tree_info |= CAR(n)->tree_info;
-    if(cdr_is_node(n)) n->tree_info |= CDR(n)->tree_info;
+#ifdef SHARED_NODES
+    if (n->tree_info & OPT_NOT_SHARED) {
+      n->tree_info = n->node_info;
+      if(car_is_node(n)) n->tree_info |= CAR(n)->tree_info;
+      if(cdr_is_node(n)) n->tree_info |= CDR(n)->tree_info;
+      if(!(n->tree_info & OPT_NOT_SHARED)) {
+	/* We need to fix the hash for this node. */
+	n->hash = hash_node(n);
+	/* FIXME: Should probably add the node to the hashtable here. */
+      }
+    } else {
+#endif /* SHARED_NODES */
+      n->tree_info = n->node_info;
+      if(car_is_node(n)) n->tree_info |= CAR(n)->tree_info;
+      if(cdr_is_node(n)) n->tree_info |= CDR(n)->tree_info;
+#ifdef SHARED_NODES
+      if (n->tree_info & OPT_NOT_SHARED) {
+	/* No need to have it in the hashtable anymore. */
+	sub_node(n);
+      }
+    }
+#endif /* SHARED_NODES */
 
     if(!n->parent) break;
     
-- 
GitLab