fixes for threaded version.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1705 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2006-10-16 17:12:48 +00:00
parent 18f363d0bc
commit 23e9f546fe
3 changed files with 28 additions and 6 deletions

View File

@ -11,8 +11,12 @@
* File: cdmgr.c * * File: cdmgr.c *
* comments: Code manager * * comments: Code manager *
* * * *
* Last rev: $Date: 2006-10-11 17:24:36 $,$Author: vsc $ * * Last rev: $Date: 2006-10-16 17:12:48 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.195 2006/10/11 17:24:36 vsc
* make sure we only follow pointers *before* we removed the respective code block,
* ie don't kill the child before checking pointers from parent!
*
* Revision 1.194 2006/10/11 15:08:03 vsc * Revision 1.194 2006/10/11 15:08:03 vsc
* fix bb entries * fix bb entries
* comment development code for timestamp overflow. * comment development code for timestamp overflow.
@ -887,7 +891,7 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
while (ipc) { while (ipc) {
op_numbers op = Yap_op_from_opcode(ipc->opc); op_numbers op = Yap_op_from_opcode(ipc->opc);
/* printf("op: %d %p->%p\n", op, ipc, end); */ /* fprintf(stderr,"op: %d %p->%p\n", op, ipc, end);*/
switch(op) { switch(op) {
case _Ystop: case _Ystop:
/* end of clause, for now */ /* end of clause, for now */
@ -957,9 +961,10 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
#endif #endif
decrease_ref_counter(ipc->u.lld.d->ClCode, beg, end, suspend_code); decrease_ref_counter(ipc->u.lld.d->ClCode, beg, end, suspend_code);
Yap_FreeCodeSpace((ADDR)ipc); Yap_FreeCodeSpace((ADDR)ipc);
end = ipc;
return; return;
case _enter_lu_pred: case _enter_lu_pred:
if (ipc->u.Ill.I->ClFlags & InUseMask) if (ipc->u.Ill.I->ClFlags & InUseMask || ipc->u.Ill.I->ClRefCount)
return; return;
#ifdef DEBUG #ifdef DEBUG
Yap_DirtyCps+=ipc->u.Ill.s; Yap_DirtyCps+=ipc->u.Ill.s;
@ -1144,6 +1149,7 @@ kill_off_lu_block(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap)
static void static void
kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap) kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap)
{ {
decrease_log_indices(c, (yamop *)&(ap->cs.p_code.ExpandCode));
/* parent is always locked, now I lock myself */ /* parent is always locked, now I lock myself */
if (parent != NULL) { if (parent != NULL) {
/* remove myself from parent */ /* remove myself from parent */
@ -1168,7 +1174,6 @@ kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap)
RemoveMainIndex(ap); RemoveMainIndex(ap);
} }
} }
decrease_log_indices(c, (yamop *)&(ap->cs.p_code.ExpandCode));
/* make sure that a child cannot remove us */ /* make sure that a child cannot remove us */
kill_children(c, ap); kill_children(c, ap);
/* check if we are still the main index */ /* check if we are still the main index */

View File

@ -199,7 +199,7 @@ MoveExpandedGlobal(void)
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in * cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm * absmi.asm
*/ */
cpcellsd((CELL *)(Yap_GlobalBase+(GDiff-DelayDiff)), (CELL *)OldGlobalBase, OldH - (CELL *)OldGlobalBase); cpcellsd((CELL *)(Yap_GlobalBase+(GDiff-DelayDiff)), (CELL *)Yap_GlobalBase, OldH - (CELL *)OldGlobalBase);
} }
static void static void
@ -209,7 +209,11 @@ MoveGlobalWithHole(void)
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in * cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm * absmi.asm
*/ */
#if USE_SYSTEM_MALLOC
cpcellsd((CELL *)((char *)Yap_GlobalBase+(GDiff0-DelayDiff)), (CELL *)Yap_GlobalBase, OldH - (CELL *)OldGlobalBase);
#else
cpcellsd((CELL *)((char *)OldGlobalBase+GDiff0), (CELL *)OldGlobalBase, OldH - (CELL *)OldGlobalBase); cpcellsd((CELL *)((char *)OldGlobalBase+GDiff0), (CELL *)OldGlobalBase, OldH - (CELL *)OldGlobalBase);
#endif
} }
static void static void

View File

@ -11,8 +11,13 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2006-10-11 14:53:57 $,$Author: vsc $ * * Last rev: $Date: 2006-10-16 17:12:48 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.171 2006/10/11 14:53:57 vsc
* fix memory leak
* fix overflow handling
* VS: ----------------------------------------------------------------------
*
* Revision 1.170 2006/10/10 14:08:16 vsc * Revision 1.170 2006/10/10 14:08:16 vsc
* small fixes on threaded implementation. * small fixes on threaded implementation.
* *
@ -6236,6 +6241,10 @@ kill_clause(yamop *ipc, yamop *bg, yamop *lt, path_stack_entry *sp0, PredEntry *
blk = (LogUpdIndex *)(sp->u.cle.block); blk = (LogUpdIndex *)(sp->u.cle.block);
start = blk->ClCode; start = blk->ClCode;
op0 = Yap_op_from_opcode(start->opc); op0 = Yap_op_from_opcode(start->opc);
while (op0 == _lock_lu) {
start = NEXTOP(start, p);
op0 = Yap_op_from_opcode(start->opc);
}
while (op0 == _jump_if_nonvar) { while (op0 == _jump_if_nonvar) {
start = NEXTOP(start, xll); start = NEXTOP(start, xll);
op0 = Yap_op_from_opcode(start->opc); op0 = Yap_op_from_opcode(start->opc);
@ -8373,6 +8382,10 @@ Yap_CleanUpIndex(LogUpdIndex *blk)
op_numbers op = Yap_op_from_opcode(start->opc); op_numbers op = Yap_op_from_opcode(start->opc);
blk->ClFlags &= ~DirtyMask; blk->ClFlags &= ~DirtyMask;
while (op == _lock_lu) {
start = NEXTOP(start, p);
op = Yap_op_from_opcode(start->opc);
}
while (op == _jump_if_nonvar) { while (op == _jump_if_nonvar) {
start = NEXTOP(start, xll); start = NEXTOP(start, xll);
op = Yap_op_from_opcode(start->opc); op = Yap_op_from_opcode(start->opc);