diff -ruN klic-3.003-2002-02-08b/ChangeLog klic-3.003-2002-02-16/ChangeLog
--- klic-3.003-2002-02-08b/ChangeLog	Fri Feb  8 13:27:28 2002
+++ klic-3.003-2002-02-16/ChangeLog	Sat Feb 16 10:44:20 2002
@@ -1,3 +1,11 @@
+2002-02-08 TAKAGI Yusuke <takagi@ueda.info.waseda.ac.jp>
+
+	* compiler/klicdb.c,
+	include/klic/{atomstuffs.h, functorstuffs.h, gd_macro.h},
+	runtime/{datamsg.c, debug.c, gcode.c, generic.c, newatom.c}:
+	remove ATOMNUMBERBASE and FUNCTORNUMBERBASE.
+	change functors and arities static.
+
 2002-02-06 TAKAGI Yusuke <takagi@ueda.info.waseda.ac.jp>
 
 	* compiler/klicdb.c, include/klic/atomstuffs.h, runtime/newatom.c:
diff -ruN klic-3.003-2002-02-08b/include/Makefile.tail klic-3.003-2002-02-16/include/Makefile.tail
--- klic-3.003-2002-02-08b/include/Makefile.tail	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-02-16/include/Makefile.tail	Sat Feb 16 10:54:11 2002
@@ -10,21 +10,24 @@
 
 SHMHEADERS = # klic/shm.h klic/shm_machine.h
 
-HEADERS = klic/config.h klic/alloc.h klic/atomstuffs.h \
-	klic/klichdr.h klic/stdc.h \
+HEADERS = klic/config.h \
+	klic/alloc.h klic/atomstuffs.h \
 	klic/basic.h klic/bb.h klic/control.h \
-	klic/functorstuffs.h klic/predinfo.h \
-	klic/gb.h \
-	klic/g_methtab.h klic/index.h \
-	klic/param.h klic/primitives.h \
-	klic/struct.h klic/unify.h klic/sighndl.h \
+	klic/functorstuffs.h \
 	klic/g_basic.h klic/g_extern.h \
-	klic/gd_macro.h klic/gd_methtab.h klic/gdobject.h \
-	klic/generic.h klic/newatom.h \
+	klic/g_float.h klic/g_methtab.h \
+	klic/g_string.h klic/g_vector.h \
+	klic/gb.h \
 	klic/gc_macro.h klic/gc_methtab.h klic/gcobject.h \
+	klic/gd_macro.h klic/gd_methtab.h klic/gdobject.h \
+	klic/generic.h \
 	klic/gg_macro.h klic/gg_methtab.h \
-	klic/gmodule.h klic/g_string.h klic/g_vector.h klic/g_float.h
-	# klic/options.h klic/gobj.h klic/schedule.h klic/susp.h klic/timing.h
+	klic/gmodule.h \
+	klic/index.h klic/klichdr.h klic/newatom.h \
+	klic/param.h klic/predinfo.h klic/primitives.h \
+	klic/sighndl.h klic/stdc.h klic/struct.h klic/susp.h \
+	klic/unify.h
+	# klic/options.h klic/gobj.h klic/schedule.h klic/timing.h
 	# klic/trace.h klic/traceio.h klic/timer.h
 	# klic/g_pointer.h klic/g_termarray.h klic/asyncio.h
 
diff -ruN klic-3.003-2002-02-08b/include/klic/control.h klic-3.003-2002-02-16/include/klic/control.h
--- klic-3.003-2002-02-08b/include/klic/control.h	Fri Jan 25 23:30:10 2002
+++ klic-3.003-2002-02-16/include/klic/control.h	Sat Feb 16 11:44:06 2002
@@ -98,7 +98,7 @@
   func = toppred->func; \
   if (func == (f)) \
     goto module_top; \
-  heapp = allocp; \
+  set_heapp(allocp); \
   current_queue = qp; \
   return (module) func; \
 }while(0)
diff -ruN klic-3.003-2002-02-08b/include/klic/gb.h klic-3.003-2002-02-16/include/klic/gb.h
--- klic-3.003-2002-02-08b/include/klic/gb.h	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-02-16/include/klic/gb.h	Sat Feb 16 11:44:41 2002
@@ -252,7 +252,7 @@
 do{ \
   if (reasonp != reasons) { \
     int macrotmp = check_stack_for_alternatively(allocp, reasonp); \
-    allocp = heapp; \
+    allocp = heapp(); \
     if (macrotmp != 0) goto lab; \
   } \
 }while(0)
diff -ruN klic-3.003-2002-02-08b/include/klic/gc_macro.h klic-3.003-2002-02-16/include/klic/gc_macro.h
--- klic-3.003-2002-02-08b/include/klic/gc_macro.h	Tue Jan 15 10:42:50 2002
+++ klic-3.003-2002-02-16/include/klic/gc_macro.h	Sat Feb 16 11:45:28 2002
@@ -117,7 +117,7 @@
   argv[0] = GC_TERM; \
   argv[1] = newvar; \
   tmp = GC_wakeup_g_new(2, argv, g_allocp); \
-  g_allocp = heapp; \
+  g_allocp = heapp(); \
   GC_KL1_UNIFY((var), tmp); \
   return g_allocp; \
 }while(0)
@@ -312,7 +312,7 @@
 
 #define GC_RETURN_FROM_NEW(x) \
 do{ \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return (x); \
 }while(0)
 
@@ -418,7 +418,7 @@
 #define GC_RETURN_FROM_GC(newgobj) \
 do{ \
   gcsp  = g_sp; \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return (q *) (newgobj); \
 }while(0)
 
diff -ruN klic-3.003-2002-02-08b/include/klic/gd_macro.h klic-3.003-2002-02-16/include/klic/gd_macro.h
--- klic-3.003-2002-02-08b/include/klic/gd_macro.h	Fri Feb  8 15:40:31 2002
+++ klic-3.003-2002-02-16/include/klic/gd_macro.h	Sat Feb 16 11:46:04 2002
@@ -249,13 +249,13 @@
 
 #define GD_SUSPEND_NEW(v) \
 do{ \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return (v); \
 }while(0)
 
 #define GD_RETURN_FROM_NEW(x) \
 do{ \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return makefunctor(x); \
 }while(0)
 
