1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/* ----------------------------------------------------------
% (C)1993,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.)
----------------------------------------------------------- */
:- inline:"
#include <klic/gd_macro.h>
GD_USE_CLASS(predicate);
static q* gc_postmortem_args(allocp, ntop, otop, nsize, osize)
q *allocp, *ntop, *otop;
unsigned int nsize, osize;
{
declare_globals;
extern q *copy_one_term();
if (postmortem_args != 0) {
return copy_one_term(&postmortem_args, allocp,
ntop, otop, nsize, osize);
} else {
return allocp;
}
}
".
:- module system_control.
postmortem(ModName,Goal,Result) :- functor(Goal,PredName,Arity) |
generic:new(module,Module,ModName),
generic:new(predicate,Predicate,Module,PredName,Arity),
register_postmortem(Predicate,Goal,Result).
register_postmortem(Predicate,Goal,Result) :- inline:"
{
postmortem_pred = ((struct predicate_object *)functorp(%0))->pdesc;
if (postmortem_args ==0) register_gc_hook(gc_postmortem_args);
postmortem_args = %1;
}":[Predicate+object(predicate),Goal+any] | Result=[].
gc(Before,After) :- inline:"
{
%0 = makeint(allocp-new_space_top);
allocp = real_heaplimit;
heaplimit = 0;
}":[Before0-int] |
Before=Before0,
after_gc(After).
after_gc(After) :- inline:"
{
%0 = makeint(allocp-new_space_top);
}":[After0-int] |
After=After0.
|