diff -ruN klic-3.003-2002-03-23/ChangeLog klic-3.003-2002-03-26/ChangeLog
--- klic-3.003-2002-03-23/ChangeLog	Thu Mar 21 20:01:25 2002
+++ klic-3.003-2002-03-26/ChangeLog	Tue Mar 26 16:16:39 2002
@@ -1,3 +1,7 @@
+2002-03-23 TAKAGI Yusuke <takagi@ueda.info.waseda.ac.jp>
+
+	* include/g_methtab.h: new type struct object is superclass of objects.
+
 2002-03-20 TAKAGI Yusuke <takagi@ueda.info.waseda.ac.jp>
 
 	* runtime/random.c: change random_numbers to consumer object.
diff -ruN klic-3.003-2002-03-23/MANIFEST klic-3.003-2002-03-26/MANIFEST
--- klic-3.003-2002-03-23/MANIFEST	Tue Mar 19 14:14:06 2002
+++ klic-3.003-2002-03-26/MANIFEST	Sun Mar 24 17:45:25 2002
@@ -61,7 +61,6 @@
 ./compiler/obj.c
 ./compiler/obj.ext
 ./compiler/obj.kl1
-./compiler/options.c
 ./compiler/predicates.c
 ./compiler/util.c
 ./compiler/util.ext
diff -ruN klic-3.003-2002-03-23/compiler/Makefile klic-3.003-2002-03-26/compiler/Makefile
--- klic-3.003-2002-03-23/compiler/Makefile	Thu Dec 27 19:15:57 2001
+++ klic-3.003-2002-03-26/compiler/Makefile	Sun Mar 24 17:47:16 2002
@@ -59,8 +59,7 @@
 		($(INSTALL) $(KL1SELFCOMP) klicdb $(KLICLIB)/klic) fi
 
 dist: klic klicdb klicdb.init $(CSRC) $(KL1PPCSRC) klicdb.c klic.c \
-	options.c klic.h version.c \
-	atom.h funct.h atom.c funct.c predicates.c
+	klic.h version.c atom.h funct.h atom.c funct.c predicates.c
 
 version.kl1: ../version.sed version.kl1.tmplt
 	sed -f ../version.sed <version.kl1.tmplt >version.kl1
@@ -72,15 +71,11 @@
 
 klicdb: klicdb.c klic.h
 	$(CC) -I../include $(CFLAGS) \
-	-o klicdb klicdb.c options.c $(LDFLAGS)
-#klic:	klic.c options.c klic.h version.h
-#	$(CC) -DPVMINC=\"$(PVMINC)\" -DPVMLIBDIR=\"$(PVMLIBDIR)\" \
-#	-DPVMLIB=\"$(PVMLIB)\" -I../include $(CFLAGS) \
-#	-o klic klic.c options.c $(LDFLAGS)
+	-o klicdb klicdb.c $(LDFLAGS)
 
-klic:	klic.c options.c klic.h version.h
+klic:	klic.c klic.h version.h
 	$(CC) -I../include $(CFLAGS) \
-	-o klic klic.c options.c $(LDFLAGS)
+	-o klic klic.c $(LDFLAGS)
 
 kl1pp: $(KL1PPSRC) ../runtime/libklict.a
 	./klic -P$(PARALLEL) -K $(KL1CMP) -D./klicdb -v \
diff -ruN klic-3.003-2002-03-23/compiler/kl1cmp.kl1 klic-3.003-2002-03-26/compiler/kl1cmp.kl1
--- klic-3.003-2002-03-23/compiler/kl1cmp.kl1	Wed Jan 23 16:42:17 2002
+++ klic-3.003-2002-03-26/compiler/kl1cmp.kl1	Sun Mar 24 17:54:48 2002
@@ -343,7 +343,7 @@
   handle_exception( Ps, TL, [ambiguous, token, was, found] ).
 handle_exception( abnormal( error( {TL, Reason, Ps} ))) :-
   klic_comp_message:tell( user_error, Out ),
