diff -ruN klic-3.003-2002-03-11a/include/klic/g_basic.h klic-3.003-2002-03-11b/include/klic/g_basic.h --- klic-3.003-2002-03-11a/include/klic/g_basic.h Mon Mar 11 15:14:00 2002 +++ klic-3.003-2002-03-11b/include/klic/g_basic.h Mon Mar 11 16:05:27 2002 @@ -58,10 +58,10 @@ */ #define G_HEAPALLOC(from,size,type) \ do{ \ - set_heapp(g_allocp); \ + assert(g_allocp == heapp()); \ (from) = type(g_allocp); \ g_allocp += (size); \ - assert(g_allocp >= heapp() + (size)); \ + set_heapp(g_allocp); \ }while(0) @@ -78,12 +78,13 @@ heaplimit = 0; \ (res) = GENERIC_GCREQUEST; \ } else { \ + set_heapp(g_allocp); \ G_HEAPALLOC((from), (size), type); \ - assert(g_allocp >= heapp() + (size)); \ + assert(g_allocp == heapp()); \ (res) = GENERIC_SUCCEEDED; \ } \ assert((res)==GENERIC_GCREQUEST || \ - ((res)==GENERIC_SUCCEEDED && g_allocp >= heapp()+(size)) ); \ + ((res)==GENERIC_SUCCEEDED && g_allocp == heapp()) ); \ }while(0) @@ -92,8 +93,9 @@ */ #define G_MAKE_VAR(x) \ do{ \ + set_heapp(g_allocp); \ G_HEAPALLOC((x), 1, (q)); \ - assert(g_allocp >= heapp() + 1); \ + assert(g_allocp == heapp()); \ derefone(x) = (x); \ }while(0) diff -ruN klic-3.003-2002-03-11a/include/klic/gc_macro.h klic-3.003-2002-03-11b/include/klic/gc_macro.h --- klic-3.003-2002-03-11a/include/klic/gc_macro.h Mon Mar 11 15:00:07 2002 +++ klic-3.003-2002-03-11b/include/klic/gc_macro.h Mon Mar 11 16:14:57 2002 @@ -64,16 +64,15 @@ q argv[2]; \ set_method_result(GC_SUCCEEDED); \ G_MAKE_VAR(newvar); \ - assert(g_allocp >= heapp() + 1); \ + assert(g_allocp == heapp()); \ set_rest_of_stream(newvar); \ argv[0] = GC_TERM; \ argv[1] = newvar; \ - assert(g_allocp >= heapp() + 1); \ set_heapp(g_allocp); \ tmp = GC_wakeup_g_new(2, argv); \ g_allocp = heapp(); \ GC_KL1_UNIFY((var), tmp); \ - assert(g_allocp == heapp() + 4); \ + assert(g_allocp == heapp()); \ return g_allocp; \ }while(0) @@ -110,8 +109,7 @@ q res; \ assert(g_allocp==heapp()); \ G_HEAPALLOC_WITH_CHECK((new), (size), type, res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+(size)) ); \ + assert(g_allocp == heapp()); \ if (GC_GCREQUEST == res) goto gc_request; \ }while(0) @@ -176,8 +174,7 @@ q res; \ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((newgobj), (size), (GC_OBJ_TYPE*), res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+(size)) ); \ + assert(g_allocp == heapp()); \ if(GC_GCREQUEST == res){ \ q var; \ struct goalrec *goal; \ @@ -302,13 +299,14 @@ #define GC_KL1_UNIFY(x, y) \ do{ \ struct goalrec *gp; \ + set_heapp(g_allocp); \ G_HEAPALLOC(gp, 4, (struct goalrec *)); \ - assert(g_allocp >= heapp() + 4); \ + assert(g_allocp == heapp()); \ gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \ gp->args[0] = (x); \ gp->args[1] = (y); \ resume_same_prio(gp); \ - assert(g_allocp >= heapp() + 4); \ + assert(g_allocp == heapp()); \ }while(0) #endif /* _KLIC_GC_MACRO_H_ */ diff -ruN klic-3.003-2002-03-11a/include/klic/gd_macro.h klic-3.003-2002-03-11b/include/klic/gd_macro.h --- klic-3.003-2002-03-11a/include/klic/gd_macro.h Mon Mar 11 15:20:08 2002 +++ klic-3.003-2002-03-11b/include/klic/gd_macro.h Mon Mar 11 16:16:07 2002 @@ -73,8 +73,7 @@ q res; \ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((new), (size), type, res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+(size)) ); \ + assert(g_allocp == heapp()); \ if(GD_GCREQUEST == res){ \ struct goalrec *goal; \ GD_MAKE_GENERIC_GOAL(&goal, makefunctor(GD_SELF), g_method_functor, \ @@ -90,8 +89,7 @@ q res; \ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((new), (size), type, res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+(size)) ); \ + assert(g_allocp == heapp()); \ if(GD_GCREQUEST == res){ \ q var; \ struct goalrec *goal; \ @@ -110,8 +108,7 @@ q res; \ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((newgobj), (size), (GD_OBJ_TYPE*), res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+(size)) ); \ + assert(g_allocp == heapp()); \ if(GENERIC_GCREQUEST == res){ \ q var; \ struct goalrec *goal; \ @@ -130,8 +127,7 @@ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((newgobj), GD_OBJ_SIZE(GD_SELF), \ (GD_OBJ_TYPE*), res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+GD_OBJ_SIZE(GD_SELF)) ); \ + assert(g_allocp == heapp()); \ if (GD_GCREQUEST == res) { \ struct goalrec *goal; \ GD_MAKE_GENERIC_GOAL(&goal, makefunctor(GD_SELF), \ diff -ruN klic-3.003-2002-03-11a/include/klic/gg_macro.h klic-3.003-2002-03-11b/include/klic/gg_macro.h --- klic-3.003-2002-03-11a/include/klic/gg_macro.h Mon Mar 11 15:01:28 2002 +++ klic-3.003-2002-03-11b/include/klic/gg_macro.h Mon Mar 11 16:38:04 2002 @@ -48,10 +48,10 @@ q newvar, tmp; \ q argv[2]; \ G_MAKE_VAR(newvar); \ - assert(g_allocp >= heapp() + 1); \ + assert(g_allocp == heapp()); \ argv[0] = GG_TERM; \ argv[1] = newvar; \ - set_heapp(g_allocp); \ + assert(g_allocp == heapp()); \ tmp = GC_wakeup_g_new(2, argv); \ GG_KL1_UNIFY((var), tmp); \ return(g_allocp); \ @@ -106,8 +106,9 @@ #define GG_TRY_TO_ALLOC(new,type,size,label) \ do{ \ + set_heapp(g_allocp); \ G_HEAPALLOC((new), (size), type); \ - assert(g_allocp >= heapp() + (size)); \ + assert(g_allocp == heapp()); \ if((long) real_heaplimit() <= (long) g_allocp) { \ goto label; \ } \ @@ -155,8 +156,7 @@ q res; \ assert(g_allocp == heapp()); \ G_HEAPALLOC_WITH_CHECK((newgobj), GG_OBJ_SIZE, type, res); \ - assert((res==GENERIC_GCREQUEST && g_allocp == heapp()) || \ - (res==GENERIC_SUCCEEDED && g_allocp == heapp()+GG_OBJ_SIZE) ); \ + assert(g_allocp == heapp()); \ if(GG_GCREQUEST == res) { \ q var; \ struct goalrec *goal; \ @@ -234,8 +234,9 @@ #define GG_KL1_UNIFY(x, y) \ do{ \ struct goalrec *gp; \ + set_heapp(g_allocp); \ G_HEAPALLOC(gp, 4, (struct goalrec *)); \ - assert(g_allocp >= heapp() + 4); \ + assert(g_allocp == heapp()); \ gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \ gp->args[0] = (x); \ gp->args[1] = (y); \ diff -ruN klic-3.003-2002-03-11a/runtime/gcode.c klic-3.003-2002-03-11b/runtime/gcode.c --- klic-3.003-2002-03-11a/runtime/gcode.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gcode.c Mon Mar 11 16:37:16 2002 @@ -98,8 +98,9 @@ #define GD_ALLOC_GOAL(goal, pdesc, size) \ do{ \ + set_heapp(g_allocp); \ G_HEAPALLOC(goal, (size)+2, (struct goalrec*)); \ - assert(g_allocp >= heapp() + (size)+2); \ + assert(g_allocp == heapp()); \ (goal)->pred = (pdesc); \ }while(0) @@ -282,10 +283,10 @@ set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newpred, sizeof(struct predicate_object)); - assert(g_allocp == heapp() + sizeof(struct predicate_object)); + assert(g_allocp == heapp()); newpred->pdesc = predaddr; newpred->module_obj = G_MAKEFUNCTOR(module_obj); newpred->predicate_name = predname; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_RETURN_FROM_NEW(newpred); } diff -ruN klic-3.003-2002-03-11a/runtime/ge_exref.c klic-3.003-2002-03-11b/runtime/ge_exref.c --- klic-3.003-2002-03-11a/runtime/ge_exref.c Mon Mar 11 13:23:28 2002 +++ klic-3.003-2002-03-11b/runtime/ge_exref.c Mon Mar 11 16:36:55 2002 @@ -171,7 +171,7 @@ q* g_allocp = heapp(); GGSET_NEWOBJ_FOR_NEW(new_exref, (struct exref_object*)); - assert(g_allocp == heapp() + GG_OBJ_SIZE); + assert(g_allocp == heapp()); new_exref->node = (long) intval(GG_ARGV[0]); new_exref->index = (long) intval(GG_ARGV[1]); @@ -183,7 +183,7 @@ regist_imp_entry(new_exref); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GG_RETURN_FROM_NEW(new_exref->to_exref); } diff -ruN klic-3.003-2002-03-11a/runtime/ge_readhook.c klic-3.003-2002-03-11b/runtime/ge_readhook.c --- klic-3.003-2002-03-11a/runtime/ge_readhook.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/ge_readhook.c Mon Mar 11 16:17:57 2002 @@ -98,7 +98,7 @@ q* g_allocp = heapp(); GCSET_NEWOBJ_FOR_NEW(new_read_hook, GC_OBJ_SIZE(new_read_hook)); - assert(g_allocp == heapp() + GC_OBJ_SIZE(new_read_hook)); + assert(g_allocp == heapp()); new_read_hook->node = (long) intval(GC_ARGV[0]); new_read_hook->index = (long) intval(GC_ARGV[1]); new_read_hook->wec = (long) intval(GC_ARGV[2]); diff -ruN klic-3.003-2002-03-11a/runtime/ge_replyhook.c klic-3.003-2002-03-11b/runtime/ge_replyhook.c --- klic-3.003-2002-03-11a/runtime/ge_replyhook.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/ge_replyhook.c Mon Mar 11 16:18:06 2002 @@ -74,7 +74,7 @@ q* g_allocp = heapp(); GCSET_NEWOBJ_FOR_NEW(new_reply_hook, GC_OBJ_SIZE(new_reply_hook)); - assert(g_allocp == heapp() + GC_OBJ_SIZE(new_reply_hook)); + assert(g_allocp == heapp()); new_reply_hook->node = intval(GC_ARGV[0]); new_reply_hook->index = intval(GC_ARGV[1]); new_reply_hook->wec = intval(GC_ARGV[2]); diff -ruN klic-3.003-2002-03-11a/runtime/generic.c klic-3.003-2002-03-11b/runtime/generic.c --- klic-3.003-2002-03-11a/runtime/generic.c Mon Mar 11 15:14:03 2002 +++ klic-3.003-2002-03-11b/runtime/generic.c Mon Mar 11 16:36:16 2002 @@ -49,18 +49,19 @@ int i; G_HEAPALLOC(objp, G_SIZE_IN_Q(struct functor)+argc-1, makefunctor); - assert(g_allocp == heapp() + G_SIZE_IN_Q(struct functor)+argc-1); + assert(g_allocp == heapp()); functor_of(objp) = makesym(method_functor); for( i=0; i= heapp() + G_SIZE_IN_Q(struct goalrec)-4); + assert(g_allocp == heapp()); (*goalp1)->pred = GD_GENERIC_GOAL; (*goalp1)->args[0] = objp; (*goalp1)->args[1] = var; - set_heapp(g_allocp); + assert(g_allocp == heapp()); } extern void @@ -81,15 +82,15 @@ g_allocp = heapp(); G_HEAPALLOC(*goalp1, G_SIZE_IN_Q(struct goalrec)-3, (struct goalrec*)); - assert(g_allocp >= heapp() + G_SIZE_IN_Q(struct goalrec)-3); + assert(g_allocp == heapp()); G_MAKE_VAR(newvar); - assert(g_allocp >= heapp() + 1); + assert(g_allocp == heapp()); (*goalp1)->pred = G_NEW_GOAL; (*goalp1)->args[0] = newvar; (*goalp1)->args[1] = newobj; (*goalp1)->args[2] = newobj2; *var = newvar; - set_heapp(g_allocp); + assert(g_allocp == heapp()); } /**********************************************************************/ diff -ruN klic-3.003-2002-03-11a/runtime/gfloat.c klic-3.003-2002-03-11b/runtime/gfloat.c --- klic-3.003-2002-03-11a/runtime/gfloat.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gfloat.c Mon Mar 11 16:19:32 2002 @@ -191,7 +191,7 @@ ALIGN(); set_heapp(g_allocp); GDSET_NEWOBJ(newobj); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); GD_SWITCH_ON_ARITY { case 1: { result_index = 0; @@ -396,7 +396,7 @@ ALIGN(); set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newobj, G_SIZE_IN_Q(GD_OBJ_TYPE)); - assert(g_allocp == heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)); + assert(g_allocp == heapp()); if( G_ISINT(init) ){ newobj->value = (double) G_INTVAL(init); }else if( G_ISGOBJ(init) && @@ -421,8 +421,9 @@ GD_OBJ_TYPE* newobj; ALIGN(); + set_heapp(g_allocp); G_HEAPALLOC(newobj, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE*)); - assert(g_allocp >= heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)); + assert(g_allocp == heapp()); newobj->method_table = &GD_method_table; if( sizeof(long) == sizeof(double) ){ diff -ruN klic-3.003-2002-03-11a/runtime/ggoal.c klic-3.003-2002-03-11b/runtime/ggoal.c --- klic-3.003-2002-03-11a/runtime/ggoal.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/ggoal.c Mon Mar 11 16:35:18 2002 @@ -152,7 +152,7 @@ struct goalrec *newgoal; set_heapp(g_allocp); GD_ALLOC_AREA(newgoal, (struct goalrec *), 2+5); - assert(g_allocp == heapp() + 2+5); + assert(g_allocp == heapp()); newgoal->pred = &step_trigger_pred; newgoal->args[0] = makefunctor(GD_SELF); newgoal->args[1] = GD_ARGV[0]; /* children info */ @@ -197,7 +197,7 @@ /* Allocate and set up new goal record */ set_heapp(g_allocp); GD_ALLOC_AREA(newgoal, (struct goalrec *), size+2); - assert(g_allocp == heapp() + size+2); + assert(g_allocp == heapp()); oldgoal = GD_SELF->goal; newgoal->pred = oldgoal->pred; for (k = 0; k < size; k++) { @@ -208,7 +208,7 @@ /* Allocate and set up new goal object */ set_heapp(g_allocp); GDSET_NEWOBJ(newobj); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); newobj->goal = newgoal; set_heapp(g_allocp); @@ -269,7 +269,7 @@ /* Allocate and set up new goal record */ set_heapp(g_allocp); GD_ALLOC_AREA(newgoal, (struct goalrec *), arity+2); - assert(g_allocp == heapp() + arity+2); + assert(g_allocp == heapp()); newgoal->pred = pred->pdesc; for (k = 0; k < arity; k++) { newgoal->args[k] = oldgoal->args[k]; @@ -278,7 +278,7 @@ /* Allocate and set up new goal object */ set_heapp(g_allocp); GDSET_NEWOBJ(newobj); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); newobj->goal = newgoal; GD_UNIFY_VALUE(GD_ARGV[1], GD_OBJ(newobj)); @@ -383,7 +383,7 @@ set_heapp(g_allocp); GD_ALLOC_AREA_FOR_NEW(newgoal, (struct goalrec *), pred_arity+2); - assert(g_allocp == heapp() + pred_arity+2); + assert(g_allocp == heapp()); newgoal->pred = pred->pdesc; for (k = 0; k < pred_arity; k++) { extern q element_of_vector(); @@ -391,9 +391,9 @@ } set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newobj, G_SIZE_IN_Q(GD_OBJ_TYPE)); - assert(g_allocp == heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)); + assert(g_allocp == heapp()); newobj->goal = newgoal; newobj->id = goal_obj_id++; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_RETURN_FROM_NEW(newobj); } diff -ruN klic-3.003-2002-03-11a/runtime/gio.c klic-3.003-2002-03-11b/runtime/gio.c --- klic-3.003-2002-03-11a/runtime/gio.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gio.c Mon Mar 11 16:20:48 2002 @@ -417,9 +417,9 @@ gc_request: G_MAKE_VAR(newvar); - assert(g_allocp >= heapp() + 1); + assert(g_allocp == heapp()); GC_KL1_UNIFY(GC_TERM, newvar); - assert(g_allocp >= heapp() + 4); + assert(g_allocp == heapp()); GC_RETURN_WITH_HOOK(newvar); suspend: @@ -500,7 +500,7 @@ set_heapp(g_allocp); GCSET_NEWOBJ_FOR_NEW(newobj, GC_OBJ_SIZE(newobj)); - assert(g_allocp == heapp() + GC_OBJ_SIZE(newobj)); + assert(g_allocp == heapp()); if( infile == NILATOM ){ newobj->infile = NULL; }else{ diff -ruN klic-3.003-2002-03-11a/runtime/gmerge.c klic-3.003-2002-03-11b/runtime/gmerge.c --- klic-3.003-2002-03-11a/runtime/gmerge.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gmerge.c Mon Mar 11 16:21:35 2002 @@ -28,8 +28,9 @@ #define GC_MAKE_MERGE_IN_GOAL(newvar,vec,index,size) \ do{ \ struct goalrec *goalp1; \ + set_heapp(g_allocp); \ G_HEAPALLOC(goalp1,G_SIZE_IN_Q(struct goalrec)-2,(struct goalrec *)); \ - assert(g_allocp >= heapp() + G_SIZE_IN_Q(struct goalrec)-2); \ + assert(g_allocp == heapp()); \ goalp1->pred = GC_MERGE_IN_GOAL; \ goalp1->args[0] = newvar; \ goalp1->args[1] = vec; \ @@ -58,7 +59,7 @@ struct cons *newout; set_heapp(g_allocp); GC_TRY_TO_ALLOC(newout,(struct cons *),2,gc_request); - assert(g_allocp == heapp() + 2); + assert(g_allocp == heapp()); newout->car = G_CAR_OF(GC_TERM); GCSET_VAR(newout->cdr); set_heapp(g_allocp); @@ -101,11 +102,11 @@ GD_CALL_GMETHOD(GC_TERM,element_2,argv); set_heapp(g_allocp); GC_TRY_TO_ALLOC(hook_var,(q),1,gc_request2); - assert(g_allocp == heapp() + 1); + assert(g_allocp == heapp()); derefone(hook_var) = GC_MAKE_HOOK_VAR((struct consumer_object*) GC_SELF); GC_KL1_UNIFY(argv[1],hook_var); - assert(g_allocp >= heapp() + 4); + assert(g_allocp == heapp()); } } GC_TERMINATE; @@ -113,7 +114,7 @@ assert(g_allocp == heapp()); GC_SELF->count -= size-i-1; G_MAKE_VAR(newvar); - assert(g_allocp >= heapp() + 1); + assert(g_allocp == heapp()); GC_MAKE_MERGE_IN_GOAL(newvar,GC_TERM,i,size); GC_RETURN_WITH_HOOK(newvar); } else goto invalid_data; @@ -125,9 +126,9 @@ gc_request: assert(g_allocp == heapp()); G_MAKE_VAR(newvar); - assert(g_allocp >= heapp() + 1); + assert(g_allocp == heapp()); GC_KL1_UNIFY(GC_TERM,newvar); - assert(g_allocp >= heapp() + 4); + assert(g_allocp == heapp()); GC_RETURN_WITH_HOOK(newvar); } @@ -168,7 +169,7 @@ if (GC_ARGC != 1) GC_ERROR_IN_NEW("Arity mismatch"); GCSET_NEWOBJ_FOR_NEW(newmerger,GC_OBJ_SIZE(newmerger)); - assert(g_allocp == heapp() + GC_OBJ_SIZE(newmerger)); + assert(g_allocp == heapp()); newmerger->count = 1; newmerger->outstream = GC_ARGV[0]; var = GC_MAKE_HOOK_VAR((struct consumer_object*) newmerger); diff -ruN klic-3.003-2002-03-11a/runtime/gmodule.c klic-3.003-2002-03-11b/runtime/gmodule.c --- klic-3.003-2002-03-11a/runtime/gmodule.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gmodule.c Mon Mar 11 16:33:51 2002 @@ -162,9 +162,9 @@ GD_OBJ_TYPE *newmodule; set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newmodule,sizeof(struct module_object)); - assert(g_allocp == heapp() + sizeof(struct module_object)); + assert(g_allocp == heapp()); newmodule->name = atom; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_RETURN_FROM_NEW(newmodule); } } diff -ruN klic-3.003-2002-03-11a/runtime/gmvv.c klic-3.003-2002-03-11b/runtime/gmvv.c --- klic-3.003-2002-03-11a/runtime/gmvv.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gmvv.c Mon Mar 11 16:33:29 2002 @@ -265,7 +265,7 @@ GDSET_INTARG_WITHIN_RANGE(position,GD_ARGV[0],0,size); set_heapp(g_allocp); GDSET_NEWOBJ(newvect); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); if (!iscnst) { q olddata = body[position]; @@ -279,7 +279,7 @@ q *newbody; set_heapp(g_allocp); GD_ALLOC_AREA(newbody,(q*),size); - assert(g_allocp == heapp() + size); + assert(g_allocp == heapp()); for (k=0; kbody = newbody; @@ -309,7 +309,7 @@ GDSET_INTARG_WITHIN_RANGE(position,GD_ARGV[0],0,size); set_heapp(g_allocp); GDSET_NEWOBJ(newvect); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); olddata = body[position]; set_heapp(g_allocp); GD_UNIFY(GD_ARGV[1], olddata); @@ -323,9 +323,9 @@ } else { long k; q *newbody; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(newbody,(q*),size); - assert(g_allocp == heapp() + size); + assert(g_allocp == heapp()); for (k=0; kbody = newbody; @@ -351,16 +351,13 @@ lower_size = size-split_point; set_heapp(g_allocp); GD_ALLOC_AREA(upper_body, (q *), split_point); - assert(g_allocp == heapp() + split_point); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(lower_body, (q *), lower_size); - assert(g_allocp == heapp() + lower_size); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(upper, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(lower, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); BCOPY((char *)GD_SELF->body, (char *)upper_body, split_point*sizeof(q)); BCOPY((char *)(GD_SELF->body+split_point), (char *)lower_body, lower_size*sizeof(q)); @@ -398,10 +395,9 @@ newsize = size1+size2; set_heapp(g_allocp); GD_ALLOC_AREA(newbody, (q *), newsize); - assert(g_allocp == heapp() + newsize); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(new, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); Shallow(GD_SELF); BCOPY((char *)GD_SELF->body, (char *)newbody, size1*sizeof(q)); Shallow(another); @@ -564,13 +560,13 @@ GD_DEREF_FOR_NEW(init); set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newvect, G_SIZE_IN_Q(GD_OBJ_TYPE)); - assert(g_allocp == heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)); + assert(g_allocp == heapp()); if (G_ISINT(init)) { size = G_INTVAL(init); if (size < 0) GD_ERROR_IN_NEW("Negative size specified"); set_heapp(g_allocp); GD_ALLOC_AREA_FOR_NEW(body, (q*), size); - assert(g_allocp == heapp() + size); + assert(g_allocp == heapp()); for (k=0; k= heapp()+G_SIZE_IN_Q(GD_OBJ_TYPE)) ); + assert(g_allocp == heapp()); /* G_HEAPALLOC(newvect, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE*)); */ if(GENERIC_GCREQUEST == res){ @@ -673,13 +667,11 @@ newvect->method_table = &GD_method_table; newvect-> index = size = (long)GET_BUFFER(inbuf); - /* set_heapp(g_allocp); - * GD_ALLOC_AREA_FOR_NEW(body, (q*), size); - * assert(g_allocp == heapp() + size) */ set_heapp(g_allocp); + /* GD_ALLOC_AREA_FOR_NEW(body, (q*), size); + * assert(g_allocp == heapp()); */ G_HEAPALLOC_WITH_CHECK(body, size, (q*), res); - assert(res==GENERIC_GCREQUEST || - (res==GENERIC_SUCCEEDED && g_allocp >= heapp()+size) ); + assert(g_allocp == heapp()); /* G_HEAPALLOC(body, size, (q*)); */ if(GD_GCREQUEST == res){ add_this_more_space(size); diff -ruN klic-3.003-2002-03-11a/runtime/gpointer.c klic-3.003-2002-03-11b/runtime/gpointer.c --- klic-3.003-2002-03-11a/runtime/gpointer.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gpointer.c Mon Mar 11 16:32:21 2002 @@ -56,10 +56,10 @@ if (GD_ARGC != 1) GD_FAIL("Argument mismatch in pointer:new"); G_HEAPALLOC(newobj,GD_OBJ_SIZE(newobj),(GD_OBJ_TYPE *)); - assert(g_allocp >= heapp() + GD_OBJ_SIZE(newobj)); + assert(g_allocp == heapp()); newobj->method_table = &GD_method_table; newobj->pointer = (char *)GD_ARGV[0]; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_RETURN_FROM_NEW(newobj); } diff -ruN klic-3.003-2002-03-11a/runtime/gstring.c klic-3.003-2002-03-11b/runtime/gstring.c --- klic-3.003-2002-03-11a/runtime/gstring.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gstring.c Mon Mar 11 16:32:02 2002 @@ -259,7 +259,7 @@ GDSET_INTARG_WITHIN_RANGE(newelem,GD_ARGV[1],0,256); set_heapp(g_allocp); GDSET_NEWOBJ(newstr); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); if (!iscnst) { unsigned char olddata = body[position]; @@ -271,9 +271,9 @@ } else { unsigned char *newbody; unsigned long qsize = ROUND_UP(size); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(newbody, (unsigned char *), qsize); - assert(g_allocp == heapp() + qsize); + assert(g_allocp == heapp()); BCOPY(body, newbody, qsize*sizeof(q)); newbody[position] = newelem; newstr->body = newbody; @@ -299,16 +299,13 @@ lower_size = size-split_point; set_heapp(g_allocp); GD_ALLOC_AREA(upper_body, (unsigned char *), ROUND_UP(split_point)); - assert(g_allocp == heapp() + ROUND_UP(split_point)); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(lower_body, (unsigned char *), ROUND_UP(lower_size)); - assert(g_allocp == heapp() + ROUND_UP(lower_size)); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(upper, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(lower, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); BCOPY(GD_SELF->body, upper_body, split_point); BCOPY(GD_SELF->body+split_point, lower_body, lower_size); upper->method_table = lower->method_table = GD_SELF->method_table; @@ -346,10 +343,9 @@ newsize = size1+size2; set_heapp(g_allocp); GD_ALLOC_AREA(newbody, (unsigned char *), ROUND_UP(newsize)); - assert(g_allocp == heapp() + ROUND_UP(newsize)); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA(new, (GD_OBJ_TYPE *), GD_OBJ_SIZE(GD_SELF)); - assert(g_allocp == heapp() + GD_OBJ_SIZE(GD_SELF)); + assert(g_allocp == heapp()); Shallow(GD_SELF); BCOPY(GD_SELF->body, newbody, size1); Shallow(another); @@ -627,15 +623,15 @@ GD_DEREF_FOR_NEW(init); set_heapp(g_allocp); GDSET_NEWOBJ_FOR_NEW(newstr, G_SIZE_IN_Q(GD_OBJ_TYPE)); - assert(g_allocp == heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)); + assert(g_allocp == heapp()); if (G_ISINT(init)) { unsigned long qsize; size = G_INTVAL(init); if (size < 0) GD_ERROR_IN_NEW("Negative size specified"); qsize = ROUND_UP(size); - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_ALLOC_AREA_FOR_NEW(body, (unsigned char *), qsize); - assert(g_allocp == heapp() + qsize); + assert(g_allocp == heapp()); BZERO(body, qsize*sizeof(q)); } else if (init==NILATOM || G_ISCONS(init)) { unsigned long qsize, k; @@ -656,7 +652,7 @@ init = GD_ARGV[0]; set_heapp(g_allocp); GD_ALLOC_AREA_FOR_NEW(body, (unsigned char *), qsize); - assert(g_allocp == heapp() + qsize); + assert(g_allocp == heapp()); for (k=0; k= heapp()+G_SIZE_IN_Q(GD_OBJ_TYPE)) ); + assert(g_allocp == heapp()); /* G_HEAPALLOC(newstring, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE*)); */ if(GENERIC_GCREQUEST == res){ @@ -714,8 +709,7 @@ q *tmpbody; set_heapp(g_allocp); G_HEAPALLOC_WITH_CHECK(tmpbody, size, (q*), res); - assert(res==GENERIC_GCREQUEST || - (res==GENERIC_SUCCEEDED && g_allocp >= heapp()+size) ); + assert(g_allocp == heapp()); body = (unsigned char *) tmpbody; } /* G_HEAPALLOC(body, size, (unsigned char*)); */ diff -ruN klic-3.003-2002-03-11a/runtime/gtermarray.c klic-3.003-2002-03-11b/runtime/gtermarray.c --- klic-3.003-2002-03-11a/runtime/gtermarray.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/gtermarray.c Mon Mar 11 16:30:01 2002 @@ -63,13 +63,13 @@ q* g_allocp = heapp(); G_HEAPALLOC(newobj,G_SIZE_IN_Q(GD_OBJ_TYPE)+size-1,(GD_OBJ_TYPE *)); - assert(g_allocp >= heapp() + G_SIZE_IN_Q(GD_OBJ_TYPE)+size-1); + assert(g_allocp == heapp()); newobj->method_table = &GD_method_table; newobj->nterm = size; for (i=0; iterms[i] = GD_ARGV[i]; } - set_heapp(g_allocp); + assert(g_allocp == heapp()); GD_RETURN_FROM_NEW(newobj); } diff -ruN klic-3.003-2002-03-11a/runtime/random.c klic-3.003-2002-03-11b/runtime/random.c --- klic-3.003-2002-03-11a/runtime/random.c Mon Mar 11 13:23:48 2002 +++ klic-3.003-2002-03-11b/runtime/random.c Mon Mar 11 16:29:39 2002 @@ -120,14 +120,14 @@ } set_heapp(g_allocp); GGSET_NEWOBJ_FOR_NEW(obj, (GG_OBJ_TYPE*)); - assert(g_allocp == heapp() + GG_OBJ_SIZE); + assert(g_allocp == heapp()); obj->state[0] = seed >> (sizeof(seed)*4); obj->state[1] = seed >> (sizeof(seed)*2); obj->state[2] = seed >> (sizeof(seed)*0); obj->range = range; obj->max = ((((unsigned long)(~0))<<1)>>1)/range*range; - set_heapp(g_allocp); + assert(g_allocp == heapp()); GG_RETURN_FROM_NEW(GG_MAKE_HOOK_VAR(obj)); } #endif /* NRAND48 */ diff -ruN klic-3.003-2002-03-11a/runtime/wakeup.c klic-3.003-2002-03-11b/runtime/wakeup.c --- klic-3.003-2002-03-11a/runtime/wakeup.c Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-11b/runtime/wakeup.c Mon Mar 11 16:28:49 2002 @@ -29,7 +29,7 @@ q* g_allocp = heapp(); GC_KL1_UNIFY(GC_SELF->x,GC_SELF->y); - assert(g_allocp >= heapp() + 4); + assert(g_allocp == heapp()); GC_TERMINATE; } @@ -70,7 +70,7 @@ if (GC_ARGC != 2) GC_FAIL("arity mismatch in creation of a merger."); GCSET_NEWOBJ_FOR_NEW(wakeup,GC_OBJ_SIZE(wakeup)); - assert(g_allocp == heapp() + GC_OBJ_SIZE(wakeup)); + assert(g_allocp == heapp()); wakeup->x = GC_ARGV[0]; wakeup->y = GC_ARGV[1]; var = GC_MAKE_HOOK_VAR((struct consumer_object*) wakeup);