bug fixes for YapTab support
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1259 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
90
C/absmi.c
90
C/absmi.c
@@ -10,8 +10,12 @@
|
||||
* *
|
||||
* File: absmi.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2005-03-01 22:25:07 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2005-03-04 20:29:55 $,$Author: ricroc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.158 2005/03/01 22:25:07 vsc
|
||||
* fix pruning bug
|
||||
* make DL_MALLOC less enthusiastic about walking through buckets.
|
||||
*
|
||||
* Revision 1.157 2005/02/08 18:04:17 vsc
|
||||
* library_directory may not be deterministic (usually it isn't).
|
||||
*
|
||||
@@ -571,7 +575,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(PREG->u.ld.d);
|
||||
restore_at_least_one_arg(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -590,7 +594,7 @@ Yap_absmi(int inp)
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_at_least_one_arg(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -602,7 +606,7 @@ Yap_absmi(int inp)
|
||||
/* After trust, cut should be pointing at the new top
|
||||
* choicepoint */
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -657,7 +661,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(PREG->u.ld.d);
|
||||
restore_args(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -676,7 +680,7 @@ Yap_absmi(int inp)
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_args(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -688,7 +692,7 @@ Yap_absmi(int inp)
|
||||
/* After trust, cut should be pointing at the new top
|
||||
* choicepoint */
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -802,7 +806,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(PREG->u.ld.d);
|
||||
restore_args(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -821,7 +825,7 @@ Yap_absmi(int inp)
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_args(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -833,7 +837,7 @@ Yap_absmi(int inp)
|
||||
/* After trust, cut should be pointing at the new top
|
||||
* choicepoint */
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -884,7 +888,7 @@ Yap_absmi(int inp)
|
||||
CACHE_Y(B);
|
||||
restore_yaam_regs(PREG->u.ld.d);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -902,7 +906,7 @@ Yap_absmi(int inp)
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -912,7 +916,7 @@ Yap_absmi(int inp)
|
||||
pop_yaam_regs();
|
||||
S_YREG = (CELL *)(B_YREG+1);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -949,7 +953,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(PREG->u.ld.d);
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -968,7 +972,7 @@ Yap_absmi(int inp)
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -979,7 +983,7 @@ Yap_absmi(int inp)
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
S_YREG = &(B_YREG->cp_a2);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -1025,7 +1029,7 @@ Yap_absmi(int inp)
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -1045,7 +1049,7 @@ Yap_absmi(int inp)
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -1057,7 +1061,7 @@ Yap_absmi(int inp)
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
S_YREG = &(B_YREG->cp_a3);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -1107,7 +1111,7 @@ Yap_absmi(int inp)
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -1128,7 +1132,7 @@ Yap_absmi(int inp)
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -1141,7 +1145,7 @@ Yap_absmi(int inp)
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
S_YREG = &(B_YREG->cp_a4);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -1194,7 +1198,7 @@ Yap_absmi(int inp)
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
ARG4 = B_YREG->cp_a4;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -1216,7 +1220,7 @@ Yap_absmi(int inp)
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
ARG4 = B_YREG->cp_a4;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -1230,7 +1234,7 @@ Yap_absmi(int inp)
|
||||
ARG4 = B_YREG->cp_a4;
|
||||
S_YREG = &(B_YREG->cp_a5);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
@@ -1658,7 +1662,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(PREG);
|
||||
restore_args(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -1722,17 +1726,6 @@ Yap_absmi(int inp)
|
||||
PREFETCH_OP(PREG);
|
||||
failloop:
|
||||
if (pt0 == S_TR) {
|
||||
#ifdef FROZEN_STACKS /* TRAIL */
|
||||
#ifdef SBA
|
||||
if (pt0 < TR_FZ || pt0 > (tr_fr_ptr)Yap_TrailTop)
|
||||
#else
|
||||
if (pt0 < TR_FZ)
|
||||
#endif /* SBA */
|
||||
{
|
||||
TR = TR_FZ;
|
||||
TRAIL_LINK(pt0);
|
||||
}
|
||||
#endif /* FROZEN_STACKS */
|
||||
SP = SP0;
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
if (Yap_do_low_level_trace) {
|
||||
@@ -1837,6 +1830,17 @@ Yap_absmi(int inp)
|
||||
}
|
||||
}
|
||||
#endif /* LOW_LEVEL_TRACER */
|
||||
#ifdef FROZEN_STACKS
|
||||
#ifdef SBA
|
||||
if (pt0 < TR_FZ || pt0 > (tr_fr_ptr)Yap_TrailTop)
|
||||
#else
|
||||
if (pt0 < TR_FZ)
|
||||
#endif /* SBA */
|
||||
{
|
||||
TR = TR_FZ;
|
||||
TRAIL_LINK(pt0);
|
||||
} else
|
||||
#endif /* FROZEN_STACKS */
|
||||
RESTORE_TR();
|
||||
GONext();
|
||||
}
|
||||
@@ -7442,7 +7446,7 @@ Yap_absmi(int inp)
|
||||
restore_yaam_regs(NEXTOP(PREG, ld));
|
||||
restore_at_least_one_arg(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -7460,7 +7464,7 @@ Yap_absmi(int inp)
|
||||
ARG1 = B_YREG->cp_a1;
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -7478,7 +7482,7 @@ Yap_absmi(int inp)
|
||||
ARG2 = B_YREG->cp_a2;
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -7497,7 +7501,7 @@ Yap_absmi(int inp)
|
||||
ARG3 = B_YREG->cp_a3;
|
||||
ARG4 = B_YREG->cp_a4;
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
@@ -7514,7 +7518,7 @@ Yap_absmi(int inp)
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_at_least_one_arg(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
}
|
||||
@@ -7524,7 +7528,7 @@ Yap_absmi(int inp)
|
||||
pop_yaam_regs();
|
||||
pop_at_least_one_arg(PREG->u.ld.s);
|
||||
#ifdef FROZEN_STACKS
|
||||
B_YREG = PROTECT_FROZEN_B(B_YREG);
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
|
||||
27
C/alloc.c
27
C/alloc.c
@@ -12,7 +12,7 @@
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: allocating space *
|
||||
* version:$Id: alloc.c,v 1.68 2004-12-05 05:01:22 vsc Exp $ *
|
||||
* version:$Id: alloc.c,v 1.69 2005-03-04 20:30:10 ricroc Exp $ *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
@@ -466,7 +466,7 @@ AllocHeap(unsigned int size)
|
||||
|
||||
#ifdef YAPOR
|
||||
if (HeapTop > Addr(Yap_GlobalBase) - MinHeapGap) {
|
||||
abort_optyap("No heap left in function AllocHeap");
|
||||
abort_yapor("No heap left in function AllocHeap");
|
||||
}
|
||||
#else
|
||||
if (HeapTop > HeapLim - MinHeapGap) {
|
||||
@@ -815,7 +815,7 @@ static int
|
||||
ExtendWorkSpace(Int s, int fixed_allocation)
|
||||
{
|
||||
#ifdef YAPOR
|
||||
abort_optyap("function ExtendWorkSpace called");
|
||||
abort_yapor("function ExtendWorkSpace called");
|
||||
return(FALSE);
|
||||
#else
|
||||
MALLOC_T a;
|
||||
@@ -1266,14 +1266,6 @@ InitHeap(void *heap_addr)
|
||||
FreeBlocks = NIL;
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
#ifdef USE_HEAP
|
||||
/* Try to make the system to crash */
|
||||
BaseAllocArea = NULL;
|
||||
TopAllocArea = BaseAllocArea;
|
||||
#else
|
||||
BaseAllocArea = AllocCodeSpace(OPT_CHUNK_SIZE);
|
||||
TopAllocArea = BaseAllocArea;
|
||||
#endif
|
||||
LOCAL = REMOTE; /* point to the first area */
|
||||
#endif /* YAPOR || TABLING */
|
||||
}
|
||||
@@ -1289,21 +1281,8 @@ Yap_InitMemory(int Trail, int Heap, int Stack)
|
||||
{
|
||||
Int pm, sa, ta;
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
{
|
||||
#ifdef USE_HEAP
|
||||
int OKHeap = MinHeapSpace+(sizeof(struct global_data) + aux_number_workers*sizeof(struct local_data))/1024;
|
||||
#else
|
||||
int OKHeap = MinHeapSpace+(sizeof(struct global_data) + aux_number_workers*sizeof(struct local_data)+OPT_CHUNK_SIZE)/1024;
|
||||
#endif
|
||||
if (Heap < OKHeap)
|
||||
Heap = OKHeap;
|
||||
}
|
||||
#else
|
||||
if (Heap < MinHeapSpace)
|
||||
Heap = MinHeapSpace;
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
/* sanity checking for data areas */
|
||||
if (Trail < MinTrailSpace)
|
||||
Trail = MinTrailSpace;
|
||||
|
||||
16
C/amasm.c
16
C/amasm.c
@@ -11,8 +11,12 @@
|
||||
* File: amasm.c *
|
||||
* comments: abstract machine assembler *
|
||||
* *
|
||||
* Last rev: $Date: 2005-01-28 23:14:34 $ *
|
||||
* Last rev: $Date: 2005-03-04 20:30:10 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.71 2005/01/28 23:14:34 vsc
|
||||
* move to Yap-4.5.7
|
||||
* Fix clause size
|
||||
*
|
||||
* Revision 1.70 2004/12/28 22:20:35 vsc
|
||||
* some extra bug fixes for trail overflows: some cannot be recovered that easily,
|
||||
* some can.
|
||||
@@ -2262,10 +2266,10 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
#define TRYOP(G,P) (IPredArity<5 ? (op_numbers)((int)(P)+(IPredArity*3)) : (G))
|
||||
#ifdef YAPOR
|
||||
#define TRYCODE(G,P) a_try(TRYOP(G,P), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], IPredArity, &clinfo, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no)
|
||||
#define TABLE_TRYCODE(G) a_try(G, (CELL)emit_ilabel(cip->cpc->rnd1, code_addr, cip), IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no)
|
||||
#define TABLE_TRYCODE(G) a_try(G, (CELL)emit_ilabel(cip->cpc->rnd1, cip), IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no)
|
||||
#else
|
||||
#define TRYCODE(G,P) a_try(TRYOP(G,P), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], IPredArity, &clinfo, code_p, pass_no)
|
||||
#define TABLE_TRYCODE(G) a_try(G, (CELL)emit_ilabel(cip->cpc->rnd1, code_addr, cip), IPredArity, code_p, pass_no)
|
||||
#define TABLE_TRYCODE(G) a_try(G, (CELL)emit_ilabel(cip->cpc->rnd1, cip), IPredArity, &clinfo, code_p, pass_no)
|
||||
#endif /* YAPOR */
|
||||
|
||||
static yamop *
|
||||
@@ -2407,10 +2411,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
case table_new_answer_op:
|
||||
code_p = a_n(_table_new_answer, (int) cip->cpc->rnd2, code_p);
|
||||
code_p = a_n(_table_new_answer, (int) cip->cpc->rnd2, code_p, pass_no);
|
||||
break;
|
||||
case table_try_single_op:
|
||||
code_p = a_gl(_table_try_single, code_p, clinfo, code_p, pass_no, cpc);
|
||||
code_p = a_gl(_table_try_single, &clinfo, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
#endif /* TABLING */
|
||||
#ifdef TABLING_INNER_CUTS
|
||||
@@ -2706,7 +2710,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
}
|
||||
#ifdef TABLING
|
||||
if (tabled)
|
||||
code_p = a_gl(_table_trust, &clinfo, code_p, pass_no, cpc);
|
||||
code_p = a_gl(_table_trust, &clinfo, code_p, pass_no, cip->cpc);
|
||||
else
|
||||
#endif
|
||||
code_p = a_gl(_trust, &clinfo, code_p, pass_no, cip->cpc);
|
||||
|
||||
@@ -10,8 +10,12 @@
|
||||
* File: c_interface.c *
|
||||
* comments: c_interface primitives definition *
|
||||
* *
|
||||
* Last rev: $Date: 2005-03-02 18:35:44 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2005-03-04 20:30:10 $,$Author: ricroc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.62 2005/03/02 18:35:44 vsc
|
||||
* try to make initialisation process more robust
|
||||
* try to make name more robust (in case Lookup new atom fails)
|
||||
*
|
||||
* Revision 1.61 2005/03/01 22:25:08 vsc
|
||||
* fix pruning bug
|
||||
* make DL_MALLOC less enthusiastic about walking through buckets.
|
||||
@@ -1151,7 +1155,7 @@ YAP_Init(YAP_init_args *yap_init)
|
||||
CurrentModule = USER_MODULE;
|
||||
P = GETWORK_FIRST_TIME;
|
||||
Yap_exec_absmi(FALSE);
|
||||
abort_optyap("abstract machine unexpected exit");
|
||||
abort_yapor("abstract machine unexpected exit");
|
||||
}
|
||||
#endif /* YAPOR */
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
11
C/cdmgr.c
11
C/cdmgr.c
@@ -11,8 +11,12 @@
|
||||
* File: cdmgr.c *
|
||||
* comments: Code manager *
|
||||
* *
|
||||
* Last rev: $Date: 2005-02-25 03:39:44 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2005-03-04 20:30:11 $,$Author: ricroc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.153 2005/02/25 03:39:44 vsc
|
||||
* fix fixes to undefp
|
||||
* fix bug where clause mistook cp for ap
|
||||
*
|
||||
* Revision 1.152 2005/02/08 18:04:57 vsc
|
||||
* library_directory may not be deterministic (usually it isn't).
|
||||
*
|
||||
@@ -263,7 +267,8 @@ PredForChoicePt(yamop *p_code) {
|
||||
return NULL;
|
||||
case _table_completion:
|
||||
case _table_answer_resolution:
|
||||
return ENV_ToP(gc_B->cp_cp);
|
||||
return NULL; /* ricroc: is this OK? */
|
||||
/* compile error --> return ENV_ToP(gc_B->cp_cp); */
|
||||
#endif
|
||||
case _or_else:
|
||||
if (p_code == p_code->u.sla.sla_u.l) {
|
||||
@@ -1209,7 +1214,7 @@ add_first_static(PredEntry *p, yamop *cp, int spy_flag)
|
||||
PUT_YAMOP_SEQ(pt);
|
||||
}
|
||||
if (YAMOP_LTT(pt) != 1)
|
||||
abort_optyap("YAMOP_LTT error in function add_first_static");
|
||||
abort_yapor("YAMOP_LTT error in function add_first_static");
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
if (is_tabled(p)) {
|
||||
|
||||
21
C/compiler.c
21
C/compiler.c
@@ -11,8 +11,12 @@
|
||||
* File: compiler.c *
|
||||
* comments: Clause compiler *
|
||||
* *
|
||||
* Last rev: $Date: 2005-02-21 16:49:39 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2005-03-04 20:30:11 $,$Author: ricroc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.62 2005/02/21 16:49:39 vsc
|
||||
* amd64 fixes
|
||||
* library fixes
|
||||
*
|
||||
* Revision 1.61 2005/01/28 23:14:35 vsc
|
||||
* move to Yap-4.5.7
|
||||
* Fix clause size
|
||||
@@ -1231,11 +1235,15 @@ c_goal(Term Goal, int mod, compiler_struct *cglobs)
|
||||
if (cglobs->onlast) {
|
||||
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
|
||||
#ifdef TABLING
|
||||
READ_LOCK(cglobs->cint.CurrentPred->PRWLock);
|
||||
if (is_tabled(cglobs->cint.CurrentPred))
|
||||
Yap_emit(table_new_answer_op, Zero, cglobs->cint.CurrentPred->ArityOfPE, &cglobs->cint);
|
||||
else
|
||||
#endif /* TABLING */
|
||||
Yap_emit(procceed_op, Zero, Zero, &cglobs->cint);
|
||||
#ifdef TABLING
|
||||
READ_UNLOCK(cglobs->cint.CurrentPred->PRWLock);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2944,7 +2952,16 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src)
|
||||
/* phase 1 : produce skeleton code and variable information */
|
||||
c_head(head, &cglobs);
|
||||
if (cglobs.is_a_fact && !cglobs.vtable) {
|
||||
Yap_emit(procceed_op, Zero, Zero, &cglobs.cint);
|
||||
#ifdef TABLING
|
||||
READ_LOCK(cglobs.cint.CurrentPred->PRWLock);
|
||||
if (is_tabled(cglobs.cint.CurrentPred))
|
||||
Yap_emit(table_new_answer_op, Zero, cglobs.cint.CurrentPred->ArityOfPE, &cglobs.cint);
|
||||
else
|
||||
#endif /* TABLING */
|
||||
Yap_emit(procceed_op, Zero, Zero, &cglobs.cint);
|
||||
#ifdef TABLING
|
||||
READ_UNLOCK(cglobs.cint.CurrentPred->PRWLock);
|
||||
#endif
|
||||
/* ground term, do not need much more work */
|
||||
if (cglobs.cint.BlobsStart != NULL) {
|
||||
cglobs.cint.cpc->nextInst = cglobs.cint.BlobsStart;
|
||||
|
||||
4
C/grow.c
4
C/grow.c
@@ -757,6 +757,10 @@ fix_compiler_instructions(PInstr *pcpc)
|
||||
case enter_lu_op:
|
||||
case empty_call_op:
|
||||
case blob_op:
|
||||
#ifdef TABLING
|
||||
case table_new_answer_op:
|
||||
case table_try_single_op:
|
||||
#endif /* TABLING */
|
||||
break;
|
||||
}
|
||||
if (ncpc != NULL) {
|
||||
|
||||
@@ -11,8 +11,12 @@
|
||||
* File: index.c *
|
||||
* comments: Indexing a Prolog predicate *
|
||||
* *
|
||||
* Last rev: $Date: 2005-03-01 22:25:08 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2005-03-04 20:30:12 $,$Author: ricroc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.118 2005/03/01 22:25:08 vsc
|
||||
* fix pruning bug
|
||||
* make DL_MALLOC less enthusiastic about walking through buckets.
|
||||
*
|
||||
* Revision 1.117 2005/02/25 00:09:06 vsc
|
||||
* fix fix, otherwise I'd remove two choice-points :-(.
|
||||
*
|
||||
@@ -3262,7 +3266,7 @@ static UInt
|
||||
emit_single_switch_case(ClauseDef *min, struct intermediates *cint, int first, int clleft, UInt nxtlbl)
|
||||
{
|
||||
#ifdef TABLING
|
||||
if (ap->PredFlags & TabledPredFlag) {
|
||||
if (cint->CurrentPred->PredFlags & TabledPredFlag) {
|
||||
/* we have two differences with tabling:
|
||||
1. we cannot allow straight jumps to clauses, otherwise thetabled
|
||||
would never get to be created.
|
||||
|
||||
112
C/init.c
112
C/init.c
@@ -1122,79 +1122,6 @@ InitVersion(void)
|
||||
MkAtomTerm(Yap_LookupAtom(YAP_VERSION)));
|
||||
}
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
static void
|
||||
InitYapOr(int Heap,
|
||||
int Stack,
|
||||
int Trail,
|
||||
int aux_number_workers,
|
||||
int aux_scheduler_loop,
|
||||
int aux_delayed_release_load) {
|
||||
|
||||
#ifdef YAPOR
|
||||
worker_id = 0;
|
||||
#endif /* YAPOR */
|
||||
|
||||
/* starting message */
|
||||
#ifdef YAPOR
|
||||
if (aux_number_workers > MAX_WORKERS)
|
||||
abort_optyap("excessive number of workers");
|
||||
#ifdef ENV_COPY
|
||||
INFORMATION_MESSAGE("YapOr: copy model - %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#elif ACOW
|
||||
INFORMATION_MESSAGE("YapOr: acow model - %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#else /* SBA */
|
||||
INFORMATION_MESSAGE("YapOr: sba model - %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#endif /* ENV_COPY - ACOW - SBA */
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
#ifdef TABLING_BATCHED_SCHEDULING
|
||||
#ifdef YAPOR
|
||||
#ifdef ALLOC_BEFORE_CHECK
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling (TLWL-ABC)");
|
||||
#endif
|
||||
#if defined(TABLE_LOCK_AT_WRITE_LEVEL) && ! defined(ALLOC_BEFORE_CHECK)
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling (TLWL)");
|
||||
#endif
|
||||
#ifdef TABLE_LOCK_AT_NODE_LEVEL
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling (TLNL)");
|
||||
#endif
|
||||
#ifdef TABLE_LOCK_AT_ENTRY_LEVEL
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling (TLEL)");
|
||||
#endif
|
||||
#else
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling");
|
||||
#endif /* YAPOR */
|
||||
#else /* TABLING_LOCAL_SCHEDULING */
|
||||
#ifdef YAPOR
|
||||
#ifdef ALLOC_BEFORE_CHECK
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling (TLWL-ABC)");
|
||||
#endif
|
||||
#if defined(TABLE_LOCK_AT_WRITE_LEVEL) && ! defined(ALLOC_BEFORE_CHECK)
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling (TLWL)");
|
||||
#endif
|
||||
#ifdef TABLE_LOCK_AT_NODE_LEVEL
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling (TLNL)");
|
||||
#endif
|
||||
#ifdef TABLE_LOCK_AT_ENTRY_LEVEL
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling (TLEL)");
|
||||
#endif
|
||||
#else
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling");
|
||||
#endif /* YAPOR */
|
||||
#endif /* TABLING_SCHEDULING */
|
||||
#endif /* TABLING */
|
||||
#ifdef YAPOR
|
||||
map_memory(Heap, Stack, Trail, aux_number_workers);
|
||||
#else
|
||||
Yap_InitMemory (Trail, Heap, Stack);
|
||||
#endif /* YAPOR */
|
||||
/* global initializations */
|
||||
init_global(aux_number_workers, aux_scheduler_loop, aux_delayed_release_load);
|
||||
init_signals();
|
||||
}
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
|
||||
void
|
||||
Yap_InitWorkspace(int Heap,
|
||||
@@ -1228,18 +1155,35 @@ Yap_InitWorkspace(int Heap,
|
||||
/* also init memory page size, required by later functions */
|
||||
Yap_InitSysbits ();
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
InitYapOr(Heap,
|
||||
Stack,
|
||||
Trail,
|
||||
aux_number_workers,
|
||||
aux_scheduler_loop,
|
||||
aux_delayed_release_load);
|
||||
#else /* Yap */
|
||||
Yap_InitMemory (Trail, Heap, Stack);
|
||||
#endif /* YAPOR || TABLING */
|
||||
Yap_InitTime ();
|
||||
#ifdef TABLING
|
||||
#ifdef TABLING_BATCHED_SCHEDULING
|
||||
INFORMATION_MESSAGE("YapTab: batched scheduling");
|
||||
#else /* TABLING_LOCAL_SCHEDULING */
|
||||
INFORMATION_MESSAGE("YapTab: local scheduling");
|
||||
#endif /* BATCHED - LOCAL */
|
||||
#endif /* TABLING */
|
||||
|
||||
#ifdef YAPOR
|
||||
worker_id = 0;
|
||||
if (aux_number_workers > MAX_WORKERS)
|
||||
abort_yapor("excessive number of workers");
|
||||
#ifdef ENV_COPY
|
||||
INFORMATION_MESSAGE("YapOr: copy model with %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#elif ACOW
|
||||
INFORMATION_MESSAGE("YapOr: acow model with %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#else /* SBA */
|
||||
INFORMATION_MESSAGE("YapOr: sba model with %d worker%s", aux_number_workers, aux_number_workers == 1 ? "":"s");
|
||||
#endif /* ENV_COPY - ACOW - SBA */
|
||||
map_memory(Heap, Stack, Trail, aux_number_workers);
|
||||
#else
|
||||
Yap_InitMemory (Trail, Heap, Stack);
|
||||
#endif /* YAPOR */
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
init_global(aux_number_workers, aux_scheduler_loop, aux_delayed_release_load);
|
||||
#endif /* YAPOR || TABLING */
|
||||
|
||||
Yap_InitTime ();
|
||||
AtomHashTableSize = MaxHash;
|
||||
HashChain = (AtomHashEntry *)Yap_AllocAtomSpace(sizeof(AtomHashEntry) * MaxHash);
|
||||
if (HashChain == NULL) {
|
||||
|
||||
26
C/save.c
26
C/save.c
@@ -468,18 +468,9 @@ save_heap(void)
|
||||
j = Unsigned(&GLOBAL) - Unsigned(Yap_HeapBase);
|
||||
putout(j);
|
||||
mywrite(splfild, (char *) Yap_HeapBase, j);
|
||||
#ifdef USE_HEAP
|
||||
j = Unsigned(HeapTop) - Unsigned(&HashChain);
|
||||
putout(j);
|
||||
mywrite(splfild, (char *) &HashChain, j);
|
||||
#else
|
||||
j = Unsigned(BaseAllocArea) - Unsigned(&HashChain);
|
||||
putout(j);
|
||||
mywrite(splfild, (char *) &HashChain, j);
|
||||
j = Unsigned(HeapTop) - Unsigned(TopAllocBlockArea);
|
||||
putout(j);
|
||||
mywrite(splfild, (char *) TopAllocBlockArea, j);
|
||||
#endif
|
||||
#else
|
||||
j = Unsigned(HeapTop) - Unsigned(Yap_HeapBase);
|
||||
/* store 10 more cells because of the memory manager */
|
||||
@@ -888,28 +879,11 @@ CopyCode(void)
|
||||
}
|
||||
if (myread(splfild, (char *) Yap_HeapBase, j) < 0)
|
||||
return -1;
|
||||
#ifdef USE_HEAP
|
||||
j = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
if (myread(splfild, (char *) &HashChain, j) < 0)
|
||||
return -1;
|
||||
#else
|
||||
j = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
if (j != Unsigned(BaseAllocArea) - Unsigned(&HashChain)) {
|
||||
Yap_ErrorMessage = "Base to Hash does not match saved state";
|
||||
return -1;
|
||||
}
|
||||
if (myread(splfild, (char *) &HashChain, j) < 0)
|
||||
return -1;
|
||||
j = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
if (myread(splfild, (char *) TopAllocBlockArea, j) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
#else
|
||||
if (myread(splfild, (char *) Yap_HeapBase,
|
||||
(Unsigned(OldHeapTop) - Unsigned(OldHeapBase))) < 0)
|
||||
|
||||
Reference in New Issue
Block a user