@@ -382,7 +382,7 @@
 #define GD_RETURN_FROM_GC(newgobj) \
 do{ \
   gcsp = g_sp; \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return(((q *)(newgobj))); \
 }while(0)
 
diff -ruN klic-3.003-2002-02-08b/include/klic/generic.h klic-3.003-2002-02-16/include/klic/generic.h
--- klic-3.003-2002-02-08b/include/klic/generic.h	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-02-16/include/klic/generic.h	Sat Feb 16 11:46:20 2002
@@ -18,7 +18,7 @@
 #define new_generic(name,argc,out,offset)  \
 do{ \
   (out) = (name)((argc), generic_arg, allocp+offset); \
-  allocp = heapp; \
+  allocp = heapp(); \
 }while(0)
 
 #define call_generic(obj,funct,offset) \
diff -ruN klic-3.003-2002-02-08b/include/klic/gg_macro.h klic-3.003-2002-02-16/include/klic/gg_macro.h
--- klic-3.003-2002-02-08b/include/klic/gg_macro.h	Tue Jan 15 10:45:17 2002
+++ klic-3.003-2002-02-16/include/klic/gg_macro.h	Sat Feb 16 11:46:48 2002
@@ -189,7 +189,7 @@
 
 #define GG_RETURN_FROM_NEW(var) \
 do{ \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return (var); \
 }while(0)
 
@@ -272,7 +272,7 @@
 #define GG_RETURN_FROM_GC(newgobj) \
 do{ \
   gcsp  = g_sp; \
-  heapp = g_allocp; \
+  set_heapp(g_allocp); \
   return(((q *)(newgobj))); \
 }while(0)
 
diff -ruN klic-3.003-2002-02-08b/include/klic/struct.h klic-3.003-2002-02-16/include/klic/struct.h
--- klic-3.003-2002-02-08b/include/klic/struct.h	Sat Dec 29 12:48:20 2001
+++ klic-3.003-2002-02-16/include/klic/struct.h	Sat Feb 16 12:09:23 2002
@@ -229,7 +229,6 @@
 #define prioq		(glbl->prioq0)
 #define current_prio	(glbl->current_prio0)
 #define top_prio	(glbl->top_prio0)
-#define heapp		(glbl->heapp0)
 #define heaptop		(glbl->heaptop0)
 #define heaplimit	(glbl->heaplimit0)
 #define real_heaplimit	(glbl->real_heaplimit0)
@@ -278,7 +277,6 @@
 
 Extern struct global_variables {
   /* First four items are accessed frequently */
-  q* heapp0;			/* top of free area (when decached) */
   q* volatile heaplimit0;	/* copy of real_heaplimit or 0 */
   struct goalrec* current_queue0; /* queue for current priority */
   struct goalrec* resumed_goals0; /* spontaneous goals during reduction */
@@ -360,5 +358,10 @@
 
 Extern q suspension_reason;
 Extern q rest_of_stream;
+
+
+/* runtime/alloc.c */
+extern q* heapp(void);
+extern void set_heapp(q* p);
 
 #endif /* _KLIC_STRUCT_H_ */
diff -ruN klic-3.003-2002-02-08b/runtime/alloc.c klic-3.003-2002-02-16/runtime/alloc.c
--- klic-3.003-2002-02-08b/runtime/alloc.c	Mon Jan 21 20:57:59 2002
+++ klic-3.003-2002-02-16/runtime/alloc.c	Sat Feb 16 12:10:24 2002
@@ -10,6 +10,20 @@
 #include <klic/struct.h>
 #include <klic/primitives.h>  /* extern */
 
+static q* heapp0;  /* top of free area (when decached) */
+
+extern q*
+heapp(void)
+{
+  return heapp0;
+}
+
+extern void
+set_heapp(q* p)
+{
+  heapp0 = p;
+}
+
 extern void*
 malloc_check(size)
      unsigned long size;
@@ -41,7 +55,7 @@
   declare_globals;
   heaplimit = real_heaplimit = new_space_top+heapsize;
   heapbottom = real_heaplimit+incrementsize;
-  heaptop = heapp = new_space_top;
+  set_heapp( heaptop = new_space_top );
   real_heapbytesize = (unsigned long) heapbottom - (unsigned long) heaptop;
   this_more_space = 0;
   gc_hooktab_size = 32;
diff -ruN klic-3.003-2002-02-08b/runtime/asyncio.c klic-3.003-2002-02-16/runtime/asyncio.c
--- klic-3.003-2002-02-08b/runtime/asyncio.c	Tue Jan  1 14:17:47 2002
+++ klic-3.003-2002-02-16/runtime/asyncio.c	Sat Feb 16 11:48:52 2002
@@ -42,7 +42,7 @@
 
 #define Call_sigio_handler(again, allocp, fd, type) \
   ((again = sigio_handlers[fd](allocp, fd, type, &fdsr, &fdsw)),\
-   (allocp = heapp))
+   (allocp = heapp()) )
 
 int debugger_flag;
 
@@ -63,7 +63,7 @@
       again = (sigio_handlers[fd])(allocp, fd, retry_sigio_type, &fdsr, &fdsw);
       if (again)
 	return 1;
-      allocp = heapp;
+      allocp = heapp();
       retry_sigio_type = KLIC_SIGIO_NONE;
     }
     fdsr = sigio_infds;
@@ -120,10 +120,10 @@
 	      retry_sigio_type = call_type;
 	      return 1;
 	    }
-	    allocp = heapp;
+	    allocp = heapp();
 	}
     }
-    heapp = allocp;
+    set_heapp(allocp);
     return 0;
 }
 
@@ -209,7 +209,7 @@
     allocp = do_unify_value(allocp, array[fd], newcons);
     array[fd] = newvar;
   }
-  heapp = allocp;
+  set_heapp(allocp);
   return 0;
 }
 
