diff -ruN klic-3.003-2002-03-12/compiler/obj.kl1 klic-3.003-2002-03-12a/compiler/obj.kl1
--- klic-3.003-2002-03-12/compiler/obj.kl1	Tue Mar 12 12:09:25 2002
+++ klic-3.003-2002-03-12a/compiler/obj.kl1	Tue Mar 12 12:27:44 2002
@@ -138,7 +138,7 @@
 write_one( make_vector( X, L ), _ )-H-Out :-
   klicformat(
     "  set_heapp(allocp);\n"
-    "  ~r = create_vector0( &allocp[~d], ~d );\n",
+    "  ~r = create_vector( &allocp[~d], ~d );\n",
     [X, H, L] )-Out,
   H += L.
 write_one( alloc_functor_id( F, A ), _ )-H-Out :-
@@ -252,14 +252,14 @@
   write_adjust_qp( Q )-Out,
   klicformat(
     "  set_heapp(allocp + ~d);\n"
-    "  new_generic0( ~q_g_new, ~d, ~r );\n",
+    "  new_generic( ~q_g_new, ~d, ~r );\n",
     [H, Class, Arity, Obj] )-Out,
   H <== 0.
 write_one( call_generic( Obj, FA, Q ), _ )-H-Out :-
   write_adjust_qp( Q )-Out,
   klicformat(
     "  set_heapp(allocp + ~d);\n"
-    "  call_generic0( ~k, ~f );\n", [H, Obj, FA] )-Out,
+    "  call_generic( ~k, ~f );\n", [H, Obj, FA] )-Out,
   H <== 0.
 write_one( guard_generic( Obj, FA, Nin, Lint ), Info )-H-Out :-
   klicformat( "  guard_generic( ~k, ~f, ~d, ~l );\n",
diff -ruN klic-3.003-2002-03-12/include/klic/g_vector.h klic-3.003-2002-03-12a/include/klic/g_vector.h
--- klic-3.003-2002-03-12/include/klic/g_vector.h	Tue Mar 12 12:10:20 2002
+++ klic-3.003-2002-03-12a/include/klic/g_vector.h	Tue Mar 12 12:30:16 2002
@@ -34,7 +34,7 @@
 }
 
 /* runtime/gmvv.c */
-extern q create_vector(q* body, long size, q* g_allocp);
+extern q create_vector(q* body, long size);
 extern q create_vector0(q* body, long size);
 
 #endif /* _KLIC_G_VECTOR_H_ */
diff -ruN klic-3.003-2002-03-12/include/klic/generic.h klic-3.003-2002-03-12a/include/klic/generic.h
--- klic-3.003-2002-03-12/include/klic/generic.h	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/include/klic/generic.h	Tue Mar 12 12:28:24 2002
@@ -14,9 +14,8 @@
 /* runtime/generic.c */
 extern void gd_generic(q g_object, long g_method_functor, q* g_argv);
 
-#define new_generic(name,argc,out,offset)  \
+#define new_generic(name,argc,out)  \
 do{ \
-  set_heapp(allocp + (offset)); \
   (out) = (name)((argc), generic_arg); \
   allocp = heapp(); \
 }while(0)
@@ -27,9 +26,8 @@
   allocp = heapp(); \
 }while(0)
 
