make sure we have enough room when splitting mega clause.

This commit is contained in:
Costa Vitor 2009-09-12 16:43:44 -05:00
parent fc28a49122
commit 32122f4171

View File

@ -877,7 +877,7 @@ split_megaclause(PredEntry *ap)
mcl =
ClauseCodeToMegaClause(ap->cs.p_code.FirstClause);
for (i = 0, ptr = mcl->ClCode; i < ncls; i++) {
StaticClause *new = (StaticClause *)Yap_AllocCodeSpace(sizeof(StaticClause)+mcl->ClItemSize);
StaticClause *new = (StaticClause *)Yap_AllocCodeSpace(sizeof(StaticClause)+mcl->ClItemSize+(UInt)NEXTOP((yamop *)NULL,p));
if (new == NULL) {
if (!Yap_growheap(FALSE, (sizeof(StaticClause)+mcl->ClItemSize)*(ncls-i), NULL)) {
while (start) {
@ -895,7 +895,7 @@ split_megaclause(PredEntry *ap)
return;
}
}
Yap_ClauseSpace += sizeof(StaticClause)+mcl->ClItemSize;
Yap_ClauseSpace += sizeof(StaticClause)+mcl->ClItemSize+(UInt)NEXTOP((yamop *)NULL,p);
new->ClFlags = StaticMask|FactMask;
new->ClSize = mcl->ClItemSize;
new->usc.ClPred = ap;