diff -ruN klic-3.003-2002-02-08b/runtime/config/pvm/distpkt.c klic-3.003-2002-02-16/runtime/config/pvm/distpkt.c
--- klic-3.003-2002-02-08b/runtime/config/pvm/distpkt.c	Sun Jan 13 14:14:18 2002
+++ klic-3.003-2002-02-16/runtime/config/pvm/distpkt.c	Sat Feb 16 11:51:44 2002
@@ -145,9 +145,9 @@
     if (IS_SHOEN_NODE(my_node)){
       struct itimerval interval;
       long isec, usec;
-      heapp = set_simple_interval_timer_handler(heapp,
+      set_heapp( set_simple_interval_timer_handler(heapp(),
 						PROF_GATHER_INTERVAL_SEC,
-						0, send_profile_trigger);
+						0, send_profile_trigger) );
     }else{
       call_at_time_intervals(0, PROF_SAMPLE_INTERVAL_uSEC, count_profile);
       /* add_signal_handler(SIGUSR2, send_profile); */
@@ -161,8 +161,8 @@
       interval_usec = 10000;
     isec = interval_usec / 1000000;
     usec = interval_usec % 1000000;
-    heapp = set_simple_interval_timer_handler(heapp, isec, usec,
-					      receive_message);
+    set_heapp( set_simple_interval_timer_handler(heapp(), isec, usec,
+					      receive_message) );
   }
 #endif /* USETIMER */
 }
diff -ruN klic-3.003-2002-02-08b/runtime/config/pvm-tcp/distpkt.c klic-3.003-2002-02-16/runtime/config/pvm-tcp/distpkt.c
--- klic-3.003-2002-02-08b/runtime/config/pvm-tcp/distpkt.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-02-16/runtime/config/pvm-tcp/distpkt.c	Sat Feb 16 11:50:28 2002
@@ -505,8 +505,8 @@
 	  interval_usec = 10000;
 	isec = interval_usec / 1000000;
 	usec = interval_usec % 1000000;
-	heapp = set_simple_interval_timer_handler(heapp, isec, usec,
-						  receive_message);
+	set_heapp( set_simple_interval_timer_handler
+          (heapp(), isec, usec, receive_message) );
     }
 #endif
     signal(SIGUSR2, dummy);
diff -ruN klic-3.003-2002-02-08b/runtime/config/shm/distpkt.c klic-3.003-2002-02-16/runtime/config/shm/distpkt.c
--- klic-3.003-2002-02-08b/runtime/config/shm/distpkt.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-02-16/runtime/config/shm/distpkt.c	Sat Feb 16 11:52:44 2002
@@ -145,9 +145,9 @@
 	if (IS_SHOEN_NODE(my_node)){
 	    struct itimerval interval;
 	    long isec, usec;
-	    heapp = set_simple_interval_timer_handler(heapp, 
-						      PROF_GATHER_INTERVAL_SEC,
-						      0, send_profile_trigger);
+	    set_heapp( set_simple_interval_timer_handler(heapp(),
+						PROF_GATHER_INTERVAL_SEC,
+						0, send_profile_trigger) );
 	}else {	
 	    call_at_time_intervals(0, PROF_SAMPLE_INTERVAL_uSEC, 
 				   count_profile);
@@ -161,8 +161,8 @@
 	  interval_usec = 10000;
 	isec = interval_usec / 1000000;
 	usec = interval_usec % 1000000;
-	heapp = set_simple_interval_timer_handler(heapp, isec, usec,
-						  receive_message);
+	set_heapp( set_simple_interval_timer_handler(heapp(), isec, usec,
+						  receive_message) );
     }
 #endif
 }
diff -ruN klic-3.003-2002-02-08b/runtime/export_table.c klic-3.003-2002-02-16/runtime/export_table.c
--- klic-3.003-2002-02-08b/runtime/export_table.c	Sun Jan 13 11:26:48 2002
+++ klic-3.003-2002-02-16/runtime/export_table.c	Sat Feb 16 11:53:06 2002
@@ -169,7 +169,7 @@
     if(exp_table[i].data != (q) UNUSED_EXPREC){
       newdata = general_gc(&(exp_table[i].data), allocp, gcsp);
       exp_table[i].data = newdata;
-      allocp = heapp;
+      allocp = heapp();
       j++;
     }
     if(j == active_exp_entry){
diff -ruN klic-3.003-2002-02-08b/runtime/faisus.c klic-3.003-2002-02-16/runtime/faisus.c
--- klic-3.003-2002-02-08b/runtime/faisus.c	Fri Jan 18 15:37:50 2002
+++ klic-3.003-2002-02-16/runtime/faisus.c	Sat Feb 16 11:53:49 2002
@@ -130,7 +130,7 @@
 	    suspended = 1;
 	  }
 	} else {
-	  allocp = heapp;
+	  allocp = heapp();
  	  derefone(ref) = tmp;
 	  resume_same_prio(goal);
         }
@@ -276,7 +276,7 @@
 	    } else {
 	      redo_request = 1;
 	      if(tmp != makeref(0)) {
-		allocp = heapp;
+		allocp = heapp();
 		derefone(ref) = tmp;
 	      } /* else GC request */
 	    }
@@ -326,7 +326,7 @@
         struct generator_susp* gsusp = generator_suspp(susp);
         q ref = gsusp->backpt;
         q tmp = generic_generate(untag_generator_susp(gsusp->u.o), allocp);
-        allocp = heapp;
+        allocp = heapp();
         if (tmp == 0) goto fin;
         derefone(ref) = tmp;
         value = tmp;
@@ -336,11 +336,11 @@
       value = tmp;
     ok:
       derefone(var) = value;
-      heapp = allocp;
+      set_heapp(allocp);
       return 1;
     }
   }
  fin:
-  heapp = allocp;
+  set_heapp(allocp);
   return 0;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/gc.c klic-3.003-2002-02-16/runtime/gc.c
--- klic-3.003-2002-02-08b/runtime/gc.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/gc.c	Sat Feb 16 11:55:38 2002
@@ -104,9 +104,9 @@
     old_space_size = bytesize;
   }
   make_heap_larger =