-#define call_generic(obj,funct,offset) \
-  ( set_heapp(allocp + (offset)), \
-    gd_generic((obj),(funct),generic_arg), \
+#define call_generic(obj,funct) \
+  ( gd_generic((obj), (funct), generic_arg), \
     allocp = heapp() )
 
 #define call_generic0(obj,funct) \
diff -ruN klic-3.003-2002-03-12/runtime/asyncio.c klic-3.003-2002-03-12a/runtime/asyncio.c
--- klic-3.003-2002-03-12/runtime/asyncio.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/asyncio.c	Tue Mar 12 13:29:21 2002
@@ -47,8 +47,7 @@
 extern void switch_debugger_flag(void){ debugger_flag = ~debugger_flag; }
 
 static int
-sigio_handler(allocp, sig)
-  q* allocp;
+sigio_handler(sig)
   int sig;
 {
     declare_globals;
@@ -57,7 +56,6 @@
     static int retry_fd;
     static enum sigiotype retry_sigio_type = KLIC_SIGIO_NONE;
 
-    set_heapp(allocp);
     if (retry_sigio_type != KLIC_SIGIO_NONE) {
       if( sigio_handlers[retry_fd](retry_fd, retry_sigio_type, &fdsr, &fdsw) != 0 )
 	return 1;  /* again */
diff -ruN klic-3.003-2002-03-12/runtime/cntlmsg.c klic-3.003-2002-03-12a/runtime/cntlmsg.c
--- klic-3.003-2002-03-12/runtime/cntlmsg.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/cntlmsg.c	Tue Mar 12 12:43:00 2002
@@ -75,15 +75,13 @@
 /*
   ANSWER VALUE
   */
-static q*
-decode_answer_value(inbuf, allocp)
+static void
+decode_answer_value(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
     q exref;
     long return_index, wec;
     declare_globals;
-    set_heapp(allocp);
 
     INT_CL_DEBUG_X(iosprintf("%d:decode_answer_value\n", my_node));
     INT_CL_PROBE_X(netstat.recv_answer_cnt++);
@@ -102,8 +100,7 @@
  funct_label:
     /* decode_data is not used, and collected by local GC */
     decode_data = pop_decode_stack();
-
-    return heapp();
+    return;
  susp_label:
     
     decode_data = pop_decode_stack();
@@ -115,7 +112,6 @@
     answer_return_exp_index = -1;
     receive_answer_flag = 0;
     /* Hack to avoid sending %unify when a ReadHook receives answer_value. */
-    return heapp();
 }
 
 
@@ -156,19 +152,17 @@
     }
 }
 
-/*
-  READ
-  */
-static q*
-decode_read(inbuf, allocp)
+
+/* READ */
+
+static void
+decode_read(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
     q data, rhook, readhook;
     long node, index, wec;
     declare_globals;
     long recved_wtc, trans_cnt;
-    set_heapp(allocp);
 
     INT_CL_DEBUG_X(iosprintf("%d:decode_read\n", my_node));
     INT_CL_PROBE_X(netstat.recv_read_cnt++);
@@ -197,7 +191,7 @@
 	receive_answer_flag = 0;
 	/* Hack to avoid sending %unify
 	   when a ReadHook receives answer_value. */
-	return heapp();
+	return;
     }
     
     deref_and_switch(data, susp_label, atomic_label, cons_label, funct_label);
@@ -214,7 +208,7 @@
 	    if(dummy_obj-> method_table == get_exref_methtab()){
 	      INT_CL_DEBUG_X(ioprintf("Node:%d exref read transfer\n", my_node));
 	      if(transfer_read(trans_cnt,recved_wtc,node,index,wec,dummy_obj))
-		return heapp();
+		return;
 	    }
 	}
     }
@@ -226,9 +220,9 @@
     generic_arg[1] = makeint(index); /* exp_table (for answer) index */
     generic_arg[2] = makeint(wec);   /* WEC */
 
-    new_generic0(reply_hook_g_new, 3, rhook);
+    { q* allocp; new_generic(reply_hook_g_new, 3, rhook); }
     do_unify(rhook, data);
-    return heapp();
+    return;
     
  atomic_label:
  cons_label:
@@ -245,7 +239,7 @@
         PUT4_BUFFER(buffer, decode_answer_value, recved_wtc, index, wec);  
 	send_message_without_wtc_chk(node, buffer);
     }
-    return heapp();
+    return;
 }
 
 static int
@@ -319,15 +313,13 @@
 
 
 /* RELEASE */
-static q*
-decode_release(inbuf, allocp)
+static void
+decode_release(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
     q exp_data;
     declare_globals;
     long exp_index, wec;
-    set_heapp(allocp);
 
     INT_CL_DEBUG_X(iosprintf("%d:decode_release\n", my_node));
     INT_CL_PROBE_X(netstat.recv_release_cnt++);
@@ -336,7 +328,6 @@
     wec       = GET_BUFFER(inbuf);
     
     exp_data = (q)search_exptbl(exp_index, wec);
-    return heapp();
 }
 
 static void
@@ -367,15 +358,13 @@
 /*
   UNIFY
   */
-static q*
-decode_unify(inbuf, allocp)
+static void
+decode_unify(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
     q exp_data;
     long unify_index, unify_wec;
     declare_globals;
-    set_heapp(allocp);
 
     INT_CL_DEBUG_X(iosprintf("%d:decode_unify\n", my_node));
     INT_CL_PROBE_X(netstat.recv_unify_cnt++);
@@ -389,7 +378,6 @@
     decode_data = pop_decode_stack();
 
     do_unify(exp_data, decode_data);
-    return heapp();
 }
 
 static long
