fix reference counters when copying try-trust chains
fixes on memory allocation git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@912 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
4f97e338ab
commit
009452e075
@ -1197,13 +1197,15 @@ Yap_absmi(int inp)
|
|||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setregs();
|
|
||||||
if (!Yap_IUnify(ARG2, t)) {
|
if (!Yap_IUnify(ARG2, t)) {
|
||||||
|
setregs();
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
|
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
|
||||||
|
setregs();
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
setregs();
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
|
||||||
@ -1237,12 +1239,16 @@ Yap_absmi(int inp)
|
|||||||
{
|
{
|
||||||
LogUpdClause *cl = ClauseCodeToLogUpdClause(PREG);
|
LogUpdClause *cl = ClauseCodeToLogUpdClause(PREG);
|
||||||
|
|
||||||
|
saveregs();
|
||||||
if (!Yap_IUnify(ARG2, cl->ClSource->Entry)) {
|
if (!Yap_IUnify(ARG2, cl->ClSource->Entry)) {
|
||||||
|
setregs();
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
|
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
|
||||||
|
setregs();
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
setregs();
|
||||||
|
|
||||||
/* say that an environment is using this clause */
|
/* say that an environment is using this clause */
|
||||||
/* we have our own copy for the clause */
|
/* we have our own copy for the clause */
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Last rev: *
|
* Last rev: *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: allocating space *
|
* comments: allocating space *
|
||||||
* version:$Id: alloc.c,v 1.38 2003-10-30 11:31:05 vsc Exp $ *
|
* version:$Id: alloc.c,v 1.39 2003-10-30 22:52:46 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
@ -1113,16 +1113,22 @@ Yap_InitMemory(int Trail, int Heap, int Stack)
|
|||||||
int
|
int
|
||||||
Yap_ExtendWorkSpace(Int s)
|
Yap_ExtendWorkSpace(Int s)
|
||||||
{
|
{
|
||||||
|
#if USE_MMAP
|
||||||
return ExtendWorkSpace(s, MAP_FIXED);
|
return ExtendWorkSpace(s, MAP_FIXED);
|
||||||
|
#else
|
||||||
|
return ExtendWorkSpace(s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt
|
UInt
|
||||||
Yap_ExtendWorkSpaceThroughHole(UInt s)
|
Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||||
{
|
{
|
||||||
|
#if USE_MMAP
|
||||||
MALLOC_T WorkSpaceTop0 = WorkSpaceTop;
|
MALLOC_T WorkSpaceTop0 = WorkSpaceTop;
|
||||||
|
|
||||||
if (ExtendWorkSpace(s, 0))
|
if (ExtendWorkSpace(s, 0))
|
||||||
return WorkSpaceTop-WorkSpaceTop0;
|
return WorkSpaceTop-WorkSpaceTop0;
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
C/index.c
13
C/index.c
@ -4609,6 +4609,7 @@ cp_lu_trychain(yamop *codep, yamop *ocodep, yamop *ostart, int flag, PredEntry *
|
|||||||
{
|
{
|
||||||
int count_reds = ap->PredFlags & CountPredFlag;
|
int count_reds = ap->PredFlags & CountPredFlag;
|
||||||
int profiled = ap->PredFlags & ProfiledPredFlag;
|
int profiled = ap->PredFlags & ProfiledPredFlag;
|
||||||
|
int compact_mode = (codep == ocodep);
|
||||||
|
|
||||||
while (ocodep != NULL &&
|
while (ocodep != NULL &&
|
||||||
ocodep < ostart->u.Ill.l2) {
|
ocodep < ostart->u.Ill.l2) {
|
||||||
@ -4624,6 +4625,7 @@ cp_lu_trychain(yamop *codep, yamop *ocodep, yamop *ostart, int flag, PredEntry *
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (op != _try_clause) {
|
if (op != _try_clause) {
|
||||||
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
||||||
|
if (compact_mode)
|
||||||
tgl->ClRefCount--;
|
tgl->ClRefCount--;
|
||||||
}
|
}
|
||||||
codep->opc = Yap_opcode(_try_clause);
|
codep->opc = Yap_opcode(_try_clause);
|
||||||
@ -4632,6 +4634,9 @@ cp_lu_trychain(yamop *codep, yamop *ocodep, yamop *ostart, int flag, PredEntry *
|
|||||||
if (op == _try_clause) {
|
if (op == _try_clause) {
|
||||||
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
||||||
tgl->ClRefCount++;
|
tgl->ClRefCount++;
|
||||||
|
} else if (!compact_mode) {
|
||||||
|
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
||||||
|
tgl->ClRefCount++;
|
||||||
}
|
}
|
||||||
codep = gen_lui_retry(codep, ocodep, profiled, count_reds, ap);
|
codep = gen_lui_retry(codep, ocodep, profiled, count_reds, ap);
|
||||||
}
|
}
|
||||||
@ -4640,17 +4645,21 @@ cp_lu_trychain(yamop *codep, yamop *ocodep, yamop *ostart, int flag, PredEntry *
|
|||||||
break;
|
break;
|
||||||
case _trust:
|
case _trust:
|
||||||
if (i < ncls-1) goto do_retry;
|
if (i < ncls-1) goto do_retry;
|
||||||
|
if (!compact_mode) {
|
||||||
|
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
||||||
|
tgl->ClRefCount++;
|
||||||
|
}
|
||||||
codep = gen_lui_trust(codep, ocodep, profiled, count_reds, ap, ocodep->u.ld.d, TRUE, nblk);
|
codep = gen_lui_trust(codep, ocodep, profiled, count_reds, ap, ocodep->u.ld.d, TRUE, nblk);
|
||||||
ocodep = NULL;
|
ocodep = NULL;
|
||||||
break;
|
break;
|
||||||
case _retry_killed:
|
case _retry_killed:
|
||||||
case _trust_killed:
|
case _trust_killed:
|
||||||
{
|
if (compact_mode) {
|
||||||
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
LogUpdClause *tgl = ClauseCodeToLogUpdClause(ocodep->u.ld.d);
|
||||||
|
|
||||||
tgl->ClRefCount--;
|
tgl->ClRefCount--;
|
||||||
ocodep = NEXTOP(ocodep, ld);
|
|
||||||
}
|
}
|
||||||
|
ocodep = NEXTOP(ocodep, ld);
|
||||||
break;
|
break;
|
||||||
case _trust_logical_pred:
|
case _trust_logical_pred:
|
||||||
ocodep = NEXTOP(ocodep, l);
|
ocodep = NEXTOP(ocodep, l);
|
||||||
|
@ -114,6 +114,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
|
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
#ifdef COMMENTED
|
#ifdef COMMENTED
|
||||||
|
if (vsc_count < 5646100000LL)
|
||||||
|
return;
|
||||||
|
if (vsc_count == 5646100441LL)
|
||||||
|
vsc_xstop = TRUE;
|
||||||
if (vsc_count < 2923351500LL) {
|
if (vsc_count < 2923351500LL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user