make sure we walk every clause when doing restore mega_clause.
This commit is contained in:
parent
021141188f
commit
a628079e00
@ -836,7 +836,7 @@ Yap_BuildMegaClause(PredEntry *ap)
|
|||||||
memcpy((void *)ptr, (void *)cl->ClCode, sz);
|
memcpy((void *)ptr, (void *)cl->ClCode, sz);
|
||||||
if (has_blobs) {
|
if (has_blobs) {
|
||||||
ClDiff = (char *)(ptr)-(char *)cl->ClCode;
|
ClDiff = (char *)(ptr)-(char *)cl->ClCode;
|
||||||
restore_opcodes(ptr);
|
restore_opcodes(ptr, NULL);
|
||||||
}
|
}
|
||||||
ptr = (yamop *)((char *)ptr + sz);
|
ptr = (yamop *)((char *)ptr + sz);
|
||||||
if (cl->ClCode == ap->cs.p_code.LastClause)
|
if (cl->ClCode == ap->cs.p_code.LastClause)
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
restore_opcodes(yamop *pc)
|
restore_opcodes(yamop *pc, yamop *max)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
op_numbers op = Yap_op_from_opcode(pc->opc);
|
op_numbers op;
|
||||||
|
if (max && pc >= max) return;
|
||||||
|
op = Yap_op_from_opcode(pc->opc);
|
||||||
pc->opc = Yap_opcode(op);
|
pc->opc = Yap_opcode(op);
|
||||||
#ifdef DEBUG_RESTORE2
|
#ifdef DEBUG_RESTORE2
|
||||||
fprintf(stderr, "%s ", Yap_op_names[op]);
|
fprintf(stderr, "%s ", Yap_op_names[op]);
|
||||||
|
23
H/rheap.h
23
H/rheap.h
@ -517,7 +517,7 @@ RestoreStaticClause(StaticClause *cl)
|
|||||||
if (cl->ClNext) {
|
if (cl->ClNext) {
|
||||||
cl->ClNext = PtoStCAdjust(cl->ClNext);
|
cl->ClNext = PtoStCAdjust(cl->ClNext);
|
||||||
}
|
}
|
||||||
restore_opcodes(cl->ClCode);
|
restore_opcodes(cl->ClCode, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restores a prolog clause, in its compiled form */
|
/* Restores a prolog clause, in its compiled form */
|
||||||
@ -528,11 +528,20 @@ RestoreMegaClause(MegaClause *cl)
|
|||||||
* clause for this predicate or not
|
* clause for this predicate or not
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
UInt ncls, i;
|
||||||
|
yamop *ptr;
|
||||||
|
|
||||||
cl->ClPred = PtoPredAdjust(cl->ClPred);
|
cl->ClPred = PtoPredAdjust(cl->ClPred);
|
||||||
if (cl->ClNext) {
|
if (cl->ClNext) {
|
||||||
cl->ClNext = (MegaClause *)AddrAdjust((ADDR)(cl->ClNext));
|
cl->ClNext = (MegaClause *)AddrAdjust((ADDR)(cl->ClNext));
|
||||||
|
}
|
||||||
|
ncls = cl->ClPred->cs.p_code.NOfClauses;
|
||||||
|
|
||||||
|
for (i = 0, ptr = cl->ClCode; i < ncls; i++) {
|
||||||
|
yamop *nextptr = (yamop *)((char *)ptr + cl->ClItemSize);
|
||||||
|
restore_opcodes(ptr, nextptr);
|
||||||
|
ptr = nextptr;
|
||||||
}
|
}
|
||||||
restore_opcodes(cl->ClCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restores a prolog clause, in its compiled form */
|
/* Restores a prolog clause, in its compiled form */
|
||||||
@ -547,7 +556,7 @@ RestoreDynamicClause(DynamicClause *cl, PredEntry *pp)
|
|||||||
cl->ClPrevious = PtoOpAdjust(cl->ClPrevious);
|
cl->ClPrevious = PtoOpAdjust(cl->ClPrevious);
|
||||||
}
|
}
|
||||||
INIT_LOCK(cl->ClLock);
|
INIT_LOCK(cl->ClLock);
|
||||||
restore_opcodes(cl->ClCode);
|
restore_opcodes(cl->ClCode, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restores a prolog clause, in its compiled form */
|
/* Restores a prolog clause, in its compiled form */
|
||||||
@ -573,7 +582,7 @@ RestoreLUClause(LogUpdClause *cl, PredEntry *pp)
|
|||||||
cl->ClNext = PtoLUCAdjust(cl->ClNext);
|
cl->ClNext = PtoLUCAdjust(cl->ClNext);
|
||||||
}
|
}
|
||||||
cl->ClPred = PtoPredAdjust(cl->ClPred);
|
cl->ClPred = PtoPredAdjust(cl->ClPred);
|
||||||
restore_opcodes(cl->ClCode);
|
restore_opcodes(cl->ClCode, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -615,7 +624,7 @@ CleanLUIndex(LogUpdIndex *idx, int recurse)
|
|||||||
CleanLUIndex(idx->ChildIndex, TRUE);
|
CleanLUIndex(idx->ChildIndex, TRUE);
|
||||||
}
|
}
|
||||||
if (!(idx->ClFlags & SwitchTableMask)) {
|
if (!(idx->ClFlags & SwitchTableMask)) {
|
||||||
restore_opcodes(idx->ClCode);
|
restore_opcodes(idx->ClCode, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +643,7 @@ CleanSIndex(StaticIndex *idx, int recurse)
|
|||||||
CleanSIndex(idx->ChildIndex, TRUE);
|
CleanSIndex(idx->ChildIndex, TRUE);
|
||||||
}
|
}
|
||||||
if (!(idx->ClFlags & SwitchTableMask)) {
|
if (!(idx->ClFlags & SwitchTableMask)) {
|
||||||
restore_opcodes(idx->ClCode);
|
restore_opcodes(idx->ClCode, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,12 @@ header(W) :-
|
|||||||
header_rclause(W) :-
|
header_rclause(W) :-
|
||||||
format(W,'~n /* This file was generated automatically by \"yap -L misc/buildops\"~n please do not update */~n~n
|
format(W,'~n /* This file was generated automatically by \"yap -L misc/buildops\"~n please do not update */~n~n
|
||||||
static void
|
static void
|
||||||
restore_opcodes(yamop *pc)
|
restore_opcodes(yamop *pc, yamop *max)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
op_numbers op = Yap_op_from_opcode(pc->opc);
|
op_numbers op;
|
||||||
|
if (max && pc >= max) return;
|
||||||
|
op = Yap_op_from_opcode(pc->opc);
|
||||||
pc->opc = Yap_opcode(op);
|
pc->opc = Yap_opcode(op);
|
||||||
#ifdef DEBUG_RESTORE2
|
#ifdef DEBUG_RESTORE2
|
||||||
fprintf(stderr, "%s ", Yap_op_names[op]);
|
fprintf(stderr, "%s ", Yap_op_names[op]);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e
|
Subproject commit e071f01c1d9015e6d3fabc73092a6e902541485a
|
@ -1 +1 @@
|
|||||||
Subproject commit a2d2f03107eecd45462cd61a678035132cf06326
|
Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa
|
Reference in New Issue
Block a user