-    (heapp-new_space_top+this_more_space > heapsize*maxactiveratio &&
+    (heapp()-new_space_top+this_more_space > heapsize*maxactiveratio &&
      heapsize < maxheapsize);
-  lastgc_dangerous = (real_heaplimit < heapp+this_more_space);
+  lastgc_dangerous = (real_heaplimit < heapp()+this_more_space);
   if( lastgc_dangerous ){
     goto gc_again;
   }
@@ -292,7 +292,7 @@
 		  struct generator_object* newobj =
 		    (struct generator_object*) generic_gc(oldobj, hp, sp);
 		  sp = gcsp;
-		  hp = heapp;
+		  hp = heapp();
 		  oldobj->method_table =
 		    (struct generator_object_method_table*) makefunctor(newobj);
 		  newgsusp->u.o = tag_generator_susp(newobj);
@@ -334,7 +334,7 @@
 			  (struct consumer_object*)
 			    generic_gc(untag_consumer_hook(u.o), hp, sp);
 			sp = gcsp;
-			hp = heapp;
+			hp = heapp();
 			untag_consumer_hook(u.o)->method_table =
 			  (struct consumer_object_method_table*)
 			    makefunctor(newobj);
@@ -430,7 +430,7 @@
 	    q* newobj;
 	    newobj = generic_gc(oldobj, hp, sp);
 	    sp = gcsp;
-	    hp = heapp;
+	    hp = heapp();
 	    *addr = functor_of(obj) = makefunctor(newobj);
 	  }else{
 	    q newfunct = makefunctor(hp);
@@ -495,7 +495,7 @@
     qp->next = last;
     last = qp;
   }
-  heapp = hp;
+  set_heapp(hp);
   return last;
 }
 
@@ -584,13 +584,13 @@
 
   for( ; pq->prio >= 0; pq = pq->next ){
     pq->q = copy_one_queue(pq->q, allocp, ntop, otop, nsize, osize);
-    allocp = heapp;
+    allocp = heapp();
   }
   qp = copy_one_queue(qp, allocp, ntop, otop, nsize, osize);
 
 #ifdef SHM
   {
-    q* hp = heapp;
+    q* hp = heapp();
     TADDRtbl* nptr;
     TADDRtbl* sptr = &ADDRtbl;
     for( sptr=sptr->next; sptr!=&ADDRtbl; sptr=nptr ){
@@ -686,7 +686,7 @@
 	}
       }
     }
-    heapp = hp;
+    set_heapp(hp);
   }
 #endif /* SHM */
 
@@ -695,7 +695,7 @@
     struct suspended_goal_rec* sgl;
     struct suspended_goal_rec** sgl_tail = &suspended_goal_list;
     struct goalrec* dead_goal = NULL;
-    q* hp = heapp;
+    q* hp = heapp();
     if( copied_susp != suspensions-resumes ){
       klic_fprintf(stderr,
 		   "%d perpetually suspending goals found\n",
@@ -729,7 +729,7 @@
 	dead_goal = sgl->goal;
       }
     }
-    heapp = hp;
+    set_heapp(hp);
     if( dead_goal != 0 ){
       /* we have to make the dead goal look like a normal ready queue */
       ((struct goalrec*) hp)->pred = &queue_empty_pred;
@@ -745,7 +745,7 @@
   }
 
   for( k=0; k<num_after_gc_hooks; k++ ){
-    heapp = after_gc_hook_table[k](heapp);
+    set_heapp( after_gc_hook_table[k](heapp()) );
   }
 
   return qp;
@@ -781,8 +781,8 @@
   declare_globals;
 
   push_gc_stack(term, sp, gcmax);
-  heapp = copy_terms(allocp, new_space_top, old_space_top,
+  set_heapp( copy_terms(allocp, new_space_top, old_space_top,
 		     new_space_size, old_space_size,
-		     sp, gcmax);
+		     sp, gcmax) );
   return *term;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/ge_exref.c klic-3.003-2002-02-16/runtime/ge_exref.c
--- klic-3.003-2002-02-08b/runtime/ge_exref.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/ge_exref.c	Sat Feb 16 11:55:58 2002
@@ -58,7 +58,7 @@
 
   GG_SELF->gc_flag = IMPREC_RELEASED;
 
-  heapp = g_allocp;
+  set_heapp(g_allocp);
   return rdhok;
 }
 
diff -ruN klic-3.003-2002-02-08b/runtime/gen.kl1 klic-3.003-2002-02-16/runtime/gen.kl1
--- klic-3.003-2002-02-08b/runtime/gen.kl1	Sat Jan 12 20:05:30 2002
+++ klic-3.003-2002-02-16/runtime/gen.kl1	Sat Feb 16 11:56:15 2002
@@ -26,7 +26,7 @@
   argc = ((struct termarray_object*) (data_objectp(%2)))->nterm;
   argv = ((struct termarray_object*) (data_objectp(%2)))->terms;
   %0   = (q) func(argc, argv, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[X0-any,Funct+functor,Argv+functor] | X0=X.
 
 generic(Funct,Obj) :- inline:"
diff -ruN klic-3.003-2002-02-08b/runtime/generic.c klic-3.003-2002-02-16/runtime/generic.c
--- klic-3.003-2002-02-08b/runtime/generic.c	Fri Feb  8 15:40:09 2002
+++ klic-3.003-2002-02-16/runtime/generic.c	Sat Feb 16 11:56:45 2002
@@ -76,8 +76,8 @@
   G_STD_DECL;
   q newvar;
   q newobj = gd_new_pointer(myself, g_allocp);
-  q newobj2  = gd_new_termarray(argc, argv, heapp);
-  g_allocp = heapp;
+  q newobj2 = gd_new_termarray(argc, argv, heapp());
+  g_allocp = heapp();
 
   G_HEAPALLOC(*goalp1, G_SIZE_IN_Q(struct goalrec)-3, (struct goalrec*));
   G_MAKE_VAR(newvar);
diff -ruN klic-3.003-2002-02-08b/runtime/gfloat.c klic-3.003-2002-02-16/runtime/gfloat.c
--- klic-3.003-2002-02-08b/runtime/gfloat.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/gfloat.c	Sat Feb 16 11:56:54 2002
@@ -140,7 +140,7 @@
     }
   }
   str = convert_c_string_to_klic_string(buf, g_allocp);
-  g_allocp = heapp;
+  g_allocp = heapp();
   GD_UNIFY_VALUE(GD_ARGV[0], str);
   GD_RETURN;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/gg_shvar.c klic-3.003-2002-02-16/runtime/gg_shvar.c
--- klic-3.003-2002-02-08b/runtime/gg_shvar.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/gg_shvar.c	Sat Feb 16 11:57:08 2002
@@ -208,7 +208,7 @@
 	  case (long) makecons(0):
 	    fatal("system bug!!!");
 	  default:
-	    g_allocp = heapp;
+	    g_allocp = heapp();
 	    derefone(y) = tmpy;
 	    return One_more;
 	  }
