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:
vsc 2006-09-29 18:59:00 +00:00
parent 168bef9531
commit 7b29ef1552
1 changed files with 9 additions and 1 deletions

View File

@ -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;