avoid using space on statistics

This commit is contained in:
Vítor Santos Costa 2015-04-21 16:09:43 -06:00
parent 94e2d3cf22
commit 660800af67
11 changed files with 150 additions and 145 deletions

View File

@ -1431,9 +1431,9 @@ spy_goal( USES_REGS1 )
}
/* first check if we need to increase the counter */
if ((pe->PredFlags & CountPredFlag)) {
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries++;
UNLOCK(pe->StatisticsForPred->lock);
LOCAL_ReductionsCounter--;
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
#if defined(YAPOR) || defined(THREADS)
@ -1470,9 +1470,9 @@ spy_goal( USES_REGS1 )
}
/* standard profiler */
if ((pe->PredFlags & ProfiledPredFlag)) {
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries++;
UNLOCK(pe->StatisticsForPred->lock);
if (!(pe->PredFlags & SpiedPredFlag)) {
P = pe->cs.p_code.TrueCodeOfPred;
#if defined(YAPOR) || defined(THREADS)

View File

@ -828,10 +828,7 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
else
p->ModuleOfPred = cur_mod;
Yap_NewModulePred(cur_mod, p);
INIT_LOCK(p->StatisticsForPred.lock);
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
#ifdef TABLING
p->TableOfPred = NULL;
#endif /* TABLING */
@ -920,10 +917,6 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
p->NextPredOfModule = NULL;
p->TimeStampOfPred = 0L;
p->LastCallOfPred = LUCALL_ASSERT;
INIT_LOCK(p->StatisticsForPred.lock);
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
#ifdef TABLING
p->TableOfPred = NULL;
#endif /* TABLING */
@ -972,10 +965,6 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
else
p->ModuleOfPred = cur_mod;
Yap_NewModulePred(cur_mod, p);
INIT_LOCK(p->StatisticsForPred.lock);
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
p->TimeStampOfPred = 0L;
p->LastCallOfPred = LUCALL_ASSERT;
#ifdef TABLING

View File

@ -282,6 +282,25 @@ static void a_fetch_cv(cmp_op_info *, int, struct intermediates *);
static void a_fetch_vc(cmp_op_info *, int, struct intermediates *);
static yamop *a_f2(cmp_op_info *, yamop *, int, struct intermediates *);
static profile_data *
initProfiler(PredEntry *p, struct intermediates *cip)
{
profile_data *ptr;
if ((ptr = (profile_data *)Yap_AllocCodeSpace(sizeof(profile_data ))) == NULL) {
/* OOOPS, got in trouble, must do a longjmp and recover space */
save_machine_regs();
siglongjmp(cip->CompilerBotch,2);
}
if (!ptr)
return NULL;
INIT_LOCK(ptr->lock);
ptr->NOfEntries = 0;
ptr->NOfHeadSuccesses = 0;
ptr->NOfRetries = 0;
p->StatisticsForPred = ptr;
return ptr;
}
#define GONEXT(TYPE) code_p = ((yamop *)(&(code_p->y_u.TYPE.next)))
inline static yslot
@ -1970,7 +1989,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
/* OOOPS, got in trouble, must do a longjmp and recover space */
save_machine_regs();
siglongjmp(cip->CompilerBotch,2);
}
}
Yap_inform_profiler_of_clause(newcp, (char *)(newcp)+size, ap, GPROF_INDEX);
Yap_LUIndexSpace_CP += size;
#ifdef DEBUG
@ -1985,18 +2004,24 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
} else if (opcode == _retry) {
if (ap->PredFlags & CountPredFlag)
newcp->opc = emit_op(_count_retry_logical);
else if (ap->PredFlags & ProfiledPredFlag)
else if (ap->PredFlags & ProfiledPredFlag) {
if (!initProfiler(ap, cip)) {
return NULL;
}
newcp->opc = emit_op(_profiled_retry_logical);
else
} else
newcp->opc = emit_op(_retry_logical);
newcp->y_u.OtaLl.s = emit_count(opr);
} else {
/* trust */
if (ap->PredFlags & CountPredFlag)
newcp->opc = emit_op(_count_trust_logical);
else if (ap->PredFlags & ProfiledPredFlag)
newcp->opc = emit_op(_profiled_trust_logical);
else
else if (ap->PredFlags & ProfiledPredFlag) {
if (!initProfiler(ap, cip)) {
return NULL;
}
newcp->opc = emit_op(_profiled_trust_logical);
} else
newcp->opc = emit_op(_trust_logical);
newcp->y_u.OtILl.block = (LogUpdIndex *)(cip->code_addr);
*cip->current_trust_lab = newcp;
@ -3637,6 +3662,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
}
break;
case retry_profiled_op:
if (!initProfiler(cip->CurrentPred, cip)) {
return NULL;
}
code_p = a_pl(_retry_profiled, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
break;
case count_call_op:

View File

@ -1620,9 +1620,6 @@ retract_all(PredEntry *p, int in_use)
p->OpcodeOfPred = UNDEF_OPCODE;
}
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
if (PROFILING) {
p->PredFlags |= ProfiledPredFlag;
} else
@ -1680,9 +1677,6 @@ add_first_static(PredEntry *p, yamop *cp, int spy_flag)
#endif
p->CodeOfPred = pt;
p->cs.p_code.NOfClauses = 1;
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
if (PROFILING) {
p->PredFlags |= ProfiledPredFlag;
spy_flag = TRUE;
@ -1719,9 +1713,6 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
PRED_GOAL_EXPANSION_ON = TRUE;
Yap_InitComma();
}
p->StatisticsForPred.NOfEntries = 0;
p->StatisticsForPred.NOfHeadSuccesses = 0;
p->StatisticsForPred.NOfRetries = 0;
if (PROFILING) {
p->PredFlags |= ProfiledPredFlag;
spy_flag = TRUE;
@ -4430,15 +4421,15 @@ p_profile_info( USES_REGS1 )
}
if (EndOfPAEntr(pe))
return(FALSE);
LOCK(pe->StatisticsForPred.lock);
if (!(pe->StatisticsForPred.NOfEntries)) {
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
if (!(pe->StatisticsForPred->NOfEntries)) {
UNLOCK(pe->StatisticsForPred->lock);
return(FALSE);
}
p[0] = Yap_MkULLIntTerm(pe->StatisticsForPred.NOfEntries);
p[1] = Yap_MkULLIntTerm(pe->StatisticsForPred.NOfHeadSuccesses);
p[2] = Yap_MkULLIntTerm(pe->StatisticsForPred.NOfRetries);
UNLOCK(pe->StatisticsForPred.lock);
p[0] = Yap_MkULLIntTerm(pe->StatisticsForPred->NOfEntries);
p[1] = Yap_MkULLIntTerm(pe->StatisticsForPred->NOfHeadSuccesses);
p[2] = Yap_MkULLIntTerm(pe->StatisticsForPred->NOfRetries);
UNLOCK(pe->StatisticsForPred->lock);
out = Yap_MkApplTerm(Yap_MkFunctor(AtomProfile,3),3,p);
return(Yap_unify(ARG3,out));
}
@ -4467,11 +4458,11 @@ p_profile_reset( USES_REGS1 )
}
if (EndOfPAEntr(pe))
return(FALSE);
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries = 0;
pe->StatisticsForPred.NOfHeadSuccesses = 0;
pe->StatisticsForPred.NOfRetries = 0;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries = 0;
pe->StatisticsForPred->NOfHeadSuccesses = 0;
pe->StatisticsForPred->NOfRetries = 0;
UNLOCK(pe->StatisticsForPred->lock);
return(TRUE);
}

