My first attempt to synchronize OPTYap with CVS
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@920 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
17dad3f6f7
commit
36e9ff7588
|
@ -12,7 +12,7 @@
|
||||||
* Last rev: *
|
* Last rev: *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: allocating space *
|
* comments: allocating space *
|
||||||
* version:$Id: alloc.c,v 1.39 2003-10-30 22:52:46 vsc Exp $ *
|
* version:$Id: alloc.c,v 1.40 2003-11-07 16:31:08 ricroc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
|
@ -1049,10 +1049,8 @@ InitHeap(void *heap_addr)
|
||||||
BaseAllocArea = AllocCodeSpace(OPT_CHUNK_SIZE);
|
BaseAllocArea = AllocCodeSpace(OPT_CHUNK_SIZE);
|
||||||
TopAllocArea = BaseAllocArea;
|
TopAllocArea = BaseAllocArea;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOCAL = REMOTE; /* point to the first area */
|
LOCAL = REMOTE; /* point to the first area */
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -2129,6 +2129,11 @@ do_pass(void)
|
||||||
a_n(_table_new_answer, (int) cpc->rnd2);
|
a_n(_table_new_answer, (int) cpc->rnd2);
|
||||||
break;
|
break;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
case clause_with_cut_op:
|
||||||
|
a_e(_clause_with_cut);
|
||||||
|
break;
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#ifdef SFUNC
|
#ifdef SFUNC
|
||||||
case get_s_f_op:
|
case get_s_f_op:
|
||||||
a_rf(_get_s_f);
|
a_rf(_get_s_f);
|
||||||
|
|
|
@ -932,7 +932,7 @@ YAP_Init(YAP_init_args *yap_init)
|
||||||
from the other workers
|
from the other workers
|
||||||
*/
|
*/
|
||||||
Yap_InitYaamRegs();
|
Yap_InitYaamRegs();
|
||||||
#endif
|
#endif /* SBA */
|
||||||
/* slaves, waiting for work */
|
/* slaves, waiting for work */
|
||||||
CurrentModule = 1;
|
CurrentModule = 1;
|
||||||
P = GETWORK_FIRST_TIME;
|
P = GETWORK_FIRST_TIME;
|
||||||
|
|
21
C/compiler.c
21
C/compiler.c
|
@ -49,12 +49,14 @@ STATIC_PROTO( int checktemp, (void));
|
||||||
STATIC_PROTO(void checkreg, (int));
|
STATIC_PROTO(void checkreg, (int));
|
||||||
STATIC_PROTO(void c_layout, (void));
|
STATIC_PROTO(void c_layout, (void));
|
||||||
STATIC_PROTO(void c_optimize, (PInstr *));
|
STATIC_PROTO(void c_optimize, (PInstr *));
|
||||||
|
|
||||||
#ifdef SFUNC
|
#ifdef SFUNC
|
||||||
STATIC_PROTO(void compile_sf_term, (Term, int));
|
STATIC_PROTO(void compile_sf_term, (Term, int));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
PInstr *cut_mark;
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
|
|
||||||
static PInstr *BodyStart;
|
static PInstr *BodyStart;
|
||||||
|
|
||||||
static Ventry *vtable;
|
static Ventry *vtable;
|
||||||
|
@ -2364,6 +2366,12 @@ c_layout(void)
|
||||||
#else
|
#else
|
||||||
switch (ic) {
|
switch (ic) {
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
case cut_op:
|
||||||
|
case cutexit_op:
|
||||||
|
cut_mark->op = clause_with_cut_op;
|
||||||
|
break;
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
case allocate_op:
|
case allocate_op:
|
||||||
case deallocate_op:
|
case deallocate_op:
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
|
@ -2476,8 +2484,11 @@ c_layout(void)
|
||||||
Contents[rn] = NIL;
|
Contents[rn] = NIL;
|
||||||
++Uses[rn];
|
++Uses[rn];
|
||||||
break;
|
break;
|
||||||
case save_b_op:
|
|
||||||
case comit_b_op:
|
case comit_b_op:
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
cut_mark->op = clause_with_cut_op;
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
|
case save_b_op:
|
||||||
case patch_b_op:
|
case patch_b_op:
|
||||||
case save_appl_op:
|
case save_appl_op:
|
||||||
case save_pair_op:
|
case save_pair_op:
|
||||||
|
@ -2819,6 +2830,10 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod)
|
||||||
}
|
}
|
||||||
/* phase 1 : produce skeleton code and variable information */
|
/* phase 1 : produce skeleton code and variable information */
|
||||||
c_head(head);
|
c_head(head);
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
Yap_emit(nop_op, Zero, Zero);
|
||||||
|
cut_mark = cpc;
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
Yap_emit(allocate_op, Zero, Zero);
|
Yap_emit(allocate_op, Zero, Zero);
|
||||||
c_body(body, mod);
|
c_body(body, mod);
|
||||||
/* Insert blobs at the very end */
|
/* Insert blobs at the very end */
|
||||||
|
|
|
@ -619,12 +619,15 @@ static char *opformat[] =
|
||||||
"restore_temps_and_skip\t\t%l",
|
"restore_temps_and_skip\t\t%l",
|
||||||
"enter_lu",
|
"enter_lu",
|
||||||
"empty_call\t\t%l,%d",
|
"empty_call\t\t%l,%d",
|
||||||
#ifdef TABLING
|
|
||||||
"table_new_answer",
|
|
||||||
#endif /* TABLING */
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
"sync",
|
"sync",
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
#ifdef TABLING
|
||||||
|
"table_new_answer",
|
||||||
|
#endif /* TABLING */
|
||||||
|
#ifdef TABLING_INNER_CUTS
|
||||||
|
"clause_with_cut",
|
||||||
|
#endif /* TABLING_INNER_CUTS */
|
||||||
"fetch_args_for_bccall\t%v",
|
"fetch_args_for_bccall\t%v",
|
||||||
"binary_cfunc\t\t%v,%P",
|
"binary_cfunc\t\t%v,%P",
|
||||||
"blob\t%O"
|
"blob\t%O"
|
||||||
|
|
10
C/grow.c
10
C/grow.c
|
@ -135,7 +135,7 @@ SetHeapRegs(void)
|
||||||
BB = ChoicePtrAdjust(BB);
|
BB = ChoicePtrAdjust(BB);
|
||||||
H_FZ = PtoGloAdjust(H_FZ);
|
H_FZ = PtoGloAdjust(H_FZ);
|
||||||
TR_FZ = PtoTRAdjust(TR_FZ);
|
TR_FZ = PtoTRAdjust(TR_FZ);
|
||||||
#endif
|
#endif /* TABLING */
|
||||||
TR = PtoTRAdjust(TR);
|
TR = PtoTRAdjust(TR);
|
||||||
YENV = PtoLocAdjust(YENV);
|
YENV = PtoLocAdjust(YENV);
|
||||||
if (IsOldGlobalPtr(S))
|
if (IsOldGlobalPtr(S))
|
||||||
|
@ -180,7 +180,7 @@ SetStackRegs(void)
|
||||||
B_FZ = ChoicePtrAdjust(B_FZ);
|
B_FZ = ChoicePtrAdjust(B_FZ);
|
||||||
BB = ChoicePtrAdjust(BB);
|
BB = ChoicePtrAdjust(BB);
|
||||||
TR_FZ = PtoTRAdjust(TR_FZ);
|
TR_FZ = PtoTRAdjust(TR_FZ);
|
||||||
#endif
|
#endif /* TABLING */
|
||||||
YENV = PtoLocAdjust(YENV);
|
YENV = PtoLocAdjust(YENV);
|
||||||
if (MyTR)
|
if (MyTR)
|
||||||
MyTR = PtoTRAdjust(MyTR);
|
MyTR = PtoTRAdjust(MyTR);
|
||||||
|
@ -704,7 +704,7 @@ do_growheap(int fix_code, UInt in_size)
|
||||||
}
|
}
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
fix_tabling_info();
|
fix_tabling_info();
|
||||||
#endif
|
#endif /* TABLING */
|
||||||
if (sz >= sizeof(CELL) * 16 * 1024L) {
|
if (sz >= sizeof(CELL) * 16 * 1024L) {
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ Yap_growglobal(CELL **ptr)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
fix_tabling_info();
|
fix_tabling_info();
|
||||||
#endif
|
#endif /* TABLING */
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ growstack(long size)
|
||||||
AdjustRegs(MaxTemps);
|
AdjustRegs(MaxTemps);
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
fix_tabling_info();
|
fix_tabling_info();
|
||||||
#endif
|
#endif /* TABLING */
|
||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
CreepFlag = CalculateStackGap();
|
CreepFlag = CalculateStackGap();
|
||||||
ASP += 256;
|
ASP += 256;
|
||||||
|
|
45
C/init.c
45
C/init.c
|
@ -978,8 +978,8 @@ InitCodes(void)
|
||||||
modp->PredFlags |= MetaPredFlag;
|
modp->PredFlags |= MetaPredFlag;
|
||||||
}
|
}
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
heap_regs->getworkcode.u.ld.p = (CODEADDR)RepPredProp(PredPropByAtom(Yap_LookupAtom("$getwork"), 0));
|
heap_regs->getworkcode.u.ld.p = RepPredProp(PredPropByAtom(Yap_LookupAtom("$getwork"), 0));
|
||||||
heap_regs->getworkcode_seq.u.ld.p = (CODEADDR)RepPredProp(PredPropByAtom(Yap_LookupAtom("$getwork_seq"), 0));
|
heap_regs->getworkcode_seq.u.ld.p = RepPredProp(PredPropByAtom(Yap_LookupAtom("$getwork_seq"), 0));
|
||||||
#endif
|
#endif
|
||||||
heap_regs->db_erased_marker =
|
heap_regs->db_erased_marker =
|
||||||
(DBRef)Yap_AllocCodeSpace(sizeof(DBStruct));
|
(DBRef)Yap_AllocCodeSpace(sizeof(DBStruct));
|
||||||
|
@ -1011,7 +1011,7 @@ InitYapOr(int Heap,
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
worker_id = 0;
|
worker_id = 0;
|
||||||
#endif
|
#endif /* YAPOR */
|
||||||
|
|
||||||
/* starting message */
|
/* starting message */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
@ -1027,21 +1027,52 @@ InitYapOr(int Heap,
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
#ifdef TABLING_BATCHED_SCHEDULING
|
#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");
|
INFORMATION_MESSAGE("YapTab: batched scheduling");
|
||||||
|
#endif /* YAPOR */
|
||||||
#else /* TABLING_LOCAL_SCHEDULING */
|
#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");
|
INFORMATION_MESSAGE("YapTab: local scheduling");
|
||||||
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING_SCHEDULING */
|
#endif /* TABLING_SCHEDULING */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
map_memory(Heap, Stack, Trail, aux_number_workers);
|
map_memory(Heap, Stack, Trail, aux_number_workers);
|
||||||
#else
|
#else
|
||||||
Yap_InitMemory (Trail, Heap, Stack);
|
Yap_InitMemory (Trail, Heap, Stack);
|
||||||
#endif
|
#endif /* YAPOR */
|
||||||
/* global initializations */
|
/* global initializations */
|
||||||
init_global(aux_number_workers, aux_scheduler_loop, aux_delayed_release_load);
|
init_global(aux_number_workers, aux_scheduler_loop, aux_delayed_release_load);
|
||||||
init_signals();
|
init_signals();
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_InitStacks(int Heap,
|
Yap_InitStacks(int Heap,
|
||||||
|
@ -1088,7 +1119,7 @@ Yap_InitStacks(int Heap,
|
||||||
#else
|
#else
|
||||||
if (Heap < MinHeapSpace)
|
if (Heap < MinHeapSpace)
|
||||||
Heap = MinHeapSpace;
|
Heap = MinHeapSpace;
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
InitYapOr(Heap,
|
InitYapOr(Heap,
|
||||||
|
@ -1131,7 +1162,7 @@ Yap_exit (int value)
|
||||||
{
|
{
|
||||||
#if defined(YAPOR)
|
#if defined(YAPOR)
|
||||||
unmap_memory();
|
unmap_memory();
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR */
|
||||||
if (! (Yap_PrologMode & BootMode) )
|
if (! (Yap_PrologMode & BootMode) )
|
||||||
Yap_ShutdownLoadForeign();
|
Yap_ShutdownLoadForeign();
|
||||||
exit(value);
|
exit(value);
|
||||||
|
|
11
C/save.c
11
C/save.c
|
@ -344,17 +344,10 @@ put_info(int info, int mode)
|
||||||
/* say whether we just saved the heap or everything */
|
/* say whether we just saved the heap or everything */
|
||||||
putout(mode);
|
putout(mode);
|
||||||
/* current state of stacks, to be used by SavedInfo */
|
/* current state of stacks, to be used by SavedInfo */
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
|
||||||
/* space available in heap area */
|
|
||||||
putout(Unsigned(Yap_GlobalBase)-Unsigned(Yap_HeapBase));
|
|
||||||
/* space available for stacks */
|
|
||||||
putout(Unsigned(Yap_LocalBase)-Unsigned(Yap_GlobalBase)+CellSize);
|
|
||||||
#else
|
|
||||||
/* space available in heap area */
|
/* space available in heap area */
|
||||||
putout(Unsigned(Yap_GlobalBase)-Unsigned(Yap_HeapBase));
|
putout(Unsigned(Yap_GlobalBase)-Unsigned(Yap_HeapBase));
|
||||||
/* space available for stacks */
|
/* space available for stacks */
|
||||||
putout(Unsigned(Yap_LocalBase)-Unsigned(Yap_GlobalBase));
|
putout(Unsigned(Yap_LocalBase)-Unsigned(Yap_GlobalBase));
|
||||||
#endif /* YAPOR || TABLING */
|
|
||||||
/* space available for trail */
|
/* space available for trail */
|
||||||
putout(Unsigned(Yap_TrailTop)-Unsigned(Yap_TrailBase));
|
putout(Unsigned(Yap_TrailTop)-Unsigned(Yap_TrailBase));
|
||||||
/* Space used in heap area */
|
/* Space used in heap area */
|
||||||
|
@ -468,7 +461,7 @@ save_heap(void)
|
||||||
j = Unsigned(HeapTop) - Unsigned(Yap_HeapBase);
|
j = Unsigned(HeapTop) - Unsigned(Yap_HeapBase);
|
||||||
/* store 10 more cells because of the memory manager */
|
/* store 10 more cells because of the memory manager */
|
||||||
mywrite(splfild, (char *) Yap_HeapBase, j);
|
mywrite(splfild, (char *) Yap_HeapBase, j);
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -804,7 +797,7 @@ CopyCode(void)
|
||||||
#else
|
#else
|
||||||
myread(splfild, (char *) Yap_HeapBase,
|
myread(splfild, (char *) Yap_HeapBase,
|
||||||
(Unsigned(OldHeapTop) - Unsigned(OldHeapBase)));
|
(Unsigned(OldHeapTop) - Unsigned(OldHeapBase)));
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the local and global stack and also the trail to their new home */
|
/* Copy the local and global stack and also the trail to their new home */
|
||||||
|
|
|
@ -2630,7 +2630,7 @@ Yap_InitCPreds(void)
|
||||||
Yap_InitGrowPreds();
|
Yap_InitGrowPreds();
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
Yap_init_optyap_preds();
|
Yap_init_optyap_preds();
|
||||||
#endif
|
#endif /* YAPOR || TABLING */
|
||||||
{
|
{
|
||||||
void (*(*(p))) (void) = E_Modules;
|
void (*(*(p))) (void) = E_Modules;
|
||||||
while (*p)
|
while (*p)
|
||||||
|
|
Reference in New Issue