new Atts code.
This commit is contained in:
parent
d48be6406b
commit
34ca485e42
23
C/grow.c
23
C/grow.c
@ -33,10 +33,6 @@
|
|||||||
#define strncat(s0,s1,sz) strcat(s0,s1)
|
#define strncat(s0,s1,sz) strcat(s0,s1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !COROUTINING
|
|
||||||
#define DelayTop() H0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STACK_SHIFTING = 0,
|
STACK_SHIFTING = 0,
|
||||||
STACK_COPYING = 1,
|
STACK_COPYING = 1,
|
||||||
@ -134,7 +130,6 @@ SetHeapRegs(int copying_threads)
|
|||||||
OldTR = TR;
|
OldTR = TR;
|
||||||
OldHeapBase = Yap_HeapBase;
|
OldHeapBase = Yap_HeapBase;
|
||||||
OldHeapTop = HeapTop;
|
OldHeapTop = HeapTop;
|
||||||
OldDelayTop = CurrentDelayTop;
|
|
||||||
/* Adjust stack addresses */
|
/* Adjust stack addresses */
|
||||||
Yap_TrailBase = TrailAddrAdjust(Yap_TrailBase);
|
Yap_TrailBase = TrailAddrAdjust(Yap_TrailBase);
|
||||||
Yap_TrailTop = TrailAddrAdjust(Yap_TrailTop);
|
Yap_TrailTop = TrailAddrAdjust(Yap_TrailTop);
|
||||||
@ -172,8 +167,6 @@ SetHeapRegs(int copying_threads)
|
|||||||
HB = PtoGloAdjust(HB);
|
HB = PtoGloAdjust(HB);
|
||||||
if (B)
|
if (B)
|
||||||
B = ChoicePtrAdjust(B);
|
B = ChoicePtrAdjust(B);
|
||||||
if (CurrentDelayTop)
|
|
||||||
CurrentDelayTop = PtoDelayAdjust(CurrentDelayTop);
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (B_FZ)
|
if (B_FZ)
|
||||||
B_FZ = ChoicePtrAdjust(B_FZ);
|
B_FZ = ChoicePtrAdjust(B_FZ);
|
||||||
@ -195,12 +188,8 @@ SetHeapRegs(int copying_threads)
|
|||||||
if (!copying_threads) {
|
if (!copying_threads) {
|
||||||
if (GlobalArena)
|
if (GlobalArena)
|
||||||
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena)));
|
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena)));
|
||||||
if (GlobalDelayArena)
|
|
||||||
GlobalDelayArena = GlobalAdjust(GlobalDelayArena);
|
|
||||||
}
|
}
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
if (DelayedVars)
|
|
||||||
DelayedVars = AbsAppl(PtoGloAdjust(RepAppl(DelayedVars)));
|
|
||||||
if (AttsMutableList)
|
if (AttsMutableList)
|
||||||
AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(AttsMutableList)));
|
AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(AttsMutableList)));
|
||||||
if (WokenGoals)
|
if (WokenGoals)
|
||||||
@ -256,7 +245,7 @@ worker_p_binding(int worker_p, CELL *aux_ptr)
|
|||||||
reg = AdjustGlobTerm(reg);
|
reg = AdjustGlobTerm(reg);
|
||||||
return reg;
|
return reg;
|
||||||
} else {
|
} else {
|
||||||
CELL reg = ThreadHandle[worker_p].current_yaam_regs->H0_[aux_ptr-H0];
|
CELL reg = ThreadHandle[worker_p].current_yaam_regs-> H0_[aux_ptr-H0];
|
||||||
reg = AdjustGlobTerm(reg);
|
reg = AdjustGlobTerm(reg);
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
@ -567,12 +556,12 @@ AdjustGlobal(long sz, int thread_copying)
|
|||||||
pt_max = (CELL *) (LOCAL_end_global_copy);
|
pt_max = (CELL *) (LOCAL_end_global_copy);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
pt = CurrentDelayTop;
|
pt = H0;
|
||||||
pt_max = (H-sz/CellSize);
|
pt_max = (H-sz/CellSize);
|
||||||
#if defined(YAPOR) && defined(THREADS)
|
#if defined(YAPOR) && defined(THREADS)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pt = CurrentDelayTop;
|
pt = H0;
|
||||||
while (pt < pt_max) {
|
while (pt < pt_max) {
|
||||||
CELL reg;
|
CELL reg;
|
||||||
|
|
||||||
@ -777,7 +766,6 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
|
|||||||
int gc_verbose;
|
int gc_verbose;
|
||||||
UInt minimal_request = 0L;
|
UInt minimal_request = 0L;
|
||||||
|
|
||||||
CurrentDelayTop = (CELL *)DelayTop();
|
|
||||||
/* adjust to a multiple of 256) */
|
/* adjust to a multiple of 256) */
|
||||||
if (size < YAP_ALLOC_SIZE)
|
if (size < YAP_ALLOC_SIZE)
|
||||||
size = YAP_ALLOC_SIZE;
|
size = YAP_ALLOC_SIZE;
|
||||||
@ -859,7 +847,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit)
|
|||||||
{
|
{
|
||||||
UInt start_growth_time, growth_time;
|
UInt start_growth_time, growth_time;
|
||||||
int gc_verbose;
|
int gc_verbose;
|
||||||
char *omax = (ADDR)DelayTop();
|
char *omax = (char *)H0;
|
||||||
ADDR old_GlobalBase = Yap_GlobalBase;
|
ADDR old_GlobalBase = Yap_GlobalBase;
|
||||||
UInt minimal_request = 0L;
|
UInt minimal_request = 0L;
|
||||||
long size = request;
|
long size = request;
|
||||||
@ -874,7 +862,6 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit)
|
|||||||
do_grow is whether we expand stacks
|
do_grow is whether we expand stacks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CurrentDelayTop = (CELL *)omax;
|
|
||||||
if (hsplit) {
|
if (hsplit) {
|
||||||
/* just a little bit of sanity checking */
|
/* just a little bit of sanity checking */
|
||||||
if (hsplit < H0 && hsplit > (CELL *)Yap_GlobalBase) {
|
if (hsplit < H0 && hsplit > (CELL *)Yap_GlobalBase) {
|
||||||
@ -1492,7 +1479,6 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
|
|||||||
long size = size0;
|
long size = size0;
|
||||||
ADDR old_Yap_GlobalBase = Yap_GlobalBase;
|
ADDR old_Yap_GlobalBase = Yap_GlobalBase;
|
||||||
|
|
||||||
CurrentDelayTop = (CELL *)DelayTop();
|
|
||||||
if (!Yap_AllowGlobalExpansion) {
|
if (!Yap_AllowGlobalExpansion) {
|
||||||
Yap_ErrorMessage = "Database crashed against stacks";
|
Yap_ErrorMessage = "Database crashed against stacks";
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1869,7 +1855,6 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
|||||||
Yap_REGS.CUT_C_TOP = ThreadHandle[worker_p].current_yaam_regs->CUT_C_TOP;
|
Yap_REGS.CUT_C_TOP = ThreadHandle[worker_p].current_yaam_regs->CUT_C_TOP;
|
||||||
#endif
|
#endif
|
||||||
DelayedVars = ThreadHandle[worker_p].current_yaam_regs->DelayedVars_;
|
DelayedVars = ThreadHandle[worker_p].current_yaam_regs->DelayedVars_;
|
||||||
CurrentDelayTop = (CELL *)DelayTop();
|
|
||||||
DynamicArrays = NULL;
|
DynamicArrays = NULL;
|
||||||
StaticArrays = NULL;
|
StaticArrays = NULL;
|
||||||
GlobalVariables = NULL;
|
GlobalVariables = NULL;
|
||||||
|
112
C/heapgc.c
112
C/heapgc.c
@ -34,8 +34,8 @@ static char SccsId[] = "%W% %G%";
|
|||||||
STATIC_PROTO(Int p_inform_gc, (void));
|
STATIC_PROTO(Int p_inform_gc, (void));
|
||||||
STATIC_PROTO(Int p_gc, (void));
|
STATIC_PROTO(Int p_gc, (void));
|
||||||
STATIC_PROTO(void push_registers, (Int, yamop *));
|
STATIC_PROTO(void push_registers, (Int, yamop *));
|
||||||
STATIC_PROTO(void marking_phase, (tr_fr_ptr, CELL *, yamop *, CELL *));
|
STATIC_PROTO(void marking_phase, (tr_fr_ptr, CELL *, yamop *));
|
||||||
STATIC_PROTO(void compaction_phase, (tr_fr_ptr, CELL *, yamop *, CELL *));
|
STATIC_PROTO(void compaction_phase, (tr_fr_ptr, CELL *, yamop *));
|
||||||
STATIC_PROTO(void pop_registers, (Int, yamop *));
|
STATIC_PROTO(void pop_registers, (Int, yamop *));
|
||||||
STATIC_PROTO(void init_dbtable, (tr_fr_ptr));
|
STATIC_PROTO(void init_dbtable, (tr_fr_ptr));
|
||||||
STATIC_PROTO(void mark_db_fixed, (CELL *));
|
STATIC_PROTO(void mark_db_fixed, (CELL *));
|
||||||
@ -442,7 +442,6 @@ push_registers(Int num_regs, yamop *nextop)
|
|||||||
ArrayEntry *al = DynamicArrays;
|
ArrayEntry *al = DynamicArrays;
|
||||||
GlobalEntry *gl = GlobalVariables;
|
GlobalEntry *gl = GlobalVariables;
|
||||||
TrailTerm(TR++) = GlobalArena;
|
TrailTerm(TR++) = GlobalArena;
|
||||||
TrailTerm(TR++) = GlobalDelayArena;
|
|
||||||
while (al) {
|
while (al) {
|
||||||
check_pr_trail(TR);
|
check_pr_trail(TR);
|
||||||
TrailTerm(TR++) = al->ValueOfVE;
|
TrailTerm(TR++) = al->ValueOfVE;
|
||||||
@ -474,8 +473,7 @@ push_registers(Int num_regs, yamop *nextop)
|
|||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
TrailTerm(TR) = WokenGoals;
|
TrailTerm(TR) = WokenGoals;
|
||||||
TrailTerm(TR+1) = AttsMutableList;
|
TrailTerm(TR+1) = AttsMutableList;
|
||||||
TrailTerm(TR+2) = DelayedVars;
|
TR += 2;
|
||||||
TR += 3;
|
|
||||||
#endif
|
#endif
|
||||||
for (i = 1; i <= num_regs; i++) {
|
for (i = 1; i <= num_regs; i++) {
|
||||||
check_pr_trail(TR);
|
check_pr_trail(TR);
|
||||||
@ -521,7 +519,6 @@ pop_registers(Int num_regs, yamop *nextop)
|
|||||||
GlobalEntry *gl = GlobalVariables;
|
GlobalEntry *gl = GlobalVariables;
|
||||||
|
|
||||||
GlobalArena = TrailTerm(ptr++);
|
GlobalArena = TrailTerm(ptr++);
|
||||||
GlobalDelayArena = TrailTerm(ptr++);
|
|
||||||
while (al) {
|
while (al) {
|
||||||
al->ValueOfVE = TrailTerm(ptr++);
|
al->ValueOfVE = TrailTerm(ptr++);
|
||||||
al = al->NextAE;
|
al = al->NextAE;
|
||||||
@ -549,7 +546,6 @@ pop_registers(Int num_regs, yamop *nextop)
|
|||||||
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
||||||
WokenGoals = TrailTerm(ptr++);
|
WokenGoals = TrailTerm(ptr++);
|
||||||
AttsMutableList = TrailTerm(ptr++);
|
AttsMutableList = TrailTerm(ptr++);
|
||||||
DelayedVars = TrailTerm(ptr++);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
for (i = 1; i <= num_regs; i++)
|
for (i = 1; i <= num_regs; i++)
|
||||||
@ -1580,6 +1576,18 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mark_att_var(CELL *hp)
|
||||||
|
{
|
||||||
|
attvar_record *attv = RepAttVar(hp);
|
||||||
|
Functor *cptr = &(attv->AttFunc);
|
||||||
|
mark_external_reference2(CellPtr(cptr));
|
||||||
|
mark_external_reference2(&attv->Done);
|
||||||
|
mark_external_reference2(&attv->Value);
|
||||||
|
mark_external_reference2(&attv->Atts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Cleaning the trail should be quick and simple, right? Well, not
|
Cleaning the trail should be quick and simple, right? Well, not
|
||||||
really :-(. The problem is that the trail includes a dumping ground
|
really :-(. The problem is that the trail includes a dumping ground
|
||||||
@ -1596,20 +1604,6 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
mark_att_var(CELL *hp)
|
|
||||||
{
|
|
||||||
attvar_record *top = (attvar_record *)Yap_GlobalBase;
|
|
||||||
Int relpos = top-(attvar_record *)hp;
|
|
||||||
attvar_record *attv = top-relpos;
|
|
||||||
if (attv != (attvar_record *)hp)
|
|
||||||
attv--;
|
|
||||||
mark_external_reference2(&attv->Done);
|
|
||||||
mark_external_reference2(&attv->Value);
|
|
||||||
mark_external_reference2(&attv->Atts);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B)
|
mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B)
|
||||||
{
|
{
|
||||||
@ -1652,7 +1646,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
#endif
|
#endif
|
||||||
discard_trail_entries++;
|
discard_trail_entries++;
|
||||||
} else {
|
} else {
|
||||||
if ( hp > (CELL*)Yap_GlobalBase && hp < H0) {
|
if ( IsAttVar(hp)) {
|
||||||
if (!detatt || hp >= detatt) {
|
if (!detatt || hp >= detatt) {
|
||||||
mark_att_var(hp);
|
mark_att_var(hp);
|
||||||
} else {
|
} else {
|
||||||
@ -1712,9 +1706,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
*/
|
*/
|
||||||
if (cptr < (CELL *)gc_B && cptr >= gc_H) {
|
if (cptr < (CELL *)gc_B && cptr >= gc_H) {
|
||||||
goto remove_trash_entry;
|
goto remove_trash_entry;
|
||||||
} else if (!detatt && cptr == RepAppl(DelayedVars)+1) {
|
} else if (IsAttVar(cptr)) {
|
||||||
/* detatt = cptr; */
|
|
||||||
} else if (cptr > (CELL*)Yap_GlobalBase && cptr < H0) {
|
|
||||||
/* MABINDING that should be recovered */
|
/* MABINDING that should be recovered */
|
||||||
if (detatt && cptr < detatt) {
|
if (detatt && cptr < detatt) {
|
||||||
goto remove_trash_entry;
|
goto remove_trash_entry;
|
||||||
@ -1847,24 +1839,6 @@ mark_slots(CELL *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef COROUTINING
|
|
||||||
static void
|
|
||||||
mark_delays(attvar_record *top, attvar_record *bottom)
|
|
||||||
{
|
|
||||||
attvar_record *attv = (attvar_record *)top;
|
|
||||||
for (; attv < bottom; attv++) {
|
|
||||||
/* only mark what is accessible */
|
|
||||||
if (IsVarTerm(attv->Done) && IsUnboundVar(&attv->Done)) {
|
|
||||||
mark_external_reference2(&attv->Done);
|
|
||||||
mark_external_reference2(&attv->Value);
|
|
||||||
mark_external_reference2(&attv->Atts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define mark_delays(T,B)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
static choiceptr
|
static choiceptr
|
||||||
youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp)
|
youngest_cp(choiceptr gc_B, dep_fr_ptr *depfrp)
|
||||||
@ -3595,7 +3569,7 @@ set_conditionals(tr_fr_ptr str) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
@ -3615,7 +3589,6 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
|||||||
values */
|
values */
|
||||||
mark_regs(old_TR); /* active registers & trail */
|
mark_regs(old_TR); /* active registers & trail */
|
||||||
/* active environments */
|
/* active environments */
|
||||||
mark_delays((attvar_record *)max, (attvar_record *)H0);
|
|
||||||
mark_environments(current_env, EnvSize(curp), EnvBMap(curp));
|
mark_environments(current_env, EnvSize(curp), EnvBMap(curp));
|
||||||
mark_choicepoints(B, old_TR, is_gc_very_verbose()); /* choicepoints, and environs */
|
mark_choicepoints(B, old_TR, is_gc_very_verbose()); /* choicepoints, and environs */
|
||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
@ -3640,22 +3613,6 @@ sweep_oldgen(CELL *max, CELL *base)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COROUTINING
|
|
||||||
static void
|
|
||||||
sweep_delays(CELL *max, CELL *myH0)
|
|
||||||
{
|
|
||||||
while (max < myH0) {
|
|
||||||
if (MARKED_PTR(max)) {
|
|
||||||
UNMARK(max);
|
|
||||||
if (HEAP_PTR(*max)) {
|
|
||||||
into_relocation_chain(max, GET_NEXT(*max));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
max++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* move marked heap objects upwards over unmarked objects, and reset all
|
* move marked heap objects upwards over unmarked objects, and reset all
|
||||||
@ -3663,9 +3620,9 @@ sweep_delays(CELL *max, CELL *myH0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp)
|
||||||
{
|
{
|
||||||
CELL *CurrentH0 = NULL, *myH0 = H0;
|
CELL *CurrentH0 = NULL;
|
||||||
|
|
||||||
int icompact = (iptop < (CELL_PTR *)ASP && 10*total_marked < H-H0);
|
int icompact = (iptop < (CELL_PTR *)ASP && 10*total_marked < H-H0);
|
||||||
|
|
||||||
@ -3682,9 +3639,6 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
|||||||
sweep_oldgen(HGEN, CurrentH0);
|
sweep_oldgen(HGEN, CurrentH0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef COROUTINING
|
|
||||||
sweep_delays(max, myH0);
|
|
||||||
#endif
|
|
||||||
sweep_environments(current_env, EnvSize(curp), EnvBMap(curp));
|
sweep_environments(current_env, EnvSize(curp), EnvBMap(curp));
|
||||||
sweep_choicepoints(B);
|
sweep_choicepoints(B);
|
||||||
sweep_trail(B, old_TR);
|
sweep_trail(B, old_TR);
|
||||||
@ -3738,7 +3692,6 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
int gc_verbose;
|
int gc_verbose;
|
||||||
volatile tr_fr_ptr old_TR = NULL;
|
volatile tr_fr_ptr old_TR = NULL;
|
||||||
UInt m_time, c_time, time_start, gc_time;
|
UInt m_time, c_time, time_start, gc_time;
|
||||||
CELL *max;
|
|
||||||
Int effectiveness, tot;
|
Int effectiveness, tot;
|
||||||
int gc_trace;
|
int gc_trace;
|
||||||
UInt gc_phase;
|
UInt gc_phase;
|
||||||
@ -3795,24 +3748,9 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
}
|
}
|
||||||
current_env = (CELL *)*ASP;
|
current_env = (CELL *)*ASP;
|
||||||
ASP++;
|
ASP++;
|
||||||
#if COROUTINING
|
|
||||||
max = (CELL *)DelayTop();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
time_start = Yap_cputime();
|
time_start = Yap_cputime();
|
||||||
#if COROUTINING
|
|
||||||
max = (CELL *)DelayTop();
|
|
||||||
while (max - (CELL*)Yap_GlobalBase < 1024+(2*NUM_OF_ATTS)) {
|
|
||||||
if (!Yap_growglobal(¤t_env)) {
|
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
max = (CELL *)DelayTop();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
max = NULL;
|
|
||||||
#endif
|
|
||||||
if (setjmp(Yap_gc_restore) == 2) {
|
if (setjmp(Yap_gc_restore) == 2) {
|
||||||
UInt sz;
|
UInt sz;
|
||||||
|
|
||||||
@ -3838,9 +3776,6 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
discard_trail_entries = 0;
|
discard_trail_entries = 0;
|
||||||
current_env = (CELL *)*ASP;
|
current_env = (CELL *)*ASP;
|
||||||
ASP++;
|
ASP++;
|
||||||
#if COROUTINING
|
|
||||||
max = (CELL *)DelayTop();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if EASY_SHUNTING
|
#if EASY_SHUNTING
|
||||||
@ -3862,9 +3797,6 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
return -1;
|
return -1;
|
||||||
current_env = (CELL *)*ASP;
|
current_env = (CELL *)*ASP;
|
||||||
ASP++;
|
ASP++;
|
||||||
#if COROUTINING
|
|
||||||
max = (CELL *)DelayTop();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
memset((void *)Yap_bp, 0, alloc_sz);
|
memset((void *)Yap_bp, 0, alloc_sz);
|
||||||
#ifdef HYBRID_SCHEME
|
#ifdef HYBRID_SCHEME
|
||||||
@ -3882,7 +3814,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
OldTR = (tr_fr_ptr)(old_TR = TR);
|
OldTR = (tr_fr_ptr)(old_TR = TR);
|
||||||
push_registers(predarity, nextop);
|
push_registers(predarity, nextop);
|
||||||
/* make sure we clean bits after a reset */
|
/* make sure we clean bits after a reset */
|
||||||
marking_phase(old_TR, current_env, nextop, max);
|
marking_phase(old_TR, current_env, nextop);
|
||||||
if (total_oldies > ((HGEN-H0)*8)/10) {
|
if (total_oldies > ((HGEN-H0)*8)/10) {
|
||||||
total_marked -= total_oldies;
|
total_marked -= total_oldies;
|
||||||
tot = total_marked+(HGEN-H0);
|
tot = total_marked+(HGEN-H0);
|
||||||
@ -3922,7 +3854,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
time_start = m_time;
|
time_start = m_time;
|
||||||
compaction_phase(old_TR, current_env, nextop, max);
|
compaction_phase(old_TR, current_env, nextop);
|
||||||
TR = old_TR;
|
TR = old_TR;
|
||||||
pop_registers(predarity, nextop);
|
pop_registers(predarity, nextop);
|
||||||
TR = new_TR;
|
TR = new_TR;
|
||||||
|
2
C/init.c
2
C/init.c
@ -1167,7 +1167,6 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->wl[i].global_variables = NULL;
|
Yap_heap_regs->wl[i].global_variables = NULL;
|
||||||
Yap_heap_regs->wl[i].global_arena = 0L;
|
Yap_heap_regs->wl[i].global_arena = 0L;
|
||||||
Yap_heap_regs->wl[i].global_arena_overflows = 0;
|
Yap_heap_regs->wl[i].global_arena_overflows = 0;
|
||||||
Yap_heap_regs->wl[i].global_delay_arena = 0L;
|
|
||||||
Yap_heap_regs->wl[i].allow_restart = FALSE;
|
Yap_heap_regs->wl[i].allow_restart = FALSE;
|
||||||
Yap_heap_regs->wl[i].tot_gc_time = 0;
|
Yap_heap_regs->wl[i].tot_gc_time = 0;
|
||||||
Yap_heap_regs->wl[i].tot_gc_recovered = 0;
|
Yap_heap_regs->wl[i].tot_gc_recovered = 0;
|
||||||
@ -1193,7 +1192,6 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->wl.global_arena = 0L;
|
Yap_heap_regs->wl.global_arena = 0L;
|
||||||
Yap_heap_regs->wl.global_arena_overflows = 0;
|
Yap_heap_regs->wl.global_arena_overflows = 0;
|
||||||
Yap_heap_regs->wl.allow_restart = FALSE;
|
Yap_heap_regs->wl.allow_restart = FALSE;
|
||||||
Yap_heap_regs->wl.global_delay_arena = 0L;
|
|
||||||
Yap_heap_regs->wl.tot_gc_time = 0;
|
Yap_heap_regs->wl.tot_gc_time = 0;
|
||||||
Yap_heap_regs->wl.tot_gc_recovered = 0;
|
Yap_heap_regs->wl.tot_gc_recovered = 0;
|
||||||
Yap_heap_regs->wl.gc_calls = 0;
|
Yap_heap_regs->wl.gc_calls = 0;
|
||||||
|
@ -628,7 +628,7 @@ p_functor(void) /* functor(?,?,?) */
|
|||||||
BIND(pt0, d0, bind_func_nvar_var);
|
BIND(pt0, d0, bind_func_nvar_var);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, d0);
|
DO_TRAIL(pt0, d0);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
bind_func_nvar_var:
|
bind_func_nvar_var:
|
||||||
#endif
|
#endif
|
||||||
/* have to buffer ENDP and label */
|
/* have to buffer ENDP and label */
|
||||||
@ -655,7 +655,7 @@ p_functor(void) /* functor(?,?,?) */
|
|||||||
/* Done */
|
/* Done */
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, d0);
|
DO_TRAIL(pt0, d0);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
bind_func_nvar3_var:
|
bind_func_nvar3_var:
|
||||||
#endif
|
#endif
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -738,7 +738,7 @@ p_functor(void) /* functor(?,?,?) */
|
|||||||
BIND(pt0, d0, bind_func_var_3nvar);
|
BIND(pt0, d0, bind_func_var_3nvar);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, d0);
|
DO_TRAIL(pt0, d0);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
bind_func_var_3nvar:
|
bind_func_var_3nvar:
|
||||||
#endif
|
#endif
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
13
C/save.c
13
C/save.c
@ -409,9 +409,6 @@ save_regs(int mode)
|
|||||||
putcellptr((CELL *)P);
|
putcellptr((CELL *)P);
|
||||||
putout(CreepFlag);
|
putout(CreepFlag);
|
||||||
putout(EX);
|
putout(EX);
|
||||||
#ifdef COROUTINING
|
|
||||||
putout(DelayedVars);
|
|
||||||
#endif
|
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(SBA) || defined(TABLING)
|
||||||
putcellptr(H_FZ);
|
putcellptr(H_FZ);
|
||||||
putcellptr((CELL *)B_FZ);
|
putcellptr((CELL *)B_FZ);
|
||||||
@ -807,11 +804,6 @@ get_regs(int flag)
|
|||||||
EX = get_cell();
|
EX = get_cell();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
#ifdef COROUTINING
|
|
||||||
DelayedVars = get_cell();
|
|
||||||
if (Yap_ErrorMessage)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
#if defined(SBA) || defined(TABLING)
|
#if defined(SBA) || defined(TABLING)
|
||||||
H_FZ = get_cellptr();
|
H_FZ = get_cellptr();
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
@ -1035,12 +1027,7 @@ restore_regs(int flag)
|
|||||||
S = PtoGloAdjust(S);
|
S = PtoGloAdjust(S);
|
||||||
if (EX)
|
if (EX)
|
||||||
EX = AbsAppl(PtoGloAdjust(RepAppl(EX)));
|
EX = AbsAppl(PtoGloAdjust(RepAppl(EX)));
|
||||||
#ifdef COROUTINING
|
|
||||||
DelayedVars = AbsAppl(PtoGloAdjust(RepAppl(DelayedVars)));
|
|
||||||
#ifdef MULTI_ASSIGNMENT_VARIABLES
|
|
||||||
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
C/unify.c
20
C/unify.c
@ -259,7 +259,7 @@ loop:
|
|||||||
BIND_GLOBAL(ptd1, d0, bind_ocunify1);
|
BIND_GLOBAL(ptd1, d0, bind_ocunify1);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(ptd1, d0);
|
DO_TRAIL(ptd1, d0);
|
||||||
if (ptd1 < H0) Yap_WakeUp(ptd1);
|
if (IsAttVar(ptd1)) Yap_WakeUp(ptd1);
|
||||||
bind_ocunify1:
|
bind_ocunify1:
|
||||||
#endif
|
#endif
|
||||||
if (Yap_rational_tree_loop(ptd1-1, ptd1, (CELL **)to_visit, (CELL **)unif))
|
if (Yap_rational_tree_loop(ptd1-1, ptd1, (CELL **)to_visit, (CELL **)unif))
|
||||||
@ -282,7 +282,7 @@ loop:
|
|||||||
BIND_GLOBAL(ptd0, d1, bind_ocunify2);
|
BIND_GLOBAL(ptd0, d1, bind_ocunify2);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(ptd0, d1);
|
DO_TRAIL(ptd0, d1);
|
||||||
if (ptd0 < H0) Yap_WakeUp(ptd0);
|
if (IsAttVar(ptd0)) Yap_WakeUp(ptd0);
|
||||||
bind_ocunify2:
|
bind_ocunify2:
|
||||||
#endif
|
#endif
|
||||||
if (Yap_rational_tree_loop(ptd0-1, ptd0, (CELL **)to_visit, (CELL **)unif))
|
if (Yap_rational_tree_loop(ptd0-1, ptd0, (CELL **)to_visit, (CELL **)unif))
|
||||||
@ -403,7 +403,7 @@ oc_unify_nvar_nvar:
|
|||||||
BIND(pt1, d0, bind_ocunify4);
|
BIND(pt1, d0, bind_ocunify4);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt1, d0);
|
DO_TRAIL(pt1, d0);
|
||||||
if (pt1 < H0) Yap_WakeUp(pt1);
|
if (IsAttVar(pt1)) Yap_WakeUp(pt1);
|
||||||
bind_ocunify4:
|
bind_ocunify4:
|
||||||
#endif
|
#endif
|
||||||
/* local variables cannot be in a term */
|
/* local variables cannot be in a term */
|
||||||
@ -421,7 +421,7 @@ oc_unify_var_nvar:
|
|||||||
BIND(pt0, d1, bind_ocunify5);
|
BIND(pt0, d1, bind_ocunify5);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, d1);
|
DO_TRAIL(pt0, d1);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
bind_ocunify5:
|
bind_ocunify5:
|
||||||
#endif
|
#endif
|
||||||
/* local variables cannot be in a term */
|
/* local variables cannot be in a term */
|
||||||
@ -436,14 +436,14 @@ oc_unify_var_nvar:
|
|||||||
UnifyCells(pt0, pt1, uc1, uc2);
|
UnifyCells(pt0, pt1, uc1, uc2);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, (CELL)pt1);
|
DO_TRAIL(pt0, (CELL)pt1);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
uc1:
|
uc1:
|
||||||
#endif
|
#endif
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
uc2:
|
uc2:
|
||||||
DO_TRAIL(pt1, (CELL)pt0);
|
DO_TRAIL(pt1, (CELL)pt0);
|
||||||
if (pt1 < H0) {
|
if (IsAttVar(pt1)) {
|
||||||
Yap_WakeUp(pt1);
|
Yap_WakeUp(pt1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -550,7 +550,7 @@ unify_nvar_nvar:
|
|||||||
BIND(pt1, d0, bind_unify3);
|
BIND(pt1, d0, bind_unify3);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt1, d0);
|
DO_TRAIL(pt1, d0);
|
||||||
if (pt1 < H0) Yap_WakeUp(pt1);
|
if (IsAttVar(pt1)) Yap_WakeUp(pt1);
|
||||||
bind_unify3:
|
bind_unify3:
|
||||||
#endif
|
#endif
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -563,7 +563,7 @@ unify_var_nvar:
|
|||||||
BIND(pt0, d1, bind_unify4);
|
BIND(pt0, d1, bind_unify4);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, d1);
|
DO_TRAIL(pt0, d1);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
bind_unify4:
|
bind_unify4:
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -579,14 +579,14 @@ unify_var_nvar_trail:
|
|||||||
UnifyCells(pt0, pt1, uc1, uc2);
|
UnifyCells(pt0, pt1, uc1, uc2);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
DO_TRAIL(pt0, (CELL)pt1);
|
DO_TRAIL(pt0, (CELL)pt1);
|
||||||
if (pt0 < H0) Yap_WakeUp(pt0);
|
if (IsAttVar(pt0)) Yap_WakeUp(pt0);
|
||||||
uc1:
|
uc1:
|
||||||
#endif
|
#endif
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
uc2:
|
uc2:
|
||||||
DO_TRAIL(pt1, (CELL)pt0);
|
DO_TRAIL(pt1, (CELL)pt0);
|
||||||
if (pt1 < H0) {
|
if (IsAttVar(pt1)) {
|
||||||
Yap_WakeUp(pt1);
|
Yap_WakeUp(pt1);
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
@ -254,7 +254,7 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf,
|
|||||||
struct cp_frame *bp[1];
|
struct cp_frame *bp[1];
|
||||||
|
|
||||||
if (dvars == NULL) {
|
if (dvars == NULL) {
|
||||||
dvars = (CELL *)DelayTop();
|
dvars = H0;
|
||||||
}
|
}
|
||||||
if (ptd0 < dvars) {
|
if (ptd0 < dvars) {
|
||||||
*ptf++ = (CELL) ptd0;
|
*ptf++ = (CELL) ptd0;
|
||||||
|
@ -406,8 +406,8 @@ write_var(CELL *t, struct write_globs *wglb, struct rewind_term *rwt)
|
|||||||
wrputc('_', wglb->writewch);
|
wrputc('_', wglb->writewch);
|
||||||
/* make sure we don't get no creepy spaces where they shouldn't be */
|
/* make sure we don't get no creepy spaces where they shouldn't be */
|
||||||
lastw = separator;
|
lastw = separator;
|
||||||
if (CellPtr(t) < H0) {
|
if (IsAttVar(t)) {
|
||||||
Int vcount = (H0-t);
|
Int vcount = (t-H0);
|
||||||
#if COROUTINING
|
#if COROUTINING
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (Yap_Portray_delays) {
|
if (Yap_Portray_delays) {
|
||||||
@ -415,7 +415,7 @@ write_var(CELL *t, struct write_globs *wglb, struct rewind_term *rwt)
|
|||||||
|
|
||||||
Yap_Portray_delays = FALSE;
|
Yap_Portray_delays = FALSE;
|
||||||
if (ext == attvars_ext) {
|
if (ext == attvars_ext) {
|
||||||
attvar_record *attv = (attvar_record *)t;
|
attvar_record *attv = RepAttVar(t);
|
||||||
long sl = 0;
|
long sl = 0;
|
||||||
Term l = attv->Atts;
|
Term l = attv->Atts;
|
||||||
|
|
||||||
@ -613,6 +613,9 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
wrputf(FloatOfTerm(t),wglb->writewch);
|
wrputf(FloatOfTerm(t),wglb->writewch);
|
||||||
return;
|
return;
|
||||||
|
case (CELL)FunctorAttVar:
|
||||||
|
write_var(RepAppl(t)+1, wglb, &nrwt);
|
||||||
|
return;
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
wrputref(RefOfTerm(t), wglb->Quote_illegal, wglb->writewch);
|
wrputref(RefOfTerm(t), wglb->Quote_illegal, wglb->writewch);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user