only delete log update facts with blobs when they cannot be in stacks.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@930 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-11-18 19:22:26 +00:00
parent 7be28e4098
commit fae22bbf6b
2 changed files with 52 additions and 27 deletions

View File

@ -703,6 +703,7 @@ a_rb(op_numbers opcode)
code_p->u.xc.x = emit_xreg2(); code_p->u.xc.x = emit_xreg2();
code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(code_addr) + label_offset[cpc->rnd1])); code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(code_addr) + label_offset[cpc->rnd1]));
} }
clause_has_blobs = TRUE;
GONEXT(xc); GONEXT(xc);
} }
@ -2342,6 +2343,10 @@ do_pass(void)
break; break;
case cutexit_op: case cutexit_op:
a_cut(); a_cut();
if (CurrentPred->PredFlags & LogUpdatePredFlag &&
clause_has_blobs &&
!alloc_found)
a_cle(_alloc_for_logical_pred);
a_e(_procceed); a_e(_procceed);
#ifdef YAPOR #ifdef YAPOR
if (pass_no) if (pass_no)
@ -2406,6 +2411,10 @@ do_pass(void)
a_l(_skip); a_l(_skip);
break; break;
case procceed_op: case procceed_op:
if (CurrentPred->PredFlags & LogUpdatePredFlag &&
clause_has_blobs &&
!alloc_found)
a_cle(_alloc_for_logical_pred);
a_e(_procceed); a_e(_procceed);
break; break;
case call_op: case call_op:
@ -2606,7 +2615,7 @@ do_pass(void)
} }
yamop * yamop *
Yap_assemble(int mode) Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact)
{ {
/* /*
* the assembly proccess is done in two passes: 1 - a first pass * the assembly proccess is done in two passes: 1 - a first pass
@ -2636,12 +2645,28 @@ Yap_assemble(int mode)
if ((CELL)code_p > size) if ((CELL)code_p > size)
size = (CELL)code_p; size = (CELL)code_p;
} }
if (mode == ASSEMBLING_CLAUSE &&
ap->PredFlags & LogUpdatePredFlag &&
!is_fact) {
DBTerm *x;
LogUpdClause *cl;
while ((x = Yap_StoreTermInDBPlusExtraSpace(t, size)) == NULL) {
if (!Yap_growheap(TRUE, size)) {
Yap_Error_TYPE = SYSTEM_ERROR;
return NULL;
}
}
cl = (LogUpdClause *)((CODEADDR)x-(UInt)size);
cl->ClSource = x;
code_addr = (yamop *)cl;
} else {
while ((code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) { while ((code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) {
if (!Yap_growheap(TRUE, size)) { if (!Yap_growheap(TRUE, size)) {
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = SYSTEM_ERROR;
return NULL; return NULL;
} }
} }
}
// fprintf(stderr,"vsc: asking for %p\n",code_addr); // fprintf(stderr,"vsc: asking for %p\n",code_addr);
entry_code = do_pass(); entry_code = do_pass();
YAPLeaveCriticalSection(); YAPLeaveCriticalSection();