avoid doing full stack shifting when on top of stack.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1699 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
168bef9531
commit
7b29ef1552
10
C/globals.c
10
C/globals.c
@ -265,8 +265,10 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity)
|
||||
if (size < 4096) {
|
||||
size = 4096;
|
||||
}
|
||||
if (pt == H && ArenaPt(arena) >= B->cp_h) {
|
||||
if (pt == H) {
|
||||
choiceptr b_ptr;
|
||||
if (H+size > ASP-1024) {
|
||||
|
||||
XREGS[arity+1] = arena;
|
||||
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, P)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
@ -274,6 +276,12 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity)
|
||||
}
|
||||
arena = XREGS[arity+1];
|
||||
}
|
||||
/* adjust possible back pointers in choice-point stack */
|
||||
b_ptr = B;
|
||||
while (b_ptr->cp_h == H) {
|
||||
b_ptr->cp_h += size;
|
||||
b_ptr = b_ptr->cp_b;
|
||||
}
|
||||
H += size;
|
||||
} else {
|
||||
XREGS[arity+1] = arena;
|
||||
|
Reference in New Issue
Block a user