@@ -433,10 +421,9 @@
 /*
   THROW GOAL
   */
-static q*
-decode_throw_goal(inbuf, allocp)
+static void
+decode_throw_goal(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   struct goalrec *newgoal;
@@ -444,7 +431,6 @@
   unsigned short int arity;
   int i;
   long prio;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(iosprintf("%d:decode_throw_goal\n", my_node));
   INT_CL_PROBE_X(netstat.recv_throw_cnt++);
@@ -471,7 +457,6 @@
   } else {
     enqueue_goal(NULL, prio, newgoal, glbl);    
   }
-  return heapp();
 }
 
 static long
@@ -650,13 +635,11 @@
     iosprintf("%s", charbuf);
 }
 
-static q*
-decode_terminate_msg(inbuf, allocp)
+static void
+decode_terminate_msg(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
-  set_heapp(allocp);
 
   if (network_statistics_flag)
     print_statistics();
diff -ruN klic-3.003-2002-03-12/runtime/config/pvm-tcp/distpkt.c klic-3.003-2002-03-12a/runtime/config/pvm-tcp/distpkt.c
--- klic-3.003-2002-03-12/runtime/config/pvm-tcp/distpkt.c	Sat Mar  2 16:45:02 2002
+++ klic-3.003-2002-03-12a/runtime/config/pvm-tcp/distpkt.c	Tue Mar 12 13:33:35 2002
@@ -463,7 +463,7 @@
     for (i = 0; i < tid_table.child_count; ++i)
       if (i != my_node)
 	FD_CLR(port_tbl[i].fd, rfd);
-    return receive_message(heapp(), SIGIO);
+    return receive_message(SIGIO);
 }
 
 static void
diff -ruN klic-3.003-2002-03-12/runtime/datamsg.c klic-3.003-2002-03-12a/runtime/datamsg.c
--- klic-3.003-2002-03-12/runtime/datamsg.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/datamsg.c	Tue Mar 12 12:49:29 2002
@@ -10,10 +10,10 @@
   DATA ENCODER			void encode_data(buffer, data, depth)
 
   specially defined as extern for reference from exref generic object;
-  EXREF DECODER			q* decode_exref(inbuf, allocp)
-  decode atomic or const	static q* decode_atomic_or_const(inbuf, allocp)
-  decode list			static q* decode_list(inbuf, allocp)
-  decode funct			static q* decode_funct(inbuf, allocp)
+  EXREF DECODER			void decode_exref(inbuf)
+  decode atomic or const	static void decode_atomic_or_const(inbuf)
+  decode list			static void decode_list(inbuf)
+  decode funct			static void decode_funct(inbuf)
   */
 
 #include <assert.h>
@@ -57,29 +57,24 @@
   LEVEL0 OBJECTS encoding
   e.g. const, atomic and ref
   */
-static q*
-decode_atomic_or_const(inbuf, allocp)
+static void
+decode_atomic_or_const(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_const_or_atomic\n", my_node));
 
   decode_data = (q) GET_BUFFER(inbuf);
   push_decode_stack(decode_data);
-  return heapp();
 }
 
-extern q*
-decode_exref(inbuf, allocp)
+extern void
+decode_exref(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   long node;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_exref\n", my_node));
 
@@ -90,33 +85,27 @@
     long wec   = GET_BUFFER(inbuf);
 
     decode_data = (q) search_exptbl(index, wec);
-    push_decode_stack(decode_data);
-    return heapp();
-
   } else {
     /* If the data is other's data */
     generic_arg[0] = makeint(node);  /* PE number */
     generic_arg[1] = makeint(GET_BUFFER(inbuf));  /* exp_table index */
     generic_arg[2] = makeint(GET_BUFFER(inbuf));  /* WEC */
 
-    new_generic0(exref_g_new, 3L, decode_data);
-    push_decode_stack(decode_data);
-    return heapp();
+    { q* allocp; new_generic(exref_g_new, 3L, decode_data); }
   }
+  push_decode_stack(decode_data);
 }
 
 /*
   decode  STRUCTURED VALUE
   e.g. lists and functors
  */
