bug fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1163 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-10-22 16:53:20 +00:00
parent eb05d95935
commit 8e92ce869f
5 changed files with 71 additions and 68 deletions

View File

@ -11,8 +11,13 @@
* File: cdmgr.c *
* comments: Code manager *
* *
* Last rev: $Date: 2004-10-06 16:55:46 $,$Author: vsc $ *
* Last rev: $Date: 2004-10-22 16:53:19 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.136 2004/10/06 16:55:46 vsc
* change configure to support big mem configs
* get rid of extra globals
* fix trouble with multifile preds
*
* Revision 1.135 2004/09/30 21:37:40 vsc
* fixes for thread support
*
@ -395,26 +400,29 @@ split_megaclause(PredEntry *ap)
StaticClause *cl = start;
start = cl->ClNext;
Yap_FreeCodeSpace((char *)cl);
start = NULL;
}
if (ap->ArityOfPE) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while breaking up mega clause for %s/%d\n",RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE,ap->ArityOfPE);
} else {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while breaking up mega clause for %s\n", RepAtom((Atom)ap->FunctorOfPred)->StrOfAE);
}
WRITE_UNLOCK(ap->PRWLock);
return;
}
new->ClFlags = FactMask;
new->ClSize = mcl->ClItemSize;
new->usc.ClPred = ap;
new->ClNext = NULL;
memcpy((void *)new->ClCode, (void *)ptr, mcl->ClItemSize);
if (prev) {
prev->ClNext = new;
} else {
start = new;
}
ptr = (yamop *)((char *)ptr + mcl->ClItemSize);
prev = new;
}
new->ClFlags = FactMask;
new->ClSize = mcl->ClItemSize;
new->usc.ClPred = ap;
new->ClNext = NULL;
memcpy((void *)new->ClCode, (void *)ptr, mcl->ClItemSize);
if (prev) {
prev->ClNext = new;
} else {
start = new;
}
ptr = (yamop *)((char *)ptr + mcl->ClItemSize);
prev = new;
}
ap->PredFlags &= ~MegaClausePredFlag;
ap->cs.p_code.FirstClause = start->ClCode;

View File

