diff -ruN klic-3.003-2002-02-25b/include/klic/control.h klic-3.003-2002-02-25c/include/klic/control.h
--- klic-3.003-2002-02-25b/include/klic/control.h	Mon Feb 25 13:13:21 2002
+++ klic-3.003-2002-02-25c/include/klic/control.h	Mon Feb 25 17:37:46 2002
@@ -73,10 +73,10 @@
 #if defined(DIST) && defined(USE_REDUCTION_COUNT)
 #define _INC_REDUCTION_COUNT(maxcount) \
 do{ \
-  if (reduction_count < (maxcount)) { \
-    reduction_count++; \
+  if (reduction_count() < (maxcount)) { \
+    inc_reduction_count(); \
   } else { \
-    reduction_count = 0; \
+    reset_reduction_count(); \
     heaplimit = 0; \
   } \
 }while(0)
diff -ruN klic-3.003-2002-02-25b/include/klic/gc_macro.h klic-3.003-2002-02-25c/include/klic/gc_macro.h
--- klic-3.003-2002-02-25b/include/klic/gc_macro.h	Mon Feb 25 14:58:03 2002
+++ klic-3.003-2002-02-25c/include/klic/gc_macro.h	Mon Feb 25 18:09:34 2002
@@ -10,13 +10,14 @@
 
 #include <klic/stdc.h>  /* CONCATENATE */
 #include <klic/basic.h>  /* fatal, debug_printf, klic_fprintf, klic_putc */
-#include <klic/struct.h>  /* rest_of_stream, method_result */
 
 extern q GC_wakeup_g_new();
 
 /* runtime/unify.c */
 extern void do_shallow_unify(q x, q y);
 extern void do_shallow_unify_value(q x, q y);
+extern void set_rest_of_stream(q term);
+extern void set_method_result(q term);
 
 /* runtime/generic.c */
 extern void G_SUSPEND(q x, struct goalrec* goal);
@@ -43,15 +44,15 @@
 
 #define    GC_RETURN_WITH_HOOK(x) \
 do{ \
-  method_result = GC_SUCCEEDED; \
-  rest_of_stream = (x); \
+  set_method_result(GC_SUCCEEDED); \
+  set_rest_of_stream(x); \
   return g_allocp; \
 }while(0)
 
 #define GC_TERMINATE \
 do{ \
-  method_result = GC_SUCCEEDED; \
-  rest_of_stream = 0; \
+  set_method_result(GC_SUCCEEDED); \
+  set_rest_of_stream(NULL); \
   return g_allocp; \
 }while(0)
 
@@ -59,10 +60,10 @@
 do{ \
   q newvar, tmp; \
   q argv[2]; \
-  method_result = GC_SUCCEEDED; \
+  set_method_result(GC_SUCCEEDED); \
   G_MAKE_VAR(newvar); \
   assert(g_allocp >= heapp() + 1); \
-  rest_of_stream = newvar; \
+  set_rest_of_stream(newvar); \
   argv[0] = GC_TERM; \
   argv[1] = newvar; \
   assert(g_allocp >= heapp() + 1); \
diff -ruN klic-3.003-2002-02-25b/include/klic/struct.h klic-3.003-2002-02-25c/include/klic/struct.h
--- klic-3.003-2002-02-25b/include/klic/struct.h	Mon Feb 25 15:03:55 2002
+++ klic-3.003-2002-02-25c/include/klic/struct.h	Mon Feb 25 17:59:28 2002
@@ -187,20 +187,8 @@
 #define resumed_goals	(glbl->resumed_goals0)
 #define heaplimit	(glbl->heaplimit0)
 #define interrupt_off   (glbl->interrupt_off0)
-#define command_argc	(glbl->command_argc0)
-#define command_argv	(glbl->command_argv0)
-#define suspensions	(glbl->suspensions0)
-#define	resumes		(glbl->resumes0)
-#define cum_susps	(glbl->cum_susps0)
-#define	cum_resumps	(glbl->cum_resumps0)
-#define suspended_goal_list (glbl->suspended_goal_list0)
-#define postmortem_pred (glbl->postmortem_pred0)
-#define postmortem_args (glbl->postmortem_args0)
 #define generic_arg	(glbl->generic_arg0)
 #define reasons		(glbl->reasons0)
-#if ( defined(DIST) && defined(USE_REDUCTION_COUNT) )
-#define reduction_count (glbl->reduction_count0)
-#endif
 #define my_node		(glbl->par.my_num0)
 #define total_node	(glbl->par.num_pes0)
 
@@ -232,58 +220,14 @@
     } aux;
   } par;
 
