Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3
This commit is contained in:
commit
d041ca7a9a
27
C/compiler.c
27
C/compiler.c
@ -2849,6 +2849,19 @@ c_layout(compiler_struct *cglobs)
|
||||
case cutexit_op:
|
||||
cglobs->cut_mark->op = clause_with_cut_op;
|
||||
break;
|
||||
#else
|
||||
case cut_op:
|
||||
case cutexit_op:
|
||||
{
|
||||
int i, max;
|
||||
|
||||
max = 0;
|
||||
for (i = 1; i < cglobs->MaxCTemps; ++i) {
|
||||
if (cglobs->Contents[i]) max = i;
|
||||
}
|
||||
cglobs->cint.cpc->ops.opseqt[1] = max;
|
||||
}
|
||||
break;
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
case allocate_op:
|
||||
case deallocate_op:
|
||||
@ -3050,18 +3063,6 @@ c_layout(compiler_struct *cglobs)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cut_op:
|
||||
case cutexit_op:
|
||||
{
|
||||
int i, max;
|
||||
|
||||
max = 0;
|
||||
for (i = 1; i < cglobs->MaxCTemps; ++i) {
|
||||
if (cglobs->Contents[i]) max = i;
|
||||
}
|
||||
cglobs->cint.cpc->ops.opseqt[1] = max;
|
||||
}
|
||||
break;
|
||||
case restore_tmps_and_skip_op:
|
||||
case restore_tmps_op:
|
||||
/*
|
||||
@ -3552,7 +3553,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
||||
} else {
|
||||
#ifdef TABLING_INNER_CUTS
|
||||
Yap_emit(nop_op, Zero, Zero, &cglobs.cint);
|
||||
cglobs->cut_mark = cpc;
|
||||
cglobs.cut_mark->op = clause_with_cut_op;
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
Yap_emit(allocate_op, Zero, Zero, &cglobs.cint);
|
||||
|
||||
|
14
C/grow.c
14
C/grow.c
@ -29,8 +29,8 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if YAPOR_THREADS
|
||||
#include <opt.mavar.h>
|
||||
#endif
|
||||
#include "opt.mavar.h"
|
||||
#endif /* YAPOR_THREADS */
|
||||
|
||||
#if !HAVE_STRNCAT
|
||||
#define strncat(s0,s1,sz) strcat(s0,s1)
|
||||
@ -269,7 +269,7 @@ RestoreTrail(int worker_p USES_REGS)
|
||||
if (aux_tr < TR){
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, "oops");
|
||||
}
|
||||
Yap_NEW_MAHASH((ma_h_inner_struct *)H);
|
||||
Yap_NEW_MAHASH((ma_h_inner_struct *)H PASS_REGS);
|
||||
while (TR != aux_tr) {
|
||||
CELL aux_cell = TrailTerm(--aux_tr);
|
||||
if (IsVarTerm(aux_cell)) {
|
||||
@ -295,7 +295,7 @@ RestoreTrail(int worker_p USES_REGS)
|
||||
CELL *cell_ptr = RepAppl(aux_cell);
|
||||
if (((CELL *)aux_cell < Get_LOCAL_top_cp()->cp_h ||
|
||||
EQUAL_OR_YOUNGER_CP(Get_LOCAL_top_cp(), (choiceptr)aux_cell)) &&
|
||||
!Yap_lookup_ma_var(cell_ptr)) {
|
||||
!Yap_lookup_ma_var(cell_ptr PASS_REGS)) {
|
||||
/* first time we found the variable, let's put the new value */
|
||||
#ifdef TABLING
|
||||
*cell_ptr = TrailVal(aux_tr);
|
||||
@ -310,7 +310,7 @@ RestoreTrail(int worker_p USES_REGS)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* YAPOR && THREADS */
|
||||
#endif /* YAPOR_THREADS */
|
||||
|
||||
static void
|
||||
MoveGlobal( USES_REGS1 )
|
||||
@ -1252,7 +1252,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
||||
if (sz < in_size) {
|
||||
sz = in_size;
|
||||
}
|
||||
#if YAPOR
|
||||
#ifdef YAPOR
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
|
||||
return FALSE;
|
||||
#endif
|
||||
@ -1690,7 +1690,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
||||
size = AdjustPageSize(size);
|
||||
trail_overflows++;
|
||||
if (gc_verbose) {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id);
|
||||
#endif
|
||||
fprintf(Yap_stderr, "%% Trail Overflow %d\n", trail_overflows);
|
||||
|
29
C/init.c
29
C/init.c
@ -1009,11 +1009,8 @@ InitFlags(void)
|
||||
yap_flags[SOURCE_MODE_FLAG] = FALSE;
|
||||
yap_flags[CHARACTER_ESCAPE_FLAG] = SICSTUS_CHARACTER_ESCAPES;
|
||||
yap_flags[WRITE_QUOTED_STRING_FLAG] = FALSE;
|
||||
#if (defined(YAPOR) || defined(THREADS)) && PUREe_YAPOR
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = FALSE;
|
||||
#else
|
||||
/* we do not garantee safe assert in parallel mode */
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = TRUE;
|
||||
#endif
|
||||
yap_flags[GENERATE_DEBUG_INFO_FLAG] = TRUE;
|
||||
/* current default */
|
||||
yap_flags[INDEXING_MODE_FLAG] = INDEX_MODE_MULTI;
|
||||
@ -1236,7 +1233,7 @@ Yap_CloseScratchPad(void)
|
||||
#include "ilocals.h"
|
||||
|
||||
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
struct global_data *Yap_global;
|
||||
long Yap_worker_area_size;
|
||||
#else
|
||||
@ -1247,7 +1244,7 @@ struct global_data Yap_Global;
|
||||
struct worker_local *Yap_WLocal[MAX_THREADS];
|
||||
#elif defined(YAPOR)
|
||||
struct worker_local *Yap_WLocal;
|
||||
#else
|
||||
#else /* !THREADS && !YAPOR */
|
||||
struct worker_local Yap_WLocal;
|
||||
#endif
|
||||
|
||||
@ -1341,21 +1338,25 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
||||
Atts = 2048*sizeof(CELL);
|
||||
else
|
||||
Atts = AdjustPageSize(Atts * K);
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#ifdef YAPOR
|
||||
worker_id = 0;
|
||||
if (n_workers > MAX_WORKERS)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers (Yap_InitWorkspace)");
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers");
|
||||
#ifdef YAPOR_COPY
|
||||
INFORMATION_MESSAGE("YapOr: copy model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||
#elif YAPOR_COW
|
||||
INFORMATION_MESSAGE("YapOr: acow model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||
#else /* YAPOR_SBA */
|
||||
#elif YAPOR_SBA
|
||||
INFORMATION_MESSAGE("YapOr: sba model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||
#endif /* YAPOR_COPY - YAPOR_COW - YAPOR_SBA */
|
||||
Yap_init_optyap_memory(Trail, Heap, Stack+Atts, n_workers);
|
||||
#elif YAPOR_THREADS
|
||||
INFORMATION_MESSAGE("YapOr: threads model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
|
||||
#endif /* YAPOR_COPY - YAPOR_COW - YAPOR_SBA - YAPOR_THREADS */
|
||||
#endif /* YAPOR */
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
Yap_init_optyap_memory(Trail, Heap, Stack+Atts, n_workers);
|
||||
#else
|
||||
Yap_InitMemory (Trail, Heap, Stack+Atts);
|
||||
#endif /* YAPOR && !THREADS */
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
Yap_init_optyap_data(max_table_size, n_workers, sch_loop, delay_load);
|
||||
#endif /* YAPOR || TABLING */
|
||||
@ -1414,9 +1415,9 @@ run_halt_hooks(int code)
|
||||
void
|
||||
Yap_exit (int value)
|
||||
{
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
Yap_unmap_optyap_memory();
|
||||
#endif /* YAPOR && !THREADS */
|
||||
#endif
|
||||
|
||||
if (! (Yap_PrologMode & BootMode) ) {
|
||||
#ifdef LOW_PROF
|
||||
|
14
C/save.c
14
C/save.c
@ -615,19 +615,20 @@ p_save2( USES_REGS1 )
|
||||
Int res;
|
||||
|
||||
Term t;
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#ifdef YAPOR
|
||||
if (Yap_number_workers != 1) {
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||
"cannot perform save: more than a worker/thread running");
|
||||
return(FALSE);
|
||||
}
|
||||
#elif defined(THREADS)
|
||||
#endif /* YAPOR */
|
||||
#ifdef THREADS
|
||||
if (Yap_NOfThreads != 1) {
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||
"cannot perform save: more than a worker/thread running");
|
||||
return(FALSE);
|
||||
}
|
||||
#endif
|
||||
#endif /* THREADS */
|
||||
/* avoid double saves */
|
||||
if (IsNonVarTerm(t = Deref(ARG2)))
|
||||
return TRUE;
|
||||
@ -1794,17 +1795,18 @@ p_restore( USES_REGS1 )
|
||||
char s[YAP_FILENAME_MAX+1];
|
||||
|
||||
Term t1 = Deref(ARG1);
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#ifdef YAPOR
|
||||
if (Yap_number_workers != 1) {
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||
return(FALSE);
|
||||
}
|
||||
#elif defined(THREADS)
|
||||
#endif /* YAPOR */
|
||||
#ifdef THREADS
|
||||
if (Yap_NOfThreads != 1) {
|
||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||
return(FALSE);
|
||||
}
|
||||
#endif
|
||||
#endif /* THREADS */
|
||||
if (!Yap_GetName(s, YAP_FILENAME_MAX, t1)) {
|
||||
Yap_Error(TYPE_ERROR_LIST,t1,"restore/1");
|
||||
return(FALSE);
|
||||
|
2
H/Regs.h
2
H/Regs.h
@ -138,7 +138,7 @@ typedef struct regstore_t
|
||||
int sba_size_;
|
||||
#endif /* YAPOR_SBA */
|
||||
#endif /* YAPOR || THREADS */
|
||||
#if (defined(YAPOR) || defined(TABLING))
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
struct local_data *LOCAL_;
|
||||
#endif
|
||||
#if PUSH_REGS
|
||||
|
@ -180,7 +180,7 @@ typedef struct various_codes {
|
||||
#include "hglobals.h"
|
||||
#include "hlocals.h"
|
||||
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
extern struct global_data *Yap_global;
|
||||
extern long Yap_worker_area_size;
|
||||
#else
|
||||
@ -188,17 +188,15 @@ extern struct global_data Yap_Global;
|
||||
#define Yap_global (&Yap_Global)
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#if defined(THREADS)
|
||||
extern struct worker_local *Yap_WLocal[MAX_THREADS];
|
||||
#define WL (Yap_WLocal[worker_id])
|
||||
#define FOREIGN(wid) (Yap_WLocal[(wid)])
|
||||
#else
|
||||
#elif defined(YAPOR)
|
||||
extern struct worker_local *Yap_WLocal;
|
||||
#define WL (Yap_WLocal+worker_id)
|
||||
#define FOREIGN(wid) (Yap_WLocal+wid)
|
||||
#endif
|
||||
#else
|
||||
#else /* !THREADS && !YAPOR */
|
||||
extern struct worker_local Yap_WLocal;
|
||||
#define WL (&Yap_WLocal)
|
||||
#define FOREIGN(wid) (&Yap_WLocal)
|
||||
|
@ -134,10 +134,6 @@
|
||||
|
||||
#define PL_local_data_p WL->Yap_ld_
|
||||
#define execution WL->_execution
|
||||
|
||||
#if MULTIPLE_STACKS
|
||||
#define WORKER WL->worker
|
||||
#endif
|
||||
#ifdef THREADS
|
||||
#define ThreadHandle WL->thread_handle
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
|
@ -136,10 +136,6 @@ typedef struct worker_local {
|
||||
|
||||
struct PL_local_data *Yap_ld_;
|
||||
struct open_query_struct* _execution;
|
||||
|
||||
#if MULTIPLE_STACKS
|
||||
struct worker worker;
|
||||
#endif
|
||||
#ifdef THREADS
|
||||
struct thandle thread_handle;
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
|
@ -134,10 +134,6 @@ static void InitWorker(int wid) {
|
||||
|
||||
FOREIGN(wid)->Yap_ld_ = Yap_InitThreadIO(wid);
|
||||
FOREIGN(wid)->_execution = NULL;
|
||||
|
||||
#if MULTIPLE_STACKS
|
||||
|
||||
#endif
|
||||
#ifdef THREADS
|
||||
InitThreadHandle(wid);
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
|
@ -134,10 +134,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
#if MULTIPLE_STACKS
|
||||
|
||||
#endif
|
||||
#ifdef THREADS
|
||||
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
|
@ -17,13 +17,11 @@
|
||||
** General Configuration Parameters **
|
||||
************************************************************************/
|
||||
|
||||
/**********************************************************
|
||||
** memory alloc scheme (mandatory, define one) **
|
||||
**********************************************************/
|
||||
/****************************************************************
|
||||
** use shared pages memory alloc scheme ? (optional) **
|
||||
****************************************************************/
|
||||
|
||||
#define YAP_MEMORY_ALLOC_SCHEME 1
|
||||
/* #define MALLOC_MEMORY_ALLOC_SCHEME 1 */
|
||||
/* #define OPTYAP_PAGES_MEMORY_ALLOC_SCHEME 1 */
|
||||
/* #define USE_PAGES_MALLOC 1 */
|
||||
|
||||
|
||||
|
||||
@ -94,7 +92,7 @@
|
||||
** memory mapping scheme (mandatory, define one) **
|
||||
************************************************************/
|
||||
#define MMAP_MEMORY_MAPPING_SCHEME 1
|
||||
//#define SHM_MEMORY_MAPPING_SCHEME 1
|
||||
/* #define SHM_MEMORY_MAPPING_SCHEME 1 */
|
||||
|
||||
/*************************************************
|
||||
** enable error checking ? (optional) **
|
||||
@ -153,23 +151,9 @@
|
||||
** Parameter Checks **
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(OPTYAP_PAGES_MEMORY_ALLOC_SCHEME) && !defined(MALLOC_MEMORY_ALLOC_SCHEME) && !defined(YAP_MEMORY_ALLOC_SCHEME)
|
||||
#error Define a memory alloc scheme
|
||||
#endif /* !OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && !MALLOC_MEMORY_ALLOC_SCHEME && !YAP_MEMORY_ALLOC_SCHEME */
|
||||
#if (defined(OPTYAP_PAGES_MEMORY_ALLOC_SCHEME) && (defined(MALLOC_MEMORY_ALLOC_SCHEME) || defined(YAP_MEMORY_ALLOC_SCHEME))) || (defined(MALLOC_MEMORY_ALLOC_SCHEME) && defined(YAP_MEMORY_ALLOC_SCHEME))
|
||||
#error Do not define multiple memory alloc schemes
|
||||
#endif /* (OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && (MALLOC_MEMORY_ALLOC_SCHEME || YAP_MEMORY_ALLOC_SCHEME)) || (MALLOC_MEMORY_ALLOC_SCHEME && YAP_MEMORY_ALLOC_SCHEME) */
|
||||
#ifdef USE_SYSTEM_MALLOC
|
||||
#define MALLOC_MEMORY_ALLOC_SCHEME 1
|
||||
#undef YAP_MEMORY_ALLOC_SCHEME
|
||||
#undef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#endif /* USE_SYSTEM_MALLOC */
|
||||
#if defined(YAPOR) && defined(MALLOC_MEMORY_ALLOC_SCHEME)
|
||||
#error YAPOR is incompatible with MALLOC_MEMORY_ALLOC_SCHEME
|
||||
#endif /* YAPOR && MALLOC_MEMORY_ALLOC_SCHEME */
|
||||
#ifndef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifndef USE_PAGES_MALLOC
|
||||
#undef LIMIT_TABLING
|
||||
#endif /* !OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* !USE_PAGES_MALLOC */
|
||||
|
||||
#ifdef YAPOR
|
||||
#ifdef i386 /* For i386 machines we use shared memory segments */
|
||||
|
@ -40,7 +40,7 @@
|
||||
** Macros **
|
||||
*********************/
|
||||
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#define STRUCTS_PER_PAGE(STR_TYPE) ((Yap_page_size - STRUCT_SIZE(struct page_header)) / STRUCT_SIZE(STR_TYPE))
|
||||
|
||||
#define INIT_PAGES(PG, STR_TYPE) \
|
||||
@ -51,7 +51,7 @@
|
||||
Pg_free_pg(PG) = NULL
|
||||
#else
|
||||
#define INIT_PAGES(PG, STR_TYPE) Pg_str_in_use(PG) = 0
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
|
||||
|
||||
@ -233,9 +233,9 @@ void make_root_frames(void) {
|
||||
void init_workers(void) {
|
||||
CACHE_REGS
|
||||
int proc;
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
return;
|
||||
#endif
|
||||
#endif /* YAPOR_THREADS */
|
||||
#ifdef YAPOR_COW
|
||||
if (Yap_number_workers> 1) {
|
||||
int son;
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
extern int Yap_page_size;
|
||||
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#include <sys/shm.h>
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
#define SHMMAX 0x2000000 /* 32 Mbytes: works fine with linux */
|
||||
/* #define SHMMAX 0x400000 - 4 Mbytes: shmget limit for Mac (?) */
|
||||
@ -45,9 +45,9 @@ extern int Yap_page_size;
|
||||
#define UPDATE_STATS(STAT, VALUE) STAT += VALUE
|
||||
|
||||
|
||||
#ifdef MALLOC_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_SYSTEM_MALLOC
|
||||
/*************************************************************************************************
|
||||
** MALLOC_MEMORY_ALLOC_SCHEME **
|
||||
** USE_SYSTEM_MALLOC **
|
||||
*************************************************************************************************/
|
||||
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
|
||||
if ((STR = (STR_TYPE *) malloc(SIZE)) == NULL) \
|
||||
@ -56,7 +56,7 @@ extern int Yap_page_size;
|
||||
free(STR)
|
||||
#else
|
||||
/*************************************************************************************************
|
||||
** ! MALLOC_MEMORY_ALLOC_SCHEME **
|
||||
** ! USE_SYSTEM_MALLOC **
|
||||
*************************************************************************************************/
|
||||
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
|
||||
{ char *block_ptr; \
|
||||
@ -79,22 +79,49 @@ extern int Yap_page_size;
|
||||
#endif /*****************************************************************************************/
|
||||
|
||||
|
||||
#if defined(MALLOC_MEMORY_ALLOC_SCHEME) || defined(YAP_MEMORY_ALLOC_SCHEME)
|
||||
|
||||
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
/*************************************************************************************************
|
||||
** MALLOC_MEMORY_ALLOC_SCHEME || YAP_MEMORY_ALLOC_SCHEME **
|
||||
** USE_PAGES_MALLOC **
|
||||
*************************************************************************************************/
|
||||
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), 1); \
|
||||
ALLOC_BLOCK(STR, sizeof(STR_TYPE), STR_TYPE)
|
||||
#define ALLOC_NEXT_FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE)
|
||||
#define FREE_PAGE(PG_HD) \
|
||||
LOCK(Pg_lock(Yap_pages_void)); \
|
||||
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), -1); \
|
||||
PgHd_next(PG_HD) = Pg_free_pg(Yap_pages_void); \
|
||||
Pg_free_pg(Yap_pages_void) = PG_HD; \
|
||||
UNLOCK(Pg_lock(Yap_pages_void))
|
||||
|
||||
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
|
||||
FREE_BLOCK(STR)
|
||||
#elif OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
{ pg_hd_ptr pg_hd; \
|
||||
pg_hd = PAGE_HEADER(STR); \
|
||||
LOCK(Pg_lock(STR_PAGES)); \
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
|
||||
if (--PgHd_str_in_use(pg_hd) == 0) { \
|
||||
UPDATE_STATS(Pg_pg_alloc(STR_PAGES), -1); \
|
||||
if (PgHd_previous(pg_hd)) { \
|
||||
if ((PgHd_next(PgHd_previous(pg_hd)) = PgHd_next(pg_hd)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = PgHd_previous(pg_hd); \
|
||||
} else { \
|
||||
if ((Pg_free_pg(STR_PAGES) = PgHd_next(pg_hd)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
|
||||
} \
|
||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||
FREE_PAGE(pg_hd); \
|
||||
} else { \
|
||||
if ((STRUCT_NEXT(STR) = (STR_TYPE *) PgHd_free_str(pg_hd)) == NULL) { \
|
||||
PgHd_previous(pg_hd) = NULL; \
|
||||
if ((PgHd_next(pg_hd) = Pg_free_pg(STR_PAGES)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = pg_hd; \
|
||||
Pg_free_pg(STR_PAGES) = pg_hd; \
|
||||
} \
|
||||
PgHd_free_str(pg_hd) = (void *) STR; \
|
||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||
} \
|
||||
}
|
||||
#ifdef LIMIT_TABLING
|
||||
/*************************************************************************************************
|
||||
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && LIMIT_TABLING **
|
||||
** USE_PAGES_MALLOC && LIMIT_TABLING **
|
||||
*************************************************************************************************/
|
||||
#define INIT_PAGE(PG_HD, STR_PAGES, STR_TYPE) \
|
||||
{ int i; \
|
||||
@ -233,7 +260,7 @@ extern int Yap_page_size;
|
||||
LOCAL_next_free_ans_node = STRUCT_NEXT(STR)
|
||||
#else
|
||||
/*************************************************************************************************
|
||||
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && !LIMIT_TABLING **
|
||||
** USE_PAGES_MALLOC && ! LIMIT_TABLING **
|
||||
*************************************************************************************************/
|
||||
#define ALLOC_PAGE(PG_HD) \
|
||||
LOCK(Pg_lock(Yap_pages_void)); \
|
||||
@ -328,45 +355,22 @@ extern int Yap_page_size;
|
||||
} \
|
||||
LOCAL_next_free_ans_node = STRUCT_NEXT(STR)
|
||||
#endif /* LIMIT_TABLING */
|
||||
#else /* ! USE_PAGES_MALLOC */
|
||||
/*************************************************************************************************
|
||||
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME **
|
||||
** ! USE_PAGES_MALLOC **
|
||||
*************************************************************************************************/
|
||||
#define FREE_PAGE(PG_HD) \
|
||||
LOCK(Pg_lock(Yap_pages_void)); \
|
||||
UPDATE_STATS(Pg_str_in_use(Yap_pages_void), -1); \
|
||||
PgHd_next(PG_HD) = Pg_free_pg(Yap_pages_void); \
|
||||
Pg_free_pg(Yap_pages_void) = PG_HD; \
|
||||
UNLOCK(Pg_lock(Yap_pages_void))
|
||||
|
||||
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), 1); \
|
||||
ALLOC_BLOCK(STR, sizeof(STR_TYPE), STR_TYPE)
|
||||
#define ALLOC_NEXT_FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE)
|
||||
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
|
||||
{ pg_hd_ptr pg_hd; \
|
||||
pg_hd = PAGE_HEADER(STR); \
|
||||
LOCK(Pg_lock(STR_PAGES)); \
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
|
||||
if (--PgHd_str_in_use(pg_hd) == 0) { \
|
||||
UPDATE_STATS(Pg_pg_alloc(STR_PAGES), -1); \
|
||||
if (PgHd_previous(pg_hd)) { \
|
||||
if ((PgHd_next(PgHd_previous(pg_hd)) = PgHd_next(pg_hd)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = PgHd_previous(pg_hd); \
|
||||
} else { \
|
||||
if ((Pg_free_pg(STR_PAGES) = PgHd_next(pg_hd)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = NULL; \
|
||||
} \
|
||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||
FREE_PAGE(pg_hd); \
|
||||
} else { \
|
||||
if ((STRUCT_NEXT(STR) = (STR_TYPE *) PgHd_free_str(pg_hd)) == NULL) { \
|
||||
PgHd_previous(pg_hd) = NULL; \
|
||||
if ((PgHd_next(pg_hd) = Pg_free_pg(STR_PAGES)) != NULL) \
|
||||
PgHd_previous(PgHd_next(pg_hd)) = pg_hd; \
|
||||
Pg_free_pg(STR_PAGES) = pg_hd; \
|
||||
} \
|
||||
PgHd_free_str(pg_hd) = (void *) STR; \
|
||||
UNLOCK(Pg_lock(STR_PAGES)); \
|
||||
} \
|
||||
}
|
||||
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
|
||||
FREE_BLOCK(STR)
|
||||
#endif /*****************************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define ALLOC_HASH_BUCKETS(BUCKET_PTR, NUM_BUCKETS) \
|
||||
{ int i; void **bucket_ptr; \
|
||||
ALLOC_BLOCK(bucket_ptr, NUM_BUCKETS * sizeof(void *), void *); \
|
||||
|
@ -21,13 +21,13 @@
|
||||
#define OPT_MAVAR_STATIC inline static
|
||||
#endif /* !OPT_MAVAR_STATIC */
|
||||
|
||||
OPT_MAVAR_STATIC unsigned int Yap_MAVAR_HASH(CELL *addr);
|
||||
OPT_MAVAR_STATIC struct ma_h_entry * Yap_ALLOC_NEW_MASPACE(void);
|
||||
OPT_MAVAR_STATIC int Yap_lookup_ma_var(CELL *addr);
|
||||
OPT_MAVAR_STATIC UInt Yap_NEW_MAHASH(ma_h_inner_struct *top);
|
||||
OPT_MAVAR_STATIC unsigned int Yap_MAVAR_HASH(CELL *addr USES_REGS);
|
||||
OPT_MAVAR_STATIC struct ma_h_entry * Yap_ALLOC_NEW_MASPACE(USES_REGS1);
|
||||
OPT_MAVAR_STATIC int Yap_lookup_ma_var(CELL *addr USES_REGS);
|
||||
OPT_MAVAR_STATIC UInt Yap_NEW_MAHASH(ma_h_inner_struct *top USES_REGS);
|
||||
|
||||
OPT_MAVAR_STATIC unsigned int
|
||||
Yap_MAVAR_HASH(CELL *addr) {
|
||||
Yap_MAVAR_HASH(CELL *addr USES_REGS) {
|
||||
#if SIZEOF_INT_P==8
|
||||
return((((unsigned int)((CELL)(addr)))>>3)%MAVARS_HASH_SIZE);
|
||||
#else
|
||||
@ -36,7 +36,7 @@ Yap_MAVAR_HASH(CELL *addr) {
|
||||
}
|
||||
|
||||
OPT_MAVAR_STATIC struct ma_h_entry *
|
||||
Yap_ALLOC_NEW_MASPACE(void)
|
||||
Yap_ALLOC_NEW_MASPACE(USES_REGS1)
|
||||
{
|
||||
ma_h_inner_struct *new = LOCAL_ma_h_top;
|
||||
LOCAL_ma_h_top++;
|
||||
@ -44,8 +44,8 @@ Yap_ALLOC_NEW_MASPACE(void)
|
||||
}
|
||||
|
||||
OPT_MAVAR_STATIC int
|
||||
Yap_lookup_ma_var(CELL *addr) {
|
||||
unsigned int i = Yap_MAVAR_HASH(addr);
|
||||
Yap_lookup_ma_var(CELL *addr USES_REGS) {
|
||||
unsigned int i = Yap_MAVAR_HASH(addr PASS_REGS);
|
||||
struct ma_h_entry *nptr, *optr;
|
||||
|
||||
if (LOCAL_ma_hash_table[i].timestmp != LOCAL_ma_timestamp) {
|
||||
@ -65,14 +65,14 @@ Yap_lookup_ma_var(CELL *addr) {
|
||||
optr = nptr;
|
||||
nptr = nptr->next;
|
||||
}
|
||||
nptr = Yap_ALLOC_NEW_MASPACE();
|
||||
nptr = Yap_ALLOC_NEW_MASPACE(PASS_REGS1);
|
||||
nptr->addr = addr;
|
||||
nptr->next = optr;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OPT_MAVAR_STATIC UInt
|
||||
Yap_NEW_MAHASH(ma_h_inner_struct *top) {
|
||||
Yap_NEW_MAHASH(ma_h_inner_struct *top USES_REGS) {
|
||||
UInt time = ++LOCAL_ma_timestamp;
|
||||
if (time == 0) {
|
||||
unsigned int i;
|
||||
|
@ -16,7 +16,7 @@
|
||||
**************************************/
|
||||
|
||||
#include "Yap.h"
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@ -72,7 +72,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
||||
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||
long TotalArea;
|
||||
#endif /* YAPOR_MODEL */
|
||||
#endif
|
||||
long ExtraArea;
|
||||
|
||||
HeapArea = ADJUST_SIZE_TO_PAGE(HeapArea);
|
||||
@ -97,7 +97,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
||||
/* the others need n stacks */
|
||||
Yap_worker_area_size = ADJUST_SIZE_TO_PAGE(GlobalLocalArea + TrailAuxArea);
|
||||
TotalArea = ExtraArea + HeapArea + Yap_worker_area_size * n_workers;
|
||||
#endif /* YAPOR_MODEL */
|
||||
#endif
|
||||
|
||||
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
||||
/* map total area in a single go */
|
||||
@ -116,7 +116,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
||||
for (i = 0; i < n_workers; i++)
|
||||
shm_map_memory(i, Yap_worker_area_size, Yap_GlobalBase + Yap_worker_area_size * i);
|
||||
}
|
||||
#endif /* YAPOR_MODEL */
|
||||
#endif
|
||||
#endif /* MEMORY_MAPPING_SCHEME */
|
||||
|
||||
#ifdef YAPOR_COW
|
||||
@ -220,7 +220,7 @@ void Yap_unmap_optyap_memory (void) {
|
||||
itos(Yap_master_worker, &MapFile[9]);
|
||||
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||
itos(Yap_worker_pid(0), &MapFile[9]);
|
||||
#endif /* YAPOR_MODEL */
|
||||
#endif
|
||||
if (remove(MapFile) == 0)
|
||||
INFORMATION_MESSAGE("Removing mapfile \"%s\"", MapFile);
|
||||
else
|
||||
@ -230,7 +230,7 @@ void Yap_unmap_optyap_memory (void) {
|
||||
i = 0;
|
||||
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||
for (i = 0; i < Yap_number_workers + 1; i++)
|
||||
#endif /* YAPOR_COW */
|
||||
#endif
|
||||
{
|
||||
if (shmctl(shm_mapid[i], IPC_RMID, 0) == 0)
|
||||
INFORMATION_MESSAGE("Removing shared memory segment %d", shm_mapid[i]);
|
||||
@ -271,5 +271,4 @@ void shm_map_memory(int id, int size, void *shmaddr) {
|
||||
return;
|
||||
}
|
||||
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
|
||||
|
||||
#endif /* YAPOR && !THREADS */
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||
|
@ -337,10 +337,8 @@ static Int p_abolish_table( USES_REGS1 ) {
|
||||
TabEnt_hash_chain(tab_ent) = NULL;
|
||||
free_subgoal_hash_chain(hash);
|
||||
sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent));
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
if (sg_node) {
|
||||
if (TabEnt_arity(tab_ent)) {
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
||||
} else {
|
||||
sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node);
|
||||
@ -350,6 +348,7 @@ static Int p_abolish_table( USES_REGS1 ) {
|
||||
#endif /* LIMIT_TABLING */
|
||||
FREE_SUBGOAL_FRAME(sg_fr);
|
||||
}
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
@ -366,10 +365,8 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
||||
TabEnt_hash_chain(tab_ent) = NULL;
|
||||
free_subgoal_hash_chain(hash);
|
||||
sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent));
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
if (sg_node) {
|
||||
if (sg_node) {
|
||||
if (TabEnt_arity(tab_ent)) {
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
||||
} else {
|
||||
sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node);
|
||||
@ -379,6 +376,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
||||
#endif /* LIMIT_TABLING */
|
||||
FREE_SUBGOAL_FRAME(sg_fr);
|
||||
}
|
||||
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
|
||||
}
|
||||
tab_ent = TabEnt_next(tab_ent);
|
||||
}
|
||||
@ -478,14 +476,14 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
|
||||
aux_bytes += show_statistics_global_trie_hashes();
|
||||
fprintf(Yap_stdout, " Memory in use (III): %10ld bytes\n\n", aux_bytes);
|
||||
total_bytes += aux_bytes;
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
||||
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||
#else
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
@ -502,7 +500,7 @@ static Int p_show_statistics_global_trie( USES_REGS1 ) {
|
||||
*********************************/
|
||||
|
||||
static Int p_yapor_threads( USES_REGS1 ) {
|
||||
#if defined(YAPOR) && defined(THREADS)
|
||||
#ifdef YAPOR_THREADS
|
||||
return Yap_unify(MkIntegerTerm(Yap_number_workers),ARG1);
|
||||
#else
|
||||
return FALSE;
|
||||
@ -714,14 +712,14 @@ static Int p_show_statistics_or( USES_REGS1 ) {
|
||||
aux_bytes += show_statistics_query_goal_answer_frames();
|
||||
fprintf(Yap_stdout, " Memory in use (II): %10ld bytes\n\n", aux_bytes);
|
||||
total_bytes += aux_bytes;
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
|
||||
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||
#else
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
@ -770,14 +768,14 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
fprintf(Yap_stdout, " Memory in use (IV): %10ld bytes\n\n", aux_bytes);
|
||||
total_bytes += aux_bytes;
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n",
|
||||
total_bytes, Pg_str_in_use(Yap_pages_void));
|
||||
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
|
||||
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
|
||||
#else
|
||||
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
@ -814,11 +812,11 @@ static Int p_get_optyap_statistics( USES_REGS1 ) {
|
||||
bytes += Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
#endif /* YAPOR && TABLING */
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
structs = Pg_pg_alloc(Yap_pages_void) * Yap_page_size;
|
||||
#else
|
||||
structs = bytes;
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
}
|
||||
#ifdef TABLING
|
||||
if (value == 1) { /* table_entries */
|
||||
@ -1026,7 +1024,7 @@ static inline void answer_to_stdout(char *answer) {
|
||||
|
||||
#ifdef TABLING
|
||||
static inline long show_statistics_table_entries(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
tab_ent_ptr aux_ptr;
|
||||
@ -1048,13 +1046,13 @@ static inline long show_statistics_table_entries(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(Yap_pages_tab_ent));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_subgoal_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
sg_fr_ptr aux_ptr;
|
||||
@ -1076,13 +1074,13 @@ static inline long show_statistics_subgoal_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(Yap_pages_sg_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_dependency_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
dep_fr_ptr aux_ptr;
|
||||
@ -1104,13 +1102,13 @@ static inline long show_statistics_dependency_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(Yap_pages_dep_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_subgoal_trie_nodes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
sg_node_ptr aux_ptr;
|
||||
@ -1132,13 +1130,13 @@ static inline long show_statistics_subgoal_trie_nodes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(Yap_pages_sg_node));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_answer_trie_nodes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
ans_node_ptr aux_ptr;
|
||||
@ -1160,13 +1158,13 @@ static inline long show_statistics_answer_trie_nodes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(Yap_pages_ans_node));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_subgoal_trie_hashes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
sg_hash_ptr aux_ptr;
|
||||
@ -1188,13 +1186,13 @@ static inline long show_statistics_subgoal_trie_hashes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(Yap_pages_sg_hash));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_answer_trie_hashes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
ans_hash_ptr aux_ptr;
|
||||
@ -1216,13 +1214,13 @@ static inline long show_statistics_answer_trie_hashes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(Yap_pages_ans_hash));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_global_trie_nodes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
gt_node_ptr aux_ptr;
|
||||
@ -1244,13 +1242,13 @@ static inline long show_statistics_global_trie_nodes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(Yap_pages_gt_node));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_global_trie_hashes(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_TABLING
|
||||
pg_hd_ptr pg_hd;
|
||||
gt_hash_ptr aux_ptr;
|
||||
@ -1272,7 +1270,7 @@ static inline long show_statistics_global_trie_hashes(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(Yap_pages_gt_hash));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash);
|
||||
}
|
||||
#endif /* TABLING */
|
||||
@ -1280,7 +1278,7 @@ static inline long show_statistics_global_trie_hashes(void) {
|
||||
|
||||
#ifdef YAPOR
|
||||
static inline long show_statistics_or_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_YAPOR
|
||||
pg_hd_ptr pg_hd;
|
||||
or_fr_ptr aux_ptr;
|
||||
@ -1302,13 +1300,13 @@ static inline long show_statistics_or_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame), Pg_str_in_use(Yap_pages_or_fr ));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_query_goal_solution_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_YAPOR
|
||||
pg_hd_ptr pg_hd;
|
||||
qg_sol_fr_ptr aux_ptr;
|
||||
@ -1330,13 +1328,13 @@ static inline long show_statistics_query_goal_solution_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(Yap_pages_qg_sol_fr ));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_query_goal_answer_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_YAPOR
|
||||
pg_hd_ptr pg_hd;
|
||||
qg_ans_fr_ptr aux_ptr;
|
||||
@ -1354,11 +1352,11 @@ static inline long show_statistics_query_goal_answer_frames(void) {
|
||||
YAPOR_ERROR_CHECKING(statistics_query_goal_answer_frames, Pg_str_free(Yap_pages_qg_ans_fr) != cont);
|
||||
#endif /* DEBUG_YAPOR */
|
||||
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld pages and %ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(Yap_pages_qg_ans__fr), Pg_str_in_use(Yap_pages_qg_ans_fr));
|
||||
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_pg_alloc(Yap_pages_qg_ans_fr), Pg_str_in_use(Yap_pages_qg_ans_fr));
|
||||
#else
|
||||
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(Yap_pages_qg_ans_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
|
||||
}
|
||||
#endif /* YAPOR */
|
||||
@ -1366,7 +1364,7 @@ static inline long show_statistics_query_goal_answer_frames(void) {
|
||||
|
||||
#if defined(YAPOR) && defined(TABLING)
|
||||
static inline long show_statistics_suspension_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_OPTYAP
|
||||
pg_hd_ptr pg_hd;
|
||||
susp_fr_ptr aux_ptr;
|
||||
@ -1388,14 +1386,14 @@ static inline long show_statistics_suspension_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(Yap_pages_susp_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TABLING_INNER_CUTS
|
||||
static inline long show_statistics_table_subgoal_solution_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_OPTYAP
|
||||
pg_hd_ptr pg_hd;
|
||||
tg_sol_fr_ptr aux_ptr;
|
||||
@ -1417,13 +1415,13 @@ static inline long show_statistics_table_subgoal_solution_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(Yap_pages_tg_sol_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
|
||||
}
|
||||
|
||||
|
||||
static inline long show_statistics_table_subgoal_answer_frames(void) {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef DEBUG_OPTYAP
|
||||
pg_hd_ptr pg_hd;
|
||||
tg_ans_fr_ptr aux_ptr;
|
||||
@ -1445,7 +1443,7 @@ static inline long show_statistics_table_subgoal_answer_frames(void) {
|
||||
#else
|
||||
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld structs in use)\n",
|
||||
Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(Yap_pages_tg_ans_fr));
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
return Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
|
||||
}
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
|
@ -18,7 +18,7 @@
|
||||
typedef double realtime;
|
||||
typedef unsigned long bitmap;
|
||||
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
/* Threads may not assume addresses are the same at different workers */
|
||||
static inline choiceptr
|
||||
offset_to_cptr(Int node)
|
||||
@ -49,7 +49,7 @@ cptr_to_offset_with_null(choiceptr node)
|
||||
if (node == NULL) return 0L;
|
||||
return (Int)((CELL *)node-LCL0);
|
||||
}
|
||||
#endif /* THREADS */
|
||||
#endif /* YAPOR_THREADS */
|
||||
|
||||
|
||||
|
||||
@ -76,14 +76,14 @@ typedef struct page_header {
|
||||
***************************/
|
||||
|
||||
struct pages {
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
#ifdef YAPOR
|
||||
lockvar lock;
|
||||
#endif /* YAPOR */
|
||||
int structs_per_page;
|
||||
struct page_header *first_free_page;
|
||||
volatile long pages_allocated;
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
volatile long structs_in_use;
|
||||
};
|
||||
|
||||
@ -182,7 +182,7 @@ struct global_optyap_data{
|
||||
char performance_mode; /* PERFORMANCE_OFF / PERFORMANCE_ON / PERFORMANCE_IN_EXECUTION */
|
||||
|
||||
/* global data related to or-parallelism */
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int root_choice_point_offset;
|
||||
#else
|
||||
choiceptr root_choice_point;
|
||||
@ -250,7 +250,7 @@ struct global_optyap_data{
|
||||
#define Yap_best_times(time) (Yap_optyap_data.best_execution_times[time])
|
||||
#define Yap_number_goals (Yap_optyap_data.number_of_executed_goals)
|
||||
#define Yap_performance_mode (Yap_optyap_data.performance_mode)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_Yap_root_cp() offset_to_cptr(Yap_optyap_data.root_choice_point_offset)
|
||||
#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point_offset = cptr_to_offset(bptr))
|
||||
#else
|
||||
@ -299,7 +299,7 @@ struct global_optyap_data{
|
||||
|
||||
#ifdef YAPOR
|
||||
struct local_signals{
|
||||
#if defined(YAPOR_COPY) || defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_THREADS)
|
||||
lockvar lock;
|
||||
volatile enum {
|
||||
Q_idle = 0,
|
||||
@ -308,7 +308,7 @@ struct local_signals{
|
||||
local = 3,
|
||||
P_idle = 4
|
||||
} P_fase, Q_fase;
|
||||
#endif /* YAPOR_COPY || THREADS */
|
||||
#endif /* YAPOR_COPY || YAPOR_THREADS */
|
||||
volatile enum {
|
||||
no_sharing = 0,
|
||||
sharing = 1,
|
||||
@ -346,19 +346,17 @@ typedef struct {
|
||||
********************************/
|
||||
|
||||
struct local_data{
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar lock;
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
lockvar lock;
|
||||
/* local data related to or-parallelism */
|
||||
volatile int load;
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int top_choice_point_offset;
|
||||
#else
|
||||
choiceptr top_choice_point;
|
||||
#endif
|
||||
struct or_frame *top_or_frame;
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int prune_request_offset;
|
||||
#else
|
||||
choiceptr prune_request;
|
||||
@ -380,7 +378,7 @@ struct local_data{
|
||||
choiceptr bottom_pruning_scope;
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
#ifdef YAPOR
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int top_choice_point_on_stack_offset;
|
||||
#else
|
||||
choiceptr top_choice_point_on_stack;
|
||||
@ -398,7 +396,7 @@ struct local_data{
|
||||
|
||||
#define LOCAL_lock (LOCAL->lock)
|
||||
#define LOCAL_load (LOCAL->load)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_LOCAL_top_cp() offset_to_cptr(LOCAL->top_choice_point_offset)
|
||||
#define Set_LOCAL_top_cp(cpt) (LOCAL->top_choice_point_offset = cptr_to_offset(cpt))
|
||||
#else
|
||||
@ -407,7 +405,7 @@ struct local_data{
|
||||
#define Set_LOCAL_top_cp(cpt) (LOCAL->top_choice_point = cpt)
|
||||
#endif
|
||||
#define LOCAL_top_or_fr (LOCAL->top_or_frame)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_LOCAL_prune_request() offset_to_cptr_with_null(LOCAL->prune_request_offset)
|
||||
#define Set_LOCAL_prune_request(cpt) (LOCAL->prune_request_offset = cptr_to_offset_with_null(cpt))
|
||||
#else
|
||||
@ -430,7 +428,7 @@ struct local_data{
|
||||
#define LOCAL_top_sg_fr (LOCAL->top_subgoal_frame)
|
||||
#define LOCAL_top_dep_fr (LOCAL->top_dependency_frame)
|
||||
#define LOCAL_pruning_scope (LOCAL->bottom_pruning_scope)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_LOCAL_top_cp_on_stack() offset_to_cptr(LOCAL->top_choice_point_on_stack_offset)
|
||||
#define Set_LOCAL_top_cp_on_stack(cpt) (LOCAL->top_choice_point_on_stack_offset = cptr_to_offset(cpt))
|
||||
#else
|
||||
@ -443,11 +441,10 @@ struct local_data{
|
||||
#define LOCAL_ma_h_top (LOCAL->ma_h_top)
|
||||
#define LOCAL_ma_hash_table (LOCAL->ma_hash_table)
|
||||
|
||||
|
||||
#define REMOTE_lock(worker) (REMOTE[worker].lock)
|
||||
|
||||
|
||||
#define REMOTE_load(worker) (REMOTE[worker].load)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define REMOTE_top_cp(worker) offset_to_cptr(REMOTE[worker].top_choice_point_offset)
|
||||
#define Set_REMOTE_top_cp(worker, bptr) (REMOTE[worker].top_choice_point_offset = cptr_to_offset(bptr))
|
||||
#else
|
||||
@ -455,7 +452,7 @@ struct local_data{
|
||||
#define Set_REMOTE_top_cp(worker, bptr) (REMOTE[worker].top_choice_point = (bptr))
|
||||
#endif
|
||||
#define REMOTE_top_or_fr(worker) (REMOTE[worker].top_or_frame)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_REMOTE_prune_request(worker) offset_to_cptr_with_null(REMOTE[worker].prune_request_offset)
|
||||
#define Set_REMOTE_prune_request(worker,cp) (REMOTE[worker].prune_request_offset = cptr_to_offset_with_null(cp))
|
||||
#else
|
||||
@ -478,7 +475,7 @@ struct local_data{
|
||||
#define REMOTE_top_sg_fr(worker) (REMOTE[worker].top_subgoal_frame)
|
||||
#define REMOTE_top_dep_fr(worker) (REMOTE[worker].top_dependency_frame)
|
||||
#define REMOTE_pruning_scope(worker) (REMOTE[worker].bottom_pruning_scope)
|
||||
#if THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define REMOTE_top_cp_on_stack(worker) offset_to_cptr(REMOTE[worker].top_choice_point_on_stack_offset)
|
||||
#define Set_REMOTE_top_cp_on_stack(worker, bptr) (REMOTE[worker].top_choice_point_on_stack_offset = cptr_to_offset(bptr))
|
||||
#else
|
||||
|
@ -137,7 +137,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
||||
SCHEDULER_GET_WORK(); \
|
||||
}
|
||||
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_SBA) || defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
|
||||
#define SCH_check_share_request() \
|
||||
if (SCH_any_share_request) { \
|
||||
ASP = YENV; \
|
||||
@ -151,7 +151,7 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
||||
if (! p_share_work()) \
|
||||
goto shared_fail; \
|
||||
}
|
||||
#endif /* YAPOR_COPY || YAPOR_SBA || YAPOR_COW */
|
||||
#endif /* YAPOR_COPY || YAPOR_SBA || YAPOR_COW || YAPOR_THREADS */
|
||||
|
||||
#define SCH_check_requests() \
|
||||
SCH_check_prune_request(); \
|
||||
|
@ -19,7 +19,7 @@ typedef struct or_frame {
|
||||
lockvar lock;
|
||||
yamop *alternative;
|
||||
volatile bitmap members;
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int node_offset;
|
||||
#else
|
||||
choiceptr node;
|
||||
@ -27,7 +27,7 @@ typedef struct or_frame {
|
||||
struct or_frame *nearest_livenode;
|
||||
/* cut support */
|
||||
int depth;
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
Int pending_prune_cp_offset;
|
||||
#else
|
||||
choiceptr pending_prune_cp;
|
||||
@ -51,7 +51,7 @@ typedef struct or_frame {
|
||||
#define OrFr_lock(X) ((X)->lock)
|
||||
#define OrFr_alternative(X) ((X)->alternative)
|
||||
#define OrFr_members(X) ((X)->members)
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define GetOrFr_node(X) offset_to_cptr((X)->node_offset)
|
||||
#define SetOrFr_node(X,V) ((X)->node_offset = cptr_to_offset(V))
|
||||
#else
|
||||
@ -61,7 +61,7 @@ typedef struct or_frame {
|
||||
#endif
|
||||
#define OrFr_nearest_livenode(X) ((X)->nearest_livenode)
|
||||
#define OrFr_depth(X) ((X)->depth)
|
||||
#ifdef THREADS
|
||||
#ifdef YAPOR_THREADS
|
||||
#define Get_OrFr_pend_prune_cp(X) offset_to_cptr_with_null((X)->pending_prune_cp_offset)
|
||||
#define Set_OrFr_pend_prune_cp(X,V) ((X)->pending_prune_cp_offset = cptr_to_offset_with_null(V))
|
||||
#else
|
||||
|
@ -16,7 +16,7 @@
|
||||
** ------------------ */
|
||||
|
||||
#include "Yap.h"
|
||||
#if defined(THREADS) && defined(YAPOR)
|
||||
#ifdef YAPOR_THREADS
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
@ -539,4 +539,4 @@ void share_private_nodes(int worker_q) {
|
||||
REMOTE_load(worker_q) = LOCAL_load = 0;
|
||||
return;
|
||||
}
|
||||
#endif /* YAPOR_COPY */
|
||||
#endif /* YAPOR_THREADS */
|
||||
|
@ -164,10 +164,10 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
||||
#define STACK_NOT_EMPTY(STACK, STACK_BASE) (STACK) != (STACK_BASE)
|
||||
#define AUX_STACK_CHECK_EXPAND(STACK, STACK_LIMIT) if ((STACK_LIMIT) >= (STACK)) EXPAND_AUX_STACK(STACK)
|
||||
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT) if ((STACK_LIMIT) >= (STACK)+4096) EXPAND_STACK(STACK)
|
||||
#if defined(YAPOR) && !defined(THREADS)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
#define EXPAND_AUX_STACK(STACK) Yap_Error(INTERNAL_ERROR, TermNil, "stack full (AUX_STACK_CHECK_EXPAND)");
|
||||
#define EXPAND_STACK(STACK) Yap_Error(INTERNAL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
|
||||
#else
|
||||
#else /* YAPOR_THREADS */
|
||||
#define EXPAND_AUX_STACK(STACK) STACK = expand_auxiliary_stack(STACK)
|
||||
#define EXPAND_STACK(STACK) Yap_Error(INTERNAL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
|
||||
#endif /* YAPOR */
|
||||
|
@ -125,9 +125,9 @@ typedef struct global_trie_hash {
|
||||
int number_of_buckets;
|
||||
struct global_trie_node **buckets;
|
||||
int number_of_nodes;
|
||||
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
struct global_trie_hash *next;
|
||||
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
} *gt_hash_ptr;
|
||||
|
||||
#define Hash_mark(X) ((X)->mark)
|
||||
|
44
configure
vendored
44
configure
vendored
@ -3691,24 +3691,40 @@ done
|
||||
|
||||
# Check whether --enable-tabling was given.
|
||||
if test "${enable_tabling+set}" = set; then :
|
||||
enableval=$enable_tabling; tabling="$enableval"
|
||||
enableval=$enable_tabling; tabling="$enableval"
|
||||
{
|
||||
if test "${enable_or_parallelism+set}" = set; then :
|
||||
enableval=$enable_or_parallelism; orparallelism="$enableval"
|
||||
case "$orparallelism" in
|
||||
yes|copy)
|
||||
;;
|
||||
*)
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "tabling only works with YapOr copy"; }
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
else
|
||||
tabling=no
|
||||
tabling=no
|
||||
fi
|
||||
|
||||
# Check whether --enable-or-parallelism was given.
|
||||
if test "${enable_or_parallelism+set}" = set; then :
|
||||
enableval=$enable_or_parallelism; orparallelism="$enableval"
|
||||
case "$orparallelism" in
|
||||
yes|copy|sba|cow|threads)
|
||||
;;
|
||||
*)
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "--enable-or-parallelism=$orparallelism invalid option"; }
|
||||
;;
|
||||
esac
|
||||
|
||||
enableval=$enable_or_parallelism; orparallelism="$enableval"
|
||||
case "$orparallelism" in
|
||||
yes|copy|sba|cow)
|
||||
;;
|
||||
threads)
|
||||
enable_threads=yes
|
||||
;;
|
||||
*)
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "--enable-or-parallelism=$orparallelism invalid option"; }
|
||||
;;
|
||||
esac
|
||||
else
|
||||
orparallelism=no
|
||||
fi
|
||||
@ -7528,7 +7544,7 @@ else
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
|
||||
;;
|
||||
threads)
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
|
||||
YAP_EXTRAS="$YAP_EXTRAS -DTHREADS=1 -DYAPOR_THREADS=1"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -149,14 +149,14 @@ print_usage(void)
|
||||
#ifdef TABLING
|
||||
fprintf(stderr," -ts Maximum table space area in Mbytes (default: unlimited)\n");
|
||||
#endif /* TABLING */
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
|
||||
fprintf(stderr," -w Number of workers (default: %d)\n",
|
||||
DEFAULT_NUMBERWORKERS);
|
||||
fprintf(stderr," -sl Loop scheduler executions before look for hiden shared work (default: %d)\n",
|
||||
DEFAULT_SCHEDULERLOOP);
|
||||
fprintf(stderr," -d Value of delayed release of load (default: %d)\n",
|
||||
DEFAULT_DELAYEDRELEASELOAD);
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */
|
||||
/* nf: Preprocessor */
|
||||
/* fprintf(stderr," -DVar=Name Persistent definition\n"); */
|
||||
fprintf(stderr,"\n");
|
||||
@ -245,7 +245,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
case 'q':
|
||||
iap->QuietMode = TRUE;
|
||||
break;
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
|
||||
case 'w':
|
||||
ssize = &(iap->NumberWorkers);
|
||||
goto GetSize;
|
||||
@ -258,7 +258,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
case 'd':
|
||||
if (!strcmp("dump-runtime-variables",p))
|
||||
return dump_runtime_variables();
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */
|
||||
#ifdef USE_SOCKET
|
||||
case 'c': /* running as client */
|
||||
{
|
||||
@ -386,12 +386,12 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
|
||||
case 's':
|
||||
case 'S':
|
||||
ssize = &(iap->StackSize);
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
|
||||
if (p[1] == 'l') {
|
||||
p++;
|
||||
ssize = &(iap->SchedulerLoop);
|
||||
}
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
|
||||
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */
|
||||
goto GetSize;
|
||||
case 'a':
|
||||
case 'A':
|
||||
|
@ -150,10 +150,6 @@ struct PL_local_data *Yap_ld_ PL_local_data_p =Yap_InitThreadIO(wid)
|
||||
|
||||
struct open_query_struct* _execution execution =NULL
|
||||
|
||||
// Ricardo's stuff
|
||||
#if MULTIPLE_STACKS
|
||||
struct worker worker WORKER void
|
||||
#endif
|
||||
|
||||
#ifdef THREADS
|
||||
struct thandle thread_handle ThreadHandle InitThreadHandle(wid)
|
||||
|
Reference in New Issue
Block a user