diff -ruN klic-3.003-2002-02-08b/runtime/ggoal.c klic-3.003-2002-02-16/runtime/ggoal.c
--- klic-3.003-2002-02-08b/runtime/ggoal.c	Sat Jan 12 12:04:50 2002
+++ klic-3.003-2002-02-16/runtime/ggoal.c	Sat Feb 16 11:57:26 2002
@@ -329,7 +329,7 @@
   obj->goal = goal;
   obj->id = goal_obj_id++;
   allocp += (sizeof(struct goal_object) + sizeof(long) - 1) / sizeof(long);
-  heapp = allocp;
+  set_heapp(allocp);
   return makefunctor(obj);
 }
 
diff -ruN klic-3.003-2002-02-08b/runtime/gio.c klic-3.003-2002-02-16/runtime/gio.c
--- klic-3.003-2002-02-08b/runtime/gio.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/gio.c	Sat Feb 16 11:57:37 2002
@@ -164,7 +164,7 @@
 	if( G_ISREF(string) ){
 	  GC_FAIL("internal error: string allocation for fread");
 	}
-	g_allocp = heapp;
+	g_allocp = heapp();
 	free(buf);
 	GC_UNIFY_VALUE(G_ARG(message, 1), string);
 	break;
diff -ruN klic-3.003-2002-02-08b/runtime/gunix.kl1 klic-3.003-2002-02-16/runtime/gunix.kl1
--- klic-3.003-2002-02-08b/runtime/gunix.kl1	Sun Jan 13 17:33:08 2002
+++ klic-3.003-2002-02-16/runtime/gunix.kl1	Sat Feb 16 11:58:17 2002
@@ -81,7 +81,7 @@
 #define MakeFilePointer(klicvar, file) \\
 do{ \\
   (klicvar) = gd_new_pointer((q) (file), allocp); \\
-  allocp = heapp; \\
+  allocp = heapp(); \\
 }while(0)
 
 #define Fopen(P,F,L,M) \\
@@ -154,13 +154,13 @@
 #define MakeInBuf(klicvar, fd, size) \\
 do{ \\
   (klicvar) = gd_new_pointer((q) make_iobuf((fd),(size),0), allocp); \\
-  allocp = heapp; \\
+  allocp = heapp(); \\
 }while(0)
 
 #define MakeOutBuf(klicvar, fd, size) \\
 do{ \\
   (klicvar) = gd_new_pointer((q) make_iobuf((fd),(size),1), allocp); \\
-  allocp = heapp; \\
+  allocp = heapp(); \\
 }while(0)
 
 #define IOBuf(x) \\
@@ -169,7 +169,7 @@
 #define MakeBIOBuf(klicvar, ifd, ofd, size) \\
 do{ \\
   (klicvar) = gd_new_pointer((q) make_biobuf((ifd),(ofd),(size)), allocp); \\
-  allocp = heapp; \\
+  allocp = heapp(); \\
 }while(0)
 
 #define BIOBuf(x) \\
