diff -ruN klic-3.003-2002-03-11c/compiler/obj.kl1 klic-3.003-2002-03-12/compiler/obj.kl1 --- klic-3.003-2002-03-11c/compiler/obj.kl1 Wed Feb 20 10:16:11 2002 +++ klic-3.003-2002-03-12/compiler/obj.kl1 Tue Mar 12 12:09:25 2002 @@ -136,7 +136,9 @@ klicformat( " ~r = makefunctor( &allocp[~d] );\n", [X, H] )-Out, H += N. write_one( make_vector( X, L ), _ )-H-Out :- - klicformat( " ~r = create_vector( &allocp[~d], ~d, allocp );\n", + klicformat( + " set_heapp(allocp);\n" + " ~r = create_vector0( &allocp[~d], ~d );\n", [X, H, L] )-Out, H += L. write_one( alloc_functor_id( F, A ), _ )-H-Out :- @@ -189,7 +191,9 @@ HP = H, klicformat( " allocp[~d] = (q) ~Q;\n", [H, Q0] )-Out. write_one( throw_goal( Node, Q0, Q ), _ )-H-Out :- - klicformat( " throw_goal( ~r, ~r, ~r );\n", [Node, Q0, Q] )-Out. + klicformat( + " set_heapp(allocp);\n" + " throw_goal( ~r, ~r, ~r );\n", [Node, Q0, Q] )-Out. write_one( enq_at_prio( P, Q0, Q ), _ )-H-Out :- klicformat( " set_heapp(allocp);\n" @@ -236,7 +240,9 @@ write_one( otherwise, Info )-H-Out :- klicformat( " otherwise( ~l );\n", [Info, interrupt] )-Out. write_one( alternatively, Info )-H-Out :- - klicformat( " alternative( ~l );\n", [Info, clear_reason] )-Out. + klicformat( + " set_heapp(allocp);\n" + " alternative( ~l );\n", [Info, clear_reason] )-Out. write_one( equiv( R1, R0 ), _ )-H-Out :- klicformat( " ~r = ~r;\n", [R0, R1] )-Out. @@ -244,12 +250,16 @@ /* Generic Objects */ write_one( new_generic( Class, Arity, Obj, Q ), _ )-H-Out :- write_adjust_qp( Q )-Out, - klicformat( " new_generic( ~q_g_new, ~d, ~r, ~d );\n", - [Class, Arity, Obj, H] )-Out, + klicformat( + " set_heapp(allocp + ~d);\n" + " new_generic0( ~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( " call_generic( ~k, ~f, ~d );\n", [Obj, FA, H] )-Out, + klicformat( + " set_heapp(allocp + ~d);\n" + " call_generic0( ~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", @@ -269,11 +279,13 @@ write_one_execute( Name, Arity, Susp )-Out :- Susp=:=0 | klicformat( + " set_heapp(allocp);\n" " execute( ~q_~d_0 );\n" " goto ~q_~d_ext_interrupt;\n", [Name, Arity, Name, Arity] )-Out. write_one_execute( Name, Arity, Susp )-Out :- Susp=\=0 | klicformat( + " set_heapp(allocp);\n" " execute( ~q_~d_clear_reason );\n" " goto ~q_~d_ext_interrupt;\n", [Name, Arity, Name, Arity] )-Out. diff -ruN klic-3.003-2002-03-11c/compiler/write.kl1 klic-3.003-2002-03-12/compiler/write.kl1 --- klic-3.003-2002-03-11c/compiler/write.kl1 Sun Feb 17 14:46:25 2002 +++ klic-3.003-2002-03-12/compiler/write.kl1 Tue Mar 12 12:08:47 2002 @@ -49,6 +49,7 @@ write_interrupt_call( MaxArity, MaxArity )-Out, klic_comp_obj:klicformat( " proceed_label:\n" + " set_heapp(allocp);\n" " loop_within_module( module_~q );\n" "}\n", [Name] )-Out. diff -ruN klic-3.003-2002-03-11c/include/klic/control.h klic-3.003-2002-03-12/include/klic/control.h --- klic-3.003-2002-03-11c/include/klic/control.h Mon Feb 25 17:37:46 2002 +++ klic-3.003-2002-03-12/include/klic/control.h Tue Mar 12 12:08:47 2002 @@ -91,9 +91,9 @@ #define loop_within_module(f) \ do{ \ module (*func)(); \ + set_heapp(allocp); \ _INC_REDUCTION_COUNT(REDUCTION_COUNTS); \ - if (allocp >= heaplimit) { \ - set_heapp(allocp); \ + if (heapp() >= heaplimit) { \ klic_interrupt(qp); \ allocp = heapp(); \ qp = current_queue; \ @@ -102,15 +102,15 @@ func = toppred->func; \ if (func == (f)) \ goto module_top; \ - set_heapp(allocp); \ current_queue = qp; \ return (module) func; \ }while(0) #define execute(label) \ do{ \ + set_heapp(allocp); \ _INC_REDUCTION_COUNT(500); \ - if (allocp < heaplimit) goto label; \ + if (heapp() < heaplimit) goto label; \ }while(0) #define proceed() \ diff -ruN klic-3.003-2002-03-11c/include/klic/g_vector.h klic-3.003-2002-03-12/include/klic/g_vector.h --- klic-3.003-2002-03-11c/include/klic/g_vector.h Thu Dec 27 19:15:58 2001 +++ klic-3.003-2002-03-12/include/klic/g_vector.h Tue Mar 12 12:10:20 2002 @@ -35,5 +35,6 @@ /* runtime/gmvv.c */ extern q create_vector(q* body, long size, q* g_allocp); +extern q create_vector0(q* body, long size); #endif /* _KLIC_G_VECTOR_H_ */ diff -ruN klic-3.003-2002-03-11c/include/klic/gb.h klic-3.003-2002-03-12/include/klic/gb.h --- klic-3.003-2002-03-11c/include/klic/gb.h Mon Feb 25 13:13:48 2002 +++ klic-3.003-2002-03-12/include/klic/gb.h Tue Mar 12 12:08:47 2002 @@ -250,9 +250,9 @@ #define alternative(lab) \ do{ \ + set_heapp(allocp); \ if (reasonp != reasons) { \ int macrotmp; \ - set_heapp(allocp); \ macrotmp = check_stack_for_alternatively(reasonp); \ allocp = heapp(); \ if (macrotmp != 0) goto lab; \ diff -ruN klic-3.003-2002-03-11c/include/klic/gd_methtab.h klic-3.003-2002-03-12/include/klic/gd_methtab.h --- klic-3.003-2002-03-11c/include/klic/gd_methtab.h Tue Mar 5 21:30:51 2002 +++ klic-3.003-2002-03-12/include/klic/gd_methtab.h Tue Mar 12 12:08:47 2002 @@ -15,7 +15,7 @@ struct data_object* GD_SELF, struct data_object* GD_OTHER ); extern q* GD_STD_UNIFY( - struct data_object* GD_SELF, struct data_object* GD_OTHER, q* g_allocp ); + struct data_object* GD_SELF, struct data_object* GD_OTHER ); extern long GD_STD_PRINT( struct data_object* GD_SELF, FILE* g_fp, @@ -25,7 +25,7 @@ extern void GD_STD_DEALLOCATE(struct data_object* GD_SELF); extern q* GD_STD_GENERIC( - struct data_object* GD_SELF, long g_method_functor, q GD_ARGV[], q* g_allocp ); + struct data_object* GD_SELF, long g_method_functor, q GD_ARGV[] ); extern q GD_STD_GGENERIC( struct data_object* GD_SELF, long g_method_functor, q GD_ARGV[] ); diff -ruN klic-3.003-2002-03-11c/include/klic/generic.h klic-3.003-2002-03-12/include/klic/generic.h --- klic-3.003-2002-03-11c/include/klic/generic.h Sat Mar 9 16:41:10 2002 +++ klic-3.003-2002-03-12/include/klic/generic.h Tue Mar 12 12:08:47 2002 @@ -21,9 +21,19 @@ 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,offset) \ ( set_heapp(allocp + (offset)), \ gd_generic((obj),(funct),generic_arg), \ + allocp = heapp() ) + +#define call_generic0(obj,funct) \ + ( gd_generic((obj), (funct), generic_arg), \ allocp = heapp() ) #define guard_generic(object,mf,inargc,label) \ diff -ruN klic-3.003-2002-03-11c/runtime/asyncio.c klic-3.003-2002-03-12/runtime/asyncio.c --- klic-3.003-2002-03-11c/runtime/asyncio.c Fri Mar 8 20:10:33 2002 +++ klic-3.003-2002-03-12/runtime/asyncio.c Tue Mar 12 12:08:47 2002 @@ -59,10 +59,8 @@ set_heapp(allocp); if (retry_sigio_type != KLIC_SIGIO_NONE) { - assert(allocp == heapp()); if( sigio_handlers[retry_fd](retry_fd, retry_sigio_type, &fdsr, &fdsw) != 0 ) return 1; /* again */ - /* allocp = heapp(); */ retry_sigio_type = KLIC_SIGIO_NONE; } fdsr = sigio_infds; @@ -109,16 +107,13 @@ default: continue; } - /* assert(allocp == heapp()); */ if( sigio_handlers[fd](fd, call_type, &fdsr, &fdsw) != 0 ){ retry_fd = fd; retry_sigio_type = call_type; return 1; /* again */ } - /* allocp = heapp(); */ } } - /* assert(allocp == heapp()); */ return 0; } diff -ruN klic-3.003-2002-03-11c/runtime/cntlmsg.c klic-3.003-2002-03-12/runtime/cntlmsg.c --- klic-3.003-2002-03-11c/runtime/cntlmsg.c Fri Mar 8 20:10:33 2002 +++ klic-3.003-2002-03-12/runtime/cntlmsg.c Tue Mar 12 12:08:47 2002 @@ -81,9 +81,9 @@ q* allocp; { q exref; - module decoder; 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++); @@ -103,7 +103,7 @@ /* decode_data is not used, and collected by local GC */ decode_data = pop_decode_stack(); - return(allocp); + return heapp(); susp_label: decode_data = pop_decode_stack(); @@ -111,15 +111,11 @@ /* Hack to avoid sending %unify when a ReadHook receives answer_value. */ answer_return_exp_index = return_index; - - set_heapp(allocp); do_unify(exref, decode_data); - allocp = heapp(); - answer_return_exp_index = -1; receive_answer_flag = 0; /* Hack to avoid sending %unify when a ReadHook receives answer_value. */ - return(allocp); + return heapp(); } @@ -172,7 +168,8 @@ 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++); @@ -195,16 +192,12 @@ /* Hack to avoid sending %unify when a ReadHook receives answer_value. */ answer_return_exp_index = index; - - set_heapp(allocp); do_unify(readhook, data); - allocp = heapp(); - answer_return_exp_index = -1; receive_answer_flag = 0; /* Hack to avoid sending %unify when a ReadHook receives answer_value. */ - return(allocp); + return heapp(); } deref_and_switch(data, susp_label, atomic_label, cons_label, funct_label); @@ -221,7 +214,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(allocp); + return heapp(); } } } @@ -232,9 +225,8 @@ generic_arg[0] = makeint(node); /* Node Number */ generic_arg[1] = makeint(index); /* exp_table (for answer) index */ generic_arg[2] = makeint(wec); /* WEC */ - - new_generic(reply_hook_g_new, 3, rhook, 0); - assert(allocp == heapp()); + + new_generic0(reply_hook_g_new, 3, rhook); do_unify(rhook, data); return heapp(); @@ -253,7 +245,7 @@ PUT4_BUFFER(buffer, decode_answer_value, recved_wtc, index, wec); send_message_without_wtc_chk(node, buffer); } - return(allocp); + return heapp(); } static int @@ -335,7 +327,8 @@ 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++); @@ -343,7 +336,7 @@ wec = GET_BUFFER(inbuf); exp_data = (q)search_exptbl(exp_index, wec); - return(allocp); + return heapp(); } static void @@ -381,8 +374,8 @@ { q exp_data; long unify_index, unify_wec; - module decoder; declare_globals; + set_heapp(allocp); INT_CL_DEBUG_X(iosprintf("%d:decode_unify\n", my_node)); INT_CL_PROBE_X(netstat.recv_unify_cnt++); @@ -393,11 +386,8 @@ unify_index = GET_BUFFER(inbuf); unify_wec = GET_BUFFER(inbuf); exp_data = (q)search_exptbl(unify_index, unify_wec); -/* decoder = (module)GET_BUFFER(inbuf); - allocp = (q *)decoder(inbuf, allocp);*/ decode_data = pop_decode_stack(); - set_heapp(allocp); do_unify(exp_data, decode_data); return heapp(); } @@ -453,8 +443,8 @@ struct predicate *pred_of_goal; unsigned short int arity; int i; - module decoder; 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++); @@ -465,12 +455,10 @@ pred_of_goal = (struct predicate *)(GET_BUFFER(inbuf)); arity = (unsigned short int)(pred_of_goal->arity); - newgoal = (struct goalrec *)allocp; - allocp = allocp+arity+2; - /* if(allocp >= real_heaplimit()){ - * fatal("Bad estimation of decodeing, heap exausted"); - * } - */ + newgoal = (struct goalrec*) klic_alloc(arity + 2); + if(heapp() >= real_heaplimit()){ + fatal("Bad estimation of decodeing, heap exausted"); + } newgoal->pred = pred_of_goal; @@ -481,9 +469,9 @@ if(prio == current_prio()){ resume_same_prio(newgoal); } else { - (void) enqueue_goal(NULL, prio, newgoal, glbl); + enqueue_goal(NULL, prio, newgoal, glbl); } - return(allocp); + return heapp(); } static long @@ -668,6 +656,8 @@ q* allocp; { declare_globals; + set_heapp(allocp); + if (network_statistics_flag) print_statistics(); longjmp(klic_topmost, 1); diff -ruN klic-3.003-2002-03-11c/runtime/datamsg.c klic-3.003-2002-03-12/runtime/datamsg.c --- klic-3.003-2002-03-11c/runtime/datamsg.c Mon Mar 4 10:49:09 2002 +++ klic-3.003-2002-03-12/runtime/datamsg.c Tue Mar 12 12:08:47 2002 @@ -63,12 +63,13 @@ 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 allocp; + return heapp(); } extern q* @@ -78,6 +79,7 @@ { declare_globals; long node; + set_heapp(allocp); INT_CL_DEBUG_X(ioprintf("%d:decode_exref\n", my_node)); @@ -89,7 +91,7 @@ decode_data = (q) search_exptbl(index, wec); push_decode_stack(decode_data); - return allocp; + return heapp(); } else { /* If the data is other's data */ @@ -97,10 +99,9 @@ generic_arg[1] = makeint(GET_BUFFER(inbuf)); /* exp_table index */ generic_arg[2] = makeint(GET_BUFFER(inbuf)); /* WEC */ - new_generic(exref_g_new, 3L, decode_data, 0); - assert(allocp == heapp()); + new_generic0(exref_g_new, 3L, decode_data); push_decode_stack(decode_data); - return allocp; + return heapp(); } } @@ -115,6 +116,7 @@ { declare_globals; q list; + set_heapp(allocp); INT_CL_DEBUG_X(ioprintf("%d:decode_list\n", my_node)); @@ -123,7 +125,7 @@ cdr_of(list) = pop_decode_stack(); car_of(list) = pop_decode_stack(); push_decode_stack(list); - return allocp; + return heapp(); } static q* @@ -134,16 +136,17 @@ declare_globals; q funct, p_funct; int i; + set_heapp(allocp); INT_CL_DEBUG_X(ioprintf("%d:decode_funct\n", my_node)); p_funct = (q) GET_BUFFER(inbuf); - if ( real_heaplimit() - allocp < arityof(p_funct) + 1 ) { + if ( real_heaplimit() - heapp() < arityof(p_funct) + 1 ) { inbuf->rd_index -= 2; heaplimit = 0; add_this_more_space(arityof(p_funct) + 1); - return allocp; + return heapp(); } heapalloc(funct, arityof(p_funct)+1, makefunctor); @@ -153,7 +156,7 @@ arg(funct, i-1) = pop_decode_stack(); } push_decode_stack(funct); - return allocp; + return heapp(); } /* diff -ruN klic-3.003-2002-03-11c/runtime/ge_exref.c klic-3.003-2002-03-12/runtime/ge_exref.c --- klic-3.003-2002-03-11c/runtime/ge_exref.c Mon Mar 11 17:13:09 2002 +++ klic-3.003-2002-03-12/runtime/ge_exref.c Tue Mar 12 12:08:47 2002 @@ -45,7 +45,7 @@ generic_arg[1] = makeint(GG_SELF->index); generic_arg[2] = makeint(GG_SELF->wec); - new_generic(read_hook_g_new, 3, rdhok, 0); + new_generic0(read_hook_g_new, 3, rdhok); assert(allocp == heapp()); GG_SELF->method_table = 0; diff -ruN klic-3.003-2002-03-11c/runtime/generic.c klic-3.003-2002-03-12/runtime/generic.c --- klic-3.003-2002-03-11c/runtime/generic.c Mon Mar 11 17:36:45 2002 +++ klic-3.003-2002-03-12/runtime/generic.c Tue Mar 12 12:08:47 2002 @@ -147,10 +147,9 @@ } extern q* -GD_STD_UNIFY(GD_SELF, GD_OTHER, g_allocp) +GD_STD_UNIFY(GD_SELF, GD_OTHER) struct data_object* GD_SELF; struct data_object* GD_OTHER; - q* g_allocp; { return heapp(); } @@ -181,11 +180,10 @@ extern q* -GD_STD_GENERIC(GD_SELF, g_method_functor, GD_ARGV, g_allocp) +GD_STD_GENERIC(GD_SELF, g_method_functor, GD_ARGV) q* GD_SELF; long g_method_functor; q GD_ARGV[]; - q* g_allocp; { return heapp(); } diff -ruN klic-3.003-2002-03-11c/runtime/gg_shvar.c klic-3.003-2002-03-12/runtime/gg_shvar.c --- klic-3.003-2002-03-11c/runtime/gg_shvar.c Mon Mar 11 17:18:41 2002 +++ klic-3.003-2002-03-12/runtime/gg_shvar.c Tue Mar 12 12:08:47 2002 @@ -74,9 +74,9 @@ derefone(GG_SELF) = GG_TERM; if( gobjp->chain ){ if( is_genhook(gobjp->chain) ){ - set_heapp(shm_ck_request(heapp(), gobjp->chain)); + shm_ck_request(gobjp->chain); }else{ - set_heapp(shm_resume_goals(heapp(), gobjp->chain)); + shm_resume_goals(gobjp->chain); } } GG_TERMINATE; @@ -98,9 +98,9 @@ derefone(GG_SELF) = y; if( gobjp->chain ){ if( is_genhook(gobjp->chain) ){ - set_heapp(shm_ck_request(heapp(), gobjp->chain)); + shm_ck_request(gobjp->chain); }else{ - set_heapp(shm_resume_goals(heapp(), gobjp->chain)); + shm_resume_goals(gobjp->chain); } } } @@ -152,7 +152,7 @@ if( xobjp->chain ){ if( is_genhook(xobjp->chain) ){ /* one is a generator hook. */ derefone(x) = y; - set_heapp(shm_ck_request(heapp(), xobjp->chain)); + shm_ck_request(xobjp->chain); }else{ /* one is a normal hook */ yaddi = n_lock(y, ytemp); if( derefone(y) != ytemp ){ @@ -169,7 +169,7 @@ yobjp->chain = shm_copy_chain(xobjp->chain); n_unlock(ytemp, yaddi); derefone(x) = y; - set_heapp(shm_ck_request(heapp(), ychain)); + shm_ck_request(ychain); }else{ /* both are ordinary hooks */ ck_new_galloc(yobjp); yobjp->chain = shm_merge_chain(xobjp->chain, yobjp->chain); @@ -218,7 +218,7 @@ }else{ /* y is a consumer */ if( xobjp && is_genhook(xobjp->chain) ){ /* global generator hook */ Shvar* tobj = shm_add_consumer(x, 0, y, glbl); - set_heapp(shm_ck_request(heapp(), xobjp->chain)); + shm_ck_request(xobjp->chain); n_unlock(temp, tag_generator_susp(tobj)); }else{ Shvar* tobj = (Shvar*) shm_add_consumer(x, xobjp, y, glbl); diff -ruN klic-3.003-2002-03-11c/runtime/ggoal.c klic-3.003-2002-03-12/runtime/ggoal.c --- klic-3.003-2002-03-11c/runtime/ggoal.c Mon Mar 11 17:34:38 2002 +++ klic-3.003-2002-03-12/runtime/ggoal.c Tue Mar 12 12:08:47 2002 @@ -317,18 +317,16 @@ static long goal_obj_id = 0; extern q -make_goal_object(goal, allocp) +make_goal_object(goal) struct goalrec* goal; - q* allocp; { declare_globals; - struct goal_object *obj = (struct goal_object *) allocp; + struct goal_object* obj = (struct goal_object*) + klic_alloc((sizeof(struct goal_object) + sizeof(long) - 1) / sizeof(long)); untrace_goal(goal); obj->method_table = &goal_g_data_method_table; obj->goal = goal; obj->id = goal_obj_id++; - allocp += (sizeof(struct goal_object) + sizeof(long) - 1) / sizeof(long); - set_heapp(allocp); return makefunctor(obj); } diff -ruN klic-3.003-2002-03-11c/runtime/gmvv.c klic-3.003-2002-03-12/runtime/gmvv.c --- klic-3.003-2002-03-11c/runtime/gmvv.c Mon Mar 11 17:33:16 2002 +++ klic-3.003-2002-03-12/runtime/gmvv.c Tue Mar 12 12:12:36 2002 @@ -568,6 +568,15 @@ long size; q *g_allocp; { + set_heapp(g_allocp); + return create_vector0(body, size); +} + +extern q +create_vector0(body, size) + q* body; + long size; +{ G_STD_DECL; struct vector_object *newvect; heapalloc(newvect, G_SIZE_IN_Q(GD_OBJ_TYPE), (GD_OBJ_TYPE *)); diff -ruN klic-3.003-2002-03-11c/runtime/intrpt.c klic-3.003-2002-03-12/runtime/intrpt.c --- klic-3.003-2002-03-11c/runtime/intrpt.c Mon Mar 4 10:41:11 2002 +++ klic-3.003-2002-03-12/runtime/intrpt.c Tue Mar 12 12:08:47 2002 @@ -77,10 +77,10 @@ qp = enqueue_resumed_goals(qp); if( stepping_flag ){ - qp = step_after(qp, allocp); + qp = step_after(qp); allocp = heapp(); }else if( trace_flag ){ - qp = trace_after(qp, allocp); + qp = trace_after(qp); allocp = heapp(); } @@ -90,21 +90,20 @@ /* signal handling */ #ifdef USESIG if( !signal_done ){ - set_heapp(allocp); klic_signal_handler(); allocp = heapp(); - retry = (allocp + this_more_space() >= real_heaplimit()); + retry = (heapp() + this_more_space() >= real_heaplimit()); /* some goals may have been resumed by the signal handler */ qp = enqueue_resumed_goals(qp); } #endif #if defined(DIST) && defined(USE_REDUCTION_COUNT) { - int again = receive_message(allocp, 0); + int again = receive_message(heapp(), 0); if( again == 0 ) heaplimit = real_heaplimit(); allocp = heapp(); - retry = (allocp + this_more_space() >= real_heaplimit()); + retry = (heapp() + this_more_space() >= real_heaplimit()); /* some goals may have been resumed by the message reception */ qp = enqueue_resumed_goals(qp); } @@ -121,7 +120,7 @@ qp = get_invoked_goals(qp); interrupt_off = -1; heaplimit = real_heaplimit(); - retry |= (allocp + this_more_space() >= heaplimit); + retry |= (heapp() + this_more_space() >= heaplimit); } #endif @@ -134,11 +133,11 @@ } #ifdef SHM - if( ck_shm_gc() || allocp + this_more_space() >= real_heaplimit() ){ + if( ck_shm_gc() || heapp() + this_more_space() >= real_heaplimit() ){ *cur_status = 3; /* ck_shm_gc will call another GC */ #else - if( allocp + this_more_space() >= real_heaplimit() ){ + if( heapp() + this_more_space() >= real_heaplimit() ){ #endif GC_ON(); qp = klic_gc(qp); @@ -152,5 +151,4 @@ }while( retry ); current_queue = qp; - set_heapp(allocp); } diff -ruN klic-3.003-2002-03-11c/runtime/kmain.c klic-3.003-2002-03-12/runtime/kmain.c --- klic-3.003-2002-03-11c/runtime/kmain.c Mon Mar 4 10:42:58 2002 +++ klic-3.003-2002-03-12/runtime/kmain.c Tue Mar 12 12:08:47 2002 @@ -307,12 +307,9 @@ { extern struct goalrec *get_top_priority_queue(); - q *allocp; struct goalrec *qp; initiate_prioq(); - allocp = heapp(); - qp = (struct goalrec *) allocp; #ifdef USESIG init_klic_signal_handling(); @@ -327,8 +324,8 @@ register_after_gc_hook(scan_imp_table); if (IS_MASTER_NODE(my_node)) { /* master node */ + qp = (struct goalrec*) klic_alloc(2); qp->pred = &predicate_main_xmain_0; - set_heapp(allocp + 2); node_wtc = SUPPLY_WTC_UNIT; } else if (IS_SHOEN_NODE(my_node)) { /* shoen node */ add_signal_handler(SIGTERM, kill_tasks); @@ -343,8 +340,8 @@ } init_rusage(); /***** for inter NODE *****/ #else /* !DIST */ + qp = (struct goalrec*) klic_alloc(2); qp->pred = &predicate_main_xmain_0; - set_heapp(allocp + 2); #endif /* DIST */ cum_susps0 = 0; cum_resumps0 = 0; @@ -372,7 +369,7 @@ #ifdef SHM if ( my_node == MASTER ) #endif - (void) enqueue_goal(NULL, HIGHESTPRIO-1, qp, glbl); + enqueue_goal(NULL, HIGHESTPRIO-1, qp, glbl); current_queue = get_top_priority_queue(); reset_resumed_goals(); @@ -396,18 +393,16 @@ klic_fprintf(stderr, "Starting postmortem processing...\n"); set_heapp (heapp() + incrementsize()/2); /* dirty patch */ initiate_prioq(); - allocp = heapp(); - qp = (struct goalrec *) allocp; + qp = (struct goalrec*) klic_alloc(2); qp->pred = postmortem_pred(); - allocp += 2; if (isfunctor(postmortem_args())) { int arity = arityof(functor_of(postmortem_args())); int k; + q* allocp = klic_alloc(arity); for (k=0; knext; allocp[1] = (q)&topsucceed_pred; - qp = (struct goalrec *)allocp; - allocp += 2; + qp = (struct goalrec*) allocp; IDLE_OFF(); - set_heapp(allocp); klic_interrupt(qp); qp = current_queue; - if ((qp->pred == &topsucceed_pred) && (heapp() == allocp)) { - allocp -= 2; + if (qp->pred == &topsucceed_pred) { + set_heapp(heapp() - 2); goto idle_loop; } @@ -535,6 +530,8 @@ #else /* #ifndef DIST */ { extern const struct predicate topsucceed_pred; + set_heapp(allocp); + if (suspensions() == resumes()) { if(count_suspension) { if(suspensions() != 0) { @@ -551,10 +548,10 @@ /* perpetual suspension suspected, but let's wait a while for interrupts */ /* enqueue topsucceed goal again */ + allocp = klic_alloc(2); allocp[0] = (q)qp; allocp[1] = (q)&topsucceed_pred; - qp = (struct goalrec *)allocp; - allocp += 2; + qp = (struct goalrec*) allocp; /* Let's not hastily check perpetual suspension */ #ifdef USETIMER @@ -581,7 +578,7 @@ #ifdef USEUSLEEP usleep(1000); #else - (void) sleep(1); + sleep(1); #endif /*USEUSLEEP*/ #endif @@ -590,8 +587,7 @@ #ifdef USETIMER if (dl_det_interval != 0) #endif - allocp = real_heaplimit(); - set_heapp(allocp); + set_heapp(real_heaplimit()); klic_interrupt(qp); allocp = heapp(); qp = current_queue; @@ -612,7 +608,6 @@ } /* check resumpsions */ - set_heapp(allocp); klic_interrupt(qp); return (module) current_queue->pred->func; #else /*!USESIG*/ diff -ruN klic-3.003-2002-03-11c/runtime/ktimer.c klic-3.003-2002-03-12/runtime/ktimer.c --- klic-3.003-2002-03-11c/runtime/ktimer.c Fri Mar 8 20:11:06 2002 +++ klic-3.003-2002-03-12/runtime/ktimer.c Tue Mar 12 12:08:47 2002 @@ -54,7 +54,7 @@ { declare_globals; - return ((int (*)())((unsigned long)data-ATOMIC))(allocp, SIGALRM); + return ((int (*)()) ((unsigned long)data-ATOMIC))(heapp(), SIGALRM); } int @@ -64,12 +64,13 @@ { declare_globals; struct timeval now; + set_heapp(allocp); klic_gettod(&now); while (timer_reservations != 0 && NotLaterThan(timer_reservations->at, now)) { int result = - timer_reservations-> handler(allocp, timer_reservations->data); + timer_reservations-> handler(heapp(), timer_reservations->data); if (result != 0) return result; allocp = heapp(); if (TimeIsZero(timer_reservations->interval)) { @@ -95,7 +96,6 @@ timer_reservations->at.tv_usec, klic_timer_interrupt_handler); } - set_heapp(allocp); return 0; } @@ -165,6 +165,7 @@ { declare_globals; struct timer_reservation_rec *newrec, **tmp; + set_heapp(allocp); newrec = alloc_timer_reservation_rec(); TimeSet(newrec->at, sec, usec); @@ -177,7 +178,7 @@ ; newrec->next = *tmp; *tmp = newrec; - process_timer_interrupt(allocp, SIGALRM); + process_timer_interrupt(heapp(), SIGALRM); return heapp(); } diff -ruN klic-3.003-2002-03-11c/runtime/profile.c klic-3.003-2002-03-12/runtime/profile.c --- klic-3.003-2002-03-11c/runtime/profile.c Sat Feb 16 12:01:42 2002 +++ klic-3.003-2002-03-12/runtime/profile.c Tue Mar 12 12:08:47 2002 @@ -40,6 +40,7 @@ declare_globals; long node; + set_heapp(allocp); node = GET_BUFFER(inbuf); shoen_profile[node].stimes = GET_BUFFER(inbuf); @@ -55,7 +56,7 @@ gather_prof_ready = 1; } - return allocp; + return heapp(); } static void @@ -113,7 +114,7 @@ q* allocp; { send_profile(); - return allocp; + return heapp(); } static void @@ -139,6 +140,7 @@ { declare_globals; long i; + set_heapp(allocp); if( gather_prof_ready ){ for( i = 0; i < total_node; i++ ){ @@ -147,6 +149,5 @@ gather_prof_ready = 0; } - set_heapp(allocp); return 0; } diff -ruN klic-3.003-2002-03-11c/runtime/sched.c klic-3.003-2002-03-12/runtime/sched.c --- klic-3.003-2002-03-11c/runtime/sched.c Mon Mar 4 10:43:58 2002 +++ klic-3.003-2002-03-12/runtime/sched.c Tue Mar 12 12:08:47 2002 @@ -113,35 +113,27 @@ declare_globals; static struct prioqrec* pq; static struct prioqrec tail_sentinel = { 0, -1, 0 }; - q* allocp = heapp(); + q* allocp; new_prioqrec(pq); /* The tail of the lowest priority level is top level succeed goal. */ pq->next = &tail_sentinel; pq->prio = 0; - + allocp = klic_alloc(2); + allocp[0] = (q) &goal_queue_tail; #ifdef SHM if( my_node == MASTER ){ - allocp[0] = (q) &goal_queue_tail; allocp[1] = (q) &mastersucceed_pred; - pq->q = (struct goalrec*) allocp; }else{ - allocp[0] = (q) &goal_queue_tail; allocp[1] = (q) &childsucceed_pred; - pq->q = (struct goalrec*) allocp; } - allocp += 2; #else - allocp[0] = (q) &goal_queue_tail; allocp[1] = (q) &topsucceed_pred; - pq->q = (struct goalrec*) allocp; - allocp += 2; #endif + pq->q = (struct goalrec*) allocp; prioq0.next = pq; - - set_heapp(allocp); } extern void @@ -277,11 +269,10 @@ int arity = toppred->pred; q prio = qp->args[arity+1]; int is_relative = intval(qp->args[arity+2]); + set_heapp(allocp); qp->pred = (struct predicate*) consp(qp->args[arity]); - set_heapp(allocp); qp = enqueue_after_waiting(qp->next, prio, qp, is_relative); - set_heapp(allocp); current_queue = qp; return (module) qp->pred->func; } @@ -342,11 +333,10 @@ { int arity = toppred->pred; q penum = qp->args[arity+1]; + set_heapp(allocp); qp->pred = (struct predicate*) consp(qp->args[arity]); - set_heapp(allocp); qp = enqueue_throw_goal(penum, qp, qp->next); - set_heapp(allocp); current_queue = qp; return (module) qp->pred->func; } @@ -439,17 +429,16 @@ struct goalrec* fg; const struct predicate* toppred; { + set_heapp(allocp); #ifdef SHM if( ext_queued ){ ext_queued = 0; qp = get_invoked_goals(&goal_queue_tail); - set_heapp(allocp); current_queue = qp; return (module) qp->pred->func; } #endif qp = get_top_priority_queue(); - set_heapp(allocp); current_queue = qp; return (module) qp->pred->func; } @@ -492,12 +481,12 @@ const struct predicate* toppred; { int first, i; + set_heapp(allocp); /* printf("Wait master.\n"); */ WLoop: if( !(ex_qp->next) ){ - set_heapp(allocp); klic_interrupt(qp); if( current_queue != qp ){ *cur_status = 1; @@ -564,7 +553,6 @@ module func; toppred = qp->pred; func = (module) toppred->func; - set_heapp(allocp); current_queue = qp; return func; } @@ -578,8 +566,8 @@ q* allocp; const struct predicate* toppred; { + set_heapp(allocp); while( !(ex_qp->next) ){ - set_heapp(allocp); klic_interrupt(qp); if( current_queue != qp ){ *cur_status = 1; @@ -600,7 +588,6 @@ module func; toppred = qp->pred; func = (module) toppred->func; - set_heapp(allocp); current_queue = qp; return func; } diff -ruN klic-3.003-2002-03-11c/runtime/sendrecv.c klic-3.003-2002-03-12/runtime/sendrecv.c --- klic-3.003-2002-03-11c/runtime/sendrecv.c Tue Mar 5 12:09:20 2002 +++ klic-3.003-2002-03-12/runtime/sendrecv.c Tue Mar 12 12:08:47 2002 @@ -155,10 +155,10 @@ int sig; { declare_globals; + set_heapp(allocp); /* static combuf* pending_msg = NULL; */ - if( allocp + this_more_space() >= real_heaplimit() ){ - set_heapp(allocp); + if( heapp() + this_more_space() >= real_heaplimit() ){ return 1; } @@ -186,10 +186,7 @@ if( inbuf==NULL ){ /* no message arrived */ - check_decode_stack(); - - set_heapp(allocp); return 0; } } @@ -197,23 +194,20 @@ while( !IS_BUFFER_EMPTY(inbuf) ){ module decoder; decoder = (module) GET_BUFFER(inbuf); - allocp = (q*) decoder(inbuf, allocp); - if( allocp + this_more_space() >= real_heaplimit() ){ + set_heapp((q*) decoder(inbuf, heapp())); + if( heapp() + this_more_space() >= real_heaplimit() ){ /* fprintf(stderr, "Node %d, decode pending\n", my_node); */ pending_msg = inbuf; - - set_heapp(allocp); return 1; } } - if( allocp + this_more_space() >= real_heaplimit() ){ + if( heapp() + this_more_space() >= real_heaplimit() ){ /* Heap over in msg_handler. this should not happen */ fprintf(stderr, - "Node %d, heap over in msg_handler allocp = %x tms = %x rhl = %x\n", - my_node, allocp, this_more_space(), real_heaplimit() ); + "Node %d, heap over in msg_handler heapp = %x tms = %x rhl = %x\n", + my_node, heapp(), this_more_space(), real_heaplimit() ); - set_heapp(allocp); return 1; } } @@ -253,6 +247,7 @@ 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++); @@ -271,7 +266,7 @@ requesting_wtc = 1; send_request_wtc(); } - return allocp; + return heapp(); } static void @@ -312,13 +307,14 @@ { 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 allocp; + return heapp(); } static void @@ -359,13 +355,14 @@ { 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 allocp; + return heapp(); } static void diff -ruN klic-3.003-2002-03-11c/runtime/shm.h klic-3.003-2002-03-12/runtime/shm.h --- klic-3.003-2002-03-11c/runtime/shm.h Wed Jan 2 14:44:16 2002 +++ klic-3.003-2002-03-12/runtime/shm.h Tue Mar 12 12:08:47 2002 @@ -208,8 +208,8 @@ extern Shvar* shm_add_consumer( q shv, Shvar* shobj, q cvar, struct global_variables* glbl ); -extern q* shm_ck_request(q* allocp, Sinfo* chain); -extern q* shm_resume_goals(q* allocp, Sinfo* hook); +extern void shm_ck_request(Sinfo* chain); +extern void shm_resume_goals(Sinfo* hook); extern TADDRtbl* create_local_tbl(q* lcl, q* gbl); diff -ruN klic-3.003-2002-03-11c/runtime/shm_obj.c klic-3.003-2002-03-12/runtime/shm_obj.c --- klic-3.003-2002-03-11c/runtime/shm_obj.c Fri Mar 8 20:10:33 2002 +++ klic-3.003-2002-03-12/runtime/shm_obj.c Tue Mar 12 12:08:47 2002 @@ -265,12 +265,12 @@ /* resume waiting process */ -extern q* -shm_resume_goals(allocp, hook) - q* allocp; +extern void +shm_resume_goals(hook) Sinfo* hook; { declare_globals; + q* allocp = heapp(); while( hook != NULL ){ if( hook->PE_num == my_node ){ @@ -285,7 +285,6 @@ q top = (q) &sptr->localA; derefone(top) = wp; derefone(wp) = top; - set_heapp(allocp); do_unify(top, shm_term); allocp = heapp(); }else{ @@ -305,7 +304,6 @@ } hook = hook->next; } - return allocp; } @@ -329,12 +327,12 @@ } -extern q* -shm_ck_request(allocp, chain) - q* allocp; +extern void +shm_ck_request(chain) Sinfo* chain; { declare_globals; + q* allocp = heapp(); Sinfo* sptr = untag_genhook(chain); int penum = sptr->PE_num; TADDRtbl* indp = sptr->indp; @@ -342,13 +340,11 @@ q temp; free_local_tbl(indp); shm_arg_copy(&indp->localA, &temp); - set_heapp(allocp); do_unify(indp->globalA, temp); allocp = heapp(); }else{ shm_request_queueing(penum, current_prio(), indp); } - return allocp; } @@ -378,6 +374,7 @@ const struct predicate* toppred; { TADDRtbl* tp = (TADDRtbl*) ((unsigned long)(qp->args[0]) - ATOMIC); + set_heapp(allocp); free_local_tbl(tp); if( isatomic(tp->localA) ){ /* consumer */ q x = (q) untag_local(tp->localA); @@ -385,7 +382,6 @@ derefone(top) = x; derefone(x) = top; qp = qp->next; - set_heapp(allocp); do_unify(top, tp->globalA); allocp = heapp(); }else{ @@ -398,7 +394,6 @@ qp = qp->next; } } - set_heapp(allocp); current_queue = qp; return (module) (qp->pred)->func; } @@ -413,15 +408,14 @@ { TADDRtbl* tp = (TADDRtbl*) ((unsigned long)(qp->args[0]) - ATOMIC); q var = (q) tp->globalA; + set_heapp(allocp); free_local_tbl(tp); qp = qp->next; if( isatomic(tp->localA) ){ /* local generator object */ q x = untag_local(tp->localA); - set_heapp(allocp); do_unify(x, var); }else{ /* shared-memory generator hook */ - set_heapp(allocp); do_unify(tp->localA, var); } current_queue = qp; diff -ruN klic-3.003-2002-03-11c/runtime/signal.c klic-3.003-2002-03-12/runtime/signal.c --- klic-3.003-2002-03-11c/runtime/signal.c Fri Mar 8 20:11:18 2002 +++ klic-3.003-2002-03-12/runtime/signal.c Tue Mar 12 12:08:47 2002 @@ -54,13 +54,12 @@ if (signal_flags[sig]) { int again; signal_flags[sig] = 0; - again = signal_handlers[sig](allocp, sig); + again = signal_handlers[sig](heapp(), sig); allocp = heapp(); if (again) { signal_done = 0; signal_flags[sig] = 1; interrupt_off = 0; - set_heapp(allocp); return; } } @@ -74,7 +73,6 @@ } } } while (!signal_done); - set_heapp(allocp); } /* Utility subroutine to add signal handlers */ @@ -166,8 +164,7 @@ q newcons = makecons(allocp); q newvar = allocp[0] = makeref(&allocp[0]); allocp[1] = makeint(sig); - allocp += 2; - set_heapp(allocp); + klic_alloc(2); do_unify_value(signal_streams[sig], newcons); signal_streams[sig] = newvar; return 0; diff -ruN klic-3.003-2002-03-11c/runtime/step.c klic-3.003-2002-03-12/runtime/step.c --- klic-3.003-2002-03-11c/runtime/step.c Fri Mar 8 20:10:33 2002 +++ klic-3.003-2002-03-12/runtime/step.c Tue Mar 12 12:08:47 2002 @@ -17,6 +17,8 @@ #include "funct.h" #include "step.h" /* stepping_flag */ +extern q make_goal_object(struct goalrec* goal); + /* Global flag for stepping */ int stepping_flag = 0; @@ -84,6 +86,7 @@ struct goal_object *obj = (struct goal_object *)functorp(qp->args[0]); struct goalrec *goal = obj->goal; const struct predicate* stepped_pred = goal->pred; + set_heapp(allocp); if (!stepping_initiated) { init_stepping(); @@ -96,7 +99,7 @@ num_wokenup = 0; num_failed = 0; step_suspended = 0; - return (*stepped_pred->func)(glbl, goal, allocp, stepped_pred); + return (*stepped_pred->func)(glbl, goal, heapp(), stepped_pred); } static void @@ -111,9 +114,8 @@ } extern struct goalrec* -step_after(qp, allocp) +step_after(qp) struct goalrec *qp; - q *allocp; { declare_globals; if (!step_suspended) { @@ -121,7 +123,6 @@ q children, wokenup, failed; struct goalrec *queue_before = step_trigger_goal->next; int j, k; - extern q make_goal_object(); /*** Handling Newly Queued Goals ***/ /* sort goals enqueued with different priorities, @@ -141,37 +142,34 @@ /* make goal list in reverse order */ /* first, those queued with higher priority */ for (k = 0; k < num_queued && queued_prio[k] > current_prio(); k++) { - q gobj = make_goal_object(queued_goals[k], allocp); - allocp = heapp(); + q gobj = make_goal_object(queued_goals[k]); + q* allocp = klic_alloc(4); allocp[0] = gobj; allocp[1] = makeint(queued_prio[k]); allocp[2] = children_reversed; allocp[3] = makecons(&allocp[0]); children_reversed = makecons(&allocp[2]); - allocp += 4; } /* then, inspect the current priority queue */ if (qp != queue_before) { do { - q gobj = make_goal_object(qp, allocp); - allocp = heapp(); + q gobj = make_goal_object(qp); + q* allocp = klic_alloc(2); allocp[0] = children_reversed; allocp[1] = gobj; children_reversed = makecons(&allocp[0]); - allocp += 2; qp = qp->next; } while (qp != queue_before); } /* finally, those with lower priority */ for (; k < num_queued; k++) { - q gobj = make_goal_object(queued_goals[k], allocp); - allocp = heapp(); + q gobj = make_goal_object(queued_goals[k]); + q* allocp = klic_alloc(4); allocp[0] = gobj; allocp[1] = makeint(queued_prio[k]); allocp[2] = children_reversed; allocp[3] = makecons(&allocp[0]); children_reversed = makecons(&allocp[2]); - allocp += 4; } /* now, reverse the list */ children = NILATOM; @@ -199,37 +197,32 @@ /* make a list of woken-up goals */ wokenup = NILATOM; for (k = 0; k < num_wokenup; k++) { - q gobj = make_goal_object(wokenup_goals[k], allocp); - allocp = heapp(); + q gobj = make_goal_object(wokenup_goals[k]); + q* allocp = klic_alloc(2); if (wokenup_prio[k] != current_prio()) { allocp[0] = gobj; allocp[1] = makeint(queued_prio[k]); gobj = makecons(&allocp[0]); - allocp += 2; } + allocp = klic_alloc(2); allocp[0] = wokenup; allocp[1] = gobj; wokenup = makecons(&allocp[0]); - allocp += 2; } /*** Handling Failed Goals */ failed = NILATOM; for (k = 0; k < num_failed; k++) { - q gobj = make_goal_object(failed_goals[k], allocp); - allocp = heapp(); + q gobj = make_goal_object(failed_goals[k]); + q* allocp = klic_alloc(2); allocp[0] = failed; allocp[1] = gobj; failed = makecons(&allocp[0]); - allocp += 2; } /*** Finally, Unify the Results ***/ - set_heapp(allocp); step_unify_results(children, wokenup, failed, NILATOM); - allocp = heapp(); } - set_heapp(allocp); stepping_flag = 0; return qp; } @@ -243,22 +236,20 @@ declare_globals; q reason_list; q children; - q* allocp = heapp(); + q* allocp = klic_alloc(2); allocp[0] = NILATOM; allocp[1] = step_trigger_goal->args[0]; children = makecons(allocp); - allocp += 2; reason_list = NILATOM; while (--reasonp >= reasons) { + allocp = klic_alloc(2); allocp[0] = reason_list; allocp[1] = *reasonp; reason_list = makecons(allocp); - allocp += 2; } step_suspended = 1; - set_heapp(allocp); step_unify_results(children, NILATOM, NILATOM, reason_list); } diff -ruN klic-3.003-2002-03-11c/runtime/step.h klic-3.003-2002-03-12/runtime/step.h --- klic-3.003-2002-03-11c/runtime/step.h Mon Feb 18 15:18:15 2002 +++ klic-3.003-2002-03-12/runtime/step.h Tue Mar 12 12:08:47 2002 @@ -11,7 +11,7 @@ extern int stepping_flag; -extern struct goalrec* step_after(struct goalrec* qp, q* allocp); +extern struct goalrec* step_after(struct goalrec* qp); extern void step_susp(struct goalrec* goal, q* reasonp, int spontaneous); extern void step_wokenup(struct goalrec* goal, long prio); extern void step_failure(struct goalrec* goal); diff -ruN klic-3.003-2002-03-11c/runtime/trace.c klic-3.003-2002-03-12/runtime/trace.c --- klic-3.003-2002-03-11c/runtime/trace.c Mon Feb 25 16:10:40 2002 +++ klic-3.003-2002-03-12/runtime/trace.c Tue Mar 12 12:08:47 2002 @@ -480,6 +480,7 @@ const struct predicate* traced_pred; struct pred_table_entry *pte; struct trace_info_rec *info; + set_heapp(allocp); InitPort(); info = TraceInfo(qp); @@ -546,13 +547,12 @@ parent_info = info; if (trace_flag) heaplimit = 0; - return traced_pred->func(glbl, qp, allocp, traced_pred); + return traced_pred->func(glbl, qp, heapp(), traced_pred); } extern struct goalrec* -trace_after(qp, allocp) +trace_after(qp) struct goalrec *qp; - q *allocp; { declare_globals; struct goalrec *qt, *before = qp_before; @@ -688,7 +688,6 @@ trace_flag = 0; parent = 0; - set_heapp(allocp); if (interrupt_off) heaplimit = real_heaplimit(); else heaplimit = 0; return qp; diff -ruN klic-3.003-2002-03-11c/runtime/trace.h klic-3.003-2002-03-12/runtime/trace.h --- klic-3.003-2002-03-11c/runtime/trace.h Mon Jan 21 20:55:25 2002 +++ klic-3.003-2002-03-12/runtime/trace.h Tue Mar 12 12:08:47 2002 @@ -37,7 +37,7 @@ extern unsigned untrace_goal(struct goalrec* g); -extern struct goalrec* trace_after(struct goalrec* qp, q* allocp); +extern struct goalrec* trace_after(struct goalrec* qp); extern struct goalrec* trace_susp(struct goalrec* qp, q* reasonp, int spontaneous); extern void trace_resumption(struct goalrec* qp); extern void trace_failure(struct goalrec* qp);