@ -11,8 +11,12 @@
* File: index.c *
* comments: Indexing a Prolog predicate *
* *
* Last rev: $Date: 2004-10-04 18:56:19 $,$Author: vsc $ *
* Last rev: $Date: 2004-10-22 16:53:19 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.102 2004/10/04 18:56:19 vsc
* fixes for thread support
* fix indexing bug (serious)
*
* Revision 1.101 2004/09/30 21:37:41 vsc
* fixes for thread support
*
@ -5943,7 +5947,13 @@ insertz_in_lu_block(LogUpdIndex *blk, PredEntry *ap, yamop *code)
bsize = blk->ClSize;
end = (yamop *)((CODEADDR)blk+bsize);
where = last = begin->u.Ill.l2;
next = NEXTOP(NEXTOP(where, ld),p); /* trust logical followed by trust */
next = NEXTOP(where, ld);
if (ap->PredFlags & CountPredFlag) {
next = NEXTOP(where,p); /* trust logical followed by trust */
}
if (ap->PredFlags & ProfiledPredFlag) {
next = NEXTOP(where,p); /* trust logical followed by trust */
}
last = PREVOP(last, ld);
/* follow profiling and counting instructions */
if (ap->PredFlags & ProfiledPredFlag) {
@ -6793,36 +6803,21 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
if ((cb = setjmp(cint.CompilerBotch)) == 3) {
restore_machine_regs();
Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP);
save_machine_regs();
} else if (cb == 2) {
restore_machine_regs();
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
save_machine_regs();
if (ap->PredFlags & LogUpdatePredFlag) {
Yap_kill_iblock((ClauseUnion *)ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred),NULL, ap);
} else {
StaticIndex *cl;
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
}
return;
}
Yap_growheap(FALSE, Yap_Error_Size, NULL);
save_machine_regs();
} else if (cb == 4) {
restore_machine_regs();
if (!Yap_growtrail(Yap_Error_Size)) {
save_machine_regs();
if (ap->PredFlags & LogUpdatePredFlag) {
Yap_kill_iblock((ClauseUnion *)ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred),NULL, ap);
} else {
StaticIndex *cl;
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
}
return;
}
Yap_Error_Size = 0;
Yap_growtrail(Yap_Error_Size);
save_machine_regs();
}
if (cb) {
Yap_RemoveIndexation(ap);
return;
}
Yap_Error_Size = 0;
Yap_ErrorMessage = NULL;
#ifdef DEBUG
if (Yap_Option['i' - 'a' + 1]) {
@ -7324,38 +7319,30 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
if ((cb = setjmp(cint.CompilerBotch)) == 3) {
restore_machine_regs();
Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP);
save_machine_regs();
} else if (cb == 2) {
restore_machine_regs();
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
save_machine_regs();
if (ap->PredFlags & LogUpdatePredFlag) {
Yap_kill_iblock((ClauseUnion *)ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred),NULL, ap);
} else {
StaticIndex *cl;
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
}
return;
}
Yap_Error_Size = 0;
Yap_growheap(FALSE, Yap_Error_Size, NULL);
save_machine_regs();
} else if (cb == 4) {
restore_machine_regs();
if (!Yap_growtrail(Yap_Error_Size)) {
save_machine_regs();
if (ap->PredFlags & LogUpdatePredFlag) {
Yap_kill_iblock((ClauseUnion *)ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred),NULL, ap);
} else {
StaticIndex *cl;
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
}
return;
}
Yap_Error_Size = 0;
Yap_growtrail(Yap_Error_Size);
save_machine_regs();
}
Yap_Error_Size = 0;
Yap_ErrorMessage = NULL;
if (cb) {
/* cannot rely on the code */
if (ap->PredFlags & LogUpdatePredFlag) {
Yap_kill_iblock((ClauseUnion *)ClauseCodeToLogUpdIndex(ap->cs.p_code.TrueCodeOfPred),NULL, ap);
} else {
StaticIndex *cl;
cl = ClauseCodeToStaticIndex(ap->cs.p_code.TrueCodeOfPred);
Yap_kill_iblock((ClauseUnion *)cl, NULL, ap);
}
return;
}
#ifdef DEBUG
if (Yap_Option['i' - 'a' + 1]) {
Term tmod = ap->ModuleOfPred;

View File

@ -1159,6 +1159,7 @@ InteractSIGINT(int ch) {
fprintf(Yap_stderr, "Please press one of:\n");
fprintf(Yap_stderr, " a for abort\n c for continue\n d for debug\n");
fprintf(Yap_stderr, " e for exit\n s for statistics\n t for trace\n");
fprintf(Yap_stderr, " b for break\n");
return(0);
}
}

View File

@ -45,8 +45,8 @@ typedef struct StructClauseDef {
yamop *CurrentCode; /* start of code for clause */
union {
yamop *WorkPC; /* start of code for clause */
CELL *c_sreg;
Term t_ptr;
CELL *c_sreg;
} u;
} ClauseDef;

View File

@ -799,7 +799,10 @@ incore(G) :- '$execute'(G).
it saves the importante data about current streams and
debugger state */
break :- get_value('$break',BL), NBL is BL+1,
break :-
( recorded('$trace',Val,R) -> Trace = Val, erase(R); true),
( recorded('$debug',Val,R1) -> Debug = Val, erase(R1); true),
get_value('$break',BL), NBL is BL+1,
get_value(spy_gn,SPY_GN),
'$access_yap_flags'(10,SPY_CREEP),
get_value(spy_cl,SPY_CL),
@ -815,6 +818,10 @@ break :- get_value('$break',BL), NBL is BL+1,
set_value(spy_cl,SPY_CL),
set_value(spy_leap,_Leap),
'$set_input'(InpStream), '$set_output'(OutStream),
( recorded('$trace',_,R2), erase(R2), fail; true),
( recorded('$debug',_,R3), erase(R3), fail; true),
(nonvar(Trace) -> recorda('$trace',Trace,_)),
(nonvar(Debug) -> recorda('$debug',Debug,_)),
set_value('$break',BL).