fix array handling of DBRefs

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1083 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-06-18 16:35:18 +00:00
parent 0b40851d2d
commit 34ea2e6905
3 changed files with 19 additions and 10 deletions

View File

@ -365,7 +365,7 @@ atom_gc(void)
agc_calls++; agc_calls++;
agc_collected = 0; agc_collected = 0;
if (gc_trace) { if (gc_trace) {
fprintf(Yap_stderr, "[agc]\n"); fprintf(Yap_stderr, "AGC]\n");
} else if (gc_verbose) { } else if (gc_verbose) {
fprintf(Yap_stderr, "[AGC] Start of atom garbage collection %d:\n", agc_calls); fprintf(Yap_stderr, "[AGC] Start of atom garbage collection %d:\n", agc_calls);
} }

View File

@ -16,8 +16,7 @@
*************************************************************************/ *************************************************************************/
#include "Yap.h" #include "Yap.h"
#include "Yatom.h" #include "clause.h"
#include "Heap.h"
#include "eval.h" #include "eval.h"
#include "heapgc.h" #include "heapgc.h"
#if HAVE_ERRNO_H #if HAVE_ERRNO_H
@ -1542,6 +1541,7 @@ p_assign_static(void)
{ {
Term t0 = ptr->ValueOfVE.dbrefs[indx]; Term t0 = ptr->ValueOfVE.dbrefs[indx];
DBRef p = DBRefOfTerm(t3);
if (!IsDBRefTerm(t3)) { if (!IsDBRefTerm(t3)) {
WRITE_UNLOCK(ptr->ArRWLock); WRITE_UNLOCK(ptr->ArRWLock);
@ -1549,9 +1549,22 @@ p_assign_static(void)
return (FALSE); return (FALSE);
} }
ptr->ValueOfVE.dbrefs[indx]= t3; ptr->ValueOfVE.dbrefs[indx]= t3;
if (t0 != 0L) if (t0 != 0L) {
DBRefOfTerm(t0)->NOfRefsTo--; DBRef ptr = DBRefOfTerm(t0);
DBRefOfTerm(t3)->NOfRefsTo++; if (ptr->Flags & LogUpdMask) {
LogUpdClause *lup = (LogUpdClause *)ptr;
lup->ClRefCount--;
} else {
ptr->NOfRefsTo--;
}
}
if (p->Flags & LogUpdMask) {
LogUpdClause *lup = (LogUpdClause *)p;
lup->ClRefCount++;
} else {
p->NOfRefsTo++;
}
} }
break; break;

View File

@ -106,13 +106,9 @@ check_trail_consistency(void) {
*/ */
int vsc_xstop = FALSE;
CELL old_value = 0L, old_value2 = 0L; CELL old_value = 0L, old_value2 = 0L;
/*
void jmp_deb(int i) {if (i) printf("Here we go\n"); else jmp_deb(0);} void jmp_deb(int i) {if (i) printf("Here we go\n"); else jmp_deb(0);}
*/
void void
low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)