handle blob overflows.

This commit is contained in:
Vítor Santos Costa
2011-12-22 10:27:56 +00:00
parent 32ebfe00fd
commit 551df1c70a
10 changed files with 83 additions and 16 deletions

17
C/agc.c
View File

@@ -398,13 +398,25 @@ clean_atom_list(AtomHashEntry *HashPtr)
while (atm != NIL) {
AtomEntry *at = RepAtom(atm);
if (AtomResetMark(at) ||
at->PropsOfAE != NIL ||
( at->PropsOfAE != NIL && !IsBlob(at) ) ||
(GLOBAL_AGCHook != NULL && !GLOBAL_AGCHook(atm))) {
patm = &(at->NextOfAE);
atm = at->NextOfAE;
} else {
NOfAtoms--;
if (IsWideAtom(atm)) {
if (IsBlob(atm)) {
BlobPropEntry *b = RepBlobProp(at->PropsOfAE);
if (b->NextOfPE != NIL) {
patm = &(at->NextOfAE);
atm = at->NextOfAE;
continue;
}
NOfAtoms++;
NOfBlobs--;
Yap_FreeCodeSpace((char *)b);
GLOBAL_agc_collected += sizeof(BlobPropEntry);
GLOBAL_agc_collected += sizeof(AtomEntry)+sizeof(size_t)+at->rep.blob->length;
} else if (IsWideAtom(atm)) {
#ifdef DEBUG_RESTORE3
fprintf(stderr, "Purged %p:%S\n", at, at->WStrOfAE);
#endif
@@ -478,6 +490,7 @@ atom_gc(USES_REGS1)
mark_stacks(PASS_REGS1);
restore_codes();
clean_atoms();
NOfBlobsMax = NOfBlobs+(NOfBlobs/2+256< 1024 ? NOfBlobs/2+256 : 1024);
YAPLeaveCriticalSection();
agc_time = Yap_cputime()-time_start;
GLOBAL_tot_agc_time += agc_time;