-static q*
-decode_list(inbuf, allocp)
+static void
+decode_list(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   q list;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_list\n", my_node));
 
@@ -125,18 +114,15 @@
   cdr_of(list) = pop_decode_stack();
   car_of(list) = pop_decode_stack();
   push_decode_stack(list);
-  return heapp();
 }
 
-static q*
-decode_funct(inbuf, allocp)
+static void
+decode_funct(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   q funct, p_funct;
   int i;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_funct\n", my_node));
 
@@ -146,7 +132,7 @@
     inbuf->rd_index -= 2;
     heaplimit = 0;
     add_this_more_space(arityof(p_funct) + 1);
-    return heapp();
+    return;
   }
 
   heapalloc(funct, arityof(p_funct)+1, makefunctor);
@@ -156,7 +142,6 @@
     arg(funct, i-1) = pop_decode_stack();
   }
   push_decode_stack(funct);
-  return heapp();
 }
 
 /*
@@ -296,5 +281,4 @@
  Const_case:
   PUT2_BUFFER(buffer, decode_atomic_or_const, data);
   end_encode_data(buffer, cdrlist);
-  return;
 }
diff -ruN klic-3.003-2002-03-12/runtime/ge_exref.c klic-3.003-2002-03-12a/runtime/ge_exref.c
--- klic-3.003-2002-03-12/runtime/ge_exref.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/ge_exref.c	Tue Mar 12 13:01:33 2002
@@ -33,7 +33,7 @@
 #include <klic/generic.h>
 
 extern q read_hook_g_new();
-extern q* decode_exref();
+extern void decode_exref();
 
 GGDEF_GENERATE()
 {
@@ -45,8 +45,7 @@
   generic_arg[1] = makeint(GG_SELF->index);
   generic_arg[2] = makeint(GG_SELF->wec);
 
-  new_generic0(read_hook_g_new, 3, rdhok);
-  assert(allocp == heapp());
+  new_generic(read_hook_g_new, 3, rdhok);
 
   GG_SELF->method_table = 0;
 
diff -ruN klic-3.003-2002-03-12/runtime/gfloat.c klic-3.003-2002-03-12a/runtime/gfloat.c
--- klic-3.003-2002-03-12/runtime/gfloat.c	Mon Mar 11 17:36:00 2002
+++ klic-3.003-2002-03-12a/runtime/gfloat.c	Tue Mar 12 12:51:29 2002
@@ -49,7 +49,7 @@
 
 #ifdef DIST
 extern void push_decode_stack();
-static q* decode_float(combuf* inbuf, q* g_allocp);
+static void decode_float(combuf* inbuf);
 #endif /* DIST */
 
 GD_USE_CLASS(byte__string);
@@ -398,15 +398,13 @@
 }
 
 #ifdef DIST
-static q*
-decode_float(inbuf, g_allocp)
+static void
+decode_float(inbuf)
   combuf* inbuf;
-  q* g_allocp;
 {
   G_STD_DECL;
   GD_OBJ_TYPE* newobj;
 
-  set_heapp(g_allocp);
   ALIGN();
   G_HEAPALLOC(newobj, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE*));
 
@@ -420,6 +418,5 @@
     newobj->value = dl.d;
   }
   push_decode_stack((q) makefunctor(newobj));
-  return heapp();
 }
 #endif /* DIST */
diff -ruN klic-3.003-2002-03-12/runtime/gmvv.c klic-3.003-2002-03-12a/runtime/gmvv.c
--- klic-3.003-2002-03-12/runtime/gmvv.c	Tue Mar 12 12:12:36 2002
+++ klic-3.003-2002-03-12a/runtime/gmvv.c	Tue Mar 12 12:52:47 2002
@@ -40,7 +40,7 @@
 extern void push_decode_stack();
 extern q pop_decode_stack();
 extern q element_of_vector(q v, q k);
-static q* decode_vector(combuf* inbuf, q* g_allocp);
+static void decode_vector(combuf* inbuf);
 #endif /* DIST */
 
 
@@ -563,12 +563,10 @@
 /* Interface with builtin predicates */
 
 extern q
-create_vector(body, size, g_allocp)
-     q *body;
-     long size;
-     q *g_allocp;
+create_vector(body, size)
+  q* body;
+  long size;
 {
-  set_heapp(g_allocp);
   return create_vector0(body, size);
 }
 
@@ -609,19 +607,16 @@
 }
 
 #ifdef DIST