View File

@ -445,18 +445,18 @@
/* profiled_enter_me Pred */
Op(enter_profiling, p);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, p);
GONext();
ENDOp();
/* profiled_retry Label,NArgs */
Op(retry_profiled, p);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, p);
GONext();
ENDOp();
@ -466,9 +466,9 @@
CACHE_Y(B);
/* After retry, cut should be pointing at the parent
* choicepoint for the current B */
LOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
PREG->y_u.Otapl.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
LOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG->y_u.Otapl.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
restore_yaam_regs(PREG->y_u.Otapl.d);
restore_args(PREG->y_u.Otapl.s);
#ifdef FROZEN_STACKS
@ -509,9 +509,9 @@
}
SET_BB(B_YREG);
ENDCACHE_Y();
LOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
PREG->y_u.Otapl.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
LOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG->y_u.Otapl.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, Otapl);
GONext();
ENDOp();
@ -522,9 +522,9 @@
/* count_enter_me Label,NArgs */
Op(count_call, p);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
LOCAL_ReductionsCounter--;
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
saveregs();
@ -545,9 +545,9 @@
/* count_retry Label,NArgs */
Op(count_retry, p);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
/* act as if we had backtracked */
@ -584,9 +584,9 @@
#endif /* FROZEN_STACKS */
SET_BB(B_YREG);
ENDCACHE_Y();
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
saveregs();
@ -645,9 +645,9 @@
setregs();
JMPNext();
}
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
PREG = NEXTOP(PREG, Otapl);
GONext();
ENDOp();
@ -779,9 +779,9 @@
ENDBOp();
BOp(profiled_retry_and_mark, Otapl);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
/* enter a retry dynamic */
ENDBOp();

