Upgrade to new CHR (with Jan's changes).
Found out I need to add an extra field to allocate so that the exception handling code knows where the clause is. Protect creep_allowed from NULL pointers.
This commit is contained in:
parent
2ae9677f4b
commit
2a84e259a2
19
C/absmi.c
19
C/absmi.c
@ -557,11 +557,13 @@ static inline Term rbig(MP_INT *big)
|
|||||||
static PredEntry *
|
static PredEntry *
|
||||||
creep_allowed(PredEntry *p, PredEntry *p0)
|
creep_allowed(PredEntry *p, PredEntry *p0)
|
||||||
{
|
{
|
||||||
|
if (!p0)
|
||||||
|
return NULL;
|
||||||
if (p0 == PredMetaCall)
|
if (p0 == PredMetaCall)
|
||||||
return p0;
|
return p0;
|
||||||
if (!p0->ModuleOfPred &&
|
if (!p0->ModuleOfPred &&
|
||||||
(!p->ModuleOfPred
|
(!p ||
|
||||||
||
|
!p->ModuleOfPred ||
|
||||||
p->PredFlags & StandardPredFlag))
|
p->PredFlags & StandardPredFlag))
|
||||||
return NULL;
|
return NULL;
|
||||||
return p;
|
return p;
|
||||||
@ -2693,6 +2695,7 @@ Yap_absmi(int inp)
|
|||||||
Yap_op_from_opcode(PREG->opc) != Yap_opcode(_cut_e)) {
|
Yap_op_from_opcode(PREG->opc) != Yap_opcode(_cut_e)) {
|
||||||
GONext();
|
GONext();
|
||||||
}
|
}
|
||||||
|
PP = PREG->u.p.p;
|
||||||
ASP = YREG+E_CB;
|
ASP = YREG+E_CB;
|
||||||
/* cut_e */
|
/* cut_e */
|
||||||
if (SREG <= ASP) {
|
if (SREG <= ASP) {
|
||||||
@ -2732,8 +2735,8 @@ Yap_absmi(int inp)
|
|||||||
}
|
}
|
||||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||||
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(AtomRestoreRegs,2),0));
|
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(AtomRestoreRegs,2),0));
|
||||||
XREGS[0] = YREG[PREG->u.y.y];
|
XREGS[0] = YREG[PREG->u.yp.y];
|
||||||
PREG = NEXTOP(PREG,y);
|
PREG = NEXTOP(PREG,yp);
|
||||||
goto creep_either;
|
goto creep_either;
|
||||||
}
|
}
|
||||||
/* don't do debugging and friends here */
|
/* don't do debugging and friends here */
|
||||||
@ -2763,8 +2766,8 @@ Yap_absmi(int inp)
|
|||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
ENDCACHE_Y_AS_ENV();
|
ENDCACHE_Y_AS_ENV();
|
||||||
}
|
}
|
||||||
XREGS[0] = XREG(PREG->u.x.x);
|
XREGS[0] = XREG(PREG->u.xp.x);
|
||||||
PREG = NEXTOP(PREG,x);
|
PREG = NEXTOP(PREG,xp);
|
||||||
goto creep_either;
|
goto creep_either;
|
||||||
}
|
}
|
||||||
/* don't do debugging and friends here */
|
/* don't do debugging and friends here */
|
||||||
@ -3106,9 +3109,9 @@ Yap_absmi(int inp)
|
|||||||
GONext();
|
GONext();
|
||||||
ENDOp();
|
ENDOp();
|
||||||
|
|
||||||
Op(deallocate, e);
|
Op(deallocate, p);
|
||||||
CACHE_Y_AS_ENV(YREG);
|
CACHE_Y_AS_ENV(YREG);
|
||||||
PREG = NEXTOP(PREG, e);
|
PREG = NEXTOP(PREG, p);
|
||||||
/* other instructions do depend on S being set by deallocate
|
/* other instructions do depend on S being set by deallocate
|
||||||
:-( */
|
:-( */
|
||||||
SREG = YREG;
|
SREG = YREG;
|
||||||
|
16
C/amasm.c
16
C/amasm.c
@ -517,6 +517,17 @@ a_e(op_numbers opcode, yamop *code_p, int pass_no)
|
|||||||
return code_p;
|
return code_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static yamop *
|
||||||
|
a_p0(op_numbers opcode, yamop *code_p, int pass_no, PredEntry *p0)
|
||||||
|
{
|
||||||
|
if (pass_no) {
|
||||||
|
code_p->opc = emit_op(opcode);
|
||||||
|
code_p->u.p.p = p0;
|
||||||
|
}
|
||||||
|
GONEXT(p);
|
||||||
|
return code_p;
|
||||||
|
}
|
||||||
|
|
||||||
inline static yamop *
|
inline static yamop *
|
||||||
a_ue(op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no)
|
a_ue(op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no)
|
||||||
{
|
{
|
||||||
@ -2155,7 +2166,7 @@ a_deallocate(clause_info *clinfo, yamop *code_p, int pass_no, struct intermediat
|
|||||||
cip->cpc = cip->cpc->nextInst;
|
cip->cpc = cip->cpc->nextInst;
|
||||||
code_p = a_p(_dexecute, clinfo, code_p, pass_no, cip);
|
code_p = a_p(_dexecute, clinfo, code_p, pass_no, cip);
|
||||||
} else
|
} else
|
||||||
code_p = a_e(_deallocate, code_p, pass_no);
|
code_p = a_p0(_deallocate, code_p, pass_no, cip->CurrentPred);
|
||||||
clinfo->dealloc_found = TRUE;
|
clinfo->dealloc_found = TRUE;
|
||||||
}
|
}
|
||||||
return code_p;
|
return code_p;
|
||||||
@ -3682,7 +3693,8 @@ Yap_InitComma(void)
|
|||||||
code_p->u.sbpp.bmap = NULL;
|
code_p->u.sbpp.bmap = NULL;
|
||||||
GONEXT(sbpp);
|
GONEXT(sbpp);
|
||||||
code_p->opc = emit_op(_deallocate);
|
code_p->opc = emit_op(_deallocate);
|
||||||
GONEXT(e);
|
code_p->u.p.p = PredMetaCall;
|
||||||
|
GONEXT(p);
|
||||||
code_p->opc = emit_op(_procceed);
|
code_p->opc = emit_op(_procceed);
|
||||||
code_p->u.p.p = PredMetaCall;
|
code_p->u.p.p = PredMetaCall;
|
||||||
GONEXT(p);
|
GONEXT(p);
|
||||||
|
@ -3919,11 +3919,13 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
|||||||
*endp = (CODEADDR)cl+cl->ClSize;
|
*endp = (CODEADDR)cl+cl->ClSize;
|
||||||
return cl->ClPred;
|
return cl->ClPred;
|
||||||
}
|
}
|
||||||
|
case _deallocate:
|
||||||
|
pc = NEXTOP(pc,p);
|
||||||
|
break;
|
||||||
case _cut:
|
case _cut:
|
||||||
case _cut_t:
|
case _cut_t:
|
||||||
case _cut_e:
|
case _cut_e:
|
||||||
case _allocate:
|
case _allocate:
|
||||||
case _deallocate:
|
|
||||||
case _write_void:
|
case _write_void:
|
||||||
case _write_list:
|
case _write_list:
|
||||||
case _write_l_list:
|
case _write_l_list:
|
||||||
|
@ -980,7 +980,6 @@ has_cut(yamop *pc)
|
|||||||
case _trust_fail:
|
case _trust_fail:
|
||||||
case _op_fail:
|
case _op_fail:
|
||||||
case _allocate:
|
case _allocate:
|
||||||
case _deallocate:
|
|
||||||
case _write_void:
|
case _write_void:
|
||||||
case _write_list:
|
case _write_list:
|
||||||
case _write_l_list:
|
case _write_l_list:
|
||||||
@ -1298,6 +1297,7 @@ has_cut(yamop *pc)
|
|||||||
pc = NEXTOP(pc,c);
|
pc = NEXTOP(pc,c);
|
||||||
break;
|
break;
|
||||||
/* instructions type p */
|
/* instructions type p */
|
||||||
|
case _deallocate:
|
||||||
case _procceed:
|
case _procceed:
|
||||||
pc = NEXTOP(pc,p);
|
pc = NEXTOP(pc,p);
|
||||||
break;
|
break;
|
||||||
@ -1479,8 +1479,10 @@ add_info(ClauseDef *clause, UInt regno)
|
|||||||
case _cut_e:
|
case _cut_e:
|
||||||
clause->Tag = (CELL)NULL;
|
clause->Tag = (CELL)NULL;
|
||||||
return;
|
return;
|
||||||
case _allocate:
|
|
||||||
case _deallocate:
|
case _deallocate:
|
||||||
|
cl = NEXTOP(cl,p);
|
||||||
|
break;
|
||||||
|
case _allocate:
|
||||||
case _write_void:
|
case _write_void:
|
||||||
case _write_list:
|
case _write_list:
|
||||||
case _write_l_list:
|
case _write_l_list:
|
||||||
|
5
C/init.c
5
C/init.c
@ -507,7 +507,7 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
|
|||||||
if (flags & SafePredFlag) {
|
if (flags & SafePredFlag) {
|
||||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(p_code,sbpp),p),l);
|
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(p_code,sbpp),p),l);
|
||||||
} else {
|
} else {
|
||||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),sbpp),e),p),l);
|
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),sbpp),p),p),l);
|
||||||
}
|
}
|
||||||
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
|
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
|
||||||
if (!cl) {
|
if (!cl) {
|
||||||
@ -544,7 +544,8 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
|
|||||||
p_code = NEXTOP(p_code,sbpp);
|
p_code = NEXTOP(p_code,sbpp);
|
||||||
if (!(flags & SafePredFlag)) {
|
if (!(flags & SafePredFlag)) {
|
||||||
p_code->opc = Yap_opcode(_deallocate);
|
p_code->opc = Yap_opcode(_deallocate);
|
||||||
p_code = NEXTOP(p_code,e);
|
p_code->u.p.p = pe;
|
||||||
|
p_code = NEXTOP(p_code,p);
|
||||||
}
|
}
|
||||||
p_code->opc = Yap_opcode(_procceed);
|
p_code->opc = Yap_opcode(_procceed);
|
||||||
p_code->u.p.p = pe;
|
p_code->u.p.p = pe;
|
||||||
|
@ -164,6 +164,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
sc = Yap_heap_regs;
|
sc = Yap_heap_regs;
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
|
if (vsc_count < 2473000LL)
|
||||||
|
return;
|
||||||
|
if (vsc_count == 2473801LL)
|
||||||
|
jmp_deb(1);
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
OPCODE(call ,sbpp),
|
OPCODE(call ,sbpp),
|
||||||
OPCODE(procceed ,p),
|
OPCODE(procceed ,p),
|
||||||
OPCODE(allocate ,e),
|
OPCODE(allocate ,e),
|
||||||
OPCODE(deallocate ,e),
|
OPCODE(deallocate ,p),
|
||||||
#ifdef BEAM
|
#ifdef BEAM
|
||||||
OPCODE(retry_eam ,e),
|
OPCODE(retry_eam ,e),
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,7 +149,6 @@ restore_opcodes(yamop *pc)
|
|||||||
case _cut:
|
case _cut:
|
||||||
case _cut_e:
|
case _cut_e:
|
||||||
case _cut_t:
|
case _cut_t:
|
||||||
case _deallocate:
|
|
||||||
case _enter_a_profiling:
|
case _enter_a_profiling:
|
||||||
case _expand_index:
|
case _expand_index:
|
||||||
case _index_blob:
|
case _index_blob:
|
||||||
@ -353,6 +352,7 @@ restore_opcodes(yamop *pc)
|
|||||||
/* instructions type p */
|
/* instructions type p */
|
||||||
case _count_call:
|
case _count_call:
|
||||||
case _count_retry:
|
case _count_retry:
|
||||||
|
case _deallocate:
|
||||||
case _enter_profiling:
|
case _enter_profiling:
|
||||||
case _lock_lu:
|
case _lock_lu:
|
||||||
case _procceed:
|
case _procceed:
|
||||||
|
2
LGPL/chr
2
LGPL/chr
@ -1 +1 @@
|
|||||||
Subproject commit ef9e506ca3befa9589b683ddd7e482411c00b759
|
Subproject commit 293457c65497bf63027c24cf954e6b4965f70df3
|
@ -79,9 +79,14 @@ MYDDAS_PROGRAMS= $(srcdir)/MYDDAS/myddas.ypp \
|
|||||||
$(srcdir)/MYDDAS/myddas_util_predicates.ypp \
|
$(srcdir)/MYDDAS/myddas_util_predicates.ypp \
|
||||||
$(srcdir)/MYDDAS/myddas_prolog2sql_optimizer.ypp
|
$(srcdir)/MYDDAS/myddas_prolog2sql_optimizer.ypp
|
||||||
|
|
||||||
|
DIALECT_PROGRAMS= $(srcdir)/../shlib/dialect/hprolog.pl
|
||||||
|
|
||||||
|
|
||||||
install: $(PROGRAMS) install_myddas
|
install: $(PROGRAMS) install_myddas
|
||||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
||||||
|
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/dialect
|
||||||
for p in $(PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap; done
|
for p in $(PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap; done
|
||||||
|
for p in $(DIALECT_PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap/dialect; done
|
||||||
|
|
||||||
install_myddas: $(MYDDAS_PROGRAMS)
|
install_myddas: $(MYDDAS_PROGRAMS)
|
||||||
count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \
|
count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \
|
||||||
|
2
shlib
2
shlib
@ -1 +1 @@
|
|||||||
Subproject commit 548ceefdbbeb2bdc8bcc2abbc49a8cf5a557c238
|
Subproject commit 9ca7abd128989d971a265c856bea3e1770812664
|
Reference in New Issue
Block a user