@@ -418,7 +418,7 @@
   free(path);
   %1 = makeint(family);
   %2 = gd_new_pointer((q) addr, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[Path+object(byte_string),Fam0-int,Addr0-object(pointer)] |
     Fam=Fam0, Addr=Addr0.
 net_convert(inet(HostName,Port),Fam,Addr) :- inline:"
@@ -443,7 +443,7 @@
   addr->sin_port = htons(intval(%1));
   %2 = makeint(family);
   %3 = gd_new_pointer((q) addr, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[HostName+object(byte_string),Port+int,
     Fam0-int,Addr0-object(pointer)] |
     Fam=Fam0, Addr=Addr0.
@@ -474,7 +474,7 @@
   addr->sin_port = htons(intval(%4));
   %5 = makeint(family);
   %6 = gd_new_pointer((q) addr, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[B1+int,B2+int,B3+int,B4+int,Port+int,
     Fam0-int,Addr0-object(pointer)] |
     Fam=Fam0, Addr=Addr0.
@@ -814,7 +814,7 @@
     fatal(\"internal error: string allocation failure for fread\");
   }
   %2 = str;
-  allocp = heapp;
+  allocp = heapp();
   iob->ptr += toread;
   %4 = makeint(intval(%3)+nnl);
 #else
@@ -986,7 +986,7 @@
     fatal(\"internal error: string allocation failure for fread\");
   }
   %2 = str;
-  allocp = heapp;
+  allocp = heapp();
   iob->ptr += toread;
   %4 = makeint(intval(%3) + nnl);
 #else
@@ -1186,7 +1186,7 @@
   strcat(real_template, \"XXXXXX\");
   if( mkstemp(real_template) < 0 ) real_template[0] = '\0';
   %1 = C2KLIC(real_template, allocp);
-  allocp = heapp;
+  allocp = heapp();
   free(template);
   free(real_template);
 }":[Template+object(byte_string),Filename0-object(byte_string)] |
@@ -1227,7 +1227,7 @@
     %1 = makeint(0);
   }else{
     %1 = C2KLIC(value, allocp);
-    allocp = heapp;
+    allocp = heapp();
   }
 }":[Name+object(byte_string),Value0-bound] | Value=Value0.
 
@@ -1293,7 +1293,7 @@
 make_argv_list(K,N,L) :- K<N, inline:"
 {
   %1 = C2KLIC(command_argv[intval(%0)], allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[K+int,S-object(byte_string)] |
     L=[S|T], make_argv_list(~(K+1),N,T).
 
diff -ruN klic-3.003-2002-02-08b/runtime/intrpt.c klic-3.003-2002-02-16/runtime/intrpt.c
--- klic-3.003-2002-02-08b/runtime/intrpt.c	Mon Jan  7 14:05:48 2002
+++ klic-3.003-2002-02-16/runtime/intrpt.c	Sat Feb 16 11:58:49 2002
@@ -72,10 +72,10 @@
 #ifdef DEBUGLIB
   if( stepping_flag ){
     qp = step_after(qp, allocp);
-    allocp = heapp;
+    allocp = heapp();
   }else if( trace_flag ){
     qp = trace_after(qp, allocp);
-    allocp = heapp;
+    allocp = heapp();
   }
 #endif
 
@@ -96,7 +96,7 @@
       int again = receive_message(allocp, 0);
       if( again == 0 )
 	heaplimit = real_heaplimit;
-      allocp = heapp;
+      allocp = heapp();
       retry = (allocp + this_more_space >= real_heaplimit);
       /* some goals may have been resumed by the message reception */
       qp = enqueue_resumed_goals(qp);
@@ -140,7 +140,7 @@
 #endif
       GC_OFF();
 
-      allocp = heapp;
+      allocp = heapp();
     }
   }while( retry );
 
diff -ruN klic-3.003-2002-02-08b/runtime/io.kl1 klic-3.003-2002-02-16/runtime/io.kl1
--- klic-3.003-2002-02-08b/runtime/io.kl1	Mon Jan  7 14:05:48 2002
+++ klic-3.003-2002-02-16/runtime/io.kl1	Sat Feb 16 11:59:09 2002
@@ -44,7 +44,7 @@
     open_named_file((struct byte_string_object*) functorp(%0), \"w\");
   if( file==NULL ) goto %f;
   %1 = gd_new_pointer((q) file, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[Path+functor,File-any] |
     S=normal(Out), out(Out,File).
 otherwise.
@@ -55,7 +55,7 @@
 outstream(S) :- inline:"
 {
   %0 = gd_new_pointer((q) stdout, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[File-any] |
     out(S,File).
 
@@ -99,7 +99,7 @@
     open_named_file((struct byte_string_object*) functorp(%0), \"r\");
   if( file==NULL ) goto %f;
   %1 = gd_new_pointer((q) file, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[Path+functor,File-any] |
     S=normal(In), in(In,File).
 otherwise.
@@ -110,7 +110,7 @@
 instream(S) :- inline:"
 {
   %0 = gd_new_pointer((q) stdin, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }
 ":[File-any] |
     in(S,File).
@@ -137,6 +137,6 @@
 errstream(S) :- inline:"
 {
   %0 = gd_new_pointer((q) stderr, allocp);
-  allocp = heapp;
+  allocp = heapp();
 }":[File-any] |
     out(S,File).
diff -ruN klic-3.003-2002-02-08b/runtime/kmain.c klic-3.003-2002-02-16/runtime/kmain.c
--- klic-3.003-2002-02-08b/runtime/kmain.c	Sun Jan  6 15:18:16 2002
+++ klic-3.003-2002-02-16/runtime/kmain.c	Sat Feb 16 12:00:47 2002
@@ -170,7 +170,7 @@
   const struct predicate* toppred = qp->pred;
   module func = (module)toppred->func;
   while (1) {
-    func = ((module (*)())func)(glbl, qp, heapp, toppred);
+    func = ((module (*)())func)(glbl, qp, heapp(), toppred);
     qp = current_queue;
     toppred = qp->pred;
   }
@@ -288,7 +288,7 @@
     q *allocp;
     struct goalrec *qp;
 
-    allocp = initiate_prioq(heapp);
+    allocp = initiate_prioq(heapp());
     qp = (struct goalrec *) allocp;
 
 #ifdef USESIG
@@ -305,7 +305,7 @@
 
     if (IS_MASTER_NODE(my_node)) {	/* master node */
 	qp->pred = &predicate_main_xmain_0;
-	heapp = allocp + 2;
+	set_heapp(allocp + 2);
 	node_wtc = SUPPLY_WTC_UNIT;
     } else if (IS_SHOEN_NODE(my_node)) {	/* shoen node */
 	add_signal_handler(SIGTERM, kill_tasks);
@@ -321,7 +321,7 @@
     init_rusage(); /***** for inter NODE *****/
 #else /* !DIST */
     qp->pred = &predicate_main_xmain_0;
-    heapp = allocp + 2;
+    set_heapp(allocp + 2);
 #endif /* DIST */
 #ifdef DEBUGLIB
     cum_susps = 0;
@@ -376,7 +376,7 @@
 #else /*!DIST*/
       if (postmortem_pred == 0 || postmortem_args == 0) break;
       klic_fprintf(stderr, "Starting postmortem processing...\n");
-      allocp = initiate_prioq(heapp+incrementsize/2); /* dirty patch */
+      allocp = initiate_prioq(heapp()+incrementsize/2); /* dirty patch */
       qp = (struct goalrec *) allocp;
       qp->pred = postmortem_pred;
       allocp += 2;
@@ -387,7 +387,7 @@
 	  *allocp++ = arg(postmortem_args, k);
 	}
       }
-      heapp = allocp;
+      set_heapp(allocp);
 #endif /*DIST*/
     }
   }
@@ -500,10 +500,10 @@
   allocp += 2;
 
   IDLE_OFF();
-  heapp = klic_interrupt(allocp, qp);
+  set_heapp(klic_interrupt(allocp, qp));
   qp = current_queue;
 
-  if ((qp->pred == &topsucceed_pred) && (heapp == allocp)) {
+  if ((qp->pred == &topsucceed_pred) && (heapp() == allocp)) {
       allocp -= 2;
       goto idle_loop;
   }
@@ -591,7 +591,7 @@
 
   }
   /* check resumpsions */
-  heapp = klic_interrupt(allocp, qp);
+  set_heapp(klic_interrupt(allocp, qp));
   return (module) current_queue->pred->func;
 #else /*!USESIG*/
   fatalf("%d perpetually suspending goals found",
diff -ruN klic-3.003-2002-02-08b/runtime/ktimer.c klic-3.003-2002-02-16/runtime/ktimer.c
--- klic-3.003-2002-02-08b/runtime/ktimer.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-02-16/runtime/ktimer.c	Sat Feb 16 12:01:25 2002
@@ -39,7 +39,7 @@
   declare_globals;
   extern q *do_unify_value();
 
-  heapp = do_unify_value(allocp, data, NILATOM);
+  set_heapp(do_unify_value(allocp, data, NILATOM));
   return 0;
 }
 
@@ -66,7 +66,7 @@
     int result =
       timer_reservations-> handler(allocp, timer_reservations->data);
     if (result != 0) return result;
-    allocp = heapp;
+    allocp = heapp();
     if (TimeIsZero(timer_reservations->interval)) {
       struct timer_reservation_rec *tmp = timer_reservations->next;
       timer_reservations->next = timer_rsv_free;
@@ -90,7 +90,7 @@
 			   timer_reservations->at.tv_usec,
 			   klic_timer_interrupt_handler);
   }
-  heapp = allocp;
+  set_heapp(allocp);
   return 0;
 }
 
@@ -155,7 +155,7 @@
   newrec->next = *tmp;
   *tmp = newrec;
   process_timer_interrupt(allocp, SIGALRM);
-  return heapp;
+  return heapp();
 }  
 
 q *reserve_klic_timer_interrupt(allocp, sec, usec, vrbl)
@@ -178,6 +178,6 @@
   newrec->next = *tmp;
   *tmp = newrec;
   process_timer_interrupt(allocp, SIGALRM);
-  return heapp;
+  return heapp();
 }
 #endif
diff -ruN klic-3.003-2002-02-08b/runtime/profile.c klic-3.003-2002-02-16/runtime/profile.c
--- klic-3.003-2002-02-08b/runtime/profile.c	Sun Jan  6 13:29:43 2002
+++ klic-3.003-2002-02-16/runtime/profile.c	Sat Feb 16 12:01:42 2002
@@ -147,6 +147,6 @@
     gather_prof_ready = 0;
   }
 
