Merge branch 'master' of ssh://yap.git.sf.net/gitroot/yap/yap-6.3

This commit is contained in:
Vitor Santos Costa 2011-06-26 23:14:48 +01:00
commit 9d00e3426c
13 changed files with 81 additions and 69 deletions

View File

@ -7928,11 +7928,11 @@ Yap_absmi(int inp)
\************************************************************************/
/* enter logical pred */
BOp(enter_lu_pred, Ills);
BOp(enter_lu_pred, Illss);
check_trail(TR);
/* mark the indexing code */
{
LogUpdIndex *cl = PREG->u.Ills.I;
LogUpdIndex *cl = PREG->u.Illss.I;
PredEntry *ap = cl->ClPred;
if (ap->LastCallOfPred != LUCALL_EXEC) {
@ -7947,8 +7947,8 @@ Yap_absmi(int inp)
/* fprintf(stderr,"R %x--%d--%ul\n",ap,ap->TimeStampOfPred,ap->ArityOfPE);*/
}
*--YREG = MkIntegerTerm(ap->TimeStampOfPred);
/* fprintf(stderr,"> %p/%p %d %d\n",cl,ap,ap->TimeStampOfPred,PREG->u.Ills.s);*/
PREG = PREG->u.Ills.l1;
/* fprintf(stderr,"> %p/%p %d %d\n",cl,ap,ap->TimeStampOfPred,PREG->u.Illss.s);*/
PREG = PREG->u.Illss.l1;
/* indicate the indexing code is being used */
#if MULTIPLE_STACKS
/* just store a reference */

View File

@ -482,15 +482,16 @@ a_lucl(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip,
if (pass_no) {
LogUpdIndex *lcl = (LogUpdIndex *)cip->code_addr;
code_p->opc = emit_op(opcode);
code_p->u.Ills.I = lcl;
code_p->u.Illss.I = lcl;
cip->cpc->rnd4 = (CELL)code_p;
cip->current_try_lab = &code_p->u.Ills.l1;
cip->current_trust_lab = &code_p->u.Ills.l2;
code_p->u.Ills.l1 = NULL;
code_p->u.Ills.l2 = NULL;
code_p->u.Ills.s = cip->cpc->rnd3;
cip->current_try_lab = &code_p->u.Illss.l1;
cip->current_trust_lab = &code_p->u.Illss.l2;
code_p->u.Illss.l1 = NULL;
code_p->u.Illss.l2 = NULL;
code_p->u.Illss.s = cip->cpc->rnd3;
code_p->u.Illss.e = 0;
}
GONEXT(Ills);
GONEXT(Illss);
return code_p;
}

View File

@ -1197,16 +1197,17 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
case _enter_lu_pred:
{
yamop *oipc = ipc;
if (ipc->u.Ills.I->ClFlags & InUseMask || ipc->u.Ills.I->ClRefCount)
if (ipc->u.Illss.I->ClFlags & InUseMask || ipc->u.Illss.I->ClRefCount)
return;
#ifdef DEBUG
Yap_DirtyCps+=ipc->u.Ills.s;
Yap_LiveCps-=ipc->u.Ills.s;
Yap_DirtyCps+=ipc->u.Illss.s;
Yap_LiveCps-=ipc->u.Illss.s;
#endif
ipc = ipc->u.Ills.l1;
ipc = ipc->u.Illss.l1;
/* in case we visit again */
oipc->u.Ills.l1 = FAILCODE;
oipc->u.Ills.s = 0;
oipc->u.Illss.l1 = FAILCODE;
oipc->u.Illss.s = 0;
oipc->u.Illss.e = 0;
}
break;
case _try_in:

View File

@ -3722,8 +3722,8 @@ index_sz(LogUpdIndex *x)
endop = Yap_opcode(_profiled_trust_logical);
else
endop = Yap_opcode(_trust_logical);
start = start->u.Ills.l1;
if (start->u.Ills.s) do {
start = start->u.Illss.l1;
if (start->u.Illss.s) do {
sz += (UInt)NEXTOP((yamop*)NULL,OtaLl);
op1 = start->opc;
count++;

View File

@ -558,8 +558,8 @@ recover_from_failed_susp_on_cls(struct intermediates *cint, UInt sz)
case enter_lu_op:
if (cpc->rnd4) {
yamop *code_p = (yamop *)cpc->rnd4;
yamop *first = code_p->u.Ills.l1;
yamop *last = code_p->u.Ills.l2;
yamop *first = code_p->u.Illss.l1;
yamop *last = code_p->u.Illss.l2;
while (first) {
yamop *next = first->u.OtaLl.n;
LogUpdClause *cl = first->u.OtaLl.d;
@ -1001,9 +1001,9 @@ has_cut(yamop *pc)
#endif /* TABLING */
pc = NEXTOP(pc,Otapl);
break;
/* instructions type Ills */
/* instructions type Illss */
case _enter_lu_pred:
pc = pc->u.Ills.l1;
pc = pc->u.Illss.l1;
break;
case _execute:
case _dexecute:
@ -4059,7 +4059,7 @@ expand_index(struct intermediates *cint) {
break;
case _enter_lu_pred:
/* no useful info */
ipc = ipc->u.Ills.l1;
ipc = ipc->u.Illss.l1;
break;
case _retry_profiled:
case _count_retry:
@ -4289,7 +4289,7 @@ expand_index(struct intermediates *cint) {
if (alt != NULL && ap->PredFlags & LogUpdatePredFlag) {
op_numbers fop = Yap_op_from_opcode(alt->opc);
if (fop == _enter_lu_pred)
alt = alt->u.Ills.l1;
alt = alt->u.Illss.l1;
}
ipc = NULL;
break;
@ -5080,8 +5080,8 @@ find_last_clause(yamop *start)
static void
remove_clause_from_index(yamop *header, LogUpdClause *cl)
{
yamop **prevp = &(header->u.Ills.l1);
yamop *curp = header->u.Ills.l1;
yamop **prevp = &(header->u.Illss.l1);
yamop *curp = header->u.Illss.l1;
if (curp->u.OtaLl.d == cl) {
yamop *newp = curp->u.OtaLl.n;
@ -5095,13 +5095,14 @@ remove_clause_from_index(yamop *header, LogUpdClause *cl)
curp = curp->u.OtaLl.n;
}
/* in case we were the last */
if (curp == header->u.Ills.l2)
header->u.Ills.l2 = ocurp;
if (curp == header->u.Illss.l2)
header->u.Illss.l2 = ocurp;
if (ocurp != ocurp0)
ocurp->opc = curp->opc;
ocurp->u.OtILl.n = curp->u.OtaLl.n;
ocurp->u.OtILl.block = curp->u.OtILl.block;
}
header->u.Illss.e--;
#ifdef DEBUG
Yap_DirtyCps--;
Yap_FreedCps++;
@ -5117,7 +5118,7 @@ remove_dirty_clauses_from_index(yamop *header)
LogUpdClause *cl;
yamop *previouscurp;
OPCODE endop = Yap_opcode(_trust_logical);
yamop **prevp= &(header->u.Ills.l1), *curp = header->u.Ills.l1;
yamop **prevp= &(header->u.Illss.l1), *curp = header->u.Illss.l1;
OPCODE startopc = curp->opc;
PredEntry *ap = curp->u.OtaLl.d->ClPred;
@ -5128,6 +5129,7 @@ remove_dirty_clauses_from_index(yamop *header)
while ((cl = curp->u.OtaLl.d)->ClFlags & ErasedMask) {
yamop *ocurp = curp;
header->u.Illss.e--;
#ifdef DEBUG
Yap_DirtyCps--;
Yap_FreedCps++;
@ -5141,12 +5143,15 @@ remove_dirty_clauses_from_index(yamop *header)
curp->opc = startopc;
if (curp->opc == endop)
return;
if (!header->u.Illss.e)
return;
previouscurp = curp;
curp = curp->u.OtaLl.n;
while (TRUE) {
if ((cl = curp->u.OtaLl.d)->ClFlags & ErasedMask) {
yamop *ocurp = curp;
header->u.Illss.e--;
#ifdef DEBUG
Yap_DirtyCps--;
Yap_FreedCps++;
@ -5156,7 +5161,7 @@ remove_dirty_clauses_from_index(yamop *header)
previouscurp->opc = endop;
previouscurp->u.OtILl.block = curp->u.OtILl.block;
previouscurp->u.OtILl.n = NULL;
header->u.Ills.l2 = previouscurp;
header->u.Illss.l2 = previouscurp;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,OtILl);
Yap_FreeCodeSpace((ADDR)curp);
return;
@ -5165,6 +5170,8 @@ remove_dirty_clauses_from_index(yamop *header)
curp = curp->u.OtaLl.n;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,OtaLl);
Yap_FreeCodeSpace((ADDR)ocurp);
if (!header->u.Illss.e)
return;
} else {
previouscurp = curp;
if (curp->opc == endop) {
@ -5201,15 +5208,15 @@ kill_clause(yamop *ipc, yamop *bg, yamop *lt, path_stack_entry *sp0, PredEntry *
return kill_block(sp+1, ap);
}
/* weird case ????? */
if (!start->u.Ills.s){
if (!start->u.Illss.s){
/* ERROR */
Yap_Error(INTERNAL_ERROR, TermNil, "Ills.s == 0 %p", ipc);
Yap_Error(INTERNAL_ERROR, TermNil, "Illss.s == 0 %p", ipc);
return sp;
}
if (start->u.Ills.s == 1) {
if (start->u.Illss.s == 1) {
/* we need to discover which clause is left and then die */
path_stack_entry *nsp;
LogUpdClause *tgl = find_last_clause(start->u.Ills.l1);
LogUpdClause *tgl = find_last_clause(start->u.Illss.l1);
nsp = sp;
while ((--nsp)->flag != block_entry);
@ -5585,20 +5592,20 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
/* ERROR */
break;
case _enter_lu_pred:
ipc->u.Ills.s++;
icl = ipc->u.Ills.I;
ipc->u.Illss.s++;
icl = ipc->u.Illss.I;
if (first) {
if (ap->PredFlags & CountPredFlag)
ipc->u.Ills.l1->opc = Yap_opcode(_count_retry_logical);
ipc->u.Illss.l1->opc = Yap_opcode(_count_retry_logical);
else if (ap->PredFlags & ProfiledPredFlag)
ipc->u.Ills.l1->opc = Yap_opcode(_profiled_retry_logical);
ipc->u.Illss.l1->opc = Yap_opcode(_profiled_retry_logical);
else
ipc->u.Ills.l1->opc = Yap_opcode(_retry_logical);
ipc->u.Ills.l1 = add_try(ap, cls, ipc->u.Ills.l1, cint);
ipc->u.Illss.l1->opc = Yap_opcode(_retry_logical);
ipc->u.Illss.l1 = add_try(ap, cls, ipc->u.Illss.l1, cint);
} else {
/* just go to next instruction */
yamop *end = add_trust(icl, cls, cint),
*old = ipc->u.Ills.l2;
*old = ipc->u.Illss.l2;
/* we used to have two clauses */
if (ap->PredFlags & CountPredFlag)
@ -5609,7 +5616,7 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
old->opc = Yap_opcode(_retry_logical);
old->u.OtaLl.n = end;
old->u.OtaLl.s = ap->ArityOfPE;
ipc->u.Ills.l2 = end;
ipc->u.Illss.l2 = end;
}
ipc = pop_path(&sp, cls, ap, cint);
break;
@ -6204,7 +6211,8 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
ipc = pop_path(&sp, cls, ap, cint);
break;
case _enter_lu_pred:
ipc->u.Ills.s--;
ipc->u.Illss.s--;
ipc->u.Illss.e++;
#ifdef DEBUG
Yap_DirtyCps++;
Yap_LiveCps--;
@ -6807,7 +6815,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
break;
case _enter_lu_pred:
{
LogUpdIndex *cl = ipc->u.Ills.I;
LogUpdIndex *cl = ipc->u.Illss.I;
PredEntry *ap = cl->ClPred;
if (ap->LastCallOfPred != LUCALL_EXEC) {
@ -6834,7 +6842,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
}
#endif
}
ipc = ipc->u.Ills.l1;
ipc = ipc->u.Illss.l1;
break;
case _try_logical:
if (b0 == NULL)
@ -7377,7 +7385,7 @@ Yap_NthClause(PredEntry *ap, Int ncls)
}
return NULL;
case _enter_lu_pred:
ipc = ipc->u.Ills.l1;
ipc = ipc->u.Illss.l1;
break;
case _lock_lu:
ipc = NEXTOP(ipc,p);
@ -7460,7 +7468,7 @@ Yap_CleanUpIndex(LogUpdIndex *blk)
start = NEXTOP(start, xll);
op = Yap_op_from_opcode(start->opc);
}
codep = start->u.Ills.l1;
codep = start->u.Illss.l1;
remove_dirty_clauses_from_index(start);
}

View File

@ -217,7 +217,7 @@
OPCODE(retry4 ,l),
OPCODE(trust ,Otapl),
OPCODE(try_in ,l),
OPCODE(enter_lu_pred ,Ills),
OPCODE(enter_lu_pred ,Illss),
OPCODE(try_logical ,OtaLl),
OPCODE(retry_logical ,OtaLl),
OPCODE(trust_logical ,OtILl),

View File

@ -362,8 +362,9 @@ typedef struct yami {
struct yami *l1;
struct yami *l2;
COUNT s;
COUNT e;
CELL next;
} Ills;
} Illss;
struct {
struct yami *l;
CELL next;

View File

@ -21,14 +21,15 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
pc->u.D.D = DBGroundTermAdjust(pc->u.D.D);
pc = NEXTOP(pc,D);
break;
/* instructions type Ills */
/* instructions type Illss */
case _enter_lu_pred:
pc->u.Ills.I = PtoLUIndexAdjust(pc->u.Ills.I);
pc->u.Ills.l1 = PtoOpAdjust(pc->u.Ills.l1);
pc->u.Ills.l2 = PtoOpAdjust(pc->u.Ills.l2);
pc->u.Ills.s = ConstantAdjust(pc->u.Ills.s);
opc = NEXTOP(pc,Ills);
pc = pc->u.Ills.l1;
pc->u.Illss.I = PtoLUIndexAdjust(pc->u.Illss.I);
pc->u.Illss.l1 = PtoOpAdjust(pc->u.Illss.l1);
pc->u.Illss.l2 = PtoOpAdjust(pc->u.Illss.l2);
pc->u.Illss.s = ConstantAdjust(pc->u.Illss.s);
pc->u.Illss.e = ConstantAdjust(pc->u.Illss.e);
opc = NEXTOP(pc,Illss);
pc = pc->u.Illss.l1;
break;
/* instructions type L */
case _alloc_for_logical_pred:

View File

@ -13,9 +13,9 @@
case _write_dbterm:
pc = NEXTOP(pc,D);
break;
/* instructions type Ills */
/* instructions type Illss */
case _enter_lu_pred:
return walk_got_lu_block(pc->u.Ills.I, startp, endp);
return walk_got_lu_block(pc->u.Illss.I, startp, endp);
/* instructions type L */
case _alloc_for_logical_pred:
return walk_got_lu_clause(pc->u.L.ClBase, startp, endp);

View File

@ -180,9 +180,9 @@ special_formats(C,"l") :- !,
format(C,' if (op == _Ystop) return;~n',[]).
special_formats(C,"sssl") :- !,
format(C,' AdjustSwitchTable(op, pc->u.sssl.l, pc->u.sssl.s);~n',[]).
special_formats(C,"Ills") :- !,
format(C,' opc = NEXTOP(pc,Ills);
pc = pc->u.Ills.l1;
special_formats(C,"Illss") :- !,
format(C,' opc = NEXTOP(pc,Illss);
pc = pc->u.Illss.l1;
break;~n',[]),
% don't go to NEXTOP
fail.
@ -325,8 +325,8 @@ c_call_op("execute_cpred").
c_call_op("call_c_wfail").
% I field gives direct access to LU index block and to all Pred information
output_walk(C,"Ills",_) :- !,
format(C,' return walk_got_lu_block(pc->u.Ills.I, startp, endp);~n',[]).
output_walk(C,"Illss",_) :- !,
format(C,' return walk_got_lu_block(pc->u.Illss.I, startp, endp);~n',[]).
output_walk(C,"OtILl",_) :- !,
format(C,' return walk_got_lu_block(pc->u.OtILl.block, startp, endp);~n',[]).
% I field gives direct access to LU index clause and to all Pred information

View File

@ -213,7 +213,7 @@ yap_flag(associate,X) :-
yap_flag(associate,X) :-
atom(X), !,
set_value('$associate',X).
yap_flag(bounded,X) :-
yap_flag(associate,X) :-
'$do_error'(type_error(atom,X),associate(X)).
yap_flag(bounded,X) :-

View File

@ -135,7 +135,7 @@ key_statistics(Key, NOfEntries, TotalSize) :-
% Based on the SWI-Prolog definition minus reporting the number of inferences,
% which YAP does not currently supports
:- meta_predicate time(:).
:- meta_predicate time(0).
time(Goal) :-
var(Goal),

View File

@ -12,9 +12,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- meta_predicate
parallel(:),
parallel_findall(?,:,?),
parallel_once(:).
parallel(0),
parallel_findall(?,0,?),
parallel_once(0).