try to decrease HeapTop if recovering space on top of Heap;
change overflow code to be less relying on non-decreasing Heap. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@405 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
7460eccabd
commit
5503ea22f3
62
C/absmi.c
62
C/absmi.c
@ -1634,12 +1634,7 @@ absmi(int inp)
|
||||
|
||||
NoStackExecute:
|
||||
SREG = (CELL *) pred_entry(PREG->u.l.l);
|
||||
#ifdef YAPOR
|
||||
/* abort_optyap("NoStackExecute in function absmi"); */
|
||||
if (HeapTop > GlobalBase - MinHeapGap)
|
||||
#else /* YAPOR */
|
||||
if (HeapTop > Addr(AuxSp) - MinHeapGap)
|
||||
#endif
|
||||
if (CFREG == (CELL)(LCL0+1))
|
||||
{
|
||||
ASP = Y+E_CB;
|
||||
if (ASP > (CELL *)B)
|
||||
@ -1777,18 +1772,12 @@ absmi(int inp)
|
||||
NoStackCall:
|
||||
/* on X86 machines S will not actually be holding the pointer to pred */
|
||||
SREG = (CELL *) PREG->u.sla.p;
|
||||
#ifdef YAPOR
|
||||
/* abort_optyap("NoStackCall in function absmi"); */
|
||||
if (HeapTop > GlobalBase - MinHeapGap)
|
||||
#else
|
||||
if (HeapTop > Addr(AuxSp) - MinHeapGap)
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
ASP = (CELL *) (((char *) Y) + PREG->u.sla.s);
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (CFREG == (CELL)(LCL0+1)) {
|
||||
ASP = (CELL *) (((char *) Y) + PREG->u.sla.s);
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
#ifdef COROUTINING
|
||||
if (CFREG == Unsigned(LCL0)) {
|
||||
if (ReadTimedVar(WokenGoals) != TermNil)
|
||||
@ -1856,18 +1845,12 @@ absmi(int inp)
|
||||
NoStackEither:
|
||||
/* find something to fool S */
|
||||
SREG = (CELL *)RepPredProp(GetPredPropByFunc(MkFunctor(AtomRestoreRegs,1),0));
|
||||
#ifdef YAPOR
|
||||
/* abort_optyap("NoStackCall in function absmi"); */
|
||||
if (HeapTop > GlobalBase - MinHeapGap)
|
||||
#else
|
||||
if (HeapTop > Addr(AuxSp) - MinHeapGap)
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
ASP = (CELL *) (((char *) Y) + PREG->u.sla.s);
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (CFREG == (CELL)(LCL0+1)) {
|
||||
ASP = (CELL *) (((char *) Y) + PREG->u.sla.s);
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (CFREG == Unsigned(LCL0)) {
|
||||
if (ReadTimedVar(WokenGoals) != TermNil)
|
||||
goto creep_either;
|
||||
@ -1941,18 +1924,12 @@ absmi(int inp)
|
||||
NoStackDExecute:
|
||||
/* set SREG for next instructions */
|
||||
SREG = (CELL *) pred_entry(PREG->u.l.l);
|
||||
#ifdef YAPOR
|
||||
/* abort_optyap("noStackDExecute in function absmi"); */
|
||||
if (HeapTop > GlobalBase - MinHeapGap)
|
||||
#else
|
||||
if (HeapTop > Addr(AuxSp) - MinHeapGap)
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
ASP = Y+E_CB;
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (CFREG == (CELL)(LCL0+1)) {
|
||||
ASP = Y+E_CB;
|
||||
if (ASP > (CELL *)B)
|
||||
ASP = (CELL *)B;
|
||||
goto noheapleft;
|
||||
}
|
||||
#ifdef COROUTINING
|
||||
if (CFREG == Unsigned(LCL0)) {
|
||||
if (ReadTimedVar(WokenGoals) != TermNil)
|
||||
@ -2125,6 +2102,7 @@ absmi(int inp)
|
||||
JMPNext();
|
||||
}
|
||||
#endif
|
||||
creep_on = FALSE;
|
||||
#if SHADOW_S
|
||||
S = SREG;
|
||||
#endif
|
||||
|
21
C/alloc.c
21
C/alloc.c
@ -12,7 +12,7 @@
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: allocating space *
|
||||
* version:$Id: alloc.c,v 1.16 2002-02-26 17:41:53 vsc Exp $ *
|
||||
* version:$Id: alloc.c,v 1.17 2002-03-08 06:33:16 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
@ -169,8 +169,23 @@ FreeBlock(BlockHeader *b)
|
||||
RemoveFromFreeList(p);
|
||||
b->b_size += p->b_size + 1;
|
||||
}
|
||||
/* check if we are the HeapTop */
|
||||
if (!HEAPTOP_OWNER(worker_id)) {
|
||||
LOCK(HeapTopLock);
|
||||
}
|
||||
if (sp == (YAP_SEG_SIZE *)HeapTop) {
|
||||
LOCK(HeapUsedLock);
|
||||
HeapUsed -= (b->b_size + 1) * sizeof(YAP_SEG_SIZE);
|
||||
UNLOCK(HeapUsedLock);
|
||||
HeapTop = (ADDR)b;
|
||||
*((YAP_SEG_SIZE *) HeapTop) = InUseFlag;
|
||||
} else {
|
||||
/* insert on list of free blocks */
|
||||
AddToFreeList(b);
|
||||
AddToFreeList(b);
|
||||
}
|
||||
if (!HEAPTOP_OWNER(worker_id)) {
|
||||
UNLOCK(HeapTopLock);
|
||||
}
|
||||
UNLOCK(GLOBAL_LOCKS_alloc_block);
|
||||
UNLOCK(FreeBlocksLock);
|
||||
}
|
||||
@ -265,7 +280,7 @@ AllocHeap(unsigned int size)
|
||||
if (!HEAPTOP_OWNER(worker_id)) {
|
||||
UNLOCK(HeapTopLock);
|
||||
}
|
||||
CreepFlag = Unsigned(LCL0) - Unsigned(H0);
|
||||
CreepFlag = Unsigned(LCL0+1);
|
||||
} else {
|
||||
if (size > SizeOfOverflow)
|
||||
SizeOfOverflow = size*sizeof(CELL) + sizeof(YAP_SEG_SIZE);
|
||||
|
5
H/Regs.h
5
H/Regs.h
@ -10,7 +10,7 @@
|
||||
* File: Regs.h *
|
||||
* mods: *
|
||||
* comments: YAP abstract machine registers *
|
||||
* version: $Id: Regs.h,v 1.13 2002-02-06 17:35:25 vsc Exp $ *
|
||||
* version: $Id: Regs.h,v 1.14 2002-03-08 06:33:16 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
@ -698,6 +698,9 @@ EXTERN inline void restore_B(void) {
|
||||
REGSTORE standard_regs;
|
||||
#endif /* PUSH_REGS */
|
||||
|
||||
/******************* controlling debugging ****************************/
|
||||
extern int creep_on;
|
||||
|
||||
static inline UInt
|
||||
CalculateStackGap(void)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.h.m4 *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h.m4,v 1.22 2002-02-22 06:10:16 vsc Exp $ *
|
||||
* version: $Id: Yap.h.m4,v 1.23 2002-03-08 06:33:16 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
@ -773,6 +773,9 @@ extern int CritLocks;
|
||||
extern char **yap_args;
|
||||
extern int yap_argc;
|
||||
|
||||
/******************* controlling debugging ****************************/
|
||||
extern int creep_on;
|
||||
|
||||
#ifdef YAPOR
|
||||
#define YAPEnterCriticalSection() \
|
||||
{ \
|
||||
|
@ -18,7 +18,8 @@
|
||||
% This one should come first so that disjunctions and long distance
|
||||
% cuts are compiled right with co-routining.
|
||||
%
|
||||
true :- true. % otherwise, $$compile will ignore this clause.
|
||||
|
||||
true :- true.
|
||||
|
||||
'$live' :-
|
||||
'$init_system',
|
||||
@ -679,7 +680,7 @@ incore(G) :- '$execute'(G).
|
||||
'$last_execute_within'(B).
|
||||
|
||||
% Be careful with -> cutting through
|
||||
';'(A,B) :- (A = ( T->G) ->
|
||||
(A;B) :- (A = ( T->G) ->
|
||||
( '$execute_within'(T) -> '$execute_within'(G) ; '$execute_within'(A) ; '$execute_within'(B) )
|
||||
;
|
||||
( '$execute_within'(A) ; '$execute_within'(B) ) ).
|
||||
|
Reference in New Issue
Block a user