updates to gprof
support for __POWER__ Try to saveregs before longjmp. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1485 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
208237d667
commit
f5002fa37f
58
C/absmi.c
58
C/absmi.c
@ -10,8 +10,12 @@
|
|||||||
* *
|
* *
|
||||||
* File: absmi.c *
|
* File: absmi.c *
|
||||||
* comments: Portable abstract machine interpreter *
|
* comments: Portable abstract machine interpreter *
|
||||||
* Last rev: $Date: 2005-12-17 03:25:38 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-12-23 00:20:13 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.189 2005/12/17 03:25:38 vsc
|
||||||
|
* major changes to support online event-based profiling
|
||||||
|
* improve error discovery and restart on scanner.
|
||||||
|
*
|
||||||
* Revision 1.188 2005/12/05 17:16:10 vsc
|
* Revision 1.188 2005/12/05 17:16:10 vsc
|
||||||
* write_depth/3
|
* write_depth/3
|
||||||
* overflow handlings and garbage collection
|
* overflow handlings and garbage collection
|
||||||
@ -524,12 +528,10 @@ Yap_absmi(int inp)
|
|||||||
|
|
||||||
setregs();
|
setregs();
|
||||||
|
|
||||||
|
CACHE_A1();
|
||||||
|
|
||||||
reset_absmi:
|
reset_absmi:
|
||||||
|
|
||||||
#if !S_IN_MEM
|
|
||||||
CACHE_A1();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SP = SP0;
|
SP = SP0;
|
||||||
|
|
||||||
#if USE_THREADED_CODE
|
#if USE_THREADED_CODE
|
||||||
@ -582,6 +584,7 @@ Yap_absmi(int inp)
|
|||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
setregs();
|
setregs();
|
||||||
|
CACHE_A1();
|
||||||
goto reset_absmi;
|
goto reset_absmi;
|
||||||
|
|
||||||
#if !OS_HANDLES_TR_OVERFLOW
|
#if !OS_HANDLES_TR_OVERFLOW
|
||||||
@ -1037,10 +1040,11 @@ Yap_absmi(int inp)
|
|||||||
#endif
|
#endif
|
||||||
ipc = Yap_CleanUpIndex(PREG->u.Ill.I);
|
ipc = Yap_CleanUpIndex(PREG->u.Ill.I);
|
||||||
setregs();
|
setregs();
|
||||||
/* restart index */
|
|
||||||
PREG = ipc;
|
|
||||||
UNLOCK(pe->PELock);
|
UNLOCK(pe->PELock);
|
||||||
if (PREG == NULL) FAIL();
|
/* restart index */
|
||||||
|
if (ipc == NULL) FAIL();
|
||||||
|
PREG = ipc;
|
||||||
|
save_pc();
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
}
|
}
|
||||||
@ -1109,6 +1113,7 @@ Yap_absmi(int inp)
|
|||||||
UNLOCK(lcl->ClLock);
|
UNLOCK(lcl->ClLock);
|
||||||
}
|
}
|
||||||
PREG = Yap_ErLogUpdIndex(cl, PREG);
|
PREG = Yap_ErLogUpdIndex(cl, PREG);
|
||||||
|
save_pc();
|
||||||
} else {
|
} else {
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
}
|
}
|
||||||
@ -1129,6 +1134,7 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PREG = Yap_ErLogUpdIndex(cl, PREG);
|
PREG = Yap_ErLogUpdIndex(cl, PREG);
|
||||||
|
save_pc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1312,6 +1318,8 @@ Yap_absmi(int inp)
|
|||||||
anything yet */
|
anything yet */
|
||||||
READ_UNLOCK(((PredEntry *)(PREG->u.ld.p))->PRWLock);
|
READ_UNLOCK(((PredEntry *)(PREG->u.ld.p))->PRWLock);
|
||||||
PREG = PREG->u.ld.p->CodeOfPred;
|
PREG = PREG->u.ld.p->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1461,6 +1469,7 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
PREG = B->cp_ap;
|
PREG = B->cp_ap;
|
||||||
|
save_pc();
|
||||||
CACHE_TR(B->cp_tr);
|
CACHE_TR(B->cp_tr);
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
failloop:
|
failloop:
|
||||||
@ -2149,6 +2158,8 @@ Yap_absmi(int inp)
|
|||||||
check_stack(NoStackExecute, H);
|
check_stack(NoStackExecute, H);
|
||||||
#endif
|
#endif
|
||||||
PREG = pt0->CodeOfPred;
|
PREG = pt0->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
ENV_YREG[E_CB] = d0;
|
ENV_YREG[E_CB] = d0;
|
||||||
ENDD(d0);
|
ENDD(d0);
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
@ -2209,6 +2220,8 @@ Yap_absmi(int inp)
|
|||||||
DEPTH -= MkIntConstant(2);
|
DEPTH -= MkIntConstant(2);
|
||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
PREG = pt0->CodeOfPred;
|
PREG = pt0->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
ALWAYS_LOOKAHEAD(pt0->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(pt0->OpcodeOfPred);
|
||||||
/* do deallocate */
|
/* do deallocate */
|
||||||
CPREG = (yamop *) ENV_YREG[E_CP];
|
CPREG = (yamop *) ENV_YREG[E_CP];
|
||||||
@ -2269,6 +2282,8 @@ Yap_absmi(int inp)
|
|||||||
CPREG = NEXTOP(PREG, sla);
|
CPREG = NEXTOP(PREG, sla);
|
||||||
ALWAYS_LOOKAHEAD(pt->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(pt->OpcodeOfPred);
|
||||||
PREG = pt->CodeOfPred;
|
PREG = pt->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||||
if (pt->ModuleOfPred) {
|
if (pt->ModuleOfPred) {
|
||||||
@ -2318,6 +2333,8 @@ Yap_absmi(int inp)
|
|||||||
CPREG = NEXTOP(PREG, sla);
|
CPREG = NEXTOP(PREG, sla);
|
||||||
ALWAYS_LOOKAHEAD(ap->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(ap->OpcodeOfPred);
|
||||||
PREG = ap->CodeOfPred;
|
PREG = ap->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
check_depth(DEPTH, ap);
|
check_depth(DEPTH, ap);
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
{
|
{
|
||||||
@ -2535,6 +2552,8 @@ Yap_absmi(int inp)
|
|||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
check_depth(DEPTH, ap);
|
check_depth(DEPTH, ap);
|
||||||
PREG = ap->CodeOfPred;
|
PREG = ap->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
ALWAYS_LOOKAHEAD(ap->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(ap->OpcodeOfPred);
|
||||||
/* do deallocate */
|
/* do deallocate */
|
||||||
CPREG = (yamop *) ENV_YREG[E_CP];
|
CPREG = (yamop *) ENV_YREG[E_CP];
|
||||||
@ -2728,12 +2747,16 @@ Yap_absmi(int inp)
|
|||||||
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;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
|
|
||||||
BOp(procceed, p);
|
BOp(procceed, p);
|
||||||
CACHE_Y_AS_ENV(YREG);
|
CACHE_Y_AS_ENV(YREG);
|
||||||
PREG = CPREG;
|
PREG = CPREG;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
ENV_YREG = ENV;
|
ENV_YREG = ENV;
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
DEPTH = ENV_YREG[E_DEPTH];
|
DEPTH = ENV_YREG[E_DEPTH];
|
||||||
@ -7091,6 +7114,8 @@ Yap_absmi(int inp)
|
|||||||
if (ap->OpcodeOfPred != INDEX_OPCODE) {
|
if (ap->OpcodeOfPred != INDEX_OPCODE) {
|
||||||
/* someone was here before we were */
|
/* someone was here before we were */
|
||||||
PREG = ap->CodeOfPred;
|
PREG = ap->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
WRITE_UNLOCK(ap->PRWLock);
|
WRITE_UNLOCK(ap->PRWLock);
|
||||||
JMPNext();
|
JMPNext();
|
||||||
}
|
}
|
||||||
@ -7106,6 +7131,8 @@ Yap_absmi(int inp)
|
|||||||
setregs();
|
setregs();
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
PREG = ap->CodeOfPred;
|
PREG = ap->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
WRITE_UNLOCK(ap->PRWLock);
|
WRITE_UNLOCK(ap->PRWLock);
|
||||||
}
|
}
|
||||||
JMPNext();
|
JMPNext();
|
||||||
@ -7117,6 +7144,8 @@ Yap_absmi(int inp)
|
|||||||
PredEntry *ap = PredFromDefCode(PREG);
|
PredEntry *ap = PredFromDefCode(PREG);
|
||||||
ap = Yap_GetThreadPred(ap);
|
ap = Yap_GetThreadPred(ap);
|
||||||
PREG = ap->CodeOfPred;
|
PREG = ap->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
}
|
}
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDBOp();
|
ENDBOp();
|
||||||
@ -7270,6 +7299,8 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PREG = UndefCode->CodeOfPred;
|
PREG = UndefCode->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
JMPNext();
|
JMPNext();
|
||||||
ENDBOp();
|
ENDBOp();
|
||||||
@ -7326,6 +7357,8 @@ Yap_absmi(int inp)
|
|||||||
pt0 = SpyCode;
|
pt0 = SpyCode;
|
||||||
P_before_spy = PREG;
|
P_before_spy = PREG;
|
||||||
PREG = pt0->CodeOfPred;
|
PREG = pt0->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
#ifdef LOW_LEVEL_TRACER
|
#ifdef LOW_LEVEL_TRACER
|
||||||
if (Yap_do_low_level_trace)
|
if (Yap_do_low_level_trace)
|
||||||
@ -12363,6 +12396,8 @@ Yap_absmi(int inp)
|
|||||||
ENV = ENV_YREG;
|
ENV = ENV_YREG;
|
||||||
ENV_YREG -= EnvSizeInCells+3;
|
ENV_YREG -= EnvSizeInCells+3;
|
||||||
PREG = COMMA_CODE;
|
PREG = COMMA_CODE;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
d0 = SREG[1];
|
d0 = SREG[1];
|
||||||
goto restart_execute;
|
goto restart_execute;
|
||||||
|
|
||||||
@ -12416,6 +12451,8 @@ Yap_absmi(int inp)
|
|||||||
CPREG = NEXTOP(PREG, sla);
|
CPREG = NEXTOP(PREG, sla);
|
||||||
ALWAYS_LOOKAHEAD(pen->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(pen->OpcodeOfPred);
|
||||||
PREG = pen->CodeOfPred;
|
PREG = pen->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||||
if (pen->ModuleOfPred) {
|
if (pen->ModuleOfPred) {
|
||||||
@ -12695,6 +12732,8 @@ Yap_absmi(int inp)
|
|||||||
check_stack(NoStackPTExecute, H);
|
check_stack(NoStackPTExecute, H);
|
||||||
#endif
|
#endif
|
||||||
PREG = pen->CodeOfPred;
|
PREG = pen->CodeOfPred;
|
||||||
|
/* for profiler */
|
||||||
|
save_pc();
|
||||||
ALWAYS_LOOKAHEAD(pen->OpcodeOfPred);
|
ALWAYS_LOOKAHEAD(pen->OpcodeOfPred);
|
||||||
ENV_YREG[E_CB] = (CELL)B;
|
ENV_YREG[E_CB] = (CELL)B;
|
||||||
#ifdef LOW_LEVEL_TRACER
|
#ifdef LOW_LEVEL_TRACER
|
||||||
@ -12744,6 +12783,9 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ActiveSignals & YAP_TROVF_SIGNAL) {
|
if (ActiveSignals & YAP_TROVF_SIGNAL) {
|
||||||
|
#if SHADOW_S
|
||||||
|
S = SREG;
|
||||||
|
#endif
|
||||||
saveregs_and_ycache();
|
saveregs_and_ycache();
|
||||||
if(!Yap_growtrail (sizeof(CELL) * 16 * 1024L, FALSE)) {
|
if(!Yap_growtrail (sizeof(CELL) * 16 * 1024L, FALSE)) {
|
||||||
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L);
|
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L);
|
||||||
|
63
C/cdmgr.c
63
C/cdmgr.c
@ -11,8 +11,12 @@
|
|||||||
* File: cdmgr.c *
|
* File: cdmgr.c *
|
||||||
* comments: Code manager *
|
* comments: Code manager *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-12-17 03:25:39 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-12-23 00:20:13 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.173 2005/12/17 03:25:39 vsc
|
||||||
|
* major changes to support online event-based profiling
|
||||||
|
* improve error discovery and restart on scanner.
|
||||||
|
*
|
||||||
* Revision 1.172 2005/11/23 03:01:33 vsc
|
* Revision 1.172 2005/11/23 03:01:33 vsc
|
||||||
* fix several bugs in save/restore.b
|
* fix several bugs in save/restore.b
|
||||||
*
|
*
|
||||||
@ -552,13 +556,12 @@ Yap_BuildMegaClause(PredEntry *ap)
|
|||||||
ClauseCodeToStaticClause(ap->cs.p_code.FirstClause);
|
ClauseCodeToStaticClause(ap->cs.p_code.FirstClause);
|
||||||
/* recover the space spent on the original clauses */
|
/* recover the space spent on the original clauses */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
StaticClause *ncl;
|
StaticClause *ncl, *curcl = cl;
|
||||||
|
|
||||||
ncl = cl->ClNext;
|
ncl = cl->ClNext;
|
||||||
if (cl->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_InformOfRemoval((CODEADDR)cl);
|
|
||||||
Yap_FreeCodeSpace((ADDR)cl);
|
Yap_FreeCodeSpace((ADDR)cl);
|
||||||
if (cl->ClCode == ap->cs.p_code.LastClause)
|
if (curcl->ClCode == ap->cs.p_code.LastClause)
|
||||||
break;
|
break;
|
||||||
cl = ncl;
|
cl = ncl;
|
||||||
}
|
}
|
||||||
@ -588,8 +591,7 @@ split_megaclause(PredEntry *ap)
|
|||||||
while (start) {
|
while (start) {
|
||||||
StaticClause *cl = start;
|
StaticClause *cl = start;
|
||||||
start = cl->ClNext;
|
start = cl->ClNext;
|
||||||
if (cl->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_InformOfRemoval((CODEADDR)cl);
|
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
start = NULL;
|
start = NULL;
|
||||||
}
|
}
|
||||||
@ -772,6 +774,7 @@ release_wcls(yamop *cop, OPCODE ecs)
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
Yap_expand_clauses_sz -= (UInt)(NEXTOP((yamop *)NULL,sp)+cop->u.sp.s1*sizeof(yamop *));
|
Yap_expand_clauses_sz -= (UInt)(NEXTOP((yamop *)NULL,sp)+cop->u.sp.s1*sizeof(yamop *));
|
||||||
#endif
|
#endif
|
||||||
|
Yap_InformOfRemoval((CODEADDR)cop);
|
||||||
Yap_FreeCodeSpace((char *)cop);
|
Yap_FreeCodeSpace((char *)cop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -944,8 +947,7 @@ kill_static_child_indxs(StaticIndex *indx)
|
|||||||
kill_static_child_indxs(cl);
|
kill_static_child_indxs(cl);
|
||||||
cl = next;
|
cl = next;
|
||||||
}
|
}
|
||||||
if (indx->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)indx);
|
||||||
Yap_InformOfRemoval((CODEADDR)indx);
|
|
||||||
Yap_FreeCodeSpace((char *)indx);
|
Yap_FreeCodeSpace((char *)indx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -986,8 +988,7 @@ kill_off_lu_block(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap)
|
|||||||
parent = parent->SiblingIndex;
|
parent = parent->SiblingIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)c);
|
||||||
Yap_InformOfRemoval((CODEADDR)c);
|
|
||||||
Yap_FreeCodeSpace((char *)c);
|
Yap_FreeCodeSpace((char *)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1233,8 +1234,7 @@ retract_all(PredEntry *p, int in_use)
|
|||||||
dcl->ClSize = sz;
|
dcl->ClSize = sz;
|
||||||
DeadClauses = dcl;
|
DeadClauses = dcl;
|
||||||
} else {
|
} else {
|
||||||
if (cl->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_InformOfRemoval((CODEADDR)cl);
|
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
}
|
}
|
||||||
p->cs.p_code.NOfClauses = 0;
|
p->cs.p_code.NOfClauses = 0;
|
||||||
@ -1250,8 +1250,7 @@ retract_all(PredEntry *p, int in_use)
|
|||||||
dcl->ClSize = sz;
|
dcl->ClSize = sz;
|
||||||
DeadClauses = dcl;
|
DeadClauses = dcl;
|
||||||
} else {
|
} else {
|
||||||
if (cl->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_InformOfRemoval((CODEADDR)cl);
|
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
}
|
}
|
||||||
p->cs.p_code.NOfClauses--;
|
p->cs.p_code.NOfClauses--;
|
||||||
@ -1973,8 +1972,7 @@ Yap_EraseStaticClause(StaticClause *cl, Term mod) {
|
|||||||
dcl->ClSize = sz;
|
dcl->ClSize = sz;
|
||||||
DeadClauses = dcl;
|
DeadClauses = dcl;
|
||||||
} else {
|
} else {
|
||||||
if (cl->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_InformOfRemoval((CODEADDR)cl);
|
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
}
|
}
|
||||||
if (ap->cs.p_code.NOfClauses == 0) {
|
if (ap->cs.p_code.NOfClauses == 0) {
|
||||||
@ -3553,6 +3551,12 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
case _Nstop:
|
case _Nstop:
|
||||||
return NULL;
|
return NULL;
|
||||||
case _Ystop:
|
case _Ystop:
|
||||||
|
if (pc == YESCODE) {
|
||||||
|
pp = RepPredProp(Yap_GetPredPropByAtom(AtomTrue,CurrentModule));
|
||||||
|
*startp = (CODEADDR)YESCODE;
|
||||||
|
*endp = (CODEADDR)YESCODE; /*+(CELL)(NEXTOP((yamop *)NULL,e));*/
|
||||||
|
return pp;
|
||||||
|
}
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
/* must be an index */
|
/* must be an index */
|
||||||
PredEntry **pep = (PredEntry **)pc->u.l.l;
|
PredEntry **pep = (PredEntry **)pc->u.l.l;
|
||||||
@ -3623,12 +3627,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
break;
|
break;
|
||||||
case _enter_lu_pred:
|
case _enter_lu_pred:
|
||||||
case _stale_lu_index:
|
case _stale_lu_index:
|
||||||
{
|
pc = pc->u.Ill.l2;
|
||||||
LogUpdIndex *icl = ClauseCodeToLogUpdIndex(pc);
|
|
||||||
*startp = (CODEADDR)icl;
|
|
||||||
*endp = (CODEADDR)icl+icl->ClSize;
|
|
||||||
return icl->ClPred;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
/* instructions type p */
|
/* instructions type p */
|
||||||
case _count_call:
|
case _count_call:
|
||||||
@ -3684,16 +3683,17 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
LogUpdClause *cl = pc->u.EC.ClBase;
|
LogUpdClause *cl = pc->u.EC.ClBase;
|
||||||
|
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR)cl;
|
||||||
*endp = (CODEADDR)NEXTOP((yamop *)cl,e);
|
*endp = (CODEADDR)cl+cl->ClSize;
|
||||||
return cl->ClPred;
|
return cl->ClPred;
|
||||||
}
|
}
|
||||||
/* instructions type e */
|
/* instructions type e */
|
||||||
case _unify_idb_term:
|
case _unify_idb_term:
|
||||||
case _copy_idb_term:
|
case _copy_idb_term:
|
||||||
{
|
{
|
||||||
LogUpdClause *cl = (LogUpdClause *)((CELL)pc - (CELL)(((LogUpdClause *)NULL)->ClCode));
|
LogUpdClause *cl = ClauseCodeToLogUpdClause(pc);
|
||||||
|
|
||||||
*startp = (CODEADDR)cl;
|
*startp = (CODEADDR)cl;
|
||||||
*endp = (CODEADDR)NEXTOP((yamop *)cl,e);
|
*endp = (CODEADDR)cl+cl->ClSize;
|
||||||
return cl->ClPred;
|
return cl->ClPred;
|
||||||
}
|
}
|
||||||
case _cut:
|
case _cut:
|
||||||
@ -3812,8 +3812,8 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
case _p_execute:
|
case _p_execute:
|
||||||
clause_code = TRUE;
|
clause_code = TRUE;
|
||||||
pp = RepPredProp(Yap_GetPredPropByFunc(FunctorCall, CurrentModule));
|
pp = RepPredProp(Yap_GetPredPropByFunc(FunctorCall, CurrentModule));
|
||||||
*startp = (CODEADDR)&(pp->CodeOfPred);
|
*startp = (CODEADDR)&(pp->OpcodeOfPred);
|
||||||
*endp = (CODEADDR)&(pp->CodeOfPred);
|
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred),e);
|
||||||
return pp;
|
return pp;
|
||||||
case _fcall:
|
case _fcall:
|
||||||
case _call:
|
case _call:
|
||||||
@ -4173,8 +4173,8 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
case _spy_pred:
|
case _spy_pred:
|
||||||
case _index_pred:
|
case _index_pred:
|
||||||
pp = ((PredEntry *)(Unsigned(pc)-(CELL)(&(((PredEntry *)NULL)->OpcodeOfPred))));
|
pp = ((PredEntry *)(Unsigned(pc)-(CELL)(&(((PredEntry *)NULL)->OpcodeOfPred))));
|
||||||
*startp = (CODEADDR)&(pp->CodeOfPred);
|
*startp = (CODEADDR)&(pp->OpcodeOfPred);
|
||||||
*endp = (CODEADDR)&(pp->CodeOfPred);
|
*endp = (CODEADDR)NEXTOP((yamop *)&(pp->OpcodeOfPred),e);
|
||||||
return pp;
|
return pp;
|
||||||
case _expand_clauses:
|
case _expand_clauses:
|
||||||
/* expansion points may not be found when following the indices tree */
|
/* expansion points may not be found when following the indices tree */
|
||||||
@ -4437,8 +4437,7 @@ p_clean_up_dead_clauses(void)
|
|||||||
while (DeadClauses != NULL) {
|
while (DeadClauses != NULL) {
|
||||||
char *pt = (char *)DeadClauses;
|
char *pt = (char *)DeadClauses;
|
||||||
DeadClauses = DeadClauses->NextCl;
|
DeadClauses = DeadClauses->NextCl;
|
||||||
if (((DeadClause *)pt)->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)pt);
|
||||||
Yap_InformOfRemoval((CODEADDR)pt);
|
|
||||||
Yap_FreeCodeSpace(pt);
|
Yap_FreeCodeSpace(pt);
|
||||||
}
|
}
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -4067,8 +4067,7 @@ complete_lu_erase(LogUpdClause *clau)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clau->ClFlags & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)clau);
|
||||||
Yap_InformOfRemoval((CODEADDR)clau);
|
|
||||||
Yap_FreeCodeSpace((char *)clau);
|
Yap_FreeCodeSpace((char *)clau);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4188,8 +4187,7 @@ MyEraseClause(DynamicClause *clau)
|
|||||||
P = np;
|
P = np;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clmask & ProfFoundMask)
|
Yap_InformOfRemoval((CODEADDR)clau);
|
||||||
Yap_InformOfRemoval((CODEADDR)clau);
|
|
||||||
Yap_FreeCodeSpace((char *)clau);
|
Yap_FreeCodeSpace((char *)clau);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ref->NOfRefsTo)
|
if (ref->NOfRefsTo)
|
||||||
|
114
C/gprof.c
114
C/gprof.c
@ -11,8 +11,11 @@
|
|||||||
* File: gprof.c *
|
* File: gprof.c *
|
||||||
* comments: Interrupt Driven Profiler *
|
* comments: Interrupt Driven Profiler *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-12-17 03:26:38 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-12-23 00:20:13 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $ *
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.1 2005/12/17 03:26:38 vsc
|
||||||
|
* move event profiler outside from stdpreds.c
|
||||||
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
@ -31,7 +34,7 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
Int ProfCalls, ProfGCs, ProfHGrows, ProfSGrows, ProfMallocs;
|
static Int ProfCalls, ProfGCs, ProfHGrows, ProfSGrows, ProfMallocs, ProfOn, ProfOns;
|
||||||
|
|
||||||
#define TIMER_DEFAULT 100
|
#define TIMER_DEFAULT 100
|
||||||
#define MORE_INFO_FILE 1
|
#define MORE_INFO_FILE 1
|
||||||
@ -98,6 +101,7 @@ Yap_inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe,
|
|||||||
static Int order=0;
|
static Int order=0;
|
||||||
|
|
||||||
ProfPreds++;
|
ProfPreds++;
|
||||||
|
ProfOn = TRUE;
|
||||||
if (FPreds != NULL) {
|
if (FPreds != NULL) {
|
||||||
Int temp;
|
Int temp;
|
||||||
order++;
|
order++;
|
||||||
@ -114,6 +118,7 @@ static Int order=0;
|
|||||||
#endif
|
#endif
|
||||||
fprintf(FPreds,"\n");
|
fprintf(FPreds,"\n");
|
||||||
}
|
}
|
||||||
|
ProfOn = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct clause_entry {
|
typedef struct clause_entry {
|
||||||
@ -535,7 +540,7 @@ TreeInsertHelp(rb_red_blk_node* z) {
|
|||||||
x=ProfilerRoot->left;
|
x=ProfilerRoot->left;
|
||||||
while( x != nil) {
|
while( x != nil) {
|
||||||
y=x;
|
y=x;
|
||||||
if (x->key < z->key) { /* x.key > z.key */
|
if (x->key > z->key) { /* x.key > z.key */
|
||||||
x=x->left;
|
x=x->left;
|
||||||
} else { /* x,key <= z.key */
|
} else { /* x,key <= z.key */
|
||||||
x=x->right;
|
x=x->right;
|
||||||
@ -543,7 +548,7 @@ TreeInsertHelp(rb_red_blk_node* z) {
|
|||||||
}
|
}
|
||||||
z->parent=y;
|
z->parent=y;
|
||||||
if ( (y == ProfilerRoot) ||
|
if ( (y == ProfilerRoot) ||
|
||||||
(y->key < z->key)) { /* y.key > z.key */
|
(y->key > z->key)) { /* y.key > z.key */
|
||||||
y->left=z;
|
y->left=z;
|
||||||
} else {
|
} else {
|
||||||
y->right=z;
|
y->right=z;
|
||||||
@ -652,14 +657,14 @@ RBExactQuery(yamop* q) {
|
|||||||
|
|
||||||
if (!ProfilerRoot) return NULL;
|
if (!ProfilerRoot) return NULL;
|
||||||
x=ProfilerRoot->left;
|
x=ProfilerRoot->left;
|
||||||
if (x == nil) return(0);
|
if (x == nil) return NULL;
|
||||||
while(x->key != q) {/*assignemnt*/
|
while(x->key != q) {/*assignemnt*/
|
||||||
if (x->key < q) { /* x->key > q */
|
if (x->key > q) { /* x->key > q */
|
||||||
x=x->left;
|
x=x->left;
|
||||||
} else {
|
} else {
|
||||||
x=x->right;
|
x=x->right;
|
||||||
}
|
}
|
||||||
if ( x == nil) return(0);
|
if ( x == nil) return NULL;
|
||||||
}
|
}
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
@ -673,7 +678,7 @@ RBLookup(yamop *entry) {
|
|||||||
if (current->key <= entry && current->lim >= entry) {
|
if (current->key <= entry && current->lim >= entry) {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
if (entry < current->key)
|
if (entry > current->key)
|
||||||
current = current->right;
|
current = current->right;
|
||||||
else
|
else
|
||||||
current = current->left;
|
current = current->left;
|
||||||
@ -880,7 +885,7 @@ prof_alrm(int signo, siginfo_t *si, ucontext_t *sc)
|
|||||||
void * oldpc= NULL;
|
void * oldpc= NULL;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if __POWERPC__
|
#if __POWERPC__ || _POWER
|
||||||
void * oldpc=(void *) sc->uc_mcontext->ss.srr0; /* 14= POWER PC */
|
void * oldpc=(void *) sc->uc_mcontext->ss.srr0; /* 14= POWER PC */
|
||||||
#else
|
#else
|
||||||
void *NULL;
|
void *NULL;
|
||||||
@ -893,26 +898,31 @@ prof_alrm(int signo, siginfo_t *si, ucontext_t *sc)
|
|||||||
if (Yap_PrologMode & TestMode) {
|
if (Yap_PrologMode & TestMode) {
|
||||||
if (Yap_OffLineProfiler) {
|
if (Yap_OffLineProfiler) {
|
||||||
fprintf(FProf,"%p %p\n", (void *) (Yap_PrologMode & TestMode), P);
|
fprintf(FProf,"%p %p\n", (void *) (Yap_PrologMode & TestMode), P);
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Yap_PrologMode & GCMode) {
|
if (Yap_PrologMode & GCMode) {
|
||||||
ProfGCs++;
|
ProfGCs++;
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Yap_PrologMode & MallocMode) {
|
if (Yap_PrologMode & MallocMode) {
|
||||||
ProfMallocs++;
|
ProfMallocs++;
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Yap_PrologMode & GrowHeapMode) {
|
if (Yap_PrologMode & GrowHeapMode) {
|
||||||
ProfHGrows++;
|
ProfHGrows++;
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Yap_PrologMode & GrowStackMode) {
|
if (Yap_PrologMode & GrowStackMode) {
|
||||||
ProfSGrows++;
|
ProfSGrows++;
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,13 +946,28 @@ prof_alrm(int signo, siginfo_t *si, ucontext_t *sc)
|
|||||||
current_p = P;
|
current_p = P;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Yap_OffLineProfiler) {
|
if (P < (yamop *)Yap_HeapBase || P > (yamop *)HeapTop) {
|
||||||
fprintf(FProf,"0 %p\n", current_p);
|
#if DEBUG
|
||||||
|
fprintf(stderr,"Oops: %p, %p\n", oldpc, current_p);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Yap_OffLineProfiler) {
|
||||||
|
ProfOn = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProfOn) {
|
||||||
|
ProfOns++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProfOn = TRUE;
|
||||||
|
|
||||||
if ((node = RBLookup((yamop *)current_p))) {
|
if ((node = RBLookup((yamop *)current_p))) {
|
||||||
node->pcs++;
|
node->pcs++;
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
PredEntry *pp = NULL;
|
PredEntry *pp = NULL;
|
||||||
@ -954,13 +979,28 @@ prof_alrm(int signo, siginfo_t *si, ucontext_t *sc)
|
|||||||
fprintf(stderr,"lost %p, %d\n", P, Yap_op_from_opcode(P->opc));
|
fprintf(stderr,"lost %p, %d\n", P, Yap_op_from_opcode(P->opc));
|
||||||
#endif
|
#endif
|
||||||
/* lost profiler event !! */
|
/* lost profiler event !! */
|
||||||
|
ProfOn=FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* add this clause as new node to the tree */
|
/* add this clause as new node to the tree */
|
||||||
|
if (start < (CODEADDR)Yap_HeapBase || start > (CODEADDR)HeapTop ||
|
||||||
|
end < (CODEADDR)Yap_HeapBase || end > (CODEADDR)HeapTop) {
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr,"Oops2: %p, %p\n", start, end);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pp->ArityOfPE > 100) {
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr,"%p:%p(%d)-->%p\n",oldpc,current_p,Yap_op_from_opcode(current_p->opc),pp);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
node = RBTreeInsert((yamop *)start, (yamop *)end);
|
node = RBTreeInsert((yamop *)start, (yamop *)end);
|
||||||
node->pe = pp;
|
node->pe = pp;
|
||||||
node->pcs = 1;
|
node->pcs = 1;
|
||||||
}
|
}
|
||||||
|
ProfOn = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -971,26 +1011,36 @@ Yap_InformOfRemoval(CODEADDR clau)
|
|||||||
UInt count;
|
UInt count;
|
||||||
PredEntry *pp;
|
PredEntry *pp;
|
||||||
|
|
||||||
|
if (FPreds != NULL) {
|
||||||
|
/* ricardo? */
|
||||||
|
/* do something */
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!ProfilerRoot) return;
|
if (!ProfilerRoot) return;
|
||||||
|
ProfOn = TRUE;
|
||||||
if (!(x = RBExactQuery((yamop *)clau))) {
|
if (!(x = RBExactQuery((yamop *)clau))) {
|
||||||
/* send message */
|
/* send message */
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* just keep within the other profiler for now */
|
/* just keep within the other profiler for now */
|
||||||
RBDelete(x);
|
|
||||||
pp = x->pe;
|
pp = x->pe;
|
||||||
count = x->pcs;
|
count = x->pcs;
|
||||||
|
/* fprintf(stderr,"D %p:%p\n",x,pp); */
|
||||||
|
RBDelete(x);
|
||||||
/* use a single node to represent all deleted clauses */
|
/* use a single node to represent all deleted clauses */
|
||||||
if (!(node = RBExactQuery((yamop *)pp))) {
|
if (!(node = RBExactQuery((yamop *)(pp->OpcodeOfPred)))) {
|
||||||
node = RBTreeInsert((yamop *)pp, (yamop *)pp);
|
node = RBTreeInsert((yamop *)(pp->OpcodeOfPred), NEXTOP((yamop *)(pp->OpcodeOfPred),e));
|
||||||
node->lim = (yamop *)pp;
|
node->lim = (yamop *)pp;
|
||||||
node->pe = pp;
|
node->pe = pp;
|
||||||
node->pcs = count;
|
node->pcs = count;
|
||||||
/* send message */
|
/* send message */
|
||||||
|
ProfOn = FALSE;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
node->pcs += count;
|
node->pcs += count;
|
||||||
}
|
}
|
||||||
|
ProfOn = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1007,7 +1057,7 @@ reset_tree(void) {
|
|||||||
clean_tree(ProfilerRoot);
|
clean_tree(ProfilerRoot);
|
||||||
Yap_FreeCodeSpace((char *)ProfilerNil);
|
Yap_FreeCodeSpace((char *)ProfilerNil);
|
||||||
ProfilerNil = ProfilerRoot = NULL;
|
ProfilerNil = ProfilerRoot = NULL;
|
||||||
ProfCalls = ProfGCs = ProfHGrows = ProfSGrows = ProfMallocs = 0L;
|
ProfCalls = ProfGCs = ProfHGrows = ProfSGrows = ProfMallocs = ProfOns = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int profend(void);
|
static Int profend(void);
|
||||||
@ -1021,6 +1071,10 @@ profnode(void) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (!(node = (rb_red_blk_node *)IntegerOfTerm(t1)))
|
if (!(node = (rb_red_blk_node *)IntegerOfTerm(t1)))
|
||||||
node = ProfilerRoot;
|
node = ProfilerRoot;
|
||||||
|
/*
|
||||||
|
if (node->key)
|
||||||
|
fprintf(stderr,"%p: %p,%p,%d,%p(%d),%p,%p\n",node,node->key,node->lim,node->pcs,node->pe,node->pe->ArityOfPE,node->right,node->left);
|
||||||
|
*/
|
||||||
if (node->left == ProfilerNil) {
|
if (node->left == ProfilerNil) {
|
||||||
tleft = TermNil;
|
tleft = TermNil;
|
||||||
} else {
|
} else {
|
||||||
@ -1051,7 +1105,8 @@ profglobs(void) {
|
|||||||
Yap_unify(ARG2,MkIntegerTerm(ProfGCs)) &&
|
Yap_unify(ARG2,MkIntegerTerm(ProfGCs)) &&
|
||||||
Yap_unify(ARG3,MkIntegerTerm(ProfHGrows)) &&
|
Yap_unify(ARG3,MkIntegerTerm(ProfHGrows)) &&
|
||||||
Yap_unify(ARG4,MkIntegerTerm(ProfSGrows)) &&
|
Yap_unify(ARG4,MkIntegerTerm(ProfSGrows)) &&
|
||||||
Yap_unify(ARG5,MkIntegerTerm(ProfMallocs));
|
Yap_unify(ARG5,MkIntegerTerm(ProfMallocs)) &&
|
||||||
|
Yap_unify(ARG6,MkIntegerTerm(ProfOns)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int profinit(void)
|
static Int profinit(void)
|
||||||
@ -1067,8 +1122,14 @@ static Int profinit(void)
|
|||||||
|
|
||||||
Yap_dump_code_area_for_profiler();
|
Yap_dump_code_area_for_profiler();
|
||||||
} else {
|
} else {
|
||||||
if (ProfilerRoot)
|
if (ProfilerRoot)
|
||||||
reset_tree();
|
reset_tree();
|
||||||
|
while (!(ProfilerRoot = RBTreeCreate())) {
|
||||||
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||||
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ProfilerOn = -1; /* Inited but not yet started */
|
ProfilerOn = -1; /* Inited but not yet started */
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -1116,14 +1177,6 @@ static Int start_profilers(int msec)
|
|||||||
|
|
||||||
if (ProfilerOn!=-1) return (FALSE); /* have to go through profinit */
|
if (ProfilerOn!=-1) return (FALSE); /* have to go through profinit */
|
||||||
|
|
||||||
if (ProfilerRoot)
|
|
||||||
reset_tree();
|
|
||||||
while (!(ProfilerRoot = RBTreeCreate())) {
|
|
||||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sa.sa_sigaction=prof_alrm;
|
sa.sa_sigaction=prof_alrm;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags=SA_SIGINFO;
|
sa.sa_flags=SA_SIGINFO;
|
||||||
@ -1151,6 +1204,10 @@ static Int profon0(void) {
|
|||||||
return(start_profilers(TIMER_DEFAULT));
|
return(start_profilers(TIMER_DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Int profison(void) {
|
||||||
|
return (ProfilerOn > 0);
|
||||||
|
}
|
||||||
|
|
||||||
static Int profoff(void) {
|
static Int profoff(void) {
|
||||||
if (ProfilerOn>0) {
|
if (ProfilerOn>0) {
|
||||||
setitimer(ITIMER_PROF,NULL,NULL);
|
setitimer(ITIMER_PROF,NULL,NULL);
|
||||||
@ -1242,7 +1299,8 @@ Yap_InitLowProf(void)
|
|||||||
Yap_InitCPred("$offline_showprofres", 0, profres0, SafePredFlag);
|
Yap_InitCPred("$offline_showprofres", 0, profres0, SafePredFlag);
|
||||||
Yap_InitCPred("$offline_showprofres", 1, profres, SafePredFlag);
|
Yap_InitCPred("$offline_showprofres", 1, profres, SafePredFlag);
|
||||||
Yap_InitCPred("$profnode", 6, profnode, SafePredFlag);
|
Yap_InitCPred("$profnode", 6, profnode, SafePredFlag);
|
||||||
Yap_InitCPred("$profglobs", 5, profglobs, SafePredFlag);
|
Yap_InitCPred("$profglobs", 6, profglobs, SafePredFlag);
|
||||||
|
Yap_InitCPred("$profison",0 , profison, SafePredFlag);
|
||||||
Yap_InitCPred("$get_pred_pinfo", 4, getpredinfo, SafePredFlag);
|
Yap_InitCPred("$get_pred_pinfo", 4, getpredinfo, SafePredFlag);
|
||||||
Yap_InitCPred("showprofres", 4, getpredinfo, SafePredFlag);
|
Yap_InitCPred("showprofres", 4, getpredinfo, SafePredFlag);
|
||||||
#endif
|
#endif
|
||||||
|
30
C/index.c
30
C/index.c
@ -11,8 +11,12 @@
|
|||||||
* File: index.c *
|
* File: index.c *
|
||||||
* comments: Indexing a Prolog predicate *
|
* comments: Indexing a Prolog predicate *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-12-17 03:25:39 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-12-23 00:20:13 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.149 2005/12/17 03:25:39 vsc
|
||||||
|
* major changes to support online event-based profiling
|
||||||
|
* improve error discovery and restart on scanner.
|
||||||
|
*
|
||||||
* Revision 1.148 2005/11/24 15:33:52 tiagosoares
|
* Revision 1.148 2005/11/24 15:33:52 tiagosoares
|
||||||
* removed some compilation warnings related to the cut-c code
|
* removed some compilation warnings related to the cut-c code
|
||||||
*
|
*
|
||||||
@ -622,9 +626,11 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint)
|
|||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
Yap_Error_Size = 2*max*sizeof(CELL);
|
Yap_Error_Size = 2*max*sizeof(CELL);
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,4);
|
longjmp(cint->CompilerBotch,4);
|
||||||
#else
|
#else
|
||||||
if (!Yap_growtrail(2*max*CellSize, TRUE)) {
|
if (!Yap_growtrail(2*max*CellSize, TRUE)) {
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,4);
|
longjmp(cint->CompilerBotch,4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3228,6 +3234,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint)
|
|||||||
LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz);
|
LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz);
|
||||||
if (cl == NULL) {
|
if (cl == NULL) {
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,2);
|
longjmp(cint->CompilerBotch,2);
|
||||||
}
|
}
|
||||||
cl->ClFlags = SwitchTableMask|LogUpdMask;
|
cl->ClFlags = SwitchTableMask|LogUpdMask;
|
||||||
@ -3246,6 +3253,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint)
|
|||||||
StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz);
|
StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz);
|
||||||
if (cl == NULL) {
|
if (cl == NULL) {
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,2);
|
longjmp(cint->CompilerBotch,2);
|
||||||
}
|
}
|
||||||
cl->ClFlags = SwitchTableMask;
|
cl->ClFlags = SwitchTableMask;
|
||||||
@ -3579,6 +3587,7 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi
|
|||||||
Yap_expand_clauses_sz += sz;
|
Yap_expand_clauses_sz += sz;
|
||||||
#endif
|
#endif
|
||||||
if ((ncode = (yamop *)Yap_AllocCodeSpace(sz)) == NULL) {
|
if ((ncode = (yamop *)Yap_AllocCodeSpace(sz)) == NULL) {
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch, 2);
|
longjmp(cint->CompilerBotch, 2);
|
||||||
}
|
}
|
||||||
#ifdef LOW_PROF
|
#ifdef LOW_PROF
|
||||||
@ -4140,6 +4149,7 @@ copy_clauses(ClauseDef *max0, ClauseDef *min0, CELL *top, struct intermediates *
|
|||||||
if ((char *)top + sz >= Yap_TrailTop-4096) {
|
if ((char *)top + sz >= Yap_TrailTop-4096) {
|
||||||
Yap_Error_Size = sz;
|
Yap_Error_Size = sz;
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,4);
|
longjmp(cint->CompilerBotch,4);
|
||||||
}
|
}
|
||||||
memcpy((void *)top, (void *)min0, sz);
|
memcpy((void *)top, (void *)min0, sz);
|
||||||
@ -4331,6 +4341,7 @@ compile_index(struct intermediates *cint)
|
|||||||
/* tell how much space we need */
|
/* tell how much space we need */
|
||||||
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,3);
|
longjmp(cint->CompilerBotch,3);
|
||||||
}
|
}
|
||||||
cint->freep = (char *)(cls+NClauses);
|
cint->freep = (char *)(cls+NClauses);
|
||||||
@ -4375,6 +4386,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots)
|
|||||||
return FAILCODE;
|
return FAILCODE;
|
||||||
}
|
}
|
||||||
} else if (setjres != 0) {
|
} else if (setjres != 0) {
|
||||||
|
restore_machine_regs();
|
||||||
recover_from_failed_susp_on_cls(&cint, 0);
|
recover_from_failed_susp_on_cls(&cint, 0);
|
||||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
@ -4425,7 +4437,8 @@ static istack_entry *
|
|||||||
push_stack(istack_entry *sp, Int arg, Term Tag, Term extra, struct intermediates *cint)
|
push_stack(istack_entry *sp, Int arg, Term Tag, Term extra, struct intermediates *cint)
|
||||||
{
|
{
|
||||||
if (sp+1 > (istack_entry *)Yap_TrailTop) {
|
if (sp+1 > (istack_entry *)Yap_TrailTop) {
|
||||||
longjmp(cint->CompilerBotch,4);
|
save_machine_regs();
|
||||||
|
longjmp(cint->CompilerBotch,4);
|
||||||
}
|
}
|
||||||
sp->pos = arg;
|
sp->pos = arg;
|
||||||
sp->val = Tag;
|
sp->val = Tag;
|
||||||
@ -5207,6 +5220,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
/* grow stack */
|
/* grow stack */
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,3);
|
longjmp(cint->CompilerBotch,3);
|
||||||
}
|
}
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
@ -5219,6 +5233,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
if (cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
if (cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
Yap_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,3);
|
longjmp(cint->CompilerBotch,3);
|
||||||
}
|
}
|
||||||
if (ap->PredFlags & LogUpdatePredFlag) {
|
if (ap->PredFlags & LogUpdatePredFlag) {
|
||||||
@ -5463,7 +5478,8 @@ static path_stack_entry *
|
|||||||
push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp, struct intermediates *cint)
|
push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp, struct intermediates *cint)
|
||||||
{
|
{
|
||||||
if (sp+1 > (path_stack_entry *)Yap_TrailTop) {
|
if (sp+1 > (path_stack_entry *)Yap_TrailTop) {
|
||||||
longjmp(cint->CompilerBotch,4);
|
save_machine_regs();
|
||||||
|
longjmp(cint->CompilerBotch,4);
|
||||||
}
|
}
|
||||||
sp->flag = pc_entry;
|
sp->flag = pc_entry;
|
||||||
sp->u.pce.pi_pc = pipc;
|
sp->u.pce.pi_pc = pipc;
|
||||||
@ -5627,6 +5643,7 @@ replace_index_block(ClauseUnion *parent_block, yamop *cod, yamop *ncod, PredEntr
|
|||||||
c->ParentIndex = ncl;
|
c->ParentIndex = ncl;
|
||||||
c = c->SiblingIndex;
|
c = c->SiblingIndex;
|
||||||
}
|
}
|
||||||
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
} else {
|
} else {
|
||||||
StaticIndex
|
StaticIndex
|
||||||
@ -5643,6 +5660,7 @@ replace_index_block(ClauseUnion *parent_block, yamop *cod, yamop *ncod, PredEntr
|
|||||||
}
|
}
|
||||||
c->SiblingIndex = ncl;
|
c->SiblingIndex = ncl;
|
||||||
}
|
}
|
||||||
|
Yap_InformOfRemoval((CODEADDR)cl);
|
||||||
Yap_FreeCodeSpace((char *)cl);
|
Yap_FreeCodeSpace((char *)cl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6100,7 +6118,7 @@ cp_lu_trychain(yamop *codep, yamop *ocodep, yamop *ostart, int flag, PredEntry *
|
|||||||
}
|
}
|
||||||
codep->opc = Yap_opcode(_Ystop);
|
codep->opc = Yap_opcode(_Ystop);
|
||||||
/* this must be updated if we are copying to different place */
|
/* this must be updated if we are copying to different place */
|
||||||
codep->u.l.l = ostart;
|
codep->u.l.l = nblk->ClCode;
|
||||||
return codep;
|
return codep;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6412,7 +6430,7 @@ insertz_in_lu_block(LogUpdIndex *blk, PredEntry *ap, yamop *code)
|
|||||||
where = NEXTOP(where,ld);
|
where = NEXTOP(where,ld);
|
||||||
begin->u.Ill.l2 = where;
|
begin->u.Ill.l2 = where;
|
||||||
where->opc = Yap_opcode(_Ystop);
|
where->opc = Yap_opcode(_Ystop);
|
||||||
where->u.l.l = begin;
|
where->u.l.l = blk->ClCode;
|
||||||
begin->u.Ill.s++;
|
begin->u.Ill.s++;
|
||||||
tgl->ClRefCount++;
|
tgl->ClRefCount++;
|
||||||
return blk->ClCode;
|
return blk->ClCode;
|
||||||
@ -6524,6 +6542,7 @@ expanda_block(path_stack_entry *sp, PredEntry *ap, ClauseDef *cls, int group1, y
|
|||||||
inserta_in_lu_block((LogUpdIndex *)sp->u.cle.block, ap, cls->Code);
|
inserta_in_lu_block((LogUpdIndex *)sp->u.cle.block, ap, cls->Code);
|
||||||
if (new_code == NULL) {
|
if (new_code == NULL) {
|
||||||
recover_from_failed_susp_on_cls(cint, 0);
|
recover_from_failed_susp_on_cls(cint, 0);
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,2);
|
longjmp(cint->CompilerBotch,2);
|
||||||
}
|
}
|
||||||
*sp->u.cle.entry_code = new_code;
|
*sp->u.cle.entry_code = new_code;
|
||||||
@ -6549,6 +6568,7 @@ expandz_block(path_stack_entry *sp, PredEntry *ap, ClauseDef *cls, int group1, y
|
|||||||
insertz_in_lu_block((LogUpdIndex *)sp->u.cle.block, ap, cls->Code);
|
insertz_in_lu_block((LogUpdIndex *)sp->u.cle.block, ap, cls->Code);
|
||||||
if (new_code == NULL) {
|
if (new_code == NULL) {
|
||||||
recover_from_failed_susp_on_cls(cint, 0);
|
recover_from_failed_susp_on_cls(cint, 0);
|
||||||
|
save_machine_regs();
|
||||||
longjmp(cint->CompilerBotch,2);
|
longjmp(cint->CompilerBotch,2);
|
||||||
}
|
}
|
||||||
*sp->u.cle.entry_code =
|
*sp->u.cle.entry_code =
|
||||||
|
12
C/init.c
12
C/init.c
@ -500,7 +500,8 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cl->ClFlags = 0;
|
cl->ClFlags = StaticMask;
|
||||||
|
cl->ClNext = NULL;
|
||||||
cl->ClSize = sz;
|
cl->ClSize = sz;
|
||||||
cl->usc.ClPred = pe;
|
cl->usc.ClPred = pe;
|
||||||
p_code = cl->ClCode;
|
p_code = cl->ClCode;
|
||||||
@ -561,9 +562,10 @@ Yap_InitCmpPred(char *Name, unsigned long int Arity, CmpPredicate cmp_code, int
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
cl->ClFlags = StaticMask;
|
||||||
|
cl->ClNext = NULL;
|
||||||
cl->ClSize = sz;
|
cl->ClSize = sz;
|
||||||
cl->usc.ClPred = pe;
|
cl->usc.ClPred = pe;
|
||||||
cl->ClFlags = 0;
|
|
||||||
p_code = cl->ClCode;
|
p_code = cl->ClCode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -608,7 +610,8 @@ Yap_InitAsmPred(char *Name, unsigned long int Arity, int code, CPredicate def,
|
|||||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitAsmPred");
|
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitAsmPred");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cl->ClFlags = 0;
|
cl->ClFlags = StaticMask;
|
||||||
|
cl->ClNext = NULL;
|
||||||
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sla),e),e);
|
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sla),e),e);
|
||||||
cl->usc.ClPred = pe;
|
cl->usc.ClPred = pe;
|
||||||
p_code = cl->ClCode;
|
p_code = cl->ClCode;
|
||||||
@ -744,7 +747,8 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
|
|||||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack");
|
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cl->ClFlags = 0L;
|
cl->ClFlags = StaticMask;
|
||||||
|
cl->ClNext = NULL;
|
||||||
#ifdef CUT_C
|
#ifdef CUT_C
|
||||||
cl->ClSize =
|
cl->ClSize =
|
||||||
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,lds),lds),lds),e);
|
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,lds),lds),lds),e);
|
||||||
|
@ -1244,6 +1244,7 @@ InteractSIGINT(int ch) {
|
|||||||
} else {
|
} else {
|
||||||
Yap_Error(PURE_ABORT, TermNil, "");
|
Yap_Error(PURE_ABORT, TermNil, "");
|
||||||
/* in case someone mangles the P register */
|
/* in case someone mangles the P register */
|
||||||
|
save_machine_regs();
|
||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
/* don't even think about trying this */
|
/* don't even think about trying this */
|
||||||
#else
|
#else
|
||||||
|
6
H/Regs.h
6
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.31 2005-11-18 18:50:34 tiagosoares Exp $ *
|
* version: $Id: Regs.h,v 1.32 2005-12-23 00:20:14 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#undef PUSH_X
|
#undef PUSH_X
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _POWER
|
#if defined(_POWER) || defined(__POWERPC__)
|
||||||
#undef PUSH_REGS
|
#undef PUSH_REGS
|
||||||
#undef PUSH_X
|
#undef PUSH_X
|
||||||
#endif
|
#endif
|
||||||
@ -513,7 +513,7 @@ EXTERN inline void restore_TR(void) {
|
|||||||
TR = Yap_REGS.TR_;
|
TR = Yap_REGS.TR_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__GNUC__) && defined(_POWER)
|
#elif defined(__GNUC__) && (defined(_POWER) || defined(__POWERPC__))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* Last rev: December 90 *
|
* Last rev: December 90 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Original Tag Scheme for machines with 32 bits adresses *
|
* comments: Original Tag Scheme for machines with 32 bits adresses *
|
||||||
* version: $Id: Tags_32Ops.h,v 1.1 2005-05-27 22:27:06 rslopes Exp $ *
|
* version: $Id: Tags_32Ops.h,v 1.2 2005-12-23 00:20:14 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -78,7 +78,7 @@ are now 1 in compound terms and structures.
|
|||||||
This allows optimisation of switch_list
|
This allows optimisation of switch_list
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#if defined(i386) || defined(sparc) || defined(_POWER) || defined(__sparc)
|
#if defined(i386) || defined(sparc) || defined(_POWER) || defined(__POWERPC__) || defined(__sparc)
|
||||||
#define UNIQUE_TAG_FOR_PAIRS 1
|
#define UNIQUE_TAG_FOR_PAIRS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
4
H/Yap.h
4
H/Yap.h
@ -10,7 +10,7 @@
|
|||||||
* File: Yap.h.m4 *
|
* File: Yap.h.m4 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: main header file for YAP *
|
* comments: main header file for YAP *
|
||||||
* version: $Id: Yap.h,v 1.10 2005-12-17 03:25:39 vsc Exp $ *
|
* version: $Id: Yap.h,v 1.11 2005-12-23 00:20:14 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -642,7 +642,7 @@ typedef enum
|
|||||||
if you place things in the lower addresses (power to the libc people).
|
if you place things in the lower addresses (power to the libc people).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (defined(_AIX) || defined(_WIN32) || defined(__APPLE__) || defined(sparc) || defined(__sparc) || defined(mips) || defined(__FreeBSD__) || defined(__POWERPC__) || defined(__linux__) || defined(IN_SECOND_QUADRANT) || defined(__CYGWIN__))
|
#if (defined(_AIX) || defined(_WIN32) || defined(__APPLE__) || defined(sparc) || defined(__sparc) || defined(mips) || defined(__FreeBSD__) || defined(_POWER) || defined(__POWERPC__) || defined(__linux__) || defined(IN_SECOND_QUADRANT) || defined(__CYGWIN__))
|
||||||
#define USE_LOW32_TAGS 1
|
#define USE_LOW32_TAGS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#define USE_PREFETCH 1
|
#define USE_PREFETCH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_POWER)
|
#if defined(_POWER) || defined(__POWERPC__)
|
||||||
#define SHADOW_P 1
|
#define SHADOW_P 1
|
||||||
#define SHADOW_REGS 1
|
#define SHADOW_REGS 1
|
||||||
#define USE_PREFETCH 1
|
#define USE_PREFETCH 1
|
||||||
@ -553,7 +553,7 @@ typedef CELL label;
|
|||||||
|
|
||||||
#endif /* PRECOMPUTE_REGADDRESS */
|
#endif /* PRECOMPUTE_REGADDRESS */
|
||||||
|
|
||||||
/* The Unification Stack is the Auxiliary stack */
|
/* The Unification Stack is the Auxiliary stack */
|
||||||
|
|
||||||
#define SP0 ((CELL *)AuxTop)
|
#define SP0 ((CELL *)AuxTop)
|
||||||
#define SP AuxSp
|
#define SP AuxSp
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.0:</h2>
|
<h2>Yap-5.1.0:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> FIXED: handle assert/retracts and gprof overhead right. </li>
|
||||||
|
<li> FIXED: indexing code was not setting up properly registers on longjmps. </li>
|
||||||
|
<li> FIXED: use RISC architecture on MacOsX (__POWERPC__ + _POWER). </li>
|
||||||
|
<li> FIXED: init system predicates should generate full static clause. </li>
|
||||||
<li> NEW: tabling does not conflit with depth limit (Trevor Walker). </li>
|
<li> NEW: tabling does not conflit with depth limit (Trevor Walker). </li>
|
||||||
<li> NEW: make scanner restartable on seekable files (Nuno Fonseca). </li>
|
<li> NEW: make scanner restartable on seekable files (Nuno Fonseca). </li>
|
||||||
<li> NEW: improve error discovery within scanner (Jude Shavlik). </li>
|
<li> NEW: improve error discovery within scanner (Jude Shavlik). </li>
|
||||||
|
@ -67,23 +67,40 @@ showprofres :-
|
|||||||
'$proftype'(offline),
|
'$proftype'(offline),
|
||||||
'$offline_showprofres'.
|
'$offline_showprofres'.
|
||||||
showprofres :-
|
showprofres :-
|
||||||
'$profglobs'(Tot,GCs,HGrows,SGrows,Mallocs),
|
('$profison' -> profoff, Stop = true ; Stop = false),
|
||||||
|
'$profglobs'(Tot,GCs,HGrows,SGrows,Mallocs,ProfOns),
|
||||||
% root node has no useful info.
|
% root node has no useful info.
|
||||||
'$get_all_profinfo'(0,[],ProfInfo0),
|
'$get_all_profinfo'(0,[],ProfInfo0,0,TotCode),
|
||||||
sort(ProfInfo0,ProfInfo),
|
msort(ProfInfo0,ProfInfo),
|
||||||
'$get_ppreds'(ProfInfo,Preds0),
|
'$get_ppreds'(ProfInfo,Preds0),
|
||||||
'$add_extras_prof'(GCs, HGrows, SGrows, Mallocs, Preds0, PredsI),
|
'$add_extras_prof'(GCs, HGrows, SGrows, Mallocs, Preds0, PredsI),
|
||||||
keysort(PredsI,Preds),
|
keysort(PredsI,Preds),
|
||||||
'$sum_alls'(Preds,0,Tot0),
|
'$sum_alls'(Preds,0,Tot0),
|
||||||
Accounted is -Tot0,
|
Accounted is -Tot0,
|
||||||
format(user_error,'~d ticks, ~d accounted for~n',[Tot,Accounted]),
|
(ProfOns == 0 ->
|
||||||
'$display_preds'(Preds, Tot, 0, 1).
|
format(user_error,'~d ticks, ~d accounted for~n',[Tot,Accounted])
|
||||||
|
;
|
||||||
|
format(user_error,'~d ticks, ~d accounted for (~d overhead)~n',[Tot,Accounted,ProfOns])
|
||||||
|
),
|
||||||
|
'$display_preds'(Preds, Tot, 0, 1),
|
||||||
|
(Stop = true -> profon ; true).
|
||||||
|
|
||||||
'$get_all_profinfo'([],L,L) :- !.
|
/*
|
||||||
'$get_all_profinfo'(Node,L0,Lf) :-
|
'$check_duplicates'([]).
|
||||||
|
'$check_duplicates'([A,A|ProfInfo]) :- !,
|
||||||
|
write(A),nl,
|
||||||
|
'$check_duplicates'(ProfInfo).
|
||||||
|
'$check_duplicates'([_|ProfInfo]) :-
|
||||||
|
'$check_duplicates'(ProfInfo).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
'$get_all_profinfo'([],L,L,Tot,Tot) :- !.
|
||||||
|
'$get_all_profinfo'(Node,L0,Lf,Tot0,Totf) :-
|
||||||
'$profnode'(Node,Clause,PredId,Count,Left,Right),
|
'$profnode'(Node,Clause,PredId,Count,Left,Right),
|
||||||
'$get_all_profinfo'(Left,L0,Li),
|
Tot1 is Tot0+Count,
|
||||||
'$get_all_profinfo'(Right,[gprof(PredId,Clause,Count)|Li],Lf).
|
'$get_all_profinfo'(Left,L0,Li,Tot1,Tot2),
|
||||||
|
'$get_all_profinfo'(Right,[gprof(PredId,Clause,Count)|Li],Lf,Tot2,Totf).
|
||||||
|
|
||||||
'$get_ppreds'([],[]).
|
'$get_ppreds'([],[]).
|
||||||
'$get_ppreds'([gprof(0,_,0)|Cls],Ps) :- !,
|
'$get_ppreds'([gprof(0,_,0)|Cls],Ps) :- !,
|
||||||
|
Reference in New Issue
Block a user