-  heapp = allocp;
+  set_heapp(allocp);
   return 0;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/random.c klic-3.003-2002-02-16/runtime/random.c
--- klic-3.003-2002-02-08b/runtime/random.c	Fri Jan 18 15:37:50 2002
+++ klic-3.003-2002-02-16/runtime/random.c	Sat Feb 16 12:02:21 2002
@@ -57,10 +57,10 @@
   cdr_of(cons) = var;
   s->backpt = makeref(var);
   s->u.o = tag_generator_susp(GG_SELF);
-  heapp = g_allocp;
+  set_heapp(g_allocp);
   return cons;
  gc_request:
-  heapp = g_allocp;
+  set_heapp(g_allocp);
   return 0;
 }
 
@@ -79,7 +79,7 @@
   BCOPY(GG_SELF, g_allocp, sizeof(GG_OBJ_TYPE));
   g_allocp += sizeof(GG_OBJ_TYPE)/sizeof(q);
   gcsp = g_sp;
-  heapp = g_allocp;
+  set_heapp(g_allocp);
   return newself;
 }
 
diff -ruN klic-3.003-2002-02-08b/runtime/sched.c klic-3.003-2002-02-16/runtime/sched.c
--- klic-3.003-2002-02-08b/runtime/sched.c	Sat Jan  5 14:15:15 2002
+++ klic-3.003-2002-02-16/runtime/sched.c	Sat Feb 16 12:03:34 2002
@@ -288,7 +288,7 @@
 
   qp->pred = (struct predicate*) consp(qp->args[arity]);
   qp = enqueue_after_waiting(qp->next, prio, qp, allocp, is_relative);
-  heapp = allocp;
+  set_heapp(allocp);
   current_queue = qp;
   return (module) qp->pred->func;
 }
@@ -362,7 +362,7 @@
 
   qp->pred = (struct predicate*) consp(qp->args[arity]);
   qp = enqueue_throw_goal(penum, qp, qp->next, allocp);
-  heapp = allocp;
+  set_heapp(allocp);
   current_queue = qp;
   return (module) qp->pred->func;
 }
@@ -459,13 +459,13 @@
   if( ext_queued ){
     ext_queued = 0;
     qp = get_invoked_goals(&goal_queue_tail);
-    heapp = allocp;
+    set_heapp(allocp);
     current_queue = qp;
     return (module) qp->pred->func;
   }
 #endif
   qp = get_top_priority_queue();
-  heapp = allocp;
+  set_heapp(allocp);
   current_queue = qp;
   return (module) qp->pred->func;
 }
@@ -513,7 +513,7 @@
 
  WLoop:
   if( !(ex_qp->next) ){
-    heapp = klic_interrupt(allocp, qp);
+    set_heapp(klic_interrupt(allocp, qp));
     if( current_queue != qp ){
       *cur_status = 1;
       qp = current_queue;
@@ -579,7 +579,7 @@
     module func;
     toppred = qp->pred;
     func = (module) toppred->func;
-    heapp = allocp;
+    set_heapp(allocp);
     current_queue = qp;
     return func;
   }
@@ -594,7 +594,7 @@
   const struct predicate* toppred;
 {
   while( !(ex_qp->next) ){
-    heapp = klic_interrupt(allocp, qp);
+    set_heapp(klic_interrupt(allocp, qp));
     if( current_queue != qp ){
       *cur_status = 1;
       qp = current_queue;
@@ -614,7 +614,7 @@
     module func;
     toppred = qp->pred;
     func = (module) toppred->func;
-    heapp = allocp;
+    set_heapp(allocp);
     current_queue = qp;
     return func;
   }
diff -ruN klic-3.003-2002-02-08b/runtime/sendrecv.c klic-3.003-2002-02-16/runtime/sendrecv.c
--- klic-3.003-2002-02-08b/runtime/sendrecv.c	Mon Jan  7 14:47:56 2002
+++ klic-3.003-2002-02-16/runtime/sendrecv.c	Sat Feb 16 12:04:30 2002
@@ -156,7 +156,7 @@
   /* static combuf* pending_msg = NULL; */
 
   if( allocp + this_more_space >= real_heaplimit ){
-    heapp = allocp;
+    set_heapp(allocp);
     return 1;
   }
 
@@ -187,7 +187,7 @@
 
 	check_decode_stack();
 
-	heapp = allocp;
+	set_heapp(allocp);
 	return 0;
       }
     }
@@ -200,7 +200,7 @@
 	/* fprintf(stderr, "Node %d, decode pending\n", my_node); */
 	pending_msg = inbuf;
 
-	heapp = allocp;
+	set_heapp(allocp);
 	return 1;
       }
     }
@@ -211,7 +211,7 @@
 	"Node %d, heap over in msg_handler allocp = %x tms = %x rhl = %x\n",
 	my_node, allocp, this_more_space, real_heaplimit );
 
-      heapp = allocp;
+      set_heapp(allocp);
       return 1;
     }
   }
@@ -541,7 +541,7 @@
   while( decode_stack_tmp != decode_stack_ptr ){
     newdata = general_gc(decode_stack_tmp, allocp, gcsp);
     *decode_stack_tmp = newdata;
-    allocp = heapp;
+    allocp = heapp();
     decode_stack_tmp++;
 
     /* fprintf(stderr, "Node %d gc_decode_stack\n", my_node); */
diff -ruN klic-3.003-2002-02-08b/runtime/shm_obj.c klic-3.003-2002-02-16/runtime/shm_obj.c
--- klic-3.003-2002-02-08b/runtime/shm_obj.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/shm_obj.c	Sat Feb 16 12:04:51 2002
@@ -406,7 +406,7 @@
       qp = qp->next;
     }
   }
