more fixes for low level profiler.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@830 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-05-21 12:15:09 +00:00
parent 0afb07931f
commit 7a6f4037bd
3 changed files with 25 additions and 6 deletions

View File

@ -2590,7 +2590,4 @@ Yap_InitComma(void)
code_p->opc = opcode(_p_execute_tail); code_p->opc = opcode(_p_execute_tail);
GONEXT(e); GONEXT(e);
} }
#ifdef LOW_PROF
Yap_inform_profiler_of_clause(COMMA_CODE, code_p, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,2)));
#endif
} }

View File

@ -2565,6 +2565,17 @@ add_code_in_pred(PredEntry *pp) {
READ_LOCK(pp->PRWLock); READ_LOCK(pp->PRWLock);
/* check if the codeptr comes from the indexing code */ /* check if the codeptr comes from the indexing code */
if (pp->PredFlags & (CPredFlag|AsmPredFlag)) {
char *code_end;
StaticClause *cl;
clcode = pp->CodeOfPred;
cl = ClauseCodeToStaticClause(clcode);
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl);
inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
return;
}
clcode = pp->cs.p_code.TrueCodeOfPred; clcode = pp->cs.p_code.TrueCodeOfPred;
if (pp->PredFlags & IndexedPredFlag) { if (pp->PredFlags & IndexedPredFlag) {
char *code_end; char *code_end;
@ -2590,7 +2601,7 @@ add_code_in_pred(PredEntry *pp) {
} else { } else {
cl = (CODEADDR)ClauseCodeToStaticClause(clcode); cl = (CODEADDR)ClauseCodeToStaticClause(clcode);
} }
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl); code_end = cl + Yap_SizeOfBlock((CODEADDR)cl);
inform_profiler_of_clause(clcode, (yamop *)code_end, pp); inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
if (clcode == pp->cs.p_code.LastClause) if (clcode == pp->cs.p_code.LastClause)
break; break;
@ -2608,10 +2619,22 @@ Yap_dump_code_area_for_profiler(void) {
for (i_table = NoOfModules-1; i_table >= 0; --i_table) { for (i_table = NoOfModules-1; i_table >= 0; --i_table) {
PredEntry *pp = ModulePred[i_table]; PredEntry *pp = ModulePred[i_table];
while (pp != NULL) { while (pp != NULL) {
if (pp->ArityOfPE) {
fprintf(stderr,"%s/%d %p\n",
RepAtom(NameOfFunctor(pp->FunctorOfPred))->StrOfAE,
pp->ArityOfPE,
pp);
} else {
fprintf(stderr,"%s %p\n",
RepAtom((Atom)(pp->FunctorOfPred))->StrOfAE,
pp);
}
add_code_in_pred(pp); add_code_in_pred(pp);
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
} }
inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)));
inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)));
} }
#endif /* LOW_PROF */ #endif /* LOW_PROF */

View File

@ -205,10 +205,9 @@ static void
search_pc_pred(yamop *pc_ptr,clauseentry *beg, clauseentry *end) { search_pc_pred(yamop *pc_ptr,clauseentry *beg, clauseentry *end) {
/* binary search, dynamic clauses not supported yet */ /* binary search, dynamic clauses not supported yet */
Int i, j, f, l; Int i, j, f, l;
f = 0; l = (end-beg)-1; f = 0; l = (end-beg);
i = l/2; i = l/2;
while (TRUE) { while (TRUE) {
printf("i %d\n", i);
if (beg[i].beg > pc_ptr) { if (beg[i].beg > pc_ptr) {
l = i-1; l = i-1;
if (l < f) { if (l < f) {