-  int command_argc0;
-  char** command_argv0;
-  unsigned long suspensions0, resumes0, cum_susps0, cum_resumps0;
-  struct suspended_goal_rec* suspended_goal_list0;
-  const struct predicate* postmortem_pred0;
-  q postmortem_args0;
   q generic_arg0[MAXGENERICARGS]; /* arguments of generic methods */
   q reasons0[MAXSUSPENSION];	/* suspension reasons */
-#if ( defined(DIST) && defined(USE_REDUCTION_COUNT) )
-  int reduction_count0;
-#endif
 } globals;
 
 Extern struct global_variables* My_glbl  Init(&globals);
 
 #define declare_globals struct global_variables* glbl = My_glbl
 
-/*
-  memory block outside of heap.
-*/
-
-Extern long higher_priority_goal;
-
-/*
- * variable for mutable objects
- * datas for general utility with consumer object
- */
-
-/****************
-  suspension_reason
-
-  shows result of the processing for consumer object.
-
-  0: normal;
-  1: GC request;
-  other: the process is suspended. pointer of the reason of the prosess.
-******************/
-Extern q suspension_reason;
-
-/************
-  rest_of_stream
-
-  indicates the next hooked term. This variable is meaningful
-  just `suspension_reason' is 0.
-
-  0: normal;
-  other: the next hooked term
-**************/
-Extern q rest_of_stream;
-
-extern q method_result;
-
 
 /* runtime/alloc.c */
 extern q* heapp(void);
@@ -308,22 +252,47 @@
 extern void add_this_more_space(unsigned long size);
 extern void reset_this_more_space(void);
 
+/* runtime/faisus.c */
+extern unsigned long suspensions(void);
+extern void reset_suspensions(void);
+
 /* runtime/gc.c */
 extern q** gcsp(void);
 extern q** gcmax(void);
+extern struct suspended_goal_rec* suspended_goal_list(void);
 extern void set_gcsp(q** pp);
+extern void set_suspended_goal_list(struct suspended_goal_rec* p);
+
+/* runtime/intrpt.c */
+extern void set_higher_priority_goal(void);
 
 /* runtime/kmain.c */
 extern unsigned long heapsize(void);
 extern unsigned long maxheapsize(void);
 extern unsigned long incrementsize(void);
 extern double maxactiveratio(void);
+extern int command_argc(void);
+extern char* command_arg(int i);
+extern unsigned long resumes(void);
+extern unsigned long cum_susps(void);
+extern unsigned long cum_resumps(void);
 extern void double_heapsize(void);
+extern void inc_resumes(void);
+#if defined(DIST) && defined(USE_REDUCTION_COUNT)
+extern int reduction_count(void);
+extern void inc_reduction_count(void);
+extern void reset_reduction_count(void);
+#endif
 
 /* runtime/sched.c */
 extern struct prioqrec prioq(void);
 extern unsigned long current_prio(void);
 extern void set_current_prio(unsigned long prio);
+
+/* runtime/sysc.kl1 */
+extern const struct predicate* postmortem_pred(void);
+extern q postmortem_args(void);
+extern void reset_postmortem(void);
 
 
 #endif /* _KLIC_STRUCT_H_ */
diff -ruN klic-3.003-2002-02-25b/runtime/bodyblt.kl1 klic-3.003-2002-02-25c/runtime/bodyblt.kl1
--- klic-3.003-2002-02-25b/runtime/bodyblt.kl1	Mon Feb 25 14:17:46 2002
+++ klic-3.003-2002-02-25c/runtime/bodyblt.kl1	Mon Feb 25 16:01:31 2002
@@ -92,11 +92,11 @@
     }
     klic_fprintf(stdout, \"%%ld GC\\n\", gctimes-gctimes_before);
     klic_fprintf(stdout, \"  %%ld suspensions; %%ld resumptions\\n\",
-                 suspensions, resumes);
-    if (cum_susps != 0 || cum_resumps != 0) {
+                 suspensions(), resumes());
+    if (cum_susps() != 0 || cum_resumps() != 0) {
       klic_fprintf(stdout,
                    \"  %%ld total suspensions; %%ld total resumptions\\n\",
-                   cum_susps+suspensions, cum_resumps+resumes);
+                   cum_susps() + suspensions(), cum_resumps() + resumes());
     }
   }":[X0-int] | X=X0.
 