-  klic_comp_obj:klicformat( "!! Error !!\nTL = ~w\nReason = ~wPs = \n",
+  klic_comp_obj:klicformat( "!! Error !!\nTL = ~w\nReason = ~wPs =\n",
                             [TL, Reason, Ps] )-Out,
   klic_comp_obj:flush( Status )-Out,
   Out = [],
diff -ruN klic-3.003-2002-03-23/compiler/klic.c klic-3.003-2002-03-26/compiler/klic.c
--- klic-3.003-2002-03-23/compiler/klic.c	Tue Mar 19 14:21:17 2002
+++ klic-3.003-2002-03-26/compiler/klic.c	Sun Mar 24 17:54:59 2002
@@ -6,6 +6,7 @@
 ----------------------------------------------------------- */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <klic/stdc.h>
 #include <ctype.h>
 #include <unistd.h>
@@ -21,11 +22,6 @@
 #endif
 #include <assert.h>
 
-#define KL1_TO_C_COMPILER   KLIC_COMPILER
-
-extern void* malloc();
-extern char* option_value();
-
 enum filetype { kl1_file, prog_file, asm_file, obj_file, other_file };
 
 struct lang_info {
@@ -91,6 +87,12 @@
   struct lang_info* info;
 };
 
+static char* option_value(char* optname, char* dflt)
+{
+  char* envval = getenv(optname);
+  return (envval==NULL ? dflt : envval);
+}
+
 static void
 initialize_lang_info(void)
 {
@@ -173,7 +175,7 @@
   fprintf(stderr, "  -C: no C compilation; only compile to .c\n");
   fprintf(stderr, "  -d: dry run; no actual compilation; implies -v\n");
   fprintf(stderr, "  -D dbmaker: specifies KLIC database manager program\n");
-  fprintf(stderr, "  -Fld linker: force to set linker program to linker \n");
+  fprintf(stderr, "  -Fld linker: force to set linker program to linker\n");
   fprintf(stderr, "  -Flo opt: force to set linker option to opt\n");
   fprintf(stderr, "  -g: add debug option for C compiler\n");
   fprintf(stderr, "  -K compiler: specifies KL1 to C compiler program\n");
diff -ruN klic-3.003-2002-03-23/compiler/obj.kl1 klic-3.003-2002-03-26/compiler/obj.kl1
--- klic-3.003-2002-03-23/compiler/obj.kl1	Tue Mar 12 12:27:44 2002
+++ klic-3.003-2002-03-26/compiler/obj.kl1	Sun Mar 24 18:05:27 2002
@@ -56,7 +56,7 @@
 write_one( deref( X, Lloop, Lsusp ), Info )-H-Out :-
   klicformat(
     "  deref_and_jump( ~r, ~l );\n"
-    "  *reasonp++ =  ~r;\n"
+    "  *reasonp++ = ~r;\n"
     "  goto ~l;\n",
     [X, Info, Lloop, X, Info, Lsusp] )-Out.
 write_one( goto( Label ), Info )-H-Out :-
@@ -81,9 +81,6 @@
   klicformat( " default:\n" )-Out.
 write_one( end_sw, _ )-H-Out :-
   klicformat( "  };\n" )-Out.
-write_one( eq( X, Y, Lab, FailLab, SuspLab ), Info )-H-Out :-
-  klicformat( "  if_equal( ~r, ~r, ~l, ~l, ~l );\n",
-    [X, Y, Info, Lab, Info, FailLab, Info, SuspLab] )-Out.
 write_one( if_not_eq( X, Y, Lab ), Info )-H-Out :-
   klicformat( "  if_not_equal( ~r, ~r, ~l );\n", [X, Y, Info, Lab] )-Out.
 write_one( if_int( X, ElseLab ), Info )-H-Out :-
@@ -178,7 +175,7 @@
 write_one( proceed( Q ), _ )-H-Out :-
   write_adjust( Q, H )-Out,
   H <== 0,
-  klicformat( "  proceed();\n" )-Out.
+  klicformat( "  goto proceed_label;\n" )-Out.
 write_one( set_pred( Name, Arity ), info( M, _, _ ))-H-Out :-
   H1 := H+1,
   klicformat( "  allocp[~d] = (q) &~p;\n", [H1, M, Name, Arity] )-Out.
@@ -252,14 +249,16 @@
   write_adjust_qp( Q )-Out,
   klicformat(
     "  set_heapp(allocp + ~d);\n"
-    "  new_generic( ~q_g_new, ~d, ~r );\n",
-    [H, Class, Arity, Obj] )-Out,
+    "  ~r = ~q_g_new(~d, generic_arg);\n"
+    "  allocp = heapp();\n",
+    [H, Obj, Class, Arity] )-Out,
   H <== 0.
 write_one( call_generic( Obj, FA, Q ), _ )-H-Out :-
   write_adjust_qp( Q )-Out,
   klicformat(
     "  set_heapp(allocp + ~d);\n"
-    "  call_generic( ~k, ~f );\n", [H, Obj, FA] )-Out,
+    "  gd_generic(~k, ~f, generic_arg);\n"
+    "  allocp = heapp();\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",
@@ -316,7 +315,9 @@
 write_adjust_allocp( Off )-Out :- Off=:=0 |
   true.
 write_adjust_allocp( Off )-Out :- Off=\=0 |
-  klicformat( "  allocp += ~d;\n", [Off] )-Out.
+  klicformat(
+    "  allocp += ~d;\n"
+    "  set_heapp(allocp);\n", [Off] )-Out.
 
 /* Formatting routine */
 klicformat_stderr( Format, Args ) :-
diff -ruN klic-3.003-2002-03-23/compiler/options.c klic-3.003-2002-03-26/compiler/options.c
--- klic-3.003-2002-03-23/compiler/options.c	Thu Dec 27 19:15:58 2001
+++ klic-3.003-2002-03-26/compiler/options.c	Thu Jan  1 09:00:00 1970
@@ -1,17 +0,0 @@
-/* ---------------------------------------------------------- 
-%   (C) 1994,1995 Institute for New Generation Computer Technology 
-%       (Read COPYRIGHT for detailed information.) 
-%   (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
-%       (Read COPYRIGHT-JIPDEC for detailed information.)
------------------------------------------------------------ */
-
-#include <stdlib.h>
-
-char *
-option_value(optname, dflt)
-     char *optname;
-     char *dflt;
-{
-  char *envval = getenv(optname);
-  return (envval==0 ? dflt : envval);
-}
diff -ruN klic-3.003-2002-03-23/compiler/write.kl1 klic-3.003-2002-03-26/compiler/write.kl1
--- klic-3.003-2002-03-23/compiler/write.kl1	Tue Mar 12 12:08:47 2002
+++ klic-3.003-2002-03-26/compiler/write.kl1	Sun Mar 24 18:18:25 2002
@@ -67,9 +67,9 @@
   Id = string( K ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( byte__string );\n"
-    "  static const string_structure_type_~d string_const_~d =\n"
+    "  static const struct byte_string_object string_const_~d =\n"
     "    declare_string_constant_~d( 0, 0 );\n",
-    [E, K, E] )-Out,
+    [K, E] )-Out,
   K += 1.
 declare_const( string( S ), Id )-K-Out :- string( S, L, E ), L>0 |
   Id = string( K ),
@@ -81,15 +81,15 @@
   Out <= fwrite( ";\n" ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( byte__string );\n"
-    "  static const string_structure_type_~d string_const_~d =\n"
+    "  static const struct byte_string_object string_const_~d =\n"
     "    declare_string_constant_~d( strconst_body_~d, ~d );\n",
-    [E, K, E, K, L] )-Out,
+    [K, E, K, L] )-Out,
   K += 1.
 declare_const( vector( V ), Id )-K-Out :- vector( V, L ), L=<0 |
   Id = vector( K ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( vector );\n"
-    "  static const vector_structure_type vector_const_~d =\n"
+    "  static const struct vector_object vector_const_~d =\n"
     "    declare_vector_constant( 0, 0 );\n",
     [K] )-Out,
   K += 1.
@@ -104,7 +104,7 @@
   Out <= fwrite( "  };\n" ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( vector );\n"
-    "  static const vector_structure_type vector_const_~d =\n"
+    "  static const struct vector_object vector_const_~d =\n"
     "    declare_vector_constant( vectconst_body_~d, ~d );\n",
     [K, K, L] )-Out,
   K += 1.
