fix nasty overflows in and add some very preliminary support for very large
clauses with lots of disjuncts (eg, query packs). git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1676 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
4dc4eb8a75
commit
beba8315ca
@ -11,8 +11,12 @@
|
||||
* File: compiler.c *
|
||||
* comments: Clause compiler *
|
||||
* *
|
||||
* Last rev: $Date: 2006-05-19 14:31:31 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-07-27 19:04:56 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.77 2006/05/19 14:31:31 vsc
|
||||
* get rid of IntArrays and FloatArray code.
|
||||
* include holes when calculating memory usage.
|
||||
*
|
||||
* Revision 1.76 2006/05/19 13:48:11 vsc
|
||||
* help to make Yap work with dynamic libs
|
||||
*
|
||||
@ -2794,7 +2798,7 @@ c_layout(compiler_struct *cglobs)
|
||||
{
|
||||
up = cglobs->Uses;
|
||||
cop = cglobs->Contents;
|
||||
for (rn = 0; rn <= cglobs->MaxCTemps; ++rn) {
|
||||
for (rn = 0; rn < cglobs->MaxCTemps; ++rn) {
|
||||
if (*cop != (TempVar | rn)) {
|
||||
*up++ = *cop++ = NIL;
|
||||
} else {
|
||||
|
35
C/exec.c
35
C/exec.c
@ -1649,6 +1649,40 @@ p_clean_ifcp(void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int disj_marker(yamop *apc) {
|
||||
op_numbers opnum = Yap_op_from_opcode(apc->opc);
|
||||
|
||||
return opnum == _or_else || opnum == _or_last;
|
||||
}
|
||||
|
||||
|
||||
static Int
|
||||
p_cut_up_to_next_disjunction(void) {
|
||||
choiceptr pt0 = B;
|
||||
CELL *qenv = (CELL *)ENV[E_E];
|
||||
|
||||
while (pt0 &&
|
||||
(!disj_marker(pt0->cp_ap) || qenv != pt0->cp_env)) {
|
||||
pt0 = pt0->cp_b;
|
||||
}
|
||||
if (!pt0)
|
||||
return TRUE;
|
||||
#ifdef YAPOR
|
||||
CUT_prune_to(pt0);
|
||||
#endif /* YAPOR */
|
||||
/* find where to cut to */
|
||||
if (SHOULD_CUT_UP_TO(B,pt0)) {
|
||||
B = pt0;
|
||||
#ifdef TABLING
|
||||
abolish_incomplete_subgoals(B);
|
||||
#endif /* TABLING */
|
||||
}
|
||||
/* trim_trail(); */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static Int
|
||||
JumpToEnv(Term t) {
|
||||
yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred,l),
|
||||
@ -1851,6 +1885,7 @@ Yap_InitExecFs(void)
|
||||
Yap_InitCPred("$restore_regs", 1, p_restore_regs, SafePredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$restore_regs", 2, p_restore_regs2, SafePredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("$clean_ifcp", 1, p_clean_ifcp, SafePredFlag|HiddenPredFlag);
|
||||
Yap_InitCPred("qpack_clean_up_to_disjunction", 0, p_cut_up_to_next_disjunction, SafePredFlag);
|
||||
Yap_InitCPred("$jump_env_and_store_ball", 1, p_jump_env, HiddenPredFlag);
|
||||
Yap_InitCPred("$generate_pred_info", 4, p_generate_pred_info, HiddenPredFlag);
|
||||
Yap_InitCPred("$uncaught_throw", 0, p_uncaught_throw, HiddenPredFlag);
|
||||
|
@ -3084,7 +3084,7 @@ static Int
|
||||
old_H = H;
|
||||
Yap_eot_before_eof = FALSE;
|
||||
tokstart = Yap_tokptr = Yap_toktide = Yap_tokenizer(inp_stream);
|
||||
if (Yap_Error_TYPE && seekable) {
|
||||
if (Yap_Error_TYPE != YAP_NO_ERROR && seekable) {
|
||||
H = old_H;
|
||||
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
||||
if (Stream[inp_stream].status & InMemory_Stream_f) {
|
||||
@ -3227,8 +3227,6 @@ static Int
|
||||
restore_machine_regs();
|
||||
|
||||
old_TR = TR;
|
||||
/* don't need to recheck tokens */
|
||||
tokstart = NULL;
|
||||
/* restart global */
|
||||
H = old_H;
|
||||
TR = (tr_fr_ptr)ScannerStack;
|
||||
|
@ -16,6 +16,11 @@
|
||||
|
||||
<h2>Yap-5.1.2:</h2>
|
||||
<ul>
|
||||
<li> NEW: rbqueues keeps a simple db queue</li>
|
||||
<li> NEW: cut_up_to_next_disjunction/0 tries to prune until the closest
|
||||
choice-point from the parent disjunction (think query packs).</li>
|
||||
<li> FIXED: error condition when we expand to maximum number of variables.</li>
|
||||
<li> FIXED: bug when variable list in parser overflows.</li>
|
||||
<li> FIXED: min_list (obs from Filip Zelezny).</li>
|
||||
<li> FIXED: -l and -L options (again?).</li>
|
||||
<li> FIXED: if we cannot read more chars in saved state we're dead.</li>
|
||||
|
@ -30,6 +30,7 @@ PROGRAMS= $(srcdir)/apply_macros.yap \
|
||||
$(srcdir)/avl.yap \
|
||||
$(srcdir)/charsio.yap \
|
||||
$(srcdir)/cleanup.yap \
|
||||
$(srcdir)/dbqueues.yap \
|
||||
$(srcdir)/dgraphs.yap \
|
||||
$(srcdir)/gensym.yap \
|
||||
$(srcdir)/heaps.yap \
|
||||
|
@ -1,3 +1,5 @@
|
||||
% A library to implement queues of DB Terms
|
||||
|
||||
:- module(dbqueue, [
|
||||
db_enqueue/2,
|
||||
db_dequeue/2,
|
||||
|
Reference in New Issue
Block a user