diff -ruN klic-3.003-2002-02-25b/runtime/cntlmsg.c klic-3.003-2002-02-25c/runtime/cntlmsg.c
--- klic-3.003-2002-02-25b/runtime/cntlmsg.c	Mon Feb 25 14:17:56 2002
+++ klic-3.003-2002-02-25c/runtime/cntlmsg.c	Mon Feb 25 15:55:20 2002
@@ -645,7 +645,7 @@
 	      ptr += strlen(ptr);
 	  }
 	  sprintf(ptr, " %ld GC %ld suspensions; %ld resumptions\n",
-		  gctimes, suspensions, resumes);
+		  gctimes, suspensions(), resumes());
 	  ptr += strlen(ptr);
       }
       return ptr;
diff -ruN klic-3.003-2002-02-25b/runtime/debug.c klic-3.003-2002-02-25c/runtime/debug.c
--- klic-3.003-2002-02-25b/runtime/debug.c	Fri Feb  8 15:40:09 2002
+++ klic-3.003-2002-02-25c/runtime/debug.c	Mon Feb 25 17:21:58 2002
@@ -68,7 +68,7 @@
   EmergencyStop();
 #endif /* DIST */
 
-  if (postmortem_pred !=0 && postmortem_args !=0) {
+  if (postmortem_pred() != NULL && postmortem_args() != NULL) {
     longjmp(klic_topmost, 1);
   }
 #ifdef DIST
diff -ruN klic-3.003-2002-02-25b/runtime/faisus.c klic-3.003-2002-02-25c/runtime/faisus.c
--- klic-3.003-2002-02-25b/runtime/faisus.c	Mon Feb 25 13:14:54 2002
+++ klic-3.003-2002-02-25c/runtime/faisus.c	Mon Feb 25 16:08:27 2002
@@ -34,6 +34,10 @@
 #endif /* DEBUGLIB */
 
 
+static unsigned long suspensions0;
+extern unsigned long suspensions(void){ return suspensions0; }
+extern void reset_suspensions(void){ suspensions0 = 0; }
+
 static void
 do_fail(goal, reasonp)
   struct goalrec* goal;
@@ -62,8 +66,8 @@
   heapalloc(sm, sizeof(struct suspended_goal_rec)/sizeof(q),
 	    (struct suspended_goal_rec*));
   sm->goal = goal;
-  sm->next = suspended_goal_list;
-  suspended_goal_list = sm;
+  sm->next = suspended_goal_list();
+  set_suspended_goal_list(sm);
   if (count_suspension) {
     record_suspended_pred(goal);
   }
@@ -159,7 +163,7 @@
   }
   if (suspended) {
     allocp = record_susp(allocp, goal);
-    suspensions++;
+    suspensions0 ++;
   }
 
   return allocp;
@@ -291,7 +295,7 @@
 	resume_same_prio(goal);
       } else {
 	allocp = record_susp(allocp, goal);
-	suspensions++;
+	suspensions0 ++;
       }
     }
     set_heapp(allocp);
diff -ruN klic-3.003-2002-02-25b/runtime/gc.c klic-3.003-2002-02-25c/runtime/gc.c
--- klic-3.003-2002-02-25b/runtime/gc.c	Mon Feb 25 15:24:54 2002
+++ klic-3.003-2002-02-25c/runtime/gc.c	Mon Feb 25 16:09:34 2002
@@ -49,10 +49,13 @@
 static q** gcmax0;
 static unsigned long gcstack_size;
 static unsigned long copied_susp;
+static struct suspended_goal_rec* suspended_goal_list0;
 
 extern q** gcsp(void){ return gcsp0; }
 extern q** gcmax(void){ return gcmax0; }
+extern struct suspended_goal_rec* suspended_goal_list(void){ return suspended_goal_list0; }
 extern void set_gcsp(q** pp){ gcsp0 = pp; }
