fix fix on index expansion

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1570 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-03-21 19:20:35 +00:00
parent a578a778a4
commit b38d4fc941
3 changed files with 15 additions and 7 deletions

View File

@ -11,8 +11,11 @@
* File: index.c *
* comments: Indexing a Prolog predicate *
* *
* Last rev: $Date: 2006-03-21 17:11:39 $,$Author: vsc $ *
* Last rev: $Date: 2006-03-21 19:20:34 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.156 2006/03/21 17:11:39 vsc
* prevent breakage
*
* Revision 1.155 2006/03/21 15:06:35 vsc
* fixes to handle expansion of dyn amic predicates more efficiently.
*
@ -4845,7 +4848,7 @@ count_clauses_left(yamop *cl, PredEntry *ap)
static ClausePointer
index_jmp(ClausePointer cur, yamop *ipc, int is_lu, yamop *e_code)
{
if (cur.lui == NULL || TRUE) {
if (cur.lui == NULL) {
cur.lui = NULL;
return cur;
}
@ -4864,8 +4867,8 @@ index_jmp(ClausePointer cur, yamop *ipc, int is_lu, yamop *e_code)
LogUpdIndex *pcur = lcur->ParentIndex;
if (ipc >= pcur->ClCode && ipc <= (yamop *)((CODEADDR)pcur+pcur->ClSize)) {
cur.lui = pcur;
return cur;
}
return cur;
}
/* maybe I am a new group */
ncur = ClauseCodeToLogUpdIndex(ipc);
@ -5192,6 +5195,7 @@ expand_index(struct intermediates *cint) {
yamop *newpc;
Functor f;
parentcl = code_to_indexcl(ipc->u.sssl.l,is_lu);
s_reg = RepAppl(t);
f = (Functor)(*s_reg++);
if (op == _switch_on_func) {
@ -5202,12 +5206,12 @@ expand_index(struct intermediates *cint) {
newpc = (yamop *)(fe->Label);
labp = (yamop **)(&(fe->Label));
parentcl = code_to_indexcl(ipc->u.sssl.l,is_lu);
if (newpc == e_code) {
/* we found it */
ipc = NULL;
} else {
ipc = newpc;
parentcl = index_jmp(parentcl, ipc, is_lu, e_code);
}
}
break;
@ -5217,6 +5221,7 @@ expand_index(struct intermediates *cint) {
{
AtomSwiEntry *ae;
parentcl = code_to_indexcl(ipc->u.sssl.l,is_lu);
if (op == _switch_on_cons) {
ae = lookup_c_hash(t,ipc->u.sssl.l,ipc->u.sssl.s);
} else {
@ -5224,12 +5229,12 @@ expand_index(struct intermediates *cint) {
}
labp = (yamop **)(&(ae->Label));
parentcl = code_to_indexcl(ipc->u.sssl.l,is_lu);
if (ae->Label == (CELL)e_code) {
/* we found it */
ipc = NULL;
} else {
ipc = (yamop *)(ae->Label);
parentcl = index_jmp(parentcl, ipc, is_lu, e_code);
}
}
break;

View File

@ -16,9 +16,12 @@
<h2>Yap-5.1.0:</h2>
<ul>
<li> FIXED: typo in manual (obs Bernd Gutmann).</li>
<li> NEW: track the current block more aggressively, to avoid
expand_index taking too long searching for a block.</li>
<li> FIXED: if LU indices have groups, we should create
try-retry-trust sequences immediately, otherwise LU semantics can be
compromised (obs ).</li>
compromised (obs Bernd Gutmann).</li>
<li> FIXED: when cleaning trail, gc would not always clean value
field! (obs Remko Troncon).</li>
<li> FIXED: when cleaning megaclauses, clean flag too.</li>

View File

@ -171,7 +171,7 @@ find_used([],_,L,L).
find_used([M|Mods],Mods0,L0,Lf) :-
in(M,Mods0), !,
find_used(Mods,Mods0,[M|L0],Lf).
find_used([M|Mods],Mods0,L0,Lf) :-
find_used([_|Mods],Mods0,L0,Lf) :-
find_used(Mods,Mods0,L0,Lf).
in(X,[X|_]).