-static q*
-decode_vector(inbuf, g_allocp)
+static void
+decode_vector(inbuf)
      combuf *inbuf;
-     q *g_allocp;
 {
   G_STD_DECL;
   GD_OBJ_TYPE *newvect;
   q *body;
   long size, k;
   q res;
-  module decoder;
 
-  set_heapp(g_allocp);
   /* GDSET_NEWOBJ_FOR_NEW(newvect, G_SIZE_IN_Q(GD_OBJ_TYPE)); */
   G_HEAPALLOC_WITH_CHECK(newvect, G_SIZE_IN_Q(GD_OBJ_TYPE),
                           (GD_OBJ_TYPE*), res);
@@ -633,7 +628,7 @@
       inbuf->rd_index--;
 
       /* fprintf(stderr, "Node %d Heap shortage in decoding vector(1)", my_node); */
-      return heapp();
+      return;
   }
   newvect->method_table = &GD_method_table;
   newvect-> index = size = (long)GET_BUFFER(inbuf);
@@ -647,7 +642,7 @@
       inbuf->rd_index -= 2;
 
       /* fprintf(stderr, "Node %d Heap shortage in decoding vector(2)", my_node); */
-      return heapp();
+      return;
   }
 
   for(k = size; k > 0 ; k--){
@@ -659,6 +654,5 @@
   newvect->body = body;
 
   push_decode_stack((q)makefunctor(newvect));
-  return heapp();
 }
 #endif /* DIST */
diff -ruN klic-3.003-2002-03-12/runtime/gstring.c klic-3.003-2002-03-12a/runtime/gstring.c
--- klic-3.003-2002-03-12/runtime/gstring.c	Mon Mar 11 17:31:05 2002
+++ klic-3.003-2002-03-12a/runtime/gstring.c	Tue Mar 12 12:53:57 2002
@@ -35,7 +35,7 @@
 #ifdef DIST
 extern void push_decode_stack();
 extern unsigned char* generic_string_body(GD_OBJ_TYPE* str);
-static q* decode_byte_string(combuf* inbuf, q* g_allocp);
+static void decode_byte_string(combuf* inbuf);
 #endif /* DIST */
 
 
@@ -649,10 +649,9 @@
 }
 
 #ifdef DIST
-static q*
-decode_byte_string(inbuf, g_allocp)
+static void
+decode_byte_string(inbuf)
      combuf *inbuf;
-     q *g_allocp;
 {
   G_STD_DECL;
   GD_OBJ_TYPE *newstring;
@@ -662,7 +661,6 @@
   int i;
   q res;
 
-  set_heapp(g_allocp);
   G_HEAPALLOC_WITH_CHECK(newstring, G_SIZE_IN_Q(GD_OBJ_TYPE), 
 			  (GD_OBJ_TYPE*), res);
   /* G_HEAPALLOC(newstring, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE*)); */
@@ -673,7 +671,7 @@
       inbuf->rd_index--;
 
       /* fprintf(stderr, "Node %d Heap shortage in decoding string(1)", my_node); */
-      return heapp();
+      return;
   }
   newstring->method_table = &GD_method_table;
   newstring->index = (long)GET_BUFFER(inbuf);
@@ -693,7 +691,7 @@
       inbuf->rd_index -= 2;
 
       /* fprintf(stderr, "Node %d Heap shortage in decoding string(2)", my_node); */
-      return heapp();
+      return;
   }
 
   tmp_buf = (long *)body;
@@ -707,7 +705,6 @@
 
   /* decode_data = (q) makefunctor(newstring); */
   push_decode_stack((q)makefunctor(newstring));
-  return heapp();
 }
 #endif /* DIST */
 
