hole handling in dlmalloc should not make HeapTop always skip over the hole.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1223 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-01-05 04:32:18 +00:00
parent af931c6e6d
commit b7a44d3808
4 changed files with 13 additions and 11 deletions

View File

@ -4808,6 +4808,7 @@ static Int
p_enqueue(void) p_enqueue(void)
{ {
Term Father = Deref(ARG1); Term Father = Deref(ARG1);
Term t;
QueueEntry *x; QueueEntry *x;
db_queue *father_key; db_queue *father_key;
@ -4825,9 +4826,11 @@ p_enqueue(void)
return FALSE; return FALSE;
} }
} }
t = Deref(ARG1);
x->DBT = StoreTermInDB(Deref(ARG2), 2); x->DBT = StoreTermInDB(Deref(ARG2), 2);
if (x->DBT == NULL) if (x->DBT == NULL) {
return FALSE; return FALSE;
}
x->next = NULL; x->next = NULL;
WRITE_LOCK(father_key->QRWLock); WRITE_LOCK(father_key->QRWLock);
if (father_key->LastInQueue != NULL) if (father_key->LastInQueue != NULL)

View File

@ -175,7 +175,7 @@ yapsbrk(long size)
LOCK(HeapUsedLock); LOCK(HeapUsedLock);
newHeapTop = HeapTop+size; newHeapTop = HeapTop+size;
if (Yap_hole_start && newHeapTop > Yap_hole_start) { if (Yap_hole_start && newHeapTop > Yap_hole_start) {
oldHeapTop = Yap_hole_end; HeapTop = oldHeapTop = Yap_hole_end;
newHeapTop = oldHeapTop+size; newHeapTop = oldHeapTop+size;
Yap_hole_start = Yap_hole_end = NULL; Yap_hole_start = Yap_hole_end = NULL;
} }

View File

@ -3418,18 +3418,18 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
{ {
UInt alloc_sz = (CELL *)Yap_TrailTop-(CELL*)Yap_GlobalBase; UInt alloc_sz = (CELL *)Yap_TrailTop-(CELL*)Yap_GlobalBase;
bp = Yap_PreAllocCodeSpace(); bp = Yap_PreAllocCodeSpace();
if (bp+alloc_sz > (char *)AuxSp) { while (bp+alloc_sz > (char *)AuxSp) {
/* not enough space */ /* not enough space */
*--ASP = (CELL)current_env; *--ASP = (CELL)current_env;
bp = (char *)Yap_ExpandPreAllocCodeSpace(alloc_sz, NULL); bp = (char *)Yap_ExpandPreAllocCodeSpace(alloc_sz, NULL);
if (!bp)
return 0;
current_env = (CELL *)*ASP; current_env = (CELL *)*ASP;
ASP++; ASP++;
#if COROUTINING #if COROUTINING
max = (CELL *)Yap_ReadTimedVar(DelayedVars); max = (CELL *)Yap_ReadTimedVar(DelayedVars);
#endif #endif
} }
if (!bp)
return 0;
memset((void *)bp, 0, alloc_sz); memset((void *)bp, 0, alloc_sz);
} }
#endif /* GC_NO_TAGS */ #endif /* GC_NO_TAGS */

View File

@ -69,12 +69,11 @@ findall(Template, Generator, Answers, SoFar) :-
% by getting all answers % by getting all answers
'$collect_for_findall'(Ref, SoFar, Out) :- '$collect_for_findall'(Ref, SoFar, Out) :-
( '$db_dequeue'(Ref, Term) -> '$db_dequeue'(Ref, Term), !,
Out = [Term|Answers], Out = [Term|Answers],
'$collect_for_findall'(Ref, SoFar, Answers) '$collect_for_findall'(Ref, SoFar, Answers).
; '$collect_for_findall'(Ref, SoFar, SoFar) :-
Out = SoFar Out = SoFar.
).
% findall_with_key is very similar to findall, but uses the SICStus % findall_with_key is very similar to findall, but uses the SICStus
% algorithm to guarantee that variables will have the same names. % algorithm to guarantee that variables will have the same names.