-  heapp = allocp;
+  set_heapp(allocp);
   current_queue = qp;
   return (module) (qp->pred)->func;
 }
@@ -430,7 +430,7 @@
   }else{  /* shared-memory generator hook */
     allocp = do_unify(allocp, tp->localA, var);
   }
-  heapp = allocp;
+  set_heapp(allocp);
   current_queue = qp;
   return (module) (qp->pred)->func;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/signal.c klic-3.003-2002-02-16/runtime/signal.c
--- klic-3.003-2002-02-08b/runtime/signal.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-02-16/runtime/signal.c	Sat Feb 16 12:05:07 2002
@@ -46,7 +46,7 @@
 	int again;
 	signal_flags[sig] = 0;
 	again = signal_handlers[sig](allocp, sig);
-	allocp = heapp;
+	allocp = heapp();
 	if (again) {
 	  signal_done = 0;
 	  signal_flags[sig] = 1;
@@ -165,7 +165,7 @@
   allocp += 2;
   allocp = do_unify_value(allocp, signal_streams[sig], newcons);
   signal_streams[sig] = newvar;
-  heapp = allocp;
+  set_heapp(allocp);
   return 0;
 }
 
diff -ruN klic-3.003-2002-02-08b/runtime/step.c klic-3.003-2002-02-16/runtime/step.c
--- klic-3.003-2002-02-08b/runtime/step.c	Mon Jan 21 20:55:25 2002
+++ klic-3.003-2002-02-16/runtime/step.c	Sat Feb 16 12:05:35 2002
@@ -143,7 +143,7 @@
     /* first, those queued with higher priority */
     for (k = 0; k < num_queued && queued_prio[k] > current_prio; k++) {
       q gobj = make_goal_object(queued_goals[k], allocp);
-      allocp = heapp;
+      allocp = heapp();
       allocp[0] = gobj;
       allocp[1] = makeint(queued_prio[k]);
       allocp[2] = children_reversed;
@@ -155,7 +155,7 @@
     if (qp != queue_before) {
       do {
 	q gobj = make_goal_object(qp, allocp);
-	allocp = heapp;
+	allocp = heapp();
 	allocp[0] = children_reversed;
 	allocp[1] = gobj;
 	children_reversed = makecons(&allocp[0]);
@@ -166,7 +166,7 @@
     /* finally, those with lower priority */
     for (; k < num_queued; k++) {
       q gobj = make_goal_object(queued_goals[k], allocp);
-      allocp = heapp;
+      allocp = heapp();
       allocp[0] = gobj;
       allocp[1] = makeint(queued_prio[k]);
       allocp[2] = children_reversed;
@@ -201,7 +201,7 @@
     wokenup = NILATOM;
     for (k = 0; k < num_wokenup; k++) {
       q gobj = make_goal_object(wokenup_goals[k], allocp);
-      allocp = heapp;
+      allocp = heapp();
       if (wokenup_prio[k] != current_prio) {
 	allocp[0] = gobj;
 	allocp[1] = makeint(queued_prio[k]);
@@ -218,7 +218,7 @@
     failed = NILATOM;
     for (k = 0; k < num_failed; k++) {
       q gobj = make_goal_object(failed_goals[k], allocp);
-      allocp = heapp;
+      allocp = heapp();
       allocp[0] = failed;
       allocp[1] = gobj;
       failed = makecons(&allocp[0]);
@@ -229,7 +229,7 @@
     allocp =
       step_unify_results(allocp, children, wokenup, failed, NILATOM);
   }
-  heapp = allocp;
+  set_heapp(allocp);
   stepping_flag = 0;
   return qp;
 }
diff -ruN klic-3.003-2002-02-08b/runtime/trace.c klic-3.003-2002-02-16/runtime/trace.c
--- klic-3.003-2002-02-08b/runtime/trace.c	Fri Jan 25 23:29:15 2002
+++ klic-3.003-2002-02-16/runtime/trace.c	Sat Feb 16 12:05:53 2002
@@ -688,7 +688,7 @@
   trace_flag = 0;
 
   parent = 0;
-  heapp = allocp;
+  set_heapp(allocp);
   if (interrupt_off) heaplimit = real_heaplimit;
   else heaplimit = 0;
   return qp;
diff -ruN klic-3.003-2002-02-08b/runtime/unify.c klic-3.003-2002-02-16/runtime/unify.c
--- klic-3.003-2002-02-08b/runtime/unify.c	Fri Jan 18 15:37:50 2002
+++ klic-3.003-2002-02-16/runtime/unify.c	Sat Feb 16 12:06:09 2002
@@ -105,7 +105,7 @@
       case (long)makecons(0):
 	fatal("invalid situation in generator unification");
       default:
-	allocp = heapp;
+	allocp = heapp();
 	derefone(gsusp->backpt) =  tmp;
 	if(isref(tmp) && tmp == derefone(tmp)) {
 	  derefone(tmp) = y;
@@ -248,7 +248,7 @@
 	  case (long)makecons(0):
 	    fatal("invalid situation at the generator unification");
 	  default:
-	    allocp = heapp;
+	    allocp = heapp();
 	    derefone(gsy->backpt) = tmpy;
 	    if(isref(tmpy) && tmpy == derefone(tmpy)) {
 	      derefone(tmpy) = gsx->backpt;
@@ -261,7 +261,7 @@
 	case (long)makecons(0):
 	  fatal("invalid situation at the generator unification");
 	default:
-	  allocp = heapp;
+	  allocp = heapp();
 	  gsx->backpt = tmpx;
 	  if(isref(tmpx) && tmpx == derefone(tmpx)) {
 	    derefone(sy->backpt) = tmpx;
@@ -282,7 +282,7 @@
       case (long)makecons(0): /* invalid */
 	fatal("invalid situation at the generator unification");
       default:
-        allocp = heapp;
+        allocp = heapp();
 	derefone(gsx->backpt) = tmpx;
 	if(isref(tmpx) && tmpx == derefone(tmpx)) {
 	  derefone(tmpx) = sy->backpt;
