fix YapOr threads.
This commit is contained in:
parent
d4825159ee
commit
c27f79eeb1
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);
|
||||
|
||||
|
6
C/grow.c
6
C/grow.c
@ -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);
|
||||
|
24
C/init.c
24
C/init.c
@ -1009,7 +1009,7 @@ 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
|
||||
#if (defined(YAPOR) || defined(THREADS)) && PURE_YAPOR
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = FALSE;
|
||||
#else
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = TRUE;
|
||||
@ -1236,7 +1236,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
|
||||
@ -1341,21 +1341,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 +1418,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);
|
||||
|
@ -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
|
||||
|
@ -91,8 +91,8 @@
|
||||
/************************************************************
|
||||
** memory mapping scheme (mandatory, define one) **
|
||||
************************************************************/
|
||||
//#define MMAP_MEMORY_MAPPING_SCHEME 1
|
||||
#define SHM_MEMORY_MAPPING_SCHEME 1
|
||||
#define MMAP_MEMORY_MAPPING_SCHEME 1
|
||||
/*#define SHM_MEMORY_MAPPING_SCHEME 1*/
|
||||
|
||||
/*************************************************
|
||||
** enable error checking ? (optional) **
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -501,7 +501,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;
|
||||
|
@ -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 */
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -218,7 +218,7 @@ struct global_optyap_data{
|
||||
#ifdef TABLE_LOCK_AT_WRITE_LEVEL
|
||||
lockvar table_lock[TABLE_LOCK_BUCKETS];
|
||||
#endif /* TABLE_LOCK_AT_WRITE_LEVEL */
|
||||
#ifdef TIMESTAMP_CHECK
|
||||
#ifdef TIMESTAMP_CHECKThreads
|
||||
long timestamp;
|
||||
#endif /* TIMESTAMP_CHECK */
|
||||
#endif /* TABLING */
|
||||
@ -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 */
|
||||
|
@ -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':
|
||||
|
Reference in New Issue
Block a user