transfer call and profiler to spy.
This commit is contained in:
parent
fb85cc8c25
commit
50f7a80546
105
C/absmi.c
105
C/absmi.c
@ -968,27 +968,6 @@ Yap_absmi(int inp)
|
|||||||
* Profiled try - retry - trust instructions *
|
* Profiled try - retry - trust instructions *
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
/* profiled_enter_me Pred */
|
|
||||||
Op(enter_profiling, p);
|
|
||||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
|
||||||
PREG->u.p.p->StatisticsForPred.NOfEntries++;
|
|
||||||
UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
|
|
||||||
PREG = NEXTOP(PREG, p);
|
|
||||||
GONext();
|
|
||||||
ENDOp();
|
|
||||||
|
|
||||||
/* profiled_enter */
|
|
||||||
Op(enter_a_profiling, e);
|
|
||||||
{
|
|
||||||
PredEntry *pen = RepPredProp((Prop)IntegerOfTerm(ENV[-EnvSizeInCells-2]));
|
|
||||||
PREG = NEXTOP(PREG, e);
|
|
||||||
LOCK(pen->StatisticsForPred.lock);
|
|
||||||
pen->StatisticsForPred.NOfEntries++;
|
|
||||||
UNLOCK(pen->StatisticsForPred.lock);
|
|
||||||
}
|
|
||||||
GONext();
|
|
||||||
ENDOp();
|
|
||||||
|
|
||||||
/* profiled_retry Label,NArgs */
|
/* profiled_retry Label,NArgs */
|
||||||
Op(retry_profiled, p);
|
Op(retry_profiled, p);
|
||||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||||
@ -1191,55 +1170,6 @@ Yap_absmi(int inp)
|
|||||||
* Call count instructions *
|
* Call count instructions *
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
/* count_enter_me Label,NArgs */
|
|
||||||
Op(count_call, p);
|
|
||||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
|
||||||
PREG->u.p.p->StatisticsForPred.NOfEntries++;
|
|
||||||
UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
|
|
||||||
ReductionsCounter--;
|
|
||||||
if (ReductionsCounter == 0 && ReductionsCounterOn) {
|
|
||||||
saveregs();
|
|
||||||
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
|
|
||||||
setregs();
|
|
||||||
JMPNext();
|
|
||||||
}
|
|
||||||
PredEntriesCounter--;
|
|
||||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
|
||||||
saveregs();
|
|
||||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
|
||||||
setregs();
|
|
||||||
JMPNext();
|
|
||||||
}
|
|
||||||
PREG = NEXTOP(PREG, p);
|
|
||||||
GONext();
|
|
||||||
ENDOp();
|
|
||||||
|
|
||||||
/* count_enter_me Label,NArgs */
|
|
||||||
Op(count_a_call, e);
|
|
||||||
{
|
|
||||||
PredEntry *pen = RepPredProp((Prop)IntegerOfTerm(ENV[-EnvSizeInCells-2]));
|
|
||||||
PREG = NEXTOP(PREG, e);
|
|
||||||
LOCK(pen->StatisticsForPred.lock);
|
|
||||||
pen->StatisticsForPred.NOfEntries++;
|
|
||||||
UNLOCK(pen->StatisticsForPred.lock);
|
|
||||||
ReductionsCounter--;
|
|
||||||
if (ReductionsCounter == 0 && ReductionsCounterOn) {
|
|
||||||
saveregs();
|
|
||||||
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
|
|
||||||
setregs();
|
|
||||||
JMPNext();
|
|
||||||
}
|
|
||||||
PredEntriesCounter--;
|
|
||||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
|
||||||
saveregs();
|
|
||||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
|
||||||
setregs();
|
|
||||||
JMPNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GONext();
|
|
||||||
ENDOp();
|
|
||||||
|
|
||||||
/* count_retry Label,NArgs */
|
/* count_retry Label,NArgs */
|
||||||
Op(count_retry, p);
|
Op(count_retry, p);
|
||||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||||
@ -8057,6 +7987,41 @@ Yap_absmi(int inp)
|
|||||||
/* IPred can generate errors, it thus must get rid of the lock itself */
|
/* IPred can generate errors, it thus must get rid of the lock itself */
|
||||||
setregs();
|
setregs();
|
||||||
}
|
}
|
||||||
|
/* first check if we need to increase the counter */
|
||||||
|
if ((pe->PredFlags & CountPredFlag)) {
|
||||||
|
LOCK(pe->StatisticsForPred.lock);
|
||||||
|
pe->StatisticsForPred.NOfEntries++;
|
||||||
|
UNLOCK(pe->StatisticsForPred.lock);
|
||||||
|
ReductionsCounter--;
|
||||||
|
if (ReductionsCounter == 0 && ReductionsCounterOn) {
|
||||||
|
saveregs();
|
||||||
|
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
|
||||||
|
setregs();
|
||||||
|
JMPNext();
|
||||||
|
}
|
||||||
|
PredEntriesCounter--;
|
||||||
|
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
||||||
|
saveregs();
|
||||||
|
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||||
|
setregs();
|
||||||
|
JMPNext();
|
||||||
|
}
|
||||||
|
PREG = pe->cs.p_code.TrueCodeOfPred;
|
||||||
|
if ((pe->PredFlags & (CountPredFlag|ProfiledPredFlag|SpiedPredFlag)) ==
|
||||||
|
CountPredFlag) {
|
||||||
|
JMPNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* standard profiler */
|
||||||
|
if ((pe->PredFlags & ProfiledPredFlag)) {
|
||||||
|
LOCK(pe->StatisticsForPred.lock);
|
||||||
|
pe->StatisticsForPred.NOfEntries++;
|
||||||
|
UNLOCK(pe->StatisticsForPred.lock);
|
||||||
|
if (!(pe->PredFlags & SpiedPredFlag)) {
|
||||||
|
PREG = pe->cs.p_code.TrueCodeOfPred;
|
||||||
|
}
|
||||||
|
JMPNext();
|
||||||
|
}
|
||||||
if (!DebugOn) {
|
if (!DebugOn) {
|
||||||
PREG = pe->cs.p_code.TrueCodeOfPred;
|
PREG = pe->cs.p_code.TrueCodeOfPred;
|
||||||
UNLOCK(pe->PELock);
|
UNLOCK(pe->PELock);
|
||||||
|
14
C/amasm.c
14
C/amasm.c
@ -3664,15 +3664,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||||||
case f_0_op:
|
case f_0_op:
|
||||||
code_p = a_f2(TRUE, &cmp_info, code_p, pass_no, cip);
|
code_p = a_f2(TRUE, &cmp_info, code_p, pass_no, cip);
|
||||||
break;
|
break;
|
||||||
case enter_profiling_op:
|
|
||||||
code_p = a_pl(_enter_profiling, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
|
||||||
break;
|
|
||||||
case retry_profiled_op:
|
case retry_profiled_op:
|
||||||
code_p = a_pl(_retry_profiled, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
code_p = a_pl(_retry_profiled, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
||||||
break;
|
break;
|
||||||
case count_call_op:
|
|
||||||
code_p = a_pl(_count_call, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
|
||||||
break;
|
|
||||||
case count_retry_op:
|
case count_retry_op:
|
||||||
code_p = a_pl(_count_retry, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
code_p = a_pl(_count_retry, (PredEntry *)(cip->cpc->rnd1), code_p, pass_no);
|
||||||
break;
|
break;
|
||||||
@ -3925,14 +3919,6 @@ Yap_InitComma(void)
|
|||||||
code_p->u.p.p = PredMetaCall;
|
code_p->u.p.p = PredMetaCall;
|
||||||
GONEXT(p);
|
GONEXT(p);
|
||||||
} else {
|
} else {
|
||||||
if (PROFILING) {
|
|
||||||
code_p->opc = opcode(_enter_a_profiling);
|
|
||||||
GONEXT(e);
|
|
||||||
}
|
|
||||||
if (CALL_COUNTING) {
|
|
||||||
code_p->opc = opcode(_count_a_call);
|
|
||||||
GONEXT(e);
|
|
||||||
}
|
|
||||||
code_p->opc = opcode(_p_execute_tail);
|
code_p->opc = opcode(_p_execute_tail);
|
||||||
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize)-3*sizeof(CELL));
|
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize)-3*sizeof(CELL));
|
||||||
code_p->u.Osbpp.bmap = NULL;
|
code_p->u.Osbpp.bmap = NULL;
|
||||||
|
48
C/cdmgr.c
48
C/cdmgr.c
@ -965,7 +965,7 @@ IPred(PredEntry *ap, UInt NSlots)
|
|||||||
ap->cs.p_code.TrueCodeOfPred = BaseAddr;
|
ap->cs.p_code.TrueCodeOfPred = BaseAddr;
|
||||||
ap->PredFlags |= IndexedPredFlag;
|
ap->PredFlags |= IndexedPredFlag;
|
||||||
}
|
}
|
||||||
if (ap->PredFlags & SpiedPredFlag) {
|
if (ap->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
ap->CodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
ap->CodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
@ -996,7 +996,7 @@ static void
|
|||||||
RemoveMainIndex(PredEntry *ap)
|
RemoveMainIndex(PredEntry *ap)
|
||||||
{
|
{
|
||||||
yamop *First = ap->cs.p_code.FirstClause;
|
yamop *First = ap->cs.p_code.FirstClause;
|
||||||
int spied = ap->PredFlags & SpiedPredFlag;
|
int spied = ap->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag);
|
||||||
|
|
||||||
ap->PredFlags &= ~IndexedPredFlag;
|
ap->PredFlags &= ~IndexedPredFlag;
|
||||||
if (First == NULL) {
|
if (First == NULL) {
|
||||||
@ -1753,7 +1753,7 @@ asserta_stat_clause(PredEntry *p, yamop *q, int spy_flag)
|
|||||||
clq->ClNext = clp;
|
clq->ClNext = clp;
|
||||||
clp->ClPrev = clq;
|
clp->ClPrev = clq;
|
||||||
p->cs.p_code.FirstClause = q;
|
p->cs.p_code.FirstClause = q;
|
||||||
if (p->PredFlags & SpiedPredFlag) {
|
if (p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
} else if (!(p->PredFlags & IndexedPredFlag)) {
|
} else if (!(p->PredFlags & IndexedPredFlag)) {
|
||||||
@ -1771,7 +1771,7 @@ asserta_stat_clause(PredEntry *p, yamop *q, int spy_flag)
|
|||||||
cl->ClNext = ClauseCodeToStaticClause(p->cs.p_code.FirstClause);
|
cl->ClNext = ClauseCodeToStaticClause(p->cs.p_code.FirstClause);
|
||||||
p->cs.p_code.FirstClause = q;
|
p->cs.p_code.FirstClause = q;
|
||||||
p->cs.p_code.TrueCodeOfPred = q;
|
p->cs.p_code.TrueCodeOfPred = q;
|
||||||
if (p->PredFlags & SpiedPredFlag) {
|
if (p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
} else if (!(p->PredFlags & IndexedPredFlag)) {
|
} else if (!(p->PredFlags & IndexedPredFlag)) {
|
||||||
@ -1840,7 +1840,7 @@ assertz_stat_clause(PredEntry *p, yamop *cp, int spy_flag)
|
|||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (p->PredFlags & SpiedPredFlag) {
|
if (p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
}
|
}
|
||||||
@ -1851,7 +1851,7 @@ assertz_stat_clause(PredEntry *p, yamop *cp, int spy_flag)
|
|||||||
cl->ClNext = ClauseCodeToStaticClause(cp);
|
cl->ClNext = ClauseCodeToStaticClause(cp);
|
||||||
}
|
}
|
||||||
if (p->cs.p_code.FirstClause == p->cs.p_code.LastClause) {
|
if (p->cs.p_code.FirstClause == p->cs.p_code.LastClause) {
|
||||||
if (!(p->PredFlags & SpiedPredFlag)) {
|
if (!(p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag))) {
|
||||||
p->OpcodeOfPred = INDEX_OPCODE;
|
p->OpcodeOfPred = INDEX_OPCODE;
|
||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
}
|
}
|
||||||
@ -2075,7 +2075,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
|
|||||||
if (pflags & IndexedPredFlag) {
|
if (pflags & IndexedPredFlag) {
|
||||||
Yap_AddClauseToIndex(p, cp, mode == asserta);
|
Yap_AddClauseToIndex(p, cp, mode == asserta);
|
||||||
}
|
}
|
||||||
if (pflags & SpiedPredFlag)
|
if (pflags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag))
|
||||||
spy_flag = TRUE;
|
spy_flag = TRUE;
|
||||||
if (p == PredGoalExpansion) {
|
if (p == PredGoalExpansion) {
|
||||||
Term tg = ArgOfTerm(1, tf);
|
Term tg = ArgOfTerm(1, tf);
|
||||||
@ -2315,7 +2315,7 @@ Yap_EraseStaticClause(StaticClause *cl, Term mod) {
|
|||||||
} else if (ap->cs.p_code.NOfClauses > 1) {
|
} else if (ap->cs.p_code.NOfClauses > 1) {
|
||||||
ap->OpcodeOfPred = INDEX_OPCODE;
|
ap->OpcodeOfPred = INDEX_OPCODE;
|
||||||
ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
||||||
} else if (ap->PredFlags & SpiedPredFlag) {
|
} else if (ap->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
||||||
} else {
|
} else {
|
||||||
@ -2770,24 +2770,26 @@ p_rmspy(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!(pred->PredFlags & DynamicPredFlag)) {
|
if (!(pred->PredFlags & (CountPredFlag|ProfiledPredFlag))) {
|
||||||
|
if (!(pred->PredFlags & DynamicPredFlag)) {
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
if (pred->PredFlags & LogUpdatePredFlag &&
|
if (pred->PredFlags & LogUpdatePredFlag &&
|
||||||
pred->ModuleOfPred != IDB_MODULE) {
|
pred->ModuleOfPred != IDB_MODULE) {
|
||||||
pred->OpcodeOfPred = LOCKPRED_OPCODE;
|
pred->OpcodeOfPred = LOCKPRED_OPCODE;
|
||||||
pred->CodeOfPred = (yamop *)(&(pred->OpcodeOfPred));
|
pred->CodeOfPred = (yamop *)(&(pred->OpcodeOfPred));
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
pred->CodeOfPred = pred->cs.p_code.TrueCodeOfPred;
|
||||||
|
pred->OpcodeOfPred = pred->CodeOfPred->opc;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else if (pred->OpcodeOfPred == Yap_opcode(_spy_or_trymark)) {
|
||||||
|
pred->OpcodeOfPred = Yap_opcode(_try_and_mark);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
UNLOCK(pred->PELock);
|
||||||
pred->CodeOfPred = pred->cs.p_code.TrueCodeOfPred;
|
return FALSE;
|
||||||
pred->OpcodeOfPred = pred->CodeOfPred->opc;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else if (pred->OpcodeOfPred == Yap_opcode(_spy_or_trymark)) {
|
|
||||||
pred->OpcodeOfPred = Yap_opcode(_try_and_mark);
|
|
||||||
} else {
|
|
||||||
UNLOCK(pred->PELock);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
pred->PredFlags ^= SpiedPredFlag;
|
pred->PredFlags ^= SpiedPredFlag;
|
||||||
UNLOCK(pred->PELock);
|
UNLOCK(pred->PELock);
|
||||||
|
33
C/compiler.c
33
C/compiler.c
@ -1090,10 +1090,6 @@ c_bifun(Int Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler_struct
|
|||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
}
|
}
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
|
||||||
c_args(Goal, 0, cglobs);
|
c_args(Goal, 0, cglobs);
|
||||||
Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint);
|
Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint);
|
||||||
Yap_emit(empty_call_op, Zero, Zero, &cglobs->cint);
|
Yap_emit(empty_call_op, Zero, Zero, &cglobs->cint);
|
||||||
@ -1329,10 +1325,6 @@ c_functor(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
}
|
}
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint);
|
|
||||||
c_args(Goal, 0, cglobs);
|
c_args(Goal, 0, cglobs);
|
||||||
Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint);
|
Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint);
|
||||||
Yap_emit(empty_call_op, Zero, Zero, &cglobs->cint);
|
Yap_emit(empty_call_op, Zero, Zero, &cglobs->cint);
|
||||||
@ -1469,10 +1461,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (atom == AtomCut) {
|
else if (atom == AtomCut) {
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(PredPropByAtom(AtomCut,0)), Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)RepPredProp(PredPropByAtom(AtomCut,0)), Zero, &cglobs->cint);
|
|
||||||
if (cglobs->onlast) {
|
if (cglobs->onlast) {
|
||||||
/* never a problem here with a -> b, !, c ; d */
|
/* never a problem here with a -> b, !, c ; d */
|
||||||
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
|
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
|
||||||
@ -1505,10 +1493,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
|
|
||||||
/* I need an either_me */
|
/* I need an either_me */
|
||||||
cglobs->needs_env = TRUE;
|
cglobs->needs_env = TRUE;
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)RepPredProp(PredPropByAtom(AtomRepeat,0)), Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)RepPredProp(PredPropByAtom(AtomRepeat,0)), Zero, &cglobs->cint);
|
|
||||||
cglobs->or_found = TRUE;
|
cglobs->or_found = TRUE;
|
||||||
push_branch(cglobs->onbranch, TermNil, cglobs);
|
push_branch(cglobs->onbranch, TermNil, cglobs);
|
||||||
cglobs->curbranch++;
|
cglobs->curbranch++;
|
||||||
@ -1548,11 +1532,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||||
}
|
}
|
||||||
/* if we are profiling, make sure we register we entered this predicate */
|
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
f = FunctorOfTerm(Goal);
|
f = FunctorOfTerm(Goal);
|
||||||
@ -1763,10 +1742,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (f == FunctorEq) {
|
else if (f == FunctorEq) {
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
c_eq(ArgOfTerm(1, Goal), ArgOfTerm(2, Goal), cglobs);
|
c_eq(ArgOfTerm(1, Goal), ArgOfTerm(2, Goal), cglobs);
|
||||||
if (cglobs->onlast) {
|
if (cglobs->onlast) {
|
||||||
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
|
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
|
||||||
@ -1792,10 +1767,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
else if (p->PredFlags & AsmPredFlag) {
|
else if (p->PredFlags & AsmPredFlag) {
|
||||||
int op = p->PredFlags & 0x7f;
|
int op = p->PredFlags & 0x7f;
|
||||||
|
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
if (op >= _atom && op <= _primitive) {
|
if (op >= _atom && op <= _primitive) {
|
||||||
c_test(op, ArgOfTerm(1, Goal), cglobs);
|
c_test(op, ArgOfTerm(1, Goal), cglobs);
|
||||||
if (cglobs->onlast) {
|
if (cglobs->onlast) {
|
||||||
@ -1924,10 +1895,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (profiling)
|
|
||||||
Yap_emit(enter_profiling_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
else if (call_counting)
|
|
||||||
Yap_emit(count_call_op, (CELL)p, Zero, &cglobs->cint);
|
|
||||||
if (f == FunctorExecuteInMod) {
|
if (f == FunctorExecuteInMod) {
|
||||||
/* compile the first argument only */
|
/* compile the first argument only */
|
||||||
c_arg(1, ArgOfTerm(1,Goal), 1, 0, cglobs);
|
c_arg(1, ArgOfTerm(1,Goal), 1, 0, cglobs);
|
||||||
|
@ -696,9 +696,7 @@ static char *opformat[] =
|
|||||||
"fetch_reg_constant\t%l,%N",
|
"fetch_reg_constant\t%l,%N",
|
||||||
"fetch_integer_reg\t%d,%N",
|
"fetch_integer_reg\t%d,%N",
|
||||||
"fetch_reg_integer\t%d,%N",
|
"fetch_reg_integer\t%d,%N",
|
||||||
"enter_profiling\t\t%g",
|
|
||||||
"retry_profiled\t\t%g",
|
"retry_profiled\t\t%g",
|
||||||
"count_call_op\t\t%g",
|
|
||||||
"count_retry_op\t\t%g",
|
"count_retry_op\t\t%g",
|
||||||
"restore_temps\t\t%l",
|
"restore_temps\t\t%l",
|
||||||
"restore_temps_and_skip\t\t%l",
|
"restore_temps_and_skip\t\t%l",
|
||||||
|
@ -4253,7 +4253,7 @@ PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
|
|||||||
code_p = p->cs.p_code.FirstClause;
|
code_p = p->cs.p_code.FirstClause;
|
||||||
code_p->u.Otapl.d = p->cs.p_code.FirstClause;
|
code_p->u.Otapl.d = p->cs.p_code.FirstClause;
|
||||||
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, Otapl);
|
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, Otapl);
|
||||||
if (p->PredFlags & SpiedPredFlag) {
|
if (p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
@ -4275,7 +4275,7 @@ PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
|
|||||||
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (p->PredFlags & SpiedPredFlag) {
|
if (p->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
2
C/grow.c
2
C/grow.c
@ -1027,9 +1027,7 @@ fix_compiler_instructions(PInstr *pcpc)
|
|||||||
case write_last_struct_op:
|
case write_last_struct_op:
|
||||||
case mark_initialised_pvars_op:
|
case mark_initialised_pvars_op:
|
||||||
case mark_live_regs_op:
|
case mark_live_regs_op:
|
||||||
case enter_profiling_op:
|
|
||||||
case retry_profiled_op:
|
case retry_profiled_op:
|
||||||
case count_call_op:
|
|
||||||
case count_retry_op:
|
case count_retry_op:
|
||||||
case restore_tmps_op:
|
case restore_tmps_op:
|
||||||
case restore_tmps_and_skip_op:
|
case restore_tmps_and_skip_op:
|
||||||
|
@ -5997,7 +5997,7 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ap->cs.p_code.TrueCodeOfPred = ap->cs.p_code.FirstClause;
|
ap->cs.p_code.TrueCodeOfPred = ap->cs.p_code.FirstClause;
|
||||||
if (ap->PredFlags & SpiedPredFlag) {
|
if (ap->PredFlags & (SpiedPredFlag|CountPredFlag|ProfiledPredFlag)) {
|
||||||
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
ap->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||||
ap->CodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
ap->CodeOfPred = (yamop *)(&(ap->OpcodeOfPred));
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
@ -7,15 +7,11 @@
|
|||||||
OPCODE(try_me ,Otapl),
|
OPCODE(try_me ,Otapl),
|
||||||
OPCODE(retry_me ,Otapl),
|
OPCODE(retry_me ,Otapl),
|
||||||
OPCODE(trust_me ,Otapl),
|
OPCODE(trust_me ,Otapl),
|
||||||
OPCODE(enter_profiling ,p),
|
|
||||||
OPCODE(enter_a_profiling ,e),
|
|
||||||
OPCODE(retry_profiled ,p),
|
OPCODE(retry_profiled ,p),
|
||||||
OPCODE(profiled_retry_me ,Otapl),
|
OPCODE(profiled_retry_me ,Otapl),
|
||||||
OPCODE(profiled_trust_me ,Otapl),
|
OPCODE(profiled_trust_me ,Otapl),
|
||||||
OPCODE(profiled_retry_logical ,OtaLl),
|
OPCODE(profiled_retry_logical ,OtaLl),
|
||||||
OPCODE(profiled_trust_logical ,OtILl),
|
OPCODE(profiled_trust_logical ,OtILl),
|
||||||
OPCODE(count_call ,p),
|
|
||||||
OPCODE(count_a_call ,e),
|
|
||||||
OPCODE(count_retry ,p),
|
OPCODE(count_retry ,p),
|
||||||
OPCODE(count_retry_me ,Otapl),
|
OPCODE(count_retry_me ,Otapl),
|
||||||
OPCODE(count_trust_me ,Otapl),
|
OPCODE(count_trust_me ,Otapl),
|
||||||
|
@ -136,9 +136,7 @@ typedef enum compiler_op {
|
|||||||
fetch_args_vc_op,
|
fetch_args_vc_op,
|
||||||
fetch_args_iv_op,
|
fetch_args_iv_op,
|
||||||
fetch_args_vi_op,
|
fetch_args_vi_op,
|
||||||
enter_profiling_op,
|
|
||||||
retry_profiled_op,
|
retry_profiled_op,
|
||||||
count_call_op,
|
|
||||||
count_retry_op,
|
count_retry_op,
|
||||||
restore_tmps_op,
|
restore_tmps_op,
|
||||||
restore_tmps_and_skip_op,
|
restore_tmps_and_skip_op,
|
||||||
|
@ -141,12 +141,6 @@
|
|||||||
return;
|
return;
|
||||||
cl = NEXTOP(cl,e);
|
cl = NEXTOP(cl,e);
|
||||||
break;
|
break;
|
||||||
case _count_a_call:
|
|
||||||
cl = NEXTOP(cl,e);
|
|
||||||
break;
|
|
||||||
case _enter_a_profiling:
|
|
||||||
cl = NEXTOP(cl,e);
|
|
||||||
break;
|
|
||||||
case _pop:
|
case _pop:
|
||||||
cl = NEXTOP(cl,e);
|
cl = NEXTOP(cl,e);
|
||||||
break;
|
break;
|
||||||
|
@ -194,11 +194,9 @@ restore_opcodes(yamop *pc)
|
|||||||
case _Nstop:
|
case _Nstop:
|
||||||
case _allocate:
|
case _allocate:
|
||||||
case _copy_idb_term:
|
case _copy_idb_term:
|
||||||
case _count_a_call:
|
|
||||||
case _cut:
|
case _cut:
|
||||||
case _cut_e:
|
case _cut_e:
|
||||||
case _cut_t:
|
case _cut_t:
|
||||||
case _enter_a_profiling:
|
|
||||||
case _expand_index:
|
case _expand_index:
|
||||||
case _index_blob:
|
case _index_blob:
|
||||||
case _index_dbref:
|
case _index_dbref:
|
||||||
@ -406,10 +404,8 @@ restore_opcodes(yamop *pc)
|
|||||||
pc = NEXTOP(pc,oy);
|
pc = NEXTOP(pc,oy);
|
||||||
break;
|
break;
|
||||||
/* instructions type p */
|
/* instructions type p */
|
||||||
case _count_call:
|
|
||||||
case _count_retry:
|
case _count_retry:
|
||||||
case _deallocate:
|
case _deallocate:
|
||||||
case _enter_profiling:
|
|
||||||
case _lock_lu:
|
case _lock_lu:
|
||||||
case _procceed:
|
case _procceed:
|
||||||
case _retry_profiled:
|
case _retry_profiled:
|
||||||
|
@ -154,11 +154,9 @@
|
|||||||
case _unify_idb_term:
|
case _unify_idb_term:
|
||||||
return found_idb_clause(pc, startp, endp);
|
return found_idb_clause(pc, startp, endp);
|
||||||
case _allocate:
|
case _allocate:
|
||||||
case _count_a_call:
|
|
||||||
case _cut:
|
case _cut:
|
||||||
case _cut_e:
|
case _cut_e:
|
||||||
case _cut_t:
|
case _cut_t:
|
||||||
case _enter_a_profiling:
|
|
||||||
case _index_blob:
|
case _index_blob:
|
||||||
case _index_dbref:
|
case _index_dbref:
|
||||||
case _index_long:
|
case _index_long:
|
||||||
@ -328,10 +326,8 @@
|
|||||||
clause_code = TRUE;
|
clause_code = TRUE;
|
||||||
pc = NEXTOP(pc,p);
|
pc = NEXTOP(pc,p);
|
||||||
break;
|
break;
|
||||||
case _count_call:
|
|
||||||
case _count_retry:
|
case _count_retry:
|
||||||
case _deallocate:
|
case _deallocate:
|
||||||
case _enter_profiling:
|
|
||||||
case _retry_profiled:
|
case _retry_profiled:
|
||||||
pc = NEXTOP(pc,p);
|
pc = NEXTOP(pc,p);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user