View File

@ -3445,9 +3445,9 @@ lu_recorded(PredEntry *pe USES_REGS) {
#endif
}
if (pe->PredFlags & ProfiledPredFlag) {
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries++;
UNLOCK(pe->StatisticsForPred->lock);
}
return TRUE;
}

View File

@ -70,9 +70,9 @@
}
restore_yaam_regs(PREG->y_u.OtaLl.n);
restore_args(PREG->y_u.OtaLl.s);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
#ifdef THREADS
PP = PREG->y_u.OtaLl.d->ClPred;
#endif
@ -108,9 +108,9 @@
/* jump to next alternative */
PREG = FAILCODE;
} else {
LOCK(ap->StatisticsForPred.lock);
ap->StatisticsForPred.NOfRetries++;
UNLOCK(ap->StatisticsForPred.lock);
LOCK(ap->StatisticsForPred->lock);
ap->StatisticsForPred->NOfRetries++;
UNLOCK(ap->StatisticsForPred->lock);
PREG = lcl->ClCode;
}
/* HEY, leave indexing block alone!! */
@ -272,9 +272,9 @@
setregs();
JMPNext();
}
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
#ifdef THREADS
PP = PREG->y_u.OtaLl.d->ClPred;
#endif
@ -324,9 +324,9 @@
setregs();
JMPNext();
}
LOCK(ap->StatisticsForPred.lock);
ap->StatisticsForPred.NOfRetries++;
UNLOCK(ap->StatisticsForPred.lock);
LOCK(ap->StatisticsForPred->lock);
ap->StatisticsForPred->NOfRetries++;
UNLOCK(ap->StatisticsForPred->lock);
PREG = lcl->ClCode;
}
/* HEY, leave indexing block alone!! */

View File

