protect writes to SignalMask and to CreepFlag. Reads are still not
locked. fix XREGS for threads. fix thread_signal not even being defined. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@969 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a5b6a22f27
commit
ca4e754af7
18
C/absmi.c
18
C/absmi.c
@ -212,7 +212,7 @@ Yap_absmi(int inp)
|
|||||||
|
|
||||||
/* the registers are all set up, let's swap */
|
/* the registers are all set up, let's swap */
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
pthread_setspecific(yaamregs_key, (const void *)&absmi_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)&absmi_regs);
|
||||||
ThreadHandle[worker_id].current_yaam_regs = &absmi_regs;
|
ThreadHandle[worker_id].current_yaam_regs = &absmi_regs;
|
||||||
#else
|
#else
|
||||||
Yap_regp = &absmi_regs;
|
Yap_regp = &absmi_regs;
|
||||||
@ -2456,8 +2456,10 @@ Yap_absmi(int inp)
|
|||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
/* I need this for Windows and other systems where SIGINT
|
/* I need this for Windows and other systems where SIGINT
|
||||||
is not proceesed by same thread as absmi */
|
is not proceesed by same thread as absmi */
|
||||||
|
LOCK(SignalLock);
|
||||||
if (Yap_PrologMode & (AbortMode|InterruptMode)) {
|
if (Yap_PrologMode & (AbortMode|InterruptMode)) {
|
||||||
CFREG = CalculateStackGap();
|
CFREG = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
/* same instruction */
|
/* same instruction */
|
||||||
if (Yap_PrologMode & InterruptMode) {
|
if (Yap_PrologMode & InterruptMode) {
|
||||||
Yap_PrologMode &= ~InterruptMode;
|
Yap_PrologMode &= ~InterruptMode;
|
||||||
@ -2470,6 +2472,7 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
JMPNext();
|
JMPNext();
|
||||||
}
|
}
|
||||||
|
UNLOCK(SignalLock);
|
||||||
#endif
|
#endif
|
||||||
#if SHADOW_S
|
#if SHADOW_S
|
||||||
S = SREG;
|
S = SREG;
|
||||||
@ -2520,23 +2523,26 @@ Yap_absmi(int inp)
|
|||||||
ARG1 = (Term) AbsPair(H);
|
ARG1 = (Term) AbsPair(H);
|
||||||
|
|
||||||
H += 2;
|
H += 2;
|
||||||
|
LOCK(SignalLock);
|
||||||
CFREG = CalculateStackGap();
|
CFREG = CalculateStackGap();
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
if (ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
if (ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||||
|
ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
ARG2 = Yap_ListOfWokenGoals();
|
ARG2 = Yap_ListOfWokenGoals();
|
||||||
SREG = (CELL *) (WakeUpCode);
|
SREG = (CELL *) (WakeUpCode);
|
||||||
/* no more goals to wake up */
|
/* no more goals to wake up */
|
||||||
Yap_UpdateTimedVar(WokenGoals, TermNil);
|
Yap_UpdateTimedVar(WokenGoals, TermNil);
|
||||||
ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
SREG = (CELL *) CreepCode;
|
SREG = (CELL *) CreepCode;
|
||||||
|
CFREG = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
#ifdef LOW_LEVEL_TRACER
|
#ifdef LOW_LEVEL_TRACER
|
||||||
if (Yap_do_low_level_trace)
|
if (Yap_do_low_level_trace)
|
||||||
low_level_trace(enter_pred,(PredEntry *)(SREG),XREGS+1);
|
low_level_trace(enter_pred,(PredEntry *)(SREG),XREGS+1);
|
||||||
#endif /* LOW_LEVEL_TRACE */
|
#endif /* LOW_LEVEL_TRACE */
|
||||||
PREG = ((PredEntry *)(SREG))->CodeOfPred;
|
PREG = ((PredEntry *)(SREG))->CodeOfPred;
|
||||||
CFREG = CalculateStackGap();
|
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
|
|
||||||
@ -6433,7 +6439,6 @@ Yap_absmi(int inp)
|
|||||||
{
|
{
|
||||||
Prop p = Yap_GetPredPropByFunc(Yap_MkFunctor(at, 1),0);
|
Prop p = Yap_GetPredPropByFunc(Yap_MkFunctor(at, 1),0);
|
||||||
if (p == NIL) {
|
if (p == NIL) {
|
||||||
CFREG = CalculateStackGap();
|
|
||||||
FAIL();
|
FAIL();
|
||||||
} else {
|
} else {
|
||||||
PredEntry *undefpe;
|
PredEntry *undefpe;
|
||||||
@ -6445,7 +6450,6 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PREG = UndefCode->CodeOfPred;
|
PREG = UndefCode->CodeOfPred;
|
||||||
CFREG = CalculateStackGap();
|
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDBOp();
|
ENDBOp();
|
||||||
@ -11680,7 +11684,9 @@ Yap_absmi(int inp)
|
|||||||
WRITEBACK_Y_AS_ENV();
|
WRITEBACK_Y_AS_ENV();
|
||||||
SREG = (CELL *) pen;
|
SREG = (CELL *) pen;
|
||||||
ASP = E_YREG;
|
ASP = E_YREG;
|
||||||
|
LOCK(SignalLock);
|
||||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||||
saveregs_and_ycache();
|
saveregs_and_ycache();
|
||||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||||
@ -11689,7 +11695,9 @@ Yap_absmi(int inp)
|
|||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
setregs_and_ycache();
|
setregs_and_ycache();
|
||||||
|
LOCK(SignalLock);
|
||||||
CFREG = CalculateStackGap();
|
CFREG = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
}
|
}
|
||||||
if (ActiveSignals) {
|
if (ActiveSignals) {
|
||||||
goto creep;
|
goto creep;
|
||||||
|
@ -3314,9 +3314,7 @@ p_recorded(void)
|
|||||||
} else {
|
} else {
|
||||||
DBRef ref = DBRefOfTerm(t3);
|
DBRef ref = DBRefOfTerm(t3);
|
||||||
if (ref == NULL) return FALSE;
|
if (ref == NULL) return FALSE;
|
||||||
LOCK(ref->lock);
|
|
||||||
if (DEAD_REF(ref)) {
|
if (DEAD_REF(ref)) {
|
||||||
UNLOCK(ref->lock);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (ref->Flags & LogUpdMask) {
|
if (ref->Flags & LogUpdMask) {
|
||||||
@ -3324,22 +3322,17 @@ p_recorded(void)
|
|||||||
PredEntry *ap;
|
PredEntry *ap;
|
||||||
if (Yap_op_from_opcode(cl->ClCode->opc) == _unify_idb_term) {
|
if (Yap_op_from_opcode(cl->ClCode->opc) == _unify_idb_term) {
|
||||||
if (!Yap_unify(ARG2, cl->ClSource->Entry)) {
|
if (!Yap_unify(ARG2, cl->ClSource->Entry)) {
|
||||||
UNLOCK(cl->ClLock);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (!Yap_unify(ARG2,GetDBTerm(cl->ClSource))) {
|
} else if (!Yap_unify(ARG2,GetDBTerm(cl->ClSource))) {
|
||||||
UNLOCK(cl->ClLock);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
ap = cl->ClPred;
|
ap = cl->ClPred;
|
||||||
UNLOCK(ref->lock);
|
|
||||||
return Yap_unify(GetDBLUKey(ap), ARG1);
|
return Yap_unify(GetDBLUKey(ap), ARG1);
|
||||||
} else if (!Yap_unify(ARG2,GetDBTermFromDBEntry(ref))
|
} else if (!Yap_unify(ARG2,GetDBTermFromDBEntry(ref))
|
||||||
|| !UnifyDBKey(ref,0,ARG1)) {
|
|| !UnifyDBKey(ref,0,ARG1)) {
|
||||||
UNLOCK(ref->lock);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
UNLOCK(ref->lock);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
C/exec.c
10
C/exec.c
@ -301,7 +301,9 @@ EnterCreepMode(Term t, SMALLUNSGN mod) {
|
|||||||
}
|
}
|
||||||
PredCreep = RepPredProp(PredPropByFunc(FunctorCreep,1));
|
PredCreep = RepPredProp(PredPropByFunc(FunctorCreep,1));
|
||||||
ARG1 = MkPairTerm(ModuleName[mod],ARG1);
|
ARG1 = MkPairTerm(ModuleName[mod],ARG1);
|
||||||
|
LOCK(SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
P_before_spy = P;
|
P_before_spy = P;
|
||||||
return (CallPredicate(PredCreep, B));
|
return (CallPredicate(PredCreep, B));
|
||||||
}
|
}
|
||||||
@ -1081,9 +1083,11 @@ exec_absmi(int top)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
yap_flags[SPY_CREEP_FLAG] = 0;
|
yap_flags[SPY_CREEP_FLAG] = 0;
|
||||||
|
LOCK(SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
P = (yamop *)FAILCODE;
|
|
||||||
Yap_PrologMode = UserMode;
|
Yap_PrologMode = UserMode;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
|
P = (yamop *)FAILCODE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -1541,7 +1545,7 @@ Yap_InitYaamRegs(void)
|
|||||||
machine registers */
|
machine registers */
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
int myworker_id = worker_id;
|
int myworker_id = worker_id;
|
||||||
pthread_setspecific(yaamregs_key, (const void *)ThreadHandle[myworker_id].default_yaam_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)ThreadHandle[myworker_id].default_yaam_regs);
|
||||||
ThreadHandle[myworker_id].current_yaam_regs = ThreadHandle[myworker_id].default_yaam_regs;
|
ThreadHandle[myworker_id].current_yaam_regs = ThreadHandle[myworker_id].default_yaam_regs;
|
||||||
worker_id = myworker_id;
|
worker_id = myworker_id;
|
||||||
#else
|
#else
|
||||||
@ -1573,7 +1577,9 @@ Yap_InitYaamRegs(void)
|
|||||||
BBREG = B_FZ = B_BASE;
|
BBREG = B_FZ = B_BASE;
|
||||||
TR = TR_FZ = TR_BASE;
|
TR = TR_FZ = TR_BASE;
|
||||||
#endif /* FROZEN_STACKS */
|
#endif /* FROZEN_STACKS */
|
||||||
|
LOCK(SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
EX = 0L;
|
EX = 0L;
|
||||||
/* for slots to work */
|
/* for slots to work */
|
||||||
*--ASP = MkIntTerm(0);
|
*--ASP = MkIntTerm(0);
|
||||||
|
8
C/grow.c
8
C/grow.c
@ -529,7 +529,9 @@ static_growheap(long size, int fix_code, struct intermediates *cip)
|
|||||||
}
|
}
|
||||||
/* CreepFlag is set to force heap expansion */
|
/* CreepFlag is set to force heap expansion */
|
||||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
|
LOCK(SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
}
|
}
|
||||||
ASP -= 256;
|
ASP -= 256;
|
||||||
TrDiff = LDiff = GDiff = DelayDiff = size;
|
TrDiff = LDiff = GDiff = DelayDiff = size;
|
||||||
@ -711,9 +713,11 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip)
|
|||||||
fix_tabling_info();
|
fix_tabling_info();
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
if (sz >= sizeof(CELL) * 16 * 1024L) {
|
if (sz >= sizeof(CELL) * 16 * 1024L) {
|
||||||
|
LOCK(SignalLock);
|
||||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
if (!ActiveSignals)
|
if (!ActiveSignals)
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* failed */
|
/* failed */
|
||||||
@ -996,10 +1000,12 @@ static int do_growtrail(long size)
|
|||||||
fprintf(Yap_stderr, "[TO] took %g sec\n", (double)growth_time/1000);
|
fprintf(Yap_stderr, "[TO] took %g sec\n", (double)growth_time/1000);
|
||||||
fprintf(Yap_stderr, "[TO] Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
|
fprintf(Yap_stderr, "[TO] Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
|
||||||
}
|
}
|
||||||
|
LOCK(SignalLock);
|
||||||
if (ActiveSignals == YAP_TROVF_SIGNAL) {
|
if (ActiveSignals == YAP_TROVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
}
|
}
|
||||||
ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,10 +1057,12 @@ Yap_growatomtable(void)
|
|||||||
Int start_growth_time = Yap_cputime(), growth_time;
|
Int start_growth_time = Yap_cputime(), growth_time;
|
||||||
int gc_verbose = Yap_is_gc_verbose();
|
int gc_verbose = Yap_is_gc_verbose();
|
||||||
|
|
||||||
|
LOCK(SignalLock);
|
||||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
}
|
}
|
||||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) {
|
while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) {
|
||||||
/* leave for next time */
|
/* leave for next time */
|
||||||
if (!do_growheap(FALSE, nsize*sizeof(AtomHashEntry), NULL))
|
if (!do_growheap(FALSE, nsize*sizeof(AtomHashEntry), NULL))
|
||||||
|
4
C/init.c
4
C/init.c
@ -1137,8 +1137,8 @@ Yap_InitWorkspace(int Heap,
|
|||||||
|
|
||||||
#if PUSH_REGS
|
#if PUSH_REGS
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
pthread_key_create(&yaamregs_key, NULL);
|
pthread_key_create(&Yap_yaamregs_key, NULL);
|
||||||
pthread_setspecific(yaamregs_key, (const void *)&Yap_standard_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs);
|
||||||
#else
|
#else
|
||||||
/* In this case we need to initialise the abstract registers */
|
/* In this case we need to initialise the abstract registers */
|
||||||
Yap_regp = &Yap_standard_regs;
|
Yap_regp = &Yap_standard_regs;
|
||||||
|
@ -31,7 +31,7 @@ REGSTORE Yap_standard_regs;
|
|||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
/* PushRegs always on */
|
/* PushRegs always on */
|
||||||
|
|
||||||
pthread_key_t yaamregs_key;
|
pthread_key_t Yap_yaamregs_key;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -432,7 +432,9 @@ p_creep(void)
|
|||||||
static Int
|
static Int
|
||||||
p_stop_creep(void)
|
p_stop_creep(void)
|
||||||
{
|
{
|
||||||
|
LOCK(SignalLock);
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
|
UNLOCK(SignalLock);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,13 +82,12 @@ thread_run(void *widp)
|
|||||||
|
|
||||||
/* create the YAAM descriptor */
|
/* create the YAAM descriptor */
|
||||||
ThreadHandle[myworker_id].default_yaam_regs = standard_regs;
|
ThreadHandle[myworker_id].default_yaam_regs = standard_regs;
|
||||||
pthread_setspecific(yaamregs_key, (void *)standard_regs);
|
pthread_setspecific(Yap_yaamregs_key, (void *)standard_regs);
|
||||||
worker_id = myworker_id;
|
worker_id = myworker_id;
|
||||||
Yap_InitExStacks(ThreadHandle[myworker_id].ssize, ThreadHandle[myworker_id].tsize);
|
Yap_InitExStacks(ThreadHandle[myworker_id].ssize, ThreadHandle[myworker_id].tsize);
|
||||||
Yap_InitYaamRegs();
|
Yap_InitYaamRegs();
|
||||||
{
|
{
|
||||||
ADDR ptr = Yap_PreAllocCodeSpace();
|
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
|
||||||
Yap_ReleasePreAllocCodeSpace(ptr);
|
|
||||||
}
|
}
|
||||||
tgs[0] = Yap_FetchTermFromDB(ThreadHandle[worker_id].tgoal);
|
tgs[0] = Yap_FetchTermFromDB(ThreadHandle[worker_id].tgoal);
|
||||||
tgoal = Yap_MkApplTerm(FunctorThreadRun, 1, tgs);
|
tgoal = Yap_MkApplTerm(FunctorThreadRun, 1, tgs);
|
||||||
@ -369,6 +368,7 @@ p_thread_signal(void)
|
|||||||
ThreadHandle[wid].current_yaam_regs->CreepFlag_ = Unsigned(LCL0);
|
ThreadHandle[wid].current_yaam_regs->CreepFlag_ = Unsigned(LCL0);
|
||||||
heap_regs->wl[wid].active_signals |= YAP_ITI_SIGNAL;
|
heap_regs->wl[wid].active_signals |= YAP_ITI_SIGNAL;
|
||||||
UNLOCK(heap_regs->wl[wid].signal_lock);
|
UNLOCK(heap_regs->wl[wid].signal_lock);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yap_InitThreadPreds(void)
|
void Yap_InitThreadPreds(void)
|
||||||
@ -393,6 +393,7 @@ void Yap_InitThreadPreds(void)
|
|||||||
Yap_InitCPred("$cond_broadcast", 1, p_cond_broadcast, SafePredFlag);
|
Yap_InitCPred("$cond_broadcast", 1, p_cond_broadcast, SafePredFlag);
|
||||||
Yap_InitCPred("$cond_wait", 2, p_cond_wait, SafePredFlag);
|
Yap_InitCPred("$cond_wait", 2, p_cond_wait, SafePredFlag);
|
||||||
Yap_InitCPred("$install_thread_local", 2, p_install_thread_local, SafePredFlag);
|
Yap_InitCPred("$install_thread_local", 2, p_install_thread_local, SafePredFlag);
|
||||||
|
Yap_InitCPred("$thread_signal", 2, p_thread_signal, SafePredFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
8
H/Regs.h
8
H/Regs.h
@ -10,7 +10,7 @@
|
|||||||
* File: Regs.h *
|
* File: Regs.h *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: YAP abstract machine registers *
|
* comments: YAP abstract machine registers *
|
||||||
* version: $Id: Regs.h,v 1.23 2004-02-05 16:57:01 vsc Exp $ *
|
* version: $Id: Regs.h,v 1.24 2004-02-06 17:22:24 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ extern REGSTORE *Yap_regp;
|
|||||||
|
|
||||||
#if PUSH_X
|
#if PUSH_X
|
||||||
|
|
||||||
#define XREGS (Yap_regp->XTERMS)
|
#define XREGS (Yap_REGS.XTERMS)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -153,9 +153,9 @@ Term Yap_XREGS[MaxTemps]; /* 29 */
|
|||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
|
|
||||||
extern pthread_key_t yaamregs_key;
|
extern pthread_key_t Yap_yaamregs_key;
|
||||||
|
|
||||||
#define Yap_regp ((REGSTORE *)pthread_getspecific(yaamregs_key))
|
#define Yap_regp ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ restore_absmi_regs(REGSTORE * old_regs)
|
|||||||
{
|
{
|
||||||
memcpy(old_regs, Yap_regp, sizeof(REGSTORE));
|
memcpy(old_regs, Yap_regp, sizeof(REGSTORE));
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
pthread_setspecific(yaamregs_key, (void *)old_regs);
|
pthread_setspecific(Yap_yaamregs_key, (void *)old_regs);
|
||||||
ThreadHandle[worker_id].current_yaam_regs = old_regs;
|
ThreadHandle[worker_id].current_yaam_regs = old_regs;
|
||||||
#else
|
#else
|
||||||
Yap_regp = old_regs;
|
Yap_regp = old_regs;
|
||||||
|
@ -56,6 +56,7 @@ typedef struct logic_upd_index {
|
|||||||
yamop ClCode[MIN_ARRAY];
|
yamop ClCode[MIN_ARRAY];
|
||||||
} LogUpdIndex;
|
} LogUpdIndex;
|
||||||
|
|
||||||
|
/* The ordering of the first 3 fields should be compatible with dbrefs */
|
||||||
typedef struct logic_upd_clause {
|
typedef struct logic_upd_clause {
|
||||||
Functor Id; /* allow pointers to this struct to id */
|
Functor Id; /* allow pointers to this struct to id */
|
||||||
/* as dbref */
|
/* as dbref */
|
||||||
|
@ -286,19 +286,20 @@ typedef struct DB_TERM {
|
|||||||
Term Contents[MIN_ARRAY]; /* stored term */
|
Term Contents[MIN_ARRAY]; /* stored term */
|
||||||
} DBTerm;
|
} DBTerm;
|
||||||
|
|
||||||
|
/* The ordering of the first 3 fields should be compatible with lu_clauses */
|
||||||
typedef struct DB_STRUCT {
|
typedef struct DB_STRUCT {
|
||||||
Functor id; /* allow pointers to this struct to id */
|
Functor id; /* allow pointers to this struct to id */
|
||||||
/* as dbref */
|
/* as dbref */
|
||||||
CELL Flags; /* Term Flags */
|
CELL Flags; /* Term Flags */
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar lock; /* a simple lock to protect this entry */
|
||||||
|
Int ref_count; /* how many branches are using this entry */
|
||||||
|
#endif
|
||||||
CELL NOfRefsTo; /* Number of references pointing here */
|
CELL NOfRefsTo; /* Number of references pointing here */
|
||||||
struct struct_dbentry *Parent; /* key of DBase reference */
|
struct struct_dbentry *Parent; /* key of DBase reference */
|
||||||
struct yami *Code; /* pointer to code if this is a clause */
|
struct yami *Code; /* pointer to code if this is a clause */
|
||||||
struct DB_STRUCT *Prev; /* Previous element in chain */
|
struct DB_STRUCT *Prev; /* Previous element in chain */
|
||||||
struct DB_STRUCT *Next; /* Next element in chain */
|
struct DB_STRUCT *Next; /* Next element in chain */
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar lock; /* a simple lock to protect this entry */
|
|
||||||
Int ref_count; /* how many branches are using this entry */
|
|
||||||
#endif
|
|
||||||
struct DB_STRUCT *p, *n; /* entry's age, negative if from recorda,
|
struct DB_STRUCT *p, *n; /* entry's age, negative if from recorda,
|
||||||
positive if it was recordz */
|
positive if it was recordz */
|
||||||
CELL Mask; /* parts that should be cleared */
|
CELL Mask; /* parts that should be cleared */
|
||||||
|
Reference in New Issue
Block a user