garbage collector was not asking for space.

avoid 0 sized calls to mmap.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2058 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-01-24 00:11:59 +00:00
parent 817663588d
commit e353d8811f
6 changed files with 28 additions and 7 deletions

View File

@ -194,7 +194,7 @@ yapsbrk(long size)
{
ADDR newHeapTop = HeapTop, oldHeapTop = HeapTop;
newHeapTop = HeapTop+size;
if (Yap_NOfMemoryHoles && newHeapTop > Yap_MemoryHoles[0].start) {
while (Yap_NOfMemoryHoles && newHeapTop > Yap_MemoryHoles[0].start) {
UInt i;
HeapTop = oldHeapTop = Yap_MemoryHoles[0].end;

View File

@ -377,6 +377,8 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
int psize = YAP_BUF_SIZE;
Yap_Error_TYPE = YAP_NO_ERROR;
if (where == 0L)
where = TermNil;
#if DEBUG_STRICT
if (Yap_heap_regs && !(Yap_PrologMode & BootMode))
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)ActiveSignals,Yap_PrologMode,format);

View File

@ -631,6 +631,8 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
CurrentDelayTop = (CELL *)DelayTop();
/* adjust to a multiple of 256) */
if (size < YAP_ALLOC_SIZE)
size = YAP_ALLOC_SIZE;
size = AdjustPageSize(size);
Yap_ErrorMessage = NULL;
if (!Yap_ExtendWorkSpace(size)) {
@ -734,6 +736,8 @@ static_growglobal(long size, CELL **ptr, CELL *hsplit)
if (size < ((char *)H0-omax)/8)
size = ((char *)H0-omax)/8;
if (do_grow) {
if (size < YAP_ALLOC_SIZE)
size = YAP_ALLOC_SIZE;
size = AdjustPageSize(size);
}
/* adjust to a multiple of 256) */
@ -1073,8 +1077,11 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
return FALSE;
#endif
if (SizeOfOverflow > sz)
if (SizeOfOverflow > sz) {
if (size < YAP_ALLOC_SIZE)
size = YAP_ALLOC_SIZE;
sz = AdjustPageSize(SizeOfOverflow);
}
while(sz >= sizeof(CELL) * 16 * 1024L && !static_growheap(sz, fix_code, cip, old_trp, tksp, vep)) {
size = size/2;
sz = size << shift_factor;
@ -1397,6 +1404,8 @@ growstack(long size)
int gc_verbose;
/* adjust to a multiple of 256) */
if (size < YAP_ALLOC_SIZE)
size = YAP_ALLOC_SIZE;
size = AdjustPageSize(size);
Yap_ErrorMessage = NULL;
start_growth_time = Yap_cputime();
@ -1477,8 +1486,8 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
if (!size)
size = ((ADDR)TR-Yap_TrailBase);
size *= 2;
if (size < 64*1024)
size = 64*1024;
if (size < YAP_ALLOC_SIZE)
size = YAP_ALLOC_SIZE;
if (size > 2048*1024)
size = 2048*1024;
/* adjust to a multiple of 256) */

View File

@ -3867,8 +3867,10 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop)
/* expand the stack if effectiveness is less than 20 % */
if (ASP - H < gc_margin/sizeof(CELL) ||
effectiveness < 20) {
UInt sz;
LeaveGCMode();
return Yap_growstack(gc_margin-((ASP-H)*sizeof(CELL)));
return Yap_growstack(gc_margin);
}
/*
* debug for(save_total=1; save_total<=N; ++save_total)

View File

@ -11,8 +11,12 @@
* File: index.c *
* comments: Indexing a Prolog predicate *
* *
* Last rev: $Date: 2008-01-23 17:57:46 $,$Author: vsc $ *
* Last rev: $Date: 2008-01-24 00:11:59 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.193 2008/01/23 17:57:46 vsc
* valgrind it!
* enable atom garbage collection.
*
* Revision 1.192 2007/11/26 23:43:08 vsc
* fixes to support threads and assert correctly, even if inefficiently.
*
@ -4767,7 +4771,10 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots)
if ((setjres = setjmp(cint.CompilerBotch)) == 3) {
restore_machine_regs();
recover_from_failed_susp_on_cls(&cint, 0);
Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, CP);
if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, CP)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FAILCODE;
}
} else if (setjres == 2) {
restore_machine_regs();
Yap_Error_Size = recover_from_failed_susp_on_cls(&cint, Yap_Error_Size);

View File

@ -17,6 +17,7 @@
<h2>Yap-5.1.3:</h2>
<ul>
<li> FIXED: make sure we don't ask for 0-sized blocks, minimal 64K.</li>
<li> FIXED: Aux reallocation should always increase aux size.</li>
<li> NEW: start atom garbage collector by default (except for threads).</li>
<li> FIXED: restore indices should run over the indices, and not mess