@ -26,9 +26,8 @@ static char SccsId[] = "%W% %G%";
static Int p_current_module(USES_REGS1);
static Int p_current_module1(USES_REGS1);
static ModEntry *LookupModule(Term a);
static Term Yap_YapStripModule(Term t, Term *modp);
inline static ModEntry *FetchModuleEntry(Atom at)
static ModEntry *FetchModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -46,9 +45,7 @@ inline static ModEntry *FetchModuleEntry(Atom at)
}
READ_UNLOCK(ae->ARWLock);
return NULL;
}
inline static ModEntry *GetModuleEntry(Atom at)
}inline static ModEntry *GetModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -57,11 +54,10 @@ inline static ModEntry *GetModuleEntry(Atom at)
p0 = ae->PropsOfAE;
while (p0) {
ModEntry *me = RepModProp(p0);
if (me->KindOfPE == ModProperty) {
return me;
if (p0->KindOfPE == ModProperty) {
return RepModProp(p0);
}
p0 = me->NextOfPE;
p0 = p0->NextOfPE;
}
{
CACHE_REGS
@ -284,7 +280,7 @@ static Int p_strip_module(USES_REGS1) {
return Yap_unify(ARG3, t1) && Yap_unify(ARG2, tmod);
}
static Term Yap_YapStripModule(Term t, Term *modp) {
Term Yap_YapStripModule(Term t, Term *modp) {
CACHE_REGS
Term tmod;

View File

@ -133,9 +133,9 @@ CACHE_Y(YREG);
/* profiled_enter_me Pred */
Op(enter_profiling, p);
EMIT_ENTRY_BLOCK(PREG,ENTER_PROFILING_INSTINIT);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, p);
GONext();
ENDOp();
@ -143,9 +143,9 @@ CACHE_Y(YREG);
/* profiled_retry Label,NArgs */
Op(retry_profiled, p);
EMIT_ENTRY_BLOCK(PREG,RETRY_PROFILED_INSTINIT);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, p);
GONext();
ENDOp();
@ -156,9 +156,9 @@ CACHE_Y(YREG);
CACHE_Y(B);
/* After retry, cut should be pointing at the parent
* choicepoint for the current B */
LOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
PREG->y_u.Otapl.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
LOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG->y_u.Otapl.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
restore_yaam_regs(PREG->y_u.Otapl.d);
restore_args(PREG->y_u.Otapl.s);
#ifdef FROZEN_STACKS
@ -205,9 +205,9 @@ CACHE_Y(YREG);
EMIT_SIMPLE_BLOCK(PROFILED_TRUST_ME_END);
SET_BB(B_YREG);
ENDCACHE_Y();
LOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
PREG->y_u.Otapl.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred.lock);
LOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG->y_u.Otapl.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.Otapl.p->StatisticsForPred->lock);
PREG = NEXTOP(PREG, Otapl);
GONext();
ENDOp();
@ -227,9 +227,9 @@ CACHE_Y(YREG);
}
restore_yaam_regs(PREG->y_u.OtaLl.n);
restore_args(PREG->y_u.OtaLl.s);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
#ifdef THREADS
EMIT_SIMPLE_BLOCK(PROFILED_RETRY_LOGICAL_THREADS);
PP = PREG->y_u.OtaLl.d->ClPred;
@ -265,9 +265,9 @@ CACHE_Y(YREG);
/* jump to next alternative */
PREG = FAILCODE;
} else {
LOCK(ap->StatisticsForPred.lock);
ap->StatisticsForPred.NOfRetries++;
UNLOCK(ap->StatisticsForPred.lock);
LOCK(ap->StatisticsForPred->lock);
ap->StatisticsForPred->NOfRetries++;
UNLOCK(ap->StatisticsForPred->lock);
PREG = lcl->ClCode;
}
/* HREY, leave indexing block alone!! */
@ -370,9 +370,9 @@ CACHE_Y(YREG);
/* count_enter_me Label,NArgs */
Op(count_call, p);
EMIT_ENTRY_BLOCK(PREG,COUNT_CALL_INSTINIT);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfEntries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
LOCAL_ReductionsCounter--;
EMIT_SIMPLE_BLOCK(COUNT_CALL_MIDDLE);
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
@ -396,9 +396,9 @@ CACHE_Y(YREG);
/* count_retry Label,NArgs */
Op(count_retry, p);
EMIT_ENTRY_BLOCK(PREG,COUNT_RETRY_INSTINIT);
LOCK(PREG->y_u.p.p->StatisticsForPred.lock);
PREG->y_u.p.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred.lock);
LOCK(PREG->y_u.p.p->StatisticsForPred->lock);
PREG->y_u.p.p->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.p.p->StatisticsForPred->lock);
LOCAL_RetriesCounter--;
EMIT_SIMPLE_BLOCK(COUNT_RETRY_MIDDLE);
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
@ -439,9 +439,9 @@ CACHE_Y(YREG);
#endif /* FROZEN_STACKS */
SET_BB(B_YREG);
ENDCACHE_Y();
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
saveregs();
@ -504,9 +504,9 @@ CACHE_Y(YREG);
JMPNext();
}
EMIT_SIMPLE_BLOCK(COUNT_TRUST_ME_END);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
PREG = NEXTOP(PREG, Otapl);
GONext();
ENDOp();
@ -541,9 +541,9 @@ CACHE_Y(YREG);
setregs();
JMPNext();
}
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++;
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred->lock);
#ifdef THREADS
PP = PREG->y_u.OtaLl.d->ClPred;
#endif
@ -588,9 +588,9 @@ CACHE_Y(YREG);
setregs();
JMPNext();
}
LOCK(ap->StatisticsForPred.lock);
ap->StatisticsForPred.NOfRetries++;
UNLOCK(ap->StatisticsForPred.lock);
LOCK(ap->StatisticsForPred->lock);
ap->StatisticsForPred->NOfRetries++;
UNLOCK(ap->StatisticsForPred->lock);
PREG = lcl->ClCode;
}
/* HREY, leave indexing block alone!! */
@ -1029,9 +1029,9 @@ CACHE_Y(YREG);
BOp(profiled_retry_and_mark, Otapl);
EMIT_ENTRY_BLOCK(PREG,PROFILED_RETRY_AND_MARK_INSTINIT);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred.lock);
LOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->NOfRetries++;
UNLOCK(((PredEntry *)(PREG->y_u.Otapl.p))->StatisticsForPred->lock);
/* enter a retry dynamic */
ENDBOp();
@ -7069,9 +7069,9 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(SPY_PRED_SECONDIFOK_INIT);
///#endif
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries++;
UNLOCK(pe->StatisticsForPred->lock);
LOCAL_ReductionsCounter--;
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
///#ifdef PROFILED_ABSMI
@ -7112,9 +7112,9 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(SPY_PRED_THIRDIFOK_INIT);
///#endif
LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock);
LOCK(pe->StatisticsForPred->lock);
pe->StatisticsForPred->NOfEntries++;
UNLOCK(pe->StatisticsForPred->lock);
if (!(pe->PredFlags & SpiedPredFlag)) {
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(SPY_PRED_THIRDIFOK_FIRSTIFOK);

View File

@ -303,6 +303,7 @@ Term Yap_Module_Name(struct pred_entry *);
struct pred_entry *Yap_ModulePred(Term);
void Yap_NewModulePred(Term, struct pred_entry *);
Term Yap_StripModule(Term, Term *);
Term Yap_YapStripModule(Term, Term *);
void Yap_InitModules(void);
void Yap_InitModulesC(void);
struct mod_entry *Yap_GetModuleEntry(Term tmod);

View File

@ -752,7 +752,7 @@ typedef enum {
timestamp_type LastCallOfPred;
/* This must be at an odd number of cells, otherwise it
will not be aligned on RISC machines */
profile_data StatisticsForPred; /* enable profiling for predicate */
profile_data *StatisticsForPred; /* enable profiling for predicate */
struct pred_entry *NextPredOfModule; /* next pred for same module */
struct pred_entry *NextPredOfHash ; /* next pred for same module */
} PredEntry;
@ -1868,9 +1868,9 @@ PredPropByAtomAndMod (Atom at, Term cur_mod)
#if DEBUG_PELOCKING
#define PELOCK(I,Z) \
{ LOCK((Z)->PELock); (Z)->StatisticsForPred.NOfEntries=(I);(Z)->StatisticsForPred.NOfHeadSuccesses=pthread_self(); }
{ LOCK((Z)->PELock); (Z)->StatisticsForPred->NOfEntries=(I);(Z)->StatisticsForPred->NOfHeadSuccesses=pthread_self(); }
#define UNLOCKPE(I,Z) \
( (Z)->StatisticsForPred.NOfRetries=(I), UNLOCK((Z)->PELock) )
( (Z)->StatisticsForPred->NOfRetries=(I), UNLOCK((Z)->PELock) )
#elif YAPOR || THREADS
#define PELOCK(I,Z) (LOCK((Z)->PELock))
#define UNLOCKPE(I,Z) (UNLOCK((Z)->PELock))