cleanup on exception handling
This commit is contained in:
parent
fba3c34e50
commit
44d28aa0c9
26
C/adtdefs.c
26
C/adtdefs.c
@ -30,7 +30,7 @@ static Prop PredPropByFunc(Functor, Term);
|
|||||||
static Prop PredPropByAtom(Atom, Term);
|
static Prop PredPropByAtom(Atom, Term);
|
||||||
#include "Yatom.h"
|
#include "Yatom.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
#include "pl-utf8.h"
|
#include "pl-shared.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
@ -790,7 +790,7 @@ ExpandPredHash(void)
|
|||||||
/* fe is supposed to be locked */
|
/* fe is supposed to be locked */
|
||||||
Prop
|
Prop
|
||||||
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
||||||
{
|
{ GET_LD
|
||||||
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@ -841,6 +841,9 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
|||||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||||
p->cs.p_code.NOfClauses = 0;
|
p->cs.p_code.NOfClauses = 0;
|
||||||
p->PredFlags = 0L;
|
p->PredFlags = 0L;
|
||||||
|
#if SIZEOF_INT_P==4
|
||||||
|
p->ExtraPredFlags = 0L;
|
||||||
|
#endif
|
||||||
p->src.OwnerFile = AtomNil;
|
p->src.OwnerFile = AtomNil;
|
||||||
p->OpcodeOfPred = UNDEF_OPCODE;
|
p->OpcodeOfPred = UNDEF_OPCODE;
|
||||||
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
@ -869,6 +872,9 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
|||||||
p->PredFlags |= GoalExPredFlag;
|
p->PredFlags |= GoalExPredFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (LOCAL_PL_local_data_p== NULL || truePrologFlag(PLFLAG_DEBUGINFO)) {
|
||||||
|
p->ExtraPredFlags |= NoDebugPredFlag;
|
||||||
|
}
|
||||||
p->FunctorOfPred = fe;
|
p->FunctorOfPred = fe;
|
||||||
WRITE_UNLOCK(fe->FRWLock);
|
WRITE_UNLOCK(fe->FRWLock);
|
||||||
{
|
{
|
||||||
@ -883,7 +889,7 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
|||||||
#if THREADS
|
#if THREADS
|
||||||
Prop
|
Prop
|
||||||
Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
||||||
{
|
{ LD_FROM_REGS
|
||||||
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@ -895,6 +901,9 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
|||||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||||
p->cs.p_code.NOfClauses = 0;
|
p->cs.p_code.NOfClauses = 0;
|
||||||
p->PredFlags = ap->PredFlags & ~(IndexedPredFlag|SpiedPredFlag);
|
p->PredFlags = ap->PredFlags & ~(IndexedPredFlag|SpiedPredFlag);
|
||||||
|
#if SIZEOF_INT_P==4
|
||||||
|
p->ExtraPredFlags = 0L;
|
||||||
|
#endif
|
||||||
p->src.OwnerFile = ap->src.OwnerFile;
|
p->src.OwnerFile = ap->src.OwnerFile;
|
||||||
p->OpcodeOfPred = UNDEF_OPCODE;
|
p->OpcodeOfPred = UNDEF_OPCODE;
|
||||||
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = p->cs.p_code.TrueCodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
@ -918,6 +927,9 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
|||||||
LOCAL_ThreadHandle.local_preds = p;
|
LOCAL_ThreadHandle.local_preds = p;
|
||||||
p->FunctorOfPred = ap->FunctorOfPred;
|
p->FunctorOfPred = ap->FunctorOfPred;
|
||||||
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_THREAD);
|
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_THREAD);
|
||||||
|
if (LOCAL_PL_local_data_p== NULL || truePrologFlag(PLFLAG_DEBUGINFO)) {
|
||||||
|
p->ExtraPredFlags |= NoDebugPredFlag;
|
||||||
|
}
|
||||||
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
||||||
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_THREAD);
|
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_THREAD);
|
||||||
}
|
}
|
||||||
@ -927,7 +939,7 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
|
|||||||
|
|
||||||
Prop
|
Prop
|
||||||
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
||||||
{
|
{ GET_LD
|
||||||
Prop p0;
|
Prop p0;
|
||||||
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
|
||||||
|
|
||||||
@ -943,6 +955,9 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
|||||||
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL;
|
||||||
p->cs.p_code.NOfClauses = 0;
|
p->cs.p_code.NOfClauses = 0;
|
||||||
p->PredFlags = 0L;
|
p->PredFlags = 0L;
|
||||||
|
#if SIZEOF_INT_P==4
|
||||||
|
p->ExtraPredFlags = 0L;
|
||||||
|
#endif
|
||||||
p->src.OwnerFile = AtomNil;
|
p->src.OwnerFile = AtomNil;
|
||||||
p->OpcodeOfPred = UNDEF_OPCODE;
|
p->OpcodeOfPred = UNDEF_OPCODE;
|
||||||
p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
|
p->cs.p_code.ExpandCode = EXPAND_OP_CODE;
|
||||||
@ -983,6 +998,9 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
|
|||||||
AddPropToAtom(ae, (PropEntry *)p);
|
AddPropToAtom(ae, (PropEntry *)p);
|
||||||
p0 = AbsPredProp(p);
|
p0 = AbsPredProp(p);
|
||||||
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
p->FunctorOfPred = (Functor)AbsAtom(ae);
|
||||||
|
if (LOCAL_PL_local_data_p== NULL || truePrologFlag(PLFLAG_DEBUGINFO)) {
|
||||||
|
p->ExtraPredFlags |= NoDebugPredFlag;
|
||||||
|
}
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
{
|
{
|
||||||
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM);
|
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM);
|
||||||
|
@ -2511,7 +2511,8 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS)
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
pt = CellPtr(DBSP->Contents);
|
pt = CellPtr(DBSP->Contents);
|
||||||
if (H+NOf > ASP-CalculateStackGap()/sizeof(CELL)) {
|
CalculateStackGap( PASS_REGS1 );
|
||||||
|
if (H+NOf > ASP-EventFlag/sizeof(CELL)) {
|
||||||
if (LOCAL_PrologMode & InErrorMode) {
|
if (LOCAL_PrologMode & InErrorMode) {
|
||||||
if (H+NOf > ASP)
|
if (H+NOf > ASP)
|
||||||
fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
||||||
|
@ -1996,7 +1996,7 @@ E);
|
|||||||
if (serious) {
|
if (serious) {
|
||||||
/* disable active signals at this point */
|
/* disable active signals at this point */
|
||||||
LOCAL_ActiveSignals = 0;
|
LOCAL_ActiveSignals = 0;
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
LOCAL_PrologMode &= ~InErrorMode;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
/* we might be in the middle of a critical region */
|
/* we might be in the middle of a critical region */
|
||||||
|
16
C/exec.c
16
C/exec.c
@ -168,7 +168,7 @@ do_execute(Term t, Term mod USES_REGS)
|
|||||||
/* disable creeping when we do goal expansion */
|
/* disable creeping when we do goal expansion */
|
||||||
if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) {
|
if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) {
|
||||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
return CallMetaCall(ARG1, mod PASS_REGS);
|
return CallMetaCall(ARG1, mod PASS_REGS);
|
||||||
@ -341,7 +341,7 @@ do_execute_n(Term t, Term mod, unsigned int n USES_REGS)
|
|||||||
/* disable creeping when we do goal expansion */
|
/* disable creeping when we do goal expansion */
|
||||||
if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) {
|
if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) {
|
||||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
|
t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
|
||||||
@ -405,7 +405,7 @@ EnterCreepMode(Term t, Term mod USES_REGS) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
P_before_spy = P;
|
P_before_spy = P;
|
||||||
return CallPredicate(PredCreep, B, PredCreep->CodeOfPred PASS_REGS);
|
return CallPredicate(PredCreep, B, PredCreep->CodeOfPred PASS_REGS);
|
||||||
@ -667,7 +667,7 @@ p_do_goal_expansion( USES_REGS1 )
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||||
if (!LOCAL_ActiveSignals)
|
if (!LOCAL_ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
|
|
||||||
/* CurMod:goal_expansion(A,B) */
|
/* CurMod:goal_expansion(A,B) */
|
||||||
@ -729,7 +729,7 @@ p_do_term_expansion( USES_REGS1 )
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||||
if (!LOCAL_ActiveSignals)
|
if (!LOCAL_ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
|
|
||||||
/* CurMod:term_expansion(A,B) */
|
/* CurMod:term_expansion(A,B) */
|
||||||
@ -1093,7 +1093,7 @@ exec_absmi(int top USES_REGS)
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
/* forget any signals active, we're reborne */
|
/* forget any signals active, we're reborne */
|
||||||
LOCAL_ActiveSignals = 0;
|
LOCAL_ActiveSignals = 0;
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
LOCAL_PrologMode = UserMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
@ -1127,7 +1127,7 @@ exec_absmi(int top USES_REGS)
|
|||||||
/* make sure we don't leave a FAIL signal hanging around */
|
/* make sure we don't leave a FAIL signal hanging around */
|
||||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||||
if (!LOCAL_ActiveSignals)
|
if (!LOCAL_ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1778,7 +1778,7 @@ Yap_InitYaamRegs( int myworker_id )
|
|||||||
TR = TR_FZ = (tr_fr_ptr) REMOTE_TrailBase(myworker_id);
|
TR = TR_FZ = (tr_fr_ptr) REMOTE_TrailBase(myworker_id);
|
||||||
#endif /* FROZEN_STACKS */
|
#endif /* FROZEN_STACKS */
|
||||||
LOCK(REMOTE_SignalLock(myworker_id));
|
LOCK(REMOTE_SignalLock(myworker_id));
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
/* the first real choice-point will also have AP=FAIL */
|
/* the first real choice-point will also have AP=FAIL */
|
||||||
/* always have an empty slots for people to use */
|
/* always have an empty slots for people to use */
|
||||||
REMOTE_GlobalArena(myworker_id) = TermNil;
|
REMOTE_GlobalArena(myworker_id) = TermNil;
|
||||||
|
14
C/grow.c
14
C/grow.c
@ -814,7 +814,7 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
|
|||||||
/* CreepFlag is set to force heap expansion */
|
/* CreepFlag is set to force heap expansion */
|
||||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
}
|
}
|
||||||
ASP -= 256;
|
ASP -= 256;
|
||||||
@ -896,7 +896,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
|||||||
else if (hsplit == (CELL *)omax)
|
else if (hsplit == (CELL *)omax)
|
||||||
hsplit = NULL;
|
hsplit = NULL;
|
||||||
if (size < 0 ||
|
if (size < 0 ||
|
||||||
(Unsigned(H)+size < Unsigned(ASP)-CreepFlag &&
|
(Unsigned(H)+size < Unsigned(ASP)-StackGap( PASS_REGS1 ) &&
|
||||||
hsplit > H0)) {
|
hsplit > H0)) {
|
||||||
/* don't need to expand stacks */
|
/* don't need to expand stacks */
|
||||||
insert_in_delays = FALSE;
|
insert_in_delays = FALSE;
|
||||||
@ -1313,7 +1313,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
if (!LOCAL_ActiveSignals)
|
if (!LOCAL_ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1369,7 +1369,7 @@ growatomtable( USES_REGS1 )
|
|||||||
|
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
@ -1429,7 +1429,7 @@ Yap_growheap(int fix_code, size_t in_size, void *cip)
|
|||||||
if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) {
|
if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) {
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
@ -1449,7 +1449,7 @@ Yap_growheap(int fix_code, size_t in_size, void *cip)
|
|||||||
} else {
|
} else {
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
@ -1785,7 +1785,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
|||||||
}
|
}
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) {
|
if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
|
@ -4247,8 +4247,9 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
effectiveness < 20) {
|
effectiveness < 20) {
|
||||||
LeaveGCMode( PASS_REGS1 );
|
LeaveGCMode( PASS_REGS1 );
|
||||||
#ifndef YAPOR
|
#ifndef YAPOR
|
||||||
if (gc_margin < 2*CalculateStackGap())
|
CalculateStackGap( PASS_REGS1 );
|
||||||
gc_margin = 2*CalculateStackGap();
|
if (gc_margin < 2*EventFlag)
|
||||||
|
gc_margin = 2*EventFlag;
|
||||||
return Yap_growstack(gc_margin);
|
return Yap_growstack(gc_margin);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -4294,8 +4295,10 @@ Yap_gcl(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int res;
|
int res;
|
||||||
UInt min = CalculateStackGap()*sizeof(CELL);
|
UInt min;
|
||||||
|
|
||||||
|
CalculateStackGap( PASS_REGS1 );
|
||||||
|
min = EventFlag*sizeof(CELL);
|
||||||
LOCAL_PrologMode |= GCMode;
|
LOCAL_PrologMode |= GCMode;
|
||||||
if (gc_lim < min)
|
if (gc_lim < min)
|
||||||
gc_lim = min;
|
gc_lim = min;
|
||||||
|
@ -727,7 +727,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */
|
|||||||
pt1 = H;
|
pt1 = H;
|
||||||
*pt1++ = d0;
|
*pt1++ = d0;
|
||||||
d0 = AbsAppl(H);
|
d0 = AbsAppl(H);
|
||||||
if (pt1+d1 > ENV - CreepFlag) {
|
if (pt1+d1 > ENV - StackGap( PASS_REGS1 )) {
|
||||||
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
5
C/save.c
5
C/save.c
@ -412,6 +412,8 @@ save_regs(int mode USES_REGS)
|
|||||||
return -1;
|
return -1;
|
||||||
if (putout(CreepFlag) < 0)
|
if (putout(CreepFlag) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
if (putout(EventFlag) < 0)
|
||||||
|
return -1;
|
||||||
if (putcellptr((CELL *)EX) < 0)
|
if (putcellptr((CELL *)EX) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
#if defined(YAPOR_SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
@ -854,6 +856,9 @@ get_regs(int flag USES_REGS)
|
|||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
CreepFlag = get_cell();
|
CreepFlag = get_cell();
|
||||||
|
if (LOCAL_ErrorMessage)
|
||||||
|
return -1;
|
||||||
|
EventFlag = get_cell();
|
||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
EX = (struct DB_TERM *)get_cellptr();
|
EX = (struct DB_TERM *)get_cellptr();
|
||||||
|
11
C/signals.c
11
C/signals.c
@ -41,8 +41,11 @@ inline static void
|
|||||||
do_signal(yap_signals sig USES_REGS)
|
do_signal(yap_signals sig USES_REGS)
|
||||||
{
|
{
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if (!LOCAL_InterruptsDisabled)
|
if (!LOCAL_InterruptsDisabled) {
|
||||||
CreepFlag = Unsigned(LCL0);
|
CreepFlag = Unsigned(LCL0);
|
||||||
|
if (sig != YAP_CREEP_SIGNAL)
|
||||||
|
EventFlag = Unsigned(LCL0);
|
||||||
|
}
|
||||||
LOCAL_ActiveSignals |= sig;
|
LOCAL_ActiveSignals |= sig;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
}
|
}
|
||||||
@ -52,7 +55,7 @@ undo_signal(yap_signals sig USES_REGS)
|
|||||||
{
|
{
|
||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
if ((LOCAL_ActiveSignals & ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL)) == sig) {
|
if ((LOCAL_ActiveSignals & ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL)) == sig) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
LOCAL_ActiveSignals &= ~sig;
|
LOCAL_ActiveSignals &= ~sig;
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
@ -90,7 +93,7 @@ p_stop_creeping( USES_REGS1 )
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||||
if (!LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -119,7 +122,7 @@ p_creep_allowed( USES_REGS1 )
|
|||||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
||||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||||
if (!LOCAL_ActiveSignals)
|
if (!LOCAL_ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
} else {
|
} else {
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
|
@ -2550,7 +2550,7 @@ p_alarm( USES_REGS1 )
|
|||||||
if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
|
if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||||
LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
||||||
if (!LOCAL_ActiveSignals) {
|
if (!LOCAL_ActiveSignals) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
@ -2862,6 +2862,8 @@ p_enable_interrupts( USES_REGS1 )
|
|||||||
LOCAL_InterruptsDisabled--;
|
LOCAL_InterruptsDisabled--;
|
||||||
if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
||||||
CreepFlag = Unsigned(LCL0);
|
CreepFlag = Unsigned(LCL0);
|
||||||
|
if ( LOCAL_ActiveSignals != YAP_CREEP_SIGNAL )
|
||||||
|
EventFlag = Unsigned( LCL0 );
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2873,7 +2875,7 @@ p_disable_interrupts( USES_REGS1 )
|
|||||||
LOCK(LOCAL_SignalLock);
|
LOCK(LOCAL_SignalLock);
|
||||||
LOCAL_InterruptsDisabled++;
|
LOCAL_InterruptsDisabled++;
|
||||||
if (LOCAL_ActiveSignals) {
|
if (LOCAL_ActiveSignals) {
|
||||||
CreepFlag = CalculateStackGap();
|
CalculateStackGap( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -915,6 +915,7 @@ p_thread_signal( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
LOCK(REMOTE_SignalLock(wid));
|
LOCK(REMOTE_SignalLock(wid));
|
||||||
REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ =
|
||||||
|
REMOTE_ThreadHandle(wid).current_yaam_regs->EventFlag_ =
|
||||||
Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_);
|
||||||
REMOTE_ActiveSignals(wid) |= YAP_ITI_SIGNAL;
|
REMOTE_ActiveSignals(wid) |= YAP_ITI_SIGNAL;
|
||||||
UNLOCK(REMOTE_SignalLock(wid));
|
UNLOCK(REMOTE_SignalLock(wid));
|
||||||
|
11
H/Regs.h
11
H/Regs.h
@ -92,6 +92,7 @@ INLINE_ONLY inline EXTERN void save_B(void);
|
|||||||
|
|
||||||
typedef struct regstore_t
|
typedef struct regstore_t
|
||||||
{
|
{
|
||||||
|
CELL EventFlag_; /* 13 */
|
||||||
CELL CreepFlag_; /* 13 */
|
CELL CreepFlag_; /* 13 */
|
||||||
CELL *HB_; /* 4 heap (global) stack top at latest c.p. */
|
CELL *HB_; /* 4 heap (global) stack top at latest c.p. */
|
||||||
#if defined(YAPOR_SBA) || defined(TABLING)
|
#if defined(YAPOR_SBA) || defined(TABLING)
|
||||||
@ -666,6 +667,7 @@ INLINE_ONLY EXTERN inline void restore_B(void) {
|
|||||||
#define Yap_isint Yap_REGS.isint_
|
#define Yap_isint Yap_REGS.isint_
|
||||||
#define Yap_Floats Yap_REGS.Floats_
|
#define Yap_Floats Yap_REGS.Floats_
|
||||||
#define Yap_Ints Yap_REGS.Ints_
|
#define Yap_Ints Yap_REGS.Ints_
|
||||||
|
#define EventFlag Yap_REGS.EventFlag_
|
||||||
|
|
||||||
#define REG_SIZE sizeof(REGS)/sizeof(CELL *)
|
#define REG_SIZE sizeof(REGS)/sizeof(CELL *)
|
||||||
|
|
||||||
@ -713,9 +715,8 @@ extern REGSTORE Yap_standard_regs;
|
|||||||
|
|
||||||
/******************* controlling debugging ****************************/
|
/******************* controlling debugging ****************************/
|
||||||
static inline UInt
|
static inline UInt
|
||||||
CalculateStackGap(void)
|
StackGap( USES_REGS1 )
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
|
||||||
UInt gmin = (LCL0-H0)>>2;
|
UInt gmin = (LCL0-H0)>>2;
|
||||||
|
|
||||||
if (gmin < MinStackGap) gmin = MinStackGap;
|
if (gmin < MinStackGap) gmin = MinStackGap;
|
||||||
@ -723,3 +724,9 @@ CalculateStackGap(void)
|
|||||||
return gmin;
|
return gmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
CalculateStackGap( USES_REGS1 )
|
||||||
|
{
|
||||||
|
CreepFlag = EventFlag = StackGap( PASS_REGS1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -655,6 +655,7 @@ don;t forget to also add in qly.h
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
NoDebugPredFlag = ((UInt)0x00000004L << EXTRA_FLAG_BASE), /* cannot trace this preducate */
|
||||||
NoTracePredFlag = ((UInt)0x00000002L << EXTRA_FLAG_BASE), /* cannot trace this preducate */
|
NoTracePredFlag = ((UInt)0x00000002L << EXTRA_FLAG_BASE), /* cannot trace this preducate */
|
||||||
QuasiQuotationPredFlag = ((UInt)0x00000001L << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */
|
QuasiQuotationPredFlag = ((UInt)0x00000001L << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */
|
||||||
MegaClausePredFlag = 0x80000000L, /* predicate is implemented as a mega-clause */
|
MegaClausePredFlag = 0x80000000L, /* predicate is implemented as a mega-clause */
|
||||||
|
11
H/absmi.h
11
H/absmi.h
@ -1607,4 +1607,13 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CHECK_ALARM(CONT)
|
#define PROCESS_INT( F, C ) \
|
||||||
|
BEGD(d0); \
|
||||||
|
saveregs(); \
|
||||||
|
d0 = F ( PASS_REGS1 );\
|
||||||
|
setregs(); \
|
||||||
|
if (!d0) FAIL(); \
|
||||||
|
if (d0 == 2) goto C; \
|
||||||
|
JMPNext(); \
|
||||||
|
ENDD(d0);
|
||||||
|
|
||||||
|
2
H/qly.h
2
H/qly.h
@ -102,7 +102,7 @@ typedef enum {
|
|||||||
} qlf_tag_t;
|
} qlf_tag_t;
|
||||||
|
|
||||||
#define STATIC_PRED_FLAGS (SourcePredFlag|DynamicPredFlag|LogUpdatePredFlag|CompiledPredFlag|MultiFileFlag|TabledPredFlag|MegaClausePredFlag|CountPredFlag|ProfiledPredFlag|ThreadLocalPredFlag|AtomDBPredFlag|ModuleTransparentPredFlag|NumberDBPredFlag|MetaPredFlag|SyncPredFlag|BackCPredFlag)
|
#define STATIC_PRED_FLAGS (SourcePredFlag|DynamicPredFlag|LogUpdatePredFlag|CompiledPredFlag|MultiFileFlag|TabledPredFlag|MegaClausePredFlag|CountPredFlag|ProfiledPredFlag|ThreadLocalPredFlag|AtomDBPredFlag|ModuleTransparentPredFlag|NumberDBPredFlag|MetaPredFlag|SyncPredFlag|BackCPredFlag)
|
||||||
#define EXTRA_PRED_FLAGS (QuasiQuotationPredFlag|NoTracePredFlag)
|
#define EXTRA_PRED_FLAGS (QuasiQuotationPredFlag|NoTracePredFlag|NoDebugPredFlag)
|
||||||
|
|
||||||
#define SYSTEM_PRED_FLAGS (BackCPredFlag|UserCPredFlag|CArgsPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)
|
#define SYSTEM_PRED_FLAGS (BackCPredFlag|UserCPredFlag|CArgsPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ true :- true.
|
|||||||
% ;
|
% ;
|
||||||
% true
|
% true
|
||||||
% ),
|
% ),
|
||||||
'$enter_system_mode',
|
|
||||||
'$init_globals',
|
'$init_globals',
|
||||||
'$swi_set_prolog_flag'(fileerrors, true),
|
'$swi_set_prolog_flag'(fileerrors, true),
|
||||||
set_value('$gc',on),
|
set_value('$gc',on),
|
||||||
|
Reference in New Issue
Block a user