@@ -112,7 +112,7 @@
   Id = float( K ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( float );\n"
-    "  static const float_structure_type float_const_~d =\n"
+    "  static const struct float_object float_const_~d =\n"
     "    declare_float_constant( ~g );\n",
     [K, X] )-Out,
   K += 1.
@@ -121,7 +121,7 @@
   klic_comp_obj:klicformat(
     "  declare_method_table_of( module );\n"
     "  extern module module_~q();\n"
-    "  static const module_structure_type mod_const_~d =\n"
+    "  static const struct module_object mod_const_~d =\n"
     "    declare_module_constant( module_~q, ~a );\n",
     [M, K, M, M] )-Out,
   K += 1.
@@ -130,7 +130,7 @@
   Id = predicate( K ),
   klic_comp_obj:klicformat(
     "  declare_method_table_of( predicate );\n"
-    "  static const predicate_structure_type pred_const_~d =\n"
+    "  static const struct predicate_object pred_const_~d =\n"
     "    declare_pred_constant( ~p, mod_const_~d, ~a );\n",
     [K, M, F, A, Mid, F] )-Out,
   K += 1.
diff -ruN klic-3.003-2002-03-23/include/klic/g_basic.h klic-3.003-2002-03-26/include/klic/g_basic.h
--- klic-3.003-2002-03-23/include/klic/g_basic.h	Sat Mar 23 21:34:27 2002
+++ klic-3.003-2002-03-26/include/klic/g_basic.h	Sun Mar 24 16:31:43 2002
@@ -128,15 +128,15 @@
   if( heapp() > real_heaplimit() ) fatal("not enough space collected"); \
 }while(0)
 
-
-/** G_HEAPALLOC: procedure
- * from: type&
- * size > 0: offset_t
- * type: type cast or function returning q
- */
-#define G_HEAPALLOC(from,size,type) \
+extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
+#define G_KL1_UNIFY(x, y) \
 do{ \
-  (from) = type(klic_alloc(size)); \
+  struct goalrec* gp; \
+  gp = (struct goalrec*) klic_alloc(4); \
+  gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \
+  gp->args[0] = (x); \
+  gp->args[1] = (y); \
+  resume_same_prio(gp); \
 }while(0)
 
 
@@ -153,7 +153,7 @@
     heaplimit = 0; \
     (res) = GENERIC_GCREQUEST; \
   } else { \
-    G_HEAPALLOC((from), (size), type); \
+    (from) = type(klic_alloc(size)); \
     (res) = GENERIC_SUCCEEDED; \
   } \
 }while(0)
@@ -164,7 +164,7 @@
  */
 #define G_MAKE_VAR(x) \
 do{ \
-  G_HEAPALLOC((x), 1, (q)); \
+  (x) = (q) klic_alloc(1); \
   derefone(x) = (x); \
 }while(0)
 
diff -ruN klic-3.003-2002-03-23/include/klic/gc_macro.h klic-3.003-2002-03-26/include/klic/gc_macro.h
--- klic-3.003-2002-03-23/include/klic/gc_macro.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gc_macro.h	Sun Mar 24 16:31:13 2002
@@ -105,15 +105,4 @@
 
 #define GCSET_VAR(self)  ((self) = makeref(&(self)))
 
-extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
-#define GC_KL1_UNIFY(x, y) \
-do{ \
-  struct goalrec *gp; \
-  G_HEAPALLOC(gp, 4, (struct goalrec *)); \
-  gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \
-  gp->args[0] = (x); \
-  gp->args[1] = (y); \
-  resume_same_prio(gp); \
-}while(0)
-
 #endif /* _KLIC_GC_MACRO_H_ */
diff -ruN klic-3.003-2002-03-23/include/klic/gc_methtab.h klic-3.003-2002-03-26/include/klic/gc_methtab.h
--- klic-3.003-2002-03-23/include/klic/gc_methtab.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gc_methtab.h	Sun Mar 24 15:23:11 2002
@@ -8,7 +8,7 @@
 #ifndef _KLIC_GC_METHTAB_H_
 #define _KLIC_GC_METHTAB_H_
 