diff -ruN klic-3.003-2002-03-12/runtime/intrpt.c klic-3.003-2002-03-12a/runtime/intrpt.c
--- klic-3.003-2002-03-12/runtime/intrpt.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/intrpt.c	Tue Mar 12 13:34:07 2002
@@ -99,7 +99,7 @@
 #endif
 #if defined(DIST) && defined(USE_REDUCTION_COUNT)
     {
-      int again = receive_message(heapp(), 0);
+      int again = receive_message(0);
       if( again == 0 )
 	heaplimit = real_heaplimit();
       allocp = heapp();
diff -ruN klic-3.003-2002-03-12/runtime/itimer.kl1 klic-3.003-2002-03-12a/runtime/itimer.kl1
--- klic-3.003-2002-03-12/runtime/itimer.kl1	Fri Feb 22 22:27:35 2002
+++ klic-3.003-2002-03-12a/runtime/itimer.kl1	Tue Mar 12 13:20:16 2002
@@ -13,7 +13,7 @@
 #define Twotime2time(X, Y) (((X) * SEC_DAY + (Y)))
 
 #ifdef USETIMER
-extern q* reserve_klic_timer_interrupt();  /* ktimer.c */
+extern void reserve_klic_timer_interrupt();  /* ktimer.c */
 #endif
 ".
 
@@ -83,10 +83,11 @@
     inline:"
   {
 #ifdef USETIMER
-    allocp =
-      reserve_klic_timer_interrupt(allocp,
+    set_heapp(allocp);
+    reserve_klic_timer_interrupt(
 				 Twotime2time(intval(%0), intval(%1)),
 				 intval(%2), %3);
+    allocp = heapp();
 #endif
   }": [Day+int, Sec+int, Usec+int, X+any] | true.
 
@@ -103,7 +104,9 @@
     klic_gettod(&now);
     TimeSet(intvl, Twotime2time(intval(%0), intval(%1)), intval(%2));
     TimeAdd(now, intvl, at);
-    allocp = reserve_klic_timer_interrupt(allocp, at.tv_sec, at.tv_usec, %3);
+    set_heapp(allocp);
+    reserve_klic_timer_interrupt(at.tv_sec, at.tv_usec, %3);
+    allocp = heapp();
 #endif
   }": [Day+int, Sec+int, Usec+int, X+any] | true.
 
diff -ruN klic-3.003-2002-03-12/runtime/kmain.c klic-3.003-2002-03-12a/runtime/kmain.c
--- klic-3.003-2002-03-12/runtime/kmain.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/kmain.c	Tue Mar 12 13:34:55 2002
@@ -44,7 +44,6 @@
 #define IDLE_ON()  (perfmon_state.idle_on = 1)
 #define IDLE_OFF() (perfmon_state.idle_on = 0)
 
-int receive_message();
 void gc_exp_table(void);
 void gc_decode_stack(void);
 void scan_imp_table(void);
@@ -174,10 +173,7 @@
 char *optarg;
 
 #ifdef DIST
-static int
-kill_tasks (allocp, sig)
-q *allocp;
-int sig;
+static int kill_tasks(int sig)
 {
     klic_fprintf(stdout, "kill tasks\n");
     kill_child();
diff -ruN klic-3.003-2002-03-12/runtime/ktimer.c klic-3.003-2002-03-12a/runtime/ktimer.c
--- klic-3.003-2002-03-12/runtime/ktimer.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/ktimer.c	Tue Mar 12 13:46:41 2002
@@ -37,34 +37,29 @@
 static struct timer_reservation_rec *timer_reservations;
 static struct timer_reservation_rec *timer_rsv_free;
 
-static int process_timed_instantiation(allocp, data)
-     q *allocp;
+static int process_timed_instantiation(data)
      q data;
 {
   declare_globals;
 
-  set_heapp(allocp);
   do_unify_value(data, NILATOM);
   return 0;
 }
 
-static int process_simple_timer_handler(allocp, data)
-     q *allocp;
+static int process_simple_timer_handler(data)
      q data;
 {
   declare_globals;
 
-  return ((int (*)()) ((unsigned long)data-ATOMIC))(heapp(), SIGALRM);
+  return ((int (*)()) ((unsigned long)data-ATOMIC))(SIGALRM);
 }
 
-int
-process_timer_interrupt(allocp, sig)
-     q* allocp;
+static int
+process_timer_interrupt(sig)
      long sig;
 {
   declare_globals;
   struct timeval now;
-  set_heapp(allocp);
 
   klic_gettod(&now);
   while (timer_reservations != 0 &&
@@ -72,7 +67,6 @@
     int result =
-      timer_reservations-> handler(heapp(), timer_reservations->data);
+      timer_reservations-> handler(timer_reservations->data);
     if (result != 0) return result;
-    allocp = heapp();
     if (TimeIsZero(timer_reservations->interval)) {
       struct timer_reservation_rec *tmp = timer_reservations->next;
       timer_reservations->next = timer_rsv_free;
@@ -155,17 +149,15 @@
     ;
   newrec->next = *tmp;
   *tmp = newrec;
-  process_timer_interrupt(heapp(), SIGALRM);
+  process_timer_interrupt(SIGALRM);
 }  
 
-q *reserve_klic_timer_interrupt(allocp, sec, usec, vrbl)
-     q *allocp;
+extern void reserve_klic_timer_interrupt(sec, usec, vrbl)
      long sec, usec;
      q vrbl;
 {
   declare_globals;
   struct timer_reservation_rec *newrec, **tmp;
-  set_heapp(allocp);
 
   newrec = alloc_timer_reservation_rec();
   TimeSet(newrec->at, sec, usec);
@@ -178,8 +170,7 @@
     ;
   newrec->next = *tmp;
   *tmp = newrec;
-  process_timer_interrupt(heapp(), SIGALRM);
-  return heapp();
+  process_timer_interrupt(SIGALRM);
 }
 
 #endif  /* USETIMER */
diff -ruN klic-3.003-2002-03-12/runtime/profile.c klic-3.003-2002-03-12a/runtime/profile.c
--- klic-3.003-2002-03-12/runtime/profile.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/profile.c	Tue Mar 12 13:42:07 2002
@@ -22,25 +22,22 @@
 
 /*
  * Profiler support routines
- * static q* decode_send_profile(inbuf, allocp)
+ * static void decode_send_profile(inbuf)
  * static void encode_send_profile(buffer)
- * int send_profile_signal(allocp, sig)
  */
 
 /* 
   SEND_PROFILE (from WORKERs to SHOEN)
   */
 
-static q*
-decode_send_profile(inbuf, allocp)
+static void
+decode_send_profile(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   static int gathered_count = 0;
 
   declare_globals;
   long node;
-  set_heapp(allocp);
   node = GET_BUFFER(inbuf);
 
   shoen_profile[node].stimes = GET_BUFFER(inbuf);
@@ -55,8 +52,6 @@
     gathered_count = 0;
     gather_prof_ready = 1;
   }
-
-  return heapp();
 }
 
 static void
@@ -108,13 +103,11 @@
   SEND_PROFILE_TRIGGER (from WORKERs to SHOEN)
   */
 
-static q*
-decode_profile_trigger(inbuf, allocp)
+static void
+decode_profile_trigger(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   send_profile();
-  return heapp();
 }
 
 static void
@@ -134,13 +127,11 @@
 }
 
 extern int
-send_profile_trigger(allocp, sig)
-  q* allocp;
+send_profile_trigger(sig)
   int sig;
 {
   declare_globals;
   long i;
-  set_heapp(allocp);
 
   if( gather_prof_ready ){
     for( i = 0; i < total_node; i++ ){
diff -ruN klic-3.003-2002-03-12/runtime/sendrecv.c klic-3.003-2002-03-12a/runtime/sendrecv.c
--- klic-3.003-2002-03-12/runtime/sendrecv.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/sendrecv.c	Tue Mar 12 13:35:36 2002
@@ -58,7 +58,7 @@
   SEND MESSAGE WITHOUT WTC CHK	void send_message_without_wtc_chk(node, sendbuf)
   SEND MESSAGE			void send_message(node, sendbuf)
   MESSAGE SUSPEND		void message_suspend(dummy_wtc, node, outbuf)
-  RECEIVE MESSAGE		int receive_message(allocp, sig)
+  RECEIVE MESSAGE		int receive_message(sig)
 
   Wtc feed/suply message handling.
   supply wtc			static void send_supply_wtc(node)
@@ -150,12 +150,10 @@
   RECEIVE MESSAGE
   */
 extern int
-receive_message(allocp, sig)
-  q* allocp;
+receive_message(sig)
   int sig;
 {
   declare_globals;
-  set_heapp(allocp);
   /* static combuf* pending_msg = NULL; */
 
   if( heapp() + this_more_space() >= real_heaplimit() ){
@@ -192,9 +190,9 @@
     }
 
     while( !IS_BUFFER_EMPTY(inbuf) ){
-      module decoder;
-      decoder = (module) GET_BUFFER(inbuf);
-      set_heapp((q*) decoder(inbuf, heapp()));
+      void (*decode)(combuf*);
+      decode = (module) GET_BUFFER(inbuf);
+      decode(inbuf);
       if( heapp() + this_more_space() >= real_heaplimit() ){
 	/* fprintf(stderr, "Node %d, decode pending\n", my_node); */
 	pending_msg = inbuf;
@@ -241,13 +239,11 @@
   return 1;  /* successfully send all suspended messages */
 }
 
-static q*
-decode_supply_wtc(inbuf, allocp)
+static void
+decode_supply_wtc(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_supply_wtc\n", my_node));
   INT_CL_PROBE_X(netstat.recv_supply_wtc_cnt++);
@@ -266,7 +262,6 @@
     requesting_wtc = 1;
     send_request_wtc();
   }
-  return heapp();
 }
 
 static void
@@ -300,21 +295,17 @@
 /*
   REQUEST WTC
   */
-static q*
-decode_request_wtc(inbuf, allocp)
+static void
+decode_request_wtc(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   long node = GET_BUFFER(inbuf);
-  set_heapp(allocp);
 
   INT_CL_DEBUG_X(ioprintf("%d:decode_request_wtc(%ld)\n", my_node, node));
   INT_CL_PROBE_X(netstat.recv_request_wtc_cnt++);
   shoen_wtc += 1;		/* wtc for request_wtc */
   send_supply_wtc(node);
-
-  return heapp();
 }
 
 static void
@@ -348,21 +339,17 @@
 /*
   RETURN WTC
   */
-static q*
-decode_return_wtc(inbuf, allocp)
+static void
+decode_return_wtc(inbuf)
   combuf* inbuf;
-  q* allocp;
 {
   declare_globals;
   long ret_wtc;
-  set_heapp(allocp);
 
   INT_CL_PROBE_X(netstat.recv_return_wtc_cnt++);
   ret_wtc = GET_BUFFER(inbuf);
   INT_CL_DEBUG_X(ioprintf("%d:decode_return_wtc(%d)\n", my_node, ret_wtc));
   shoen_wtc += ret_wtc;
-
-  return heapp();
 }
 
 static void
@@ -458,7 +445,7 @@
 }
 
 /*
-  Initiate message decoder stack
+  Initiate message decode stack
 */
 
 extern void
diff -ruN klic-3.003-2002-03-12/runtime/signal.c klic-3.003-2002-03-12a/runtime/signal.c
--- klic-3.003-2002-03-12/runtime/signal.c	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-12a/runtime/signal.c	Tue Mar 12 13:28:17 2002
@@ -45,7 +45,6 @@
 klic_signal_handler(void)
 {
   declare_globals;
-  q* allocp = heapp();
   int sig;
 
   do {
@@ -54,8 +53,7 @@
       if (signal_flags[sig]) {
 	int again;
 	signal_flags[sig] = 0;
-	again = signal_handlers[sig](heapp(), sig);
-	allocp = heapp();
+	again = signal_handlers[sig](sig);
 	if (again) {
 	  signal_done = 0;
 	  signal_flags[sig] = 1;
@@ -156,15 +154,14 @@
   }
 }
 
-static int streamed_signal_handler(allocp, sig)
-     q *allocp;
+static int streamed_signal_handler(sig)
      int sig;
 {
   declare_globals;
+  q* allocp = klic_alloc(2);
   q newcons = makecons(allocp);
   q newvar = allocp[0] = makeref(&allocp[0]);
   allocp[1] = makeint(sig);
-  klic_alloc(2);
   do_unify_value(signal_streams[sig], newcons);
   signal_streams[sig] = newvar;
   return 0;
@@ -198,11 +195,9 @@
   DEFAULT SIGPIPE HANDLER
 ****************************************/
 
-static int default_sigpipe_handler(allocp, sig)
-     q *allocp;
+static int default_sigpipe_handler(sig)
      int sig;
 {
-  declare_globals;
   return 0;
 }
 
diff -ruN klic-3.003-2002-03-12/runtime/unify.c klic-3.003-2002-03-12a/runtime/unify.c
--- klic-3.003-2002-03-12/runtime/unify.c	Mon Mar 11 13:18:59 2002
+++ klic-3.003-2002-03-12a/runtime/unify.c	Tue Mar 12 12:34:38 2002
@@ -532,10 +532,10 @@
   do_unify(u, v);
 }
 
-/*
-  do_unify_value(allocp, x, y)
-	"do_unify" for when "y" is known to be instantiated.
-*/
+/**
+ * do_unify_value(x, y)
+ * "do_unify" for when "y" is known to be instantiated.
+ */
 extern void
 do_unify_value(x, y)
      q x, y;
