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