-struct consumer_object_method_table G_method_table = {
+extern const struct consumer_object_method_table G_method_table = {
 #ifndef GCUSE_MY_PRINT
   G_STD_PRINT,
 #else
diff -ruN klic-3.003-2002-03-23/include/klic/gd_macro.h klic-3.003-2002-03-26/include/klic/gd_macro.h
--- klic-3.003-2002-03-23/include/klic/gd_macro.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gd_macro.h	Sun Mar 24 15:41:21 2002
@@ -27,7 +27,7 @@
 #define GD_OBJ(x)  makefunctor(x)
 
 #define GD_USE_CLASS(class) \
-extern struct data_object_method_table G_method_table0(class)
+extern const struct data_object_method_table G_method_table0(class)
 
 #define GD_UNIFY_FAIL \
   G_error("Failure", "active unification", "data", G_CLASS_NAME_STRING)
@@ -36,7 +36,6 @@
 
 #define GD_GRETURN(x)  do{ return (q) (x); }while(0)
 
-#define GD_GUNIFY_FAIL GD_GFAIL
 #define GD_GFAIL  do{ return GENERIC_FAILED; }while(0)
 #define GD_GSUCCEED  do{ return GENERIC_SUCCEEDED; }while(0)
 
diff -ruN klic-3.003-2002-03-23/include/klic/gd_methtab.h klic-3.003-2002-03-26/include/klic/gd_methtab.h
--- klic-3.003-2002-03-23/include/klic/gd_methtab.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gd_methtab.h	Sun Mar 24 15:23:26 2002
@@ -28,7 +28,7 @@
 extern q GD_STD_HASH(struct data_object* g_self, long level);
 
 
-struct data_object_method_table G_method_table = {
+extern const struct data_object_method_table G_method_table = {
 #ifndef GDUSE_MY_PRINT
   G_STD_PRINT,
 #else
diff -ruN klic-3.003-2002-03-23/include/klic/generic.h klic-3.003-2002-03-26/include/klic/generic.h
--- klic-3.003-2002-03-23/include/klic/generic.h	Wed Mar 20 15:35:27 2002
+++ klic-3.003-2002-03-26/include/klic/generic.h	Sun Mar 24 17:13:05 2002
@@ -21,17 +21,7 @@
   allocp = heapp(); \
 }while(0)
 
-#define new_generic0(name,argc,out)  \
-do{ \
-  (out) = (name)((argc), generic_arg); \
-  allocp = heapp(); \
-}while(0)
-
 #define call_generic(obj,funct) \
-  ( gd_generic((obj), (funct), generic_arg), \
-    allocp = heapp() )
-
-#define call_generic0(obj,funct) \
   ( gd_generic((obj), (funct), generic_arg), \
     allocp = heapp() )
 
diff -ruN klic-3.003-2002-03-23/include/klic/gg_macro.h klic-3.003-2002-03-26/include/klic/gg_macro.h
--- klic-3.003-2002-03-23/include/klic/gg_macro.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gg_macro.h	Sun Mar 24 16:32:12 2002
@@ -29,7 +29,7 @@
   argv[0] = g_term; \
   argv[1] = newvar; \
   tmp = GC_wakeup_g_new(2, argv); \
-  GG_KL1_UNIFY((var), tmp); \
+  G_KL1_UNIFY((var), tmp); \
   return heapp(); \
 }while(0)
 
@@ -73,17 +73,6 @@
   G_DEREF_FOR_NEW(argv_i); \
   if( !isint(argv_i) ) fatal("not integer"); \
   (var) = intval(argv_i); \
-}while(0)
-
-extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
-#define GG_KL1_UNIFY(x, y) \
-do{ \
-  struct goalrec *gp; \
-  G_HEAPALLOC(gp, 4, (struct goalrec *)); \
-  gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \
-  gp->args[0] = (x); \
-  gp->args[1] = (y); \
-  resume_same_prio(gp); \
 }while(0)
 
 #endif /* _KLIC_GG_MACRO_H_ */
diff -ruN klic-3.003-2002-03-23/include/klic/gg_methtab.h klic-3.003-2002-03-26/include/klic/gg_methtab.h
--- klic-3.003-2002-03-23/include/klic/gg_methtab.h	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/include/klic/gg_methtab.h	Sun Mar 24 15:23:37 2002
@@ -10,7 +10,7 @@
 
 extern q GG_STD_SUSPEND();
 
-struct generator_object_method_table G_method_table = {
+extern const struct generator_object_method_table G_method_table = {
 #ifndef GGUSE_MY_PRINT
   G_STD_PRINT,
 #else
diff -ruN klic-3.003-2002-03-23/runtime/bodyblt.kl1 klic-3.003-2002-03-26/runtime/bodyblt.kl1
--- klic-3.003-2002-03-23/runtime/bodyblt.kl1	Mon Feb 25 16:01:31 2002
+++ klic-3.003-2002-03-26/runtime/bodyblt.kl1	Tue Mar 26 16:08:56 2002
@@ -41,29 +41,25 @@
 
 start_measure :- inline:"
   {
-    measure(before);
+    measure(&before);
     gctimes_before = gctimes;
   }":[] | true.
 
 report_measure(X) :- inline:"
-  measure(after);
+  measure(&after);
   klic_fprintf(stdout, \"heap size = %%d words\\n\", heapsize());
+  klic_fprintf(stdout, \"%%lu ms total; %%lu user; %%lu system\\n\",
+    TOTAL_TIME, USER_TIME, SYSTEM_TIME );
+  %0 = makeint(TOTAL_TIME);
   {
 #ifdef GETRUSAGE
-    long u_usec = diff_usec(ru_utime);
-    long s_usec = diff_usec(ru_stime);
-    long t_usec = u_usec + s_usec;
-    long swaps = field_diff(ru_nswap);
-    long minflt = field_diff(ru_minflt);
-    long majflt = field_diff(ru_majflt);
-    long inblock = field_diff(ru_inblock);
-    long outblock = field_diff(ru_oublock);
-    long nvcsw = field_diff(ru_nvcsw);
-    long nivcsw = field_diff(ru_nivcsw);
-    %0 = makeint(t_usec/1000);
-    klic_fprintf(stdout,
-                 \"%%ld ms total; %%ld user; %%ld system\\n\",
-                 t_usec/1000, u_usec/1000, s_usec/1000 );
+    long swaps = FIELD_DIFF(ru_nswap);
+    long minflt = FIELD_DIFF(ru_minflt);
+    long majflt = FIELD_DIFF(ru_majflt);
+    long inblock = FIELD_DIFF(ru_inblock);
+    long outblock = FIELD_DIFF(ru_oublock);
+    long nvcsw = FIELD_DIFF(ru_nvcsw);
+    long nivcsw = FIELD_DIFF(ru_nivcsw);
     klic_fprintf(stdout,
                  \"  %%ld swaps; %%ld minor page faults; %%ld major page faults\\n\",
                  swaps, minflt, majflt );
@@ -73,19 +69,9 @@
     klic_fprintf(stdout,
                  \"  %%ld context switches (%%ld voluntary)\\n\",
                  nvcsw+nivcsw, nvcsw );
-#else  /* not GETRUSAGE */
-    long u_msec = (int) tick2msec(field_diff(tms_utime));
-    long s_msec = (int) tick2msec(field_diff(tms_stime));
-    long t_msec =
-      (int) (tick2msec(field_diff(tms_utime)) +
-             tick2msec(field_diff(tms_stime)) );
-    %0 = makeint(t_msec);
-    klic_fprintf(stdout,
-                 \"%%ld ms total; %%ld user; %%ld system\\n\",
-                 t_msec, u_msec, s_msec );
-#endif  /* not GETRUSAGE */
+#endif  /* GETRUSAGE */
     klic_fprintf(stdout, \"  \");
-    if (measure_gc) {
+    if( measure_gc() ){
       klic_fprintf(stdout,
                    \"%%ld ms utime & %%ld ms stime in \",
                    gcums, gcsms );
diff -ruN klic-3.003-2002-03-23/runtime/cntlmsg.c klic-3.003-2002-03-26/runtime/cntlmsg.c
--- klic-3.003-2002-03-23/runtime/cntlmsg.c	Tue Mar 12 13:51:31 2002
+++ klic-3.003-2002-03-26/runtime/cntlmsg.c	Tue Mar 26 16:09:06 2002
@@ -5,6 +5,8 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
 
+#define FIELD_DIFF(field)  (after_exec.field - before_exec.field)
+
 #include <assert.h>
 #include <klic/basic.h>  /* fatal */
 #include <klic/struct.h>
@@ -26,6 +28,7 @@
 #include "timing.h"
 #include "gobj.h"
 #include <klic/susp.h>
+#include <klic/g_basic.h>
 #include "interpe.h"
 #include "rmon.h"
 #include "ge_exref.h"
@@ -69,7 +72,7 @@
 extern void
 init_rusage(void)
 {
-  measure(before_exec);
+  measure(&before_exec);
 }
 
 /*
@@ -205,7 +208,7 @@
 	    struct generator_susp *susp1 = generator_suspp(derefone(data));
 	    struct exref_object *dummy_obj = 
 	      (struct exref_object *)untag_generator_susp(susp1->u.o);	
-	    if(dummy_obj-> method_table == get_exref_methtab()){
+	    if( dummy_obj->method_table == &G_method_table0(exref) ){
 	      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;
@@ -220,7 +223,7 @@
     generic_arg[1] = makeint(index); /* exp_table (for answer) index */
     generic_arg[2] = makeint(wec);   /* WEC */
 
-    { q* allocp; new_generic(reply_hook_g_new, 3, rhook); }
+    rhook = reply_hook_g_new(3, generic_arg);
     do_unify(rhook, data);
     return;
     
@@ -578,22 +581,8 @@
   char* io_buf;
 {
   declare_globals;
-  long utime, stime;
-
-  measure(after_exec);
-#define  field_diff_dist(field) (after_exec.field - before_exec.field)
-
-#ifdef GETRUSAGE
-#define  diff_usec_dist(field)\
-  (field_diff_dist(field.tv_sec) * 1000000 + field_diff_dist(field.tv_usec))
-  utime = (long)(diff_usec_dist(ru_utime)/1000);
-  stime = (long)(diff_usec_dist(ru_stime)/1000);
-
-#else /* !GETRUSAGE */
-  utime = ((long)tick2msec(field_diff_dist(tms_utime)));
-  stime = ((long)tick2msec(field_diff_dist(tms_stime)));
 
-#endif/* !GETRUSAGE */
+  measure(&after_exec);
 
   {
       char *ptr = io_buf;
@@ -605,10 +594,10 @@
 	  ptr += strlen(ptr);
       }
       sprintf(ptr, " %ld ms total; %ld user; %ld system\n",
-	      utime + stime, utime, stime);
+	      TOTAL_TIME, USER_TIME, SYSTEM_TIME);
       ptr += strlen(ptr);
       if (!IS_SHOEN_NODE(my_node)) {
-	  if (measure_gc) {
+	  if( measure_gc() ){
 	      sprintf(ptr, " %ld ms utime & %ld ms stime in ",
 		      gcums, gcsms);
 	      ptr += strlen(ptr);
diff -ruN klic-3.003-2002-03-23/runtime/datamsg.c klic-3.003-2002-03-26/runtime/datamsg.c
--- klic-3.003-2002-03-23/runtime/datamsg.c	Tue Mar 12 13:52:41 2002
+++ klic-3.003-2002-03-26/runtime/datamsg.c	Sun Mar 24 17:07:13 2002
@@ -91,7 +91,7 @@
     generic_arg[1] = makeint(GET_BUFFER(inbuf));  /* exp_table index */
     generic_arg[2] = makeint(GET_BUFFER(inbuf));  /* WEC */
 
-    { q* allocp; new_generic(exref_g_new, 3L, decode_data); }
+    decode_data = exref_g_new(3, generic_arg);
   }
   push_decode_stack(decode_data);
 }
diff -ruN klic-3.003-2002-03-23/runtime/gc.c klic-3.003-2002-03-26/runtime/gc.c
--- klic-3.003-2002-03-23/runtime/gc.c	Tue Mar 19 14:06:43 2002
+++ klic-3.003-2002-03-26/runtime/gc.c	Tue Mar 26 16:09:18 2002
@@ -5,11 +5,11 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
 
+#include <stdio.h>
 #include <klic/basic.h>  /* fatal, fatalf, klic_fprintf */
 #include <klic/struct.h>
 #include <klic/primitives.h>  /* malloc_check, realloc_check */
 #include "timing.h"
-#include <stdio.h>
 #include <klic/functorstuffs.h>  /* arityof */
 #include "gobj.h"
 #include <klic/susp.h>
@@ -25,6 +25,9 @@
 
 extern struct goalrec goal_queue_tail;
 
+static int gctimes0 = 0;
+static int gcums0 = 0;
+static int gcsms0 = 0;
 static q** gcstack;
 static q** gcsp0;
 static q** gcmax0;
@@ -32,6 +35,9 @@
 static unsigned long copied_susp;
 static struct suspended_goal_rec* suspended_goal_list0;
 
+extern int gctimes(void){ return gctimes0; }
+extern int gcums(void){ return gcums0; }
+extern int gcsms(void){ return gcsms0; }
 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; }
@@ -352,7 +358,7 @@
   }
 #endif
 
-  if( gctimes==0 ){
+  if( gctimes() == 0 ){
     /* allocate GC stack on first GC */
     gcstack_size = GCSTACKSIZE;
     gcstack = (q**) malloc_check(gcstack_size*sizeof(q*));
@@ -471,7 +477,7 @@
   q* new_new_space_top;
   unsigned long bytesize;
   int k;
-  if( measure_gc ) measure(before);
+  if( measure_gc() ) measure(&before);
 
  gc_again:
   if( make_heap_larger ){
@@ -512,16 +518,11 @@
     goto gc_again;
   }
   reset_this_more_space();
-  gctimes++;
-  if( measure_gc ){
-    measure(after);
-#ifdef GETRUSAGE
-    gcums += diff_usec(ru_utime)/1000;
-    gcsms += diff_usec(ru_stime)/1000;
-#else
-    gcums += (int) tick2msec(field_diff(tms_utime));
-    gcsms += (int) tick2msec(field_diff(tms_stime));
-#endif
+  gctimes0++;
+  if( measure_gc() ){
+    measure(&after);
+    gcums0 += USER_TIME;
+    gcsms0 += SYSTEM_TIME;
   }
   return qp;
 }
diff -ruN klic-3.003-2002-03-23/runtime/gcode.c klic-3.003-2002-03-26/runtime/gcode.c
--- klic-3.003-2002-03-23/runtime/gcode.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gcode.c	Sun Mar 24 16:19:57 2002
@@ -89,7 +89,7 @@
 
 #define GD_ALLOC_GOAL(goal, pdesc, size) \
 do{ \
-  G_HEAPALLOC(goal, (size)+2, (struct goalrec*)); \
+  (goal) = (struct goalrec*) klic_alloc((size) + 2); \
   (goal)->pred = (pdesc); \
 }while(0)
 
diff -ruN klic-3.003-2002-03-23/runtime/ge_exref.c klic-3.003-2002-03-26/runtime/ge_exref.c
--- klic-3.003-2002-03-23/runtime/ge_exref.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/ge_exref.c	Sun Mar 24 17:08:15 2002
@@ -42,13 +42,12 @@
 {
   G_STD_DECL;
   q rdhok;
-  q* allocp = heapp();
 
   generic_arg[0] = makeint(g_self->node);
   generic_arg[1] = makeint(g_self->index);
   generic_arg[2] = makeint(g_self->wec);
 
-  new_generic(read_hook_g_new, 3, rdhok);
+  rdhok = read_hook_g_new(3, generic_arg);
 
   g_self->method_table = 0;
 
@@ -92,7 +91,7 @@
 	(struct exref_object*) untag_generator_susp(gsusp1->u.o);
       /* fprintf(stderr, "Node:%d unify EXREF-GENERA", my_node); */
 
-      if( dummy_obj->method_table == get_exref_methtab() ){
+      if( dummy_obj->method_table == &G_method_table ){
 	/* fprintf(stderr, "Node:%d unify EXREF-EXREF", my_node); */
       }else{
 	fatal("unify EXREF-UnknownGEN occur");
@@ -179,12 +178,6 @@
   regist_imp_entry(new_exref);
 
   return new_exref->to_exref;
-}
-
-extern struct generator_object_method_table*
-get_exref_methtab()
-{
-  return &G_method_table;
 }
 
 #endif /* DIST */
diff -ruN klic-3.003-2002-03-23/runtime/ge_exref.h klic-3.003-2002-03-26/runtime/ge_exref.h
--- klic-3.003-2002-03-23/runtime/ge_exref.h	Tue Feb 26 14:12:06 2002
+++ klic-3.003-2002-03-26/runtime/ge_exref.h	Sun Mar 24 15:39:17 2002
@@ -19,6 +19,6 @@
   long gc_flag;
 };
 
-extern struct generator_object_method_table* get_exref_methtab(void);
+extern const struct generator_object_method_table exref_g_method_table;
 
 #endif /* _KLIC_GE_EXREF_H_ */
diff -ruN klic-3.003-2002-03-23/runtime/generic.c klic-3.003-2002-03-26/runtime/generic.c
--- klic-3.003-2002-03-23/runtime/generic.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/generic.c	Sun Mar 24 16:29:46 2002
@@ -20,7 +20,7 @@
 
 extern void suspend_goal();
 extern q gd_new_pointer();
-extern q gd_new_termarray();
+extern q termarray_g_new(long g_argc, q* g_argv);
 
 extern const struct predicate predicate_generic_xgeneric_2;
 
@@ -47,13 +47,13 @@
   q objp;
   int i;
 
-  G_HEAPALLOC(objp, G_SIZE_IN_Q(struct functor)+argc-1, makefunctor);
+  objp = makefunctor(klic_alloc(G_SIZE_IN_Q(struct functor) + argc - 1));
   functor_of(objp) = makesym(method_functor);
   for( i=0; i<argc; i++ ){
     arg(objp, i) = argv[i];
   }
 
-  G_HEAPALLOC(*goalp1, G_SIZE_IN_Q(struct goalrec)-4, (struct goalrec*));
+  *goalp1 = (struct goalrec*) klic_alloc(G_SIZE_IN_Q(struct goalrec) - 4);
   (*goalp1)->pred    = GD_GENERIC_GOAL;
   (*goalp1)->args[0] = objp;
   (*goalp1)->args[1] = var;
@@ -72,9 +72,9 @@
   q newobj, newobj2;
 
   newobj = gd_new_pointer(myself);
-  newobj2 = gd_new_termarray(argc, argv);
+  newobj2 = termarray_g_new(argc, argv);
 
-  G_HEAPALLOC(*goalp1, G_SIZE_IN_Q(struct goalrec)-3, (struct goalrec*));
+  *goalp1 = (struct goalrec*) klic_alloc(G_SIZE_IN_Q(struct goalrec) - 3);
   G_MAKE_VAR(newvar);
   (*goalp1)->pred    = G_NEW_GOAL;
   (*goalp1)->args[0] = newvar;
diff -ruN klic-3.003-2002-03-23/runtime/gfloat.c klic-3.003-2002-03-26/runtime/gfloat.c
--- klic-3.003-2002-03-23/runtime/gfloat.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gfloat.c	Sun Mar 24 16:22:59 2002
@@ -59,7 +59,7 @@
   G_STD_DECL;
   if( g_self->method_table != GD_OTHER->method_table ||
       g_self->value != GD_OTHER->value )
-    GD_GUNIFY_FAIL;
+    GD_GFAIL;
   GD_GSUCCEED;
 }
 
@@ -368,7 +368,7 @@
   G_OBJ_TYPE* newobj;
 
   ALIGN();
-  G_HEAPALLOC(newobj, G_SIZE_IN_Q(G_OBJ_TYPE), (G_OBJ_TYPE*));
+  newobj = (G_OBJ_TYPE*) klic_alloc(G_SIZE_IN_Q(G_OBJ_TYPE));
 
   newobj->method_table = &G_method_table;
   if( sizeof(long) == sizeof(double) ){
diff -ruN klic-3.003-2002-03-23/runtime/gio.c klic-3.003-2002-03-26/runtime/gio.c
--- klic-3.003-2002-03-23/runtime/gio.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gio.c	Sun Mar 24 16:32:41 2002
@@ -395,7 +395,7 @@
 
  gc_request:
   G_MAKE_VAR(newvar);
-  GC_KL1_UNIFY(g_term, newvar);
+  G_KL1_UNIFY(g_term, newvar);
   GC_RETURN_WITH_HOOK(newvar);
 
  suspend:
diff -ruN klic-3.003-2002-03-23/runtime/gmerge.c klic-3.003-2002-03-26/runtime/gmerge.c
--- klic-3.003-2002-03-23/runtime/gmerge.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gmerge.c	Sun Mar 24 16:32:59 2002
@@ -28,7 +28,7 @@
 #define GC_MAKE_MERGE_IN_GOAL(newvar,vec,index,size) \
 do{ \
   struct goalrec *goalp1; \
-  G_HEAPALLOC(goalp1,G_SIZE_IN_Q(struct goalrec)-2,(struct goalrec *)); \
+  goalp1 = (struct goalrec*) klic_alloc(G_SIZE_IN_Q(struct goalrec) - 2); \
   goalp1->pred = GC_MERGE_IN_GOAL; \
   goalp1->args[0] = newvar; \
   goalp1->args[1] = vec; \
@@ -92,7 +92,7 @@
 	  GC_TRY_TO_ALLOC(hook_var,(q),1,gc_request2);
 	  derefone(hook_var) =
 	    GC_MAKE_HOOK_VAR((struct consumer_object*) g_self);
-	  GC_KL1_UNIFY(argv[1],hook_var);
+	  G_KL1_UNIFY(argv[1], hook_var);
 	}
       }
       GC_TERMINATE;
@@ -109,7 +109,7 @@
   fatal("Invalid data unified with merger");
  gc_request:
   G_MAKE_VAR(newvar);
-  GC_KL1_UNIFY(g_term, newvar);
+  G_KL1_UNIFY(g_term, newvar);
   GC_RETURN_WITH_HOOK(newvar);
 }
 
diff -ruN klic-3.003-2002-03-23/runtime/gmodule.c klic-3.003-2002-03-26/runtime/gmodule.c
--- klic-3.003-2002-03-23/runtime/gmodule.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gmodule.c	Sun Mar 24 15:42:08 2002
@@ -39,7 +39,7 @@
 
   if (g_self->method_table != GD_OTHER->method_table ||
       g_self->name != GD_OTHER->name)
-    GD_GUNIFY_FAIL;
+    GD_GFAIL;
   else
     GD_GSUCCEED;
 }
diff -ruN klic-3.003-2002-03-23/runtime/gmvv.c klic-3.003-2002-03-26/runtime/gmvv.c
--- klic-3.003-2002-03-23/runtime/gmvv.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gmvv.c	Sun Mar 24 15:42:27 2002
@@ -86,11 +86,11 @@
 {
   G_STD_DECL;
   long size, k;
-  if( g_self->method_table != GD_OTHER->method_table ) GD_GUNIFY_FAIL;
+  if( g_self->method_table != GD_OTHER->method_table ) GD_GFAIL;
   Shallow(g_self);
   size = g_self->index;
   Shallow(GD_OTHER);
-  if (GD_OTHER->index != size) GD_GUNIFY_FAIL;
+  if (GD_OTHER->index != size) GD_GFAIL;
   for (k=0; k<size; k++) {
     q retval;
     q x = GD_OTHER->body[k];
@@ -100,7 +100,7 @@
     case GENERIC_SUCCEEDED:
       break;
     case GENERIC_FAILED:
-      GD_GUNIFY_FAIL;
+      GD_GFAIL;
       break;
     default:
       GD_GRETURN(retval);
diff -ruN klic-3.003-2002-03-23/runtime/gpointer.c klic-3.003-2002-03-26/runtime/gpointer.c
--- klic-3.003-2002-03-23/runtime/gpointer.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gpointer.c	Sun Mar 24 16:24:20 2002
@@ -19,8 +19,8 @@
 {
   G_STD_DECL;
 
-  if (g_self->method_table != GD_OTHER->method_table) GD_GUNIFY_FAIL;
-  if (g_self->pointer != GD_OTHER->pointer) GD_GUNIFY_FAIL;
+  if (g_self->method_table != GD_OTHER->method_table) GD_GFAIL;
+  if (g_self->pointer != GD_OTHER->pointer) GD_GFAIL;
   GD_GSUCCEED;
 }
 
@@ -54,7 +54,8 @@
   G_OBJ_TYPE* newobj;
 
   if (g_argc != 1) fatal("Argument mismatch in pointer:new");
-  G_HEAPALLOC(newobj, G_OBJ_SIZE, (G_OBJ_TYPE*));
+
+  newobj = (G_OBJ_TYPE*) klic_alloc(G_OBJ_SIZE);
   newobj->method_table = &G_method_table;
   newobj->pointer = (char*) g_argv[0];
   GD_RETURN_FROM_NEW(newobj);
diff -ruN klic-3.003-2002-03-23/runtime/gstring.c klic-3.003-2002-03-26/runtime/gstring.c
--- klic-3.003-2002-03-23/runtime/gstring.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gstring.c	Sun Mar 24 15:42:59 2002
@@ -80,18 +80,18 @@
 {
   G_STD_DECL;
   long size, k;
-  if (g_self->method_table != GD_OTHER->method_table) GD_GUNIFY_FAIL;
+  if (g_self->method_table != GD_OTHER->method_table) GD_GFAIL;
   Shallow(g_self);
   size = g_self->index;
   Shallow(GD_OTHER);
-  if (GD_OTHER->index != size) GD_GUNIFY_FAIL;
+  if (GD_OTHER->index != size) GD_GFAIL;
   if (IS_SHALLOW_STRING(g_self)) {
-    if (BCMP(g_self->body, GD_OTHER->body, size) != 0) GD_GUNIFY_FAIL;
+    if (BCMP(g_self->body, GD_OTHER->body, size) != 0) GD_GFAIL;
   } else {
     for (k=0; k<size; k++) {
       unsigned char c = GD_OTHER->body[k];
       Shallow(g_self);
-      if (g_self->body[k] != c) GD_GUNIFY_FAIL;
+      if (g_self->body[k] != c) GD_GFAIL;
       Shallow(GD_OTHER);
     }
   }
diff -ruN klic-3.003-2002-03-23/runtime/gtermarray.c klic-3.003-2002-03-26/runtime/gtermarray.c
--- klic-3.003-2002-03-23/runtime/gtermarray.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/gtermarray.c	Sun Mar 24 16:27:38 2002
@@ -18,9 +18,9 @@
 {
   G_STD_DECL;
 
-  if (g_self->method_table != GD_OTHER->method_table) GD_GUNIFY_FAIL;
-  if (g_self->terms != GD_OTHER->terms) GD_GUNIFY_FAIL;
-  if (g_self->nterm != GD_OTHER->nterm) GD_GUNIFY_FAIL;
+  if (g_self->method_table != GD_OTHER->method_table) GD_GFAIL;
+  if (g_self->terms != GD_OTHER->terms) GD_GFAIL;
+  if (g_self->nterm != GD_OTHER->nterm) GD_GFAIL;
   GD_GSUCCEED;
 }
 
@@ -61,19 +61,11 @@
   G_OBJ_TYPE* newobj;
   int i;
 
-  G_HEAPALLOC(newobj, G_SIZE_IN_Q(G_OBJ_TYPE)+size-1, (G_OBJ_TYPE*));
+  newobj = (G_OBJ_TYPE*) klic_alloc(G_SIZE_IN_Q(G_OBJ_TYPE) + size - 1);
   newobj->method_table = &G_method_table;
   newobj->nterm = size;
   for (i=0; i<size; i++) {
     newobj->terms[i] = g_argv[i];
   }
   GD_RETURN_FROM_NEW(newobj);
-}
-
-extern q
-gd_new_termarray(argc, argv)
-     unsigned long argc;
-     q argv[];
-{
-  return termarray_g_new(argc, argv);
 }
diff -ruN klic-3.003-2002-03-23/runtime/kmain.c klic-3.003-2002-03-26/runtime/kmain.c
--- klic-3.003-2002-03-23/runtime/kmain.c	Tue Mar 19 13:59:28 2002
+++ klic-3.003-2002-03-26/runtime/kmain.c	Tue Mar 26 16:08:40 2002
@@ -71,6 +71,8 @@
 static char** command_argv0;
 static unsigned long resumes0;
 static unsigned long cum_susps0, cum_resumps0;
+static int measure_gc0 = 0;
+
 extern unsigned long heapsize(void){ return heapsize0; }
 extern unsigned long maxheapsize(void){ return maxheapsize0; }
 extern unsigned long incrementsize(void){ return incrementsize0; }
@@ -80,6 +82,7 @@
 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 int measure_gc(void){ return measure_gc0; }
 extern void inc_resumes(void){ resumes0 ++; }
 extern void
 double_heapsize(void){
@@ -123,7 +126,7 @@
     "-i <increment>: gap between heap top and bottom\n" \
     "\t  for -h, -H and -i, 32k means 32KW and 2m means 2MW",
 
-    "g",	(union all_type*) &measure_gc, ARG_SET,
+    "g",	(union all_type*) &measure_gc0, ARG_SET,
     "-g: set garbage collection measurement on",
 
     "v",	(union all_type*) &verbose, ARG_SET,
diff -ruN klic-3.003-2002-03-23/runtime/timing.h klic-3.003-2002-03-26/runtime/timing.h
--- klic-3.003-2002-03-23/runtime/timing.h	Tue Jan  1 17:09:10 2002
+++ klic-3.003-2002-03-26/runtime/timing.h	Tue Mar 26 16:09:50 2002
@@ -10,7 +10,9 @@
 
 #include <sys/types.h>
 
-#define  field_diff(field)	(after.field - before.field)
+#ifndef FIELD_DIFF
+#define FIELD_DIFF(field)  ((unsigned long) after.field - before.field)
+#endif
 
 
 #ifdef GETRUSAGE
@@ -18,11 +20,15 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#define  diff_usec(field)\
-(field_diff(field.tv_sec) * 1000000 + field_diff(field.tv_usec))
+#define  DIFF_USEC(field) \
+  (FIELD_DIFF(field.tv_sec) * 1000000LU + FIELD_DIFF(field.tv_usec))
+
+#define	measure(adr)  getrusage(RUSAGE_SELF, (adr))
+#define USER_TIME    (DIFF_USEC(ru_utime) / 1000LU)
+#define SYSTEM_TIME  (DIFF_USEC(ru_stime) / 1000LU)
+#define TOTAL_TIME   ((DIFF_USEC(ru_utime) + DIFF_USEC(ru_stime)) / 1000LU)
 
 typedef struct rusage timerstruct;
-#define	 measure(x)	getrusage(RUSAGE_SELF, &(x))
 
 
 #else  /* not GETRUSAGE */
@@ -30,17 +36,24 @@
 #include <sys/times.h>
 #include <sys/param.h>
 
-#define	 tick2msec(n)	((n)*1000.0/HZ)
+#define	 TICK_TO_MSEC(n)  ((unsigned long) ((n)*1000.0/HZ))
+
+#define	measure(adr)  times(adr)
+#define USER_TIME    (TICK_TO_MSEC(FIELD_DIFF(tms_utime)))
+#define SYSTEM_TIME  (TICK_TO_MSEC(FIELD_DIFF(tms_stime)))
+#define TOTAL_TIME   (TICK_TO_MSEC(FIELD_DIFF(tms_utime)) + TICK_TO_MSEC(FIELD_DIFF(tms_stime)))
 
 typedef struct tms timerstruct;
-#define	 measure(x)	times(&(x))
 
 #endif  /* not GETRUSAGE */
 
 
-Extern int gctimes Init(0);
-Extern int gcums Init(0);
-Extern int gcsms Init(0);
-Extern int measure_gc Init(0);
+/* gc.c */
+extern int gctimes(void);
+extern int gcums(void);
+extern int gcsms(void);
+
+/* kmain.c */
+extern int measure_gc(void);
 
 #endif /* _KLIC_TIMING_H_ */
diff -ruN klic-3.003-2002-03-23/runtime/wakeup.c klic-3.003-2002-03-26/runtime/wakeup.c
--- klic-3.003-2002-03-23/runtime/wakeup.c	Sat Mar 23 21:34:01 2002
+++ klic-3.003-2002-03-26/runtime/wakeup.c	Sun Mar 24 16:33:07 2002
@@ -27,7 +27,7 @@
 {
   G_STD_DECL;
 
-  GC_KL1_UNIFY(g_self->x, g_self->y);
+  G_KL1_UNIFY(g_self->x, g_self->y);
   GC_TERMINATE;
 }
 