+extern void set_suspended_goal_list(struct suspended_goal_rec* p){ suspended_goal_list0 = p; }
 
 static struct goalrec* collect_garbage(struct goalrec* qp);
 
@@ -692,19 +695,19 @@
 #ifdef DEBUGLIB
   {
     struct suspended_goal_rec* sgl;
-    struct suspended_goal_rec** sgl_tail = &suspended_goal_list;
+    struct suspended_goal_rec** sgl_tail = &suspended_goal_list0;
     struct goalrec* dead_goal = NULL;
     q* hp = heapp();
-    if( copied_susp != suspensions-resumes ){
+    if( copied_susp != suspensions() - resumes() ){
       klic_fprintf(stderr,
 		   "%d perpetually suspending goals found\n",
-		   suspensions-resumes-copied_susp);
+		   suspensions() - resumes() - copied_susp);
     }
 
     /* First, we will copy the surface of suspended goal list.
      * This is needed to distinguish resumed goals and
      * goals copied while copying other goals in this list */
-    for( sgl = suspended_goal_list; sgl != NULL; sgl = sgl->next ){
+    for( sgl = suspended_goal_list(); sgl != NULL; sgl = sgl->next ){
       if( sgl->goal->pred == 0 || !isref(sgl->goal->next) ){
 	/* already copied or not resumed yet */
 	struct suspended_goal_rec* newsgr =
@@ -718,7 +721,7 @@
     *sgl_tail = NULL;
 
     /* Next, we will copy the suspended goals */
-    for( sgl = suspended_goal_list; sgl != NULL; sgl = sgl->next ) {
+    for( sgl = suspended_goal_list(); sgl != NULL; sgl = sgl->next ) {
       if( sgl->goal->pred == 0 ){
 	sgl->goal = sgl->goal->next;
       }else{
@@ -741,7 +744,7 @@
   }
 #endif /* DEBUGLIB */
 
-  if( copied_susp != suspensions-resumes ){
+  if( copied_susp != suspensions() - resumes() ){
     fatal("Perpetually suspending goal(s) found during GC");
   }
 
diff -ruN klic-3.003-2002-02-25b/runtime/gunix.kl1 klic-3.003-2002-02-25c/runtime/gunix.kl1
--- klic-3.003-2002-02-25b/runtime/gunix.kl1	Mon Feb 25 14:03:22 2002
+++ klic-3.003-2002-02-25c/runtime/gunix.kl1	Mon Feb 25 15:36:44 2002
@@ -1313,16 +1313,16 @@
         COMMAND ARGUMENT ACCESS
 ****************************************/
 
-argc(C) :- inline:"%0 = makeint(command_argc);": [Argc-int] | C = Argc.
+argc(C) :- inline:"%0 = makeint(command_argc());": [Argc-int] | C = Argc.
 
-argv(L) :- inline:"%0 = makeint(command_argc);": [Argc-int] |
+argv(L) :- inline:"%0 = makeint(command_argc());": [Argc-int] |
   make_argv_list(0, Argc, L).
 
 make_argv_list(N, N, L) :-
   L = [].
 make_argv_list(K, N, L) :- K<N, inline:"
   {
-    %1 = C2KLIC(command_argv[intval(%0)], allocp);
+    %1 = C2KLIC(command_arg(intval(%0)), allocp);
     allocp = heapp();
   }": [K+int, S-object(byte_string)] |
   L = [S | T],
diff -ruN klic-3.003-2002-02-25b/runtime/intrpt.c klic-3.003-2002-02-25c/runtime/intrpt.c
--- klic-3.003-2002-02-25b/runtime/intrpt.c	Mon Feb 25 14:50:32 2002
+++ klic-3.003-2002-02-25c/runtime/intrpt.c	Mon Feb 25 17:46:10 2002
@@ -39,6 +39,9 @@
 
 int sigint_interrupt = 0;
 
+static int higher_priority_goal0;
+extern void set_higher_priority_goal(void){ higher_priority_goal0 = !0; }
+
 static struct goalrec*
 enqueue_resumed_goals(qp)
   struct goalrec* qp;
@@ -117,8 +120,8 @@
 #endif
 
     /* priority support */
-    if( higher_priority_goal ){
-      higher_priority_goal = 0;
+    if( higher_priority_goal0 ){
+      higher_priority_goal0 = 0;
       put_priority_queue(qp, current_prio());
       qp = get_top_priority_queue();
       if( interrupt_off ) heaplimit = real_heaplimit();
diff -ruN klic-3.003-2002-02-25b/runtime/kmain.c klic-3.003-2002-02-25c/runtime/kmain.c
--- klic-3.003-2002-02-25b/runtime/kmain.c	Mon Feb 25 14:34:50 2002
+++ klic-3.003-2002-02-25c/runtime/kmain.c	Mon Feb 25 17:36:18 2002
@@ -63,12 +63,29 @@
 extern int start_tracing;
 extern int count_suspension;
 
+#if defined(DIST) && defined(USE_REDUCTION_COUNT)
+static int reduction_count0;
+extern int reduction_count(void){ return reduction_count0; }
+extern void inc_reduction_count(void){ reduction_count0 ++; }
+extern void reset_reduction_count(void){ reduction_count0 = 0; }
+#endif
+
 static unsigned long heapsize0, maxheapsize0, incrementsize0;
 static double maxactiveratio0;
+static int command_argc0;
+static char** command_argv0;
+static unsigned long resumes0;
+static unsigned long cum_susps0, cum_resumps0;
 extern unsigned long heapsize(void){ return heapsize0; }
 extern unsigned long maxheapsize(void){ return maxheapsize0; }
 extern unsigned long incrementsize(void){ return incrementsize0; }
 extern double maxactiveratio(void){ return maxactiveratio0; }
+extern int command_argc(void){ return command_argc0; }
+extern char* command_arg(int i){ return command_argv0[i]; }
+extern unsigned long resumes(void){ return resumes0; }
+extern unsigned long cum_susps(void){ return cum_susps0; }
+extern unsigned long cum_resumps(void){ return cum_resumps0; }
+extern void inc_resumes(void){ resumes0 ++; }
 extern void
 double_heapsize(void){
   heapsize0 *= 2;
@@ -235,8 +252,8 @@
 	  }
 	  exit(1);
       }
-      command_argc = targc;
-      command_argv = targv;
+      command_argc0 = targc;
+      command_argv0 = targv;
       if (verbose) 
 	klic_local_fprintf(stderr, "KLIC runtime version %s (%s)\n",
 			   runtime_version, runtime_date);
@@ -245,7 +262,7 @@
   total_node = num_pes;
 #ifdef DIST
 #ifdef USE_REDUCTION_COUNT
-  reduction_count = 0;
+  reset_reduction_count();
 #endif
   if (total_node == 0)
     total_node = 1;
@@ -263,11 +280,11 @@
 	 parent process:	0
 	 child processes:	1 <= nodeid <=  total_node+1 */
       child_id = spawn_children(total_node + 1, opttable,
-				    program_name, command_argc, command_argv);
+				    program_name, command_argc(), command_argv0);
       if (child_id == 0) {
 	  io_node_flag = 1;  /* for klic_fprintf */
 	  io_init_comm();
-	  io_server(command_argc, command_argv);
+	  io_server(command_argc(), command_argv0);
 	  /* never return from io_server() */
 	  exit(0);
       }
@@ -339,19 +356,19 @@
     set_heapp(allocp + 2);
 #endif /* DIST */
 #ifdef DEBUGLIB
-    cum_susps = 0;
-    cum_resumps = 0;
-    suspensions = 0;
-    resumes = 0;
+    cum_susps0 = 0;
+    cum_resumps0 = 0;
+    reset_suspensions();
+    resumes0 = 0;
 #endif /* DEBUGLIB */
     while (1) {
 #ifdef DEBUGLIB
-      cum_susps += suspensions;
-      suspensions = 0;
-      cum_resumps += resumes;
-      resumes = 0;
+      cum_susps0 += suspensions();
+      reset_suspensions();
+      cum_resumps0 += resumes();
+      resumes0 = 0;
       set_current_prio(-1);
-      suspended_goal_list = 0;
+      set_suspended_goal_list(NULL);
       if (start_tracing) {
 	  initiate_trace();
 #ifdef DIST
@@ -377,8 +394,7 @@
       init_dist_signal_setup();
 #else /* !DIST */
       interrupt_off = -1;
-      postmortem_pred = 0;
-      postmortem_args = 0;
+      reset_postmortem();
 #endif /* DIST */
 
       if (setjmp(klic_topmost) == 0) toploop();
@@ -389,19 +405,19 @@
       Close_net();
       break;
 #else /*!DIST*/
-      if (postmortem_pred == 0 || postmortem_args == 0) break;
+      if (postmortem_pred() == NULL || postmortem_args() == NULL) break;
       klic_fprintf(stderr, "Starting postmortem processing...\n");
       set_heapp (heapp() + incrementsize()/2);  /* dirty patch */
       initiate_prioq();
       allocp = heapp();
       qp = (struct goalrec *) allocp;
-      qp->pred = postmortem_pred;
+      qp->pred = postmortem_pred();
       allocp += 2;
-      if (isfunctor(postmortem_args)) {
-	int arity = arityof(functor_of(postmortem_args));
+      if (isfunctor(postmortem_args())) {
+	int arity = arityof(functor_of(postmortem_args()));
 	int k;
 	for (k=0; k<arity; k++) {
-	  *allocp++ = arg(postmortem_args, k);
+	  *allocp++ = arg(postmortem_args(), k);
 	}
       }
       set_heapp(allocp);
@@ -470,7 +486,7 @@
 	  exit(0);
       }
   } else {			/* if normal node */
-      if ( suspensions == resumes && !susp_msg_list) {
+      if ( suspensions() == resumes() && !susp_msg_list) {
 	  if (node_wtc)
 	    send_return_wtc(node_wtc);
       }
@@ -532,10 +548,10 @@
 #else /* #ifndef DIST */
 {
   extern const struct predicate topsucceed_pred;
-  if (suspensions == resumes) {
+  if (suspensions() == resumes()) {
 #ifdef DEBUGLIB
     if(count_suspension) {
-      if(suspensions) {
+      if(suspensions() != 0) {
 	klic_fprintf(stderr, "Suspension counts:\n");
 	scan_suspended_pred();
       } else {
@@ -616,7 +632,7 @@
   return (module) current_queue->pred->func;
 #else /*!USESIG*/
   fatalf("%d perpetually suspending goals found",
-	 suspensions-resumes);
+	 suspensions() - resumes());
 #endif /*USESIG*/
 }
 #endif /*DIST*/
diff -ruN klic-3.003-2002-02-25b/runtime/sched.c klic-3.003-2002-02-25c/runtime/sched.c
--- klic-3.003-2002-02-25b/runtime/sched.c	Mon Feb 25 13:32:00 2002
+++ klic-3.003-2002-02-25c/runtime/sched.c	Mon Feb 25 17:46:29 2002
@@ -215,7 +215,7 @@
 
       /* interrupt for higher priority goal */
       if( current_prio() < prio ){
-	higher_priority_goal = 1;
+	set_higher_priority_goal();
 	heaplimit = 0;
       }
     }
@@ -565,8 +565,8 @@
 
     for( i=0; i<total_node; i++ ){ s_unlock(p_key(i)); }
 
-    if( suspensions != resumes ){
-      fatalf(" %d perpetual suspending goals.", (suspensions-resumes));
+    if( suspensions() != resumes() ){
+      fatalf(" %d perpetual suspending goals.", suspensions() - resumes());
     }
     {
       struct ex_goalrec* eqp;
diff -ruN klic-3.003-2002-02-25b/runtime/shm_obj.c klic-3.003-2002-02-25c/runtime/shm_obj.c
--- klic-3.003-2002-02-25b/runtime/shm_obj.c	Mon Feb 25 13:16:37 2002
+++ klic-3.003-2002-02-25c/runtime/shm_obj.c	Mon Feb 25 15:57:10 2002
@@ -295,7 +295,7 @@
 	  }else{
 	    resume_same_prio(goal);
 	  }
-	  resumes++;
+	  inc_resumes();
 	}
       }
     }else{
@@ -387,7 +387,7 @@
     if( gp != NULL && isatomic(gp->next) ){
       gp->next = qp->next;
       qp = gp;
-      resumes++;
+      inc_resumes();
     }else{
       qp = qp->next;
     }
diff -ruN klic-3.003-2002-02-25b/runtime/sysc.kl1 klic-3.003-2002-02-25c/runtime/sysc.kl1
--- klic-3.003-2002-02-25b/runtime/sysc.kl1	Mon Feb 25 14:05:08 2002
+++ klic-3.003-2002-02-25c/runtime/sysc.kl1	Mon Feb 25 17:20:59 2002
@@ -13,12 +13,24 @@
 
 extern void copy_one_term();
 
+static const struct predicate* postmortem_pred0;
+static q postmortem_args0;
+
+extern const struct predicate* postmortem_pred(void){ return postmortem_pred0; }
+extern q postmortem_args(void){ return postmortem_args0; }
+extern void
+reset_postmortem(void)
+{
+  postmortem_pred0 = NULL;
+  postmortem_args0 = NULL;
+}
+
 static void
 gc_postmortem_args(void)
 {
   declare_globals;
-  if (postmortem_args != 0) {
-    copy_one_term(&postmortem_args);
+  if (postmortem_args0 != NULL) {
+    copy_one_term(&postmortem_args0);
   }
 }
 ".
@@ -34,9 +46,9 @@
 
 register_postmortem(Predicate, Goal, Result) :- inline:"
   {
-    postmortem_pred = ((struct predicate_object*) functorp(%0))->pdesc;
-    if (postmortem_args == 0) register_gc_hook(gc_postmortem_args);
-    postmortem_args = %1;
+    postmortem_pred0 = ((struct predicate_object*) functorp(%0))->pdesc;
+    if (postmortem_args0 == NULL) register_gc_hook(gc_postmortem_args);
+    postmortem_args0 = %1;
   }": [Predicate+object(predicate), Goal+any] |
   Result = [].
 
diff -ruN klic-3.003-2002-02-25b/runtime/trace.c klic-3.003-2002-02-25c/runtime/trace.c
--- klic-3.003-2002-02-25b/runtime/trace.c	Mon Feb 25 14:05:18 2002
+++ klic-3.003-2002-02-25c/runtime/trace.c	Mon Feb 25 16:10:40 2002
@@ -1962,7 +1962,7 @@
      struct trace_info_rec *info;
 {
   declare_globals;
-  struct suspended_goal_rec *sm = suspended_goal_list;
+  struct suspended_goal_rec* sm = suspended_goal_list();
   long dump_seq = 0;
   if (sm == 0) {
     trace_printf(info, "\t*** No suspended goals ***\n");
diff -ruN klic-3.003-2002-02-25b/runtime/unify.c klic-3.003-2002-02-25c/runtime/unify.c
--- klic-3.003-2002-02-25b/runtime/unify.c	Mon Feb 25 13:18:24 2002
+++ klic-3.003-2002-02-25c/runtime/unify.c	Mon Feb 25 18:10:38 2002
@@ -21,7 +21,18 @@
 extern struct predicate predicate_unify__term__dcode_xunify_2;
 extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
 
-q method_result;
+/************
+ * rest_of_stream
+ *
+ * indicates the next hooked term.
+ *
+ * 0: normal;
+ * other: the next hooked term
+ ************/
+static q rest_of_stream;
+static q method_result;
+extern void set_rest_of_stream(q term){ rest_of_stream = term; }
+extern void set_method_result(q term){ method_result = term; }
 
 #define enqueue_unify_terms(x, y) \
 { \
@@ -136,7 +147,7 @@
 	  case (long)GENERIC_FAILED:
 	    fatal("Unification failure on a consumer object");
 	  case (long)GENERIC_SUCCEEDED:
-	    if(!rest_of_stream) goto consumer_terminate;
+	    if(rest_of_stream == NULL) goto consumer_terminate;
 /*	    y = rest_of_stream;*/
 	    tmpval = rest_of_stream;
 	    break;
@@ -155,7 +166,6 @@
 	    /* exit the loop */
 	    return(allocp);
 	  default:
-/*	    y = suspension_reason;*/
 	    tmpval = method_result;
 	  }
 	  {
@@ -190,7 +200,7 @@
 	      if(trace_flag) trace_resumption(u.g);
 #endif
 	    }
-	  resumes++;
+	  inc_resumes();
 	}
       }
       loopp = loopp->next;
