struct local_optyap_data is now part of struct worker_local (generated from the file LOCALS)
This commit is contained in:
parent
72a83eec62
commit
a532b6cff3
@ -336,11 +336,7 @@ struct various_codes *Yap_heap_regs;
|
|||||||
static void
|
static void
|
||||||
InitHeap(void)
|
InitHeap(void)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
|
||||||
Yap_heap_regs = (struct various_codes *)calloc(1, sizeof(struct various_codes));
|
Yap_heap_regs = (struct various_codes *)calloc(1, sizeof(struct various_codes));
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
|
||||||
LOCAL = REMOTE; /* point to the first area */
|
|
||||||
#endif /* YAPOR || TABLING */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1479,10 +1475,6 @@ InitHeap(void *heap_addr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FreeBlocks = NIL;
|
FreeBlocks = NIL;
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
|
||||||
LOCAL = REMOTE; /* point to the first area */
|
|
||||||
#endif /* YAPOR || TABLING */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2823,27 +2823,21 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
}
|
}
|
||||||
yap_flags[FAST_BOOT_FLAG] = yap_init->FastBoot;
|
yap_flags[FAST_BOOT_FLAG] = yap_init->FastBoot;
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
#ifdef TABLING
|
Yap_init_root_frames();
|
||||||
/* make sure we initialise this field */
|
#endif /* YAPOR || TABLING */
|
||||||
Yap_root_dep_fr = NULL;
|
|
||||||
#endif
|
|
||||||
make_root_frames();
|
|
||||||
#ifdef YAPOR
|
|
||||||
init_workers();
|
|
||||||
#endif /* YAPOR */
|
|
||||||
Yap_init_local();
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
init_yapor_workers();
|
||||||
if (worker_id != 0) {
|
if (worker_id != 0) {
|
||||||
#if YAPOR_SBA||YAPOR_COPY
|
#if defined(YAPOR_COPY) || defined(YAPOR_SBA)
|
||||||
/*
|
/*
|
||||||
In the SBA we cannot just happily inherit registers
|
In the SBA we cannot just happily inherit registers
|
||||||
from the other workers
|
from the other workers
|
||||||
*/
|
*/
|
||||||
Yap_InitYaamRegs();
|
Yap_InitYaamRegs();
|
||||||
#endif /* YAPOR_SBA */
|
#endif /* YAPOR_COPY || YAPOR_SBA */
|
||||||
#ifndef THREADS
|
#ifndef YAPOR_THREADS
|
||||||
Yap_InitPreAllocCodeSpace();
|
Yap_InitPreAllocCodeSpace();
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
/* slaves, waiting for work */
|
/* slaves, waiting for work */
|
||||||
CurrentModule = USER_MODULE;
|
CurrentModule = USER_MODULE;
|
||||||
P = GETWORK_FIRST_TIME;
|
P = GETWORK_FIRST_TIME;
|
||||||
@ -2851,7 +2845,6 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
Yap_Error(INTERNAL_ERROR, TermNil, "abstract machine unexpected exit (YAP_Init)");
|
Yap_Error(INTERNAL_ERROR, TermNil, "abstract machine unexpected exit (YAP_Init)");
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#endif /* YAPOR || TABLING */
|
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
}
|
}
|
||||||
/* make sure we do this after restore */
|
/* make sure we do this after restore */
|
||||||
|
2
C/exec.c
2
C/exec.c
@ -1610,7 +1610,7 @@ Yap_InitYaamRegs(void)
|
|||||||
int myworker_id = worker_id;
|
int myworker_id = worker_id;
|
||||||
pthread_setspecific(Yap_yaamregs_key, (const void *)FOREIGN_ThreadHandle(myworker_id).default_yaam_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)FOREIGN_ThreadHandle(myworker_id).default_yaam_regs);
|
||||||
FOREIGN_ThreadHandle(myworker_id).current_yaam_regs = FOREIGN_ThreadHandle(myworker_id).default_yaam_regs;
|
FOREIGN_ThreadHandle(myworker_id).current_yaam_regs = FOREIGN_ThreadHandle(myworker_id).default_yaam_regs;
|
||||||
worker_id = myworker_id;
|
worker_id = myworker_id; /* ricroc: for what I understand, this shouldn't be necessary */
|
||||||
#else
|
#else
|
||||||
Yap_regp = &Yap_standard_regs;
|
Yap_regp = &Yap_standard_regs;
|
||||||
#endif
|
#endif
|
||||||
|
85
C/init.c
85
C/init.c
@ -73,11 +73,12 @@ STATIC_PROTO(void InitStdPreds,(void));
|
|||||||
STATIC_PROTO(void InitFlags, (void));
|
STATIC_PROTO(void InitFlags, (void));
|
||||||
STATIC_PROTO(void InitCodes, (void));
|
STATIC_PROTO(void InitCodes, (void));
|
||||||
STATIC_PROTO(void InitVersion, (void));
|
STATIC_PROTO(void InitVersion, (void));
|
||||||
|
|
||||||
static void InitWorker(int wid);
|
|
||||||
|
|
||||||
|
|
||||||
STD_PROTO(void exit, (int));
|
STD_PROTO(void exit, (int));
|
||||||
|
static void InitWorker(int wid);
|
||||||
|
#ifdef YAPOR
|
||||||
|
void init_yapor_workers(void);
|
||||||
|
#endif /* YAPOR */
|
||||||
|
|
||||||
|
|
||||||
/************** YAP PROLOG GLOBAL VARIABLES *************************/
|
/************** YAP PROLOG GLOBAL VARIABLES *************************/
|
||||||
|
|
||||||
@ -1166,6 +1167,54 @@ InitInvisibleAtoms(void)
|
|||||||
INIT_RWLOCK(Yap_heap_regs->invisiblechain.AERWLock);
|
INIT_RWLOCK(Yap_heap_regs->invisiblechain.AERWLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef YAPOR
|
||||||
|
void init_yapor_workers(void) {
|
||||||
|
CACHE_REGS
|
||||||
|
int proc;
|
||||||
|
#ifdef YAPOR_THREADS
|
||||||
|
return;
|
||||||
|
#endif /* YAPOR_THREADS */
|
||||||
|
#ifdef YAPOR_COW
|
||||||
|
if (Yap_number_workers > 1) {
|
||||||
|
int son;
|
||||||
|
son = fork();
|
||||||
|
if (son == -1)
|
||||||
|
Yap_Error(FATAL_ERROR, TermNil, "fork error (init_yapor_workers)");
|
||||||
|
if (son > 0) {
|
||||||
|
/* I am the father, I must stay here and wait for my children to all die */
|
||||||
|
struct sigaction sigact;
|
||||||
|
|
||||||
|
Yap_master_worker = getpid();
|
||||||
|
sigact.sa_handler = SIG_DFL;
|
||||||
|
sigemptyset(&sigact.sa_mask);
|
||||||
|
sigact.sa_flags = SA_RESTART;
|
||||||
|
sigaction(SIGINT, &sigact, NULL);
|
||||||
|
pause();
|
||||||
|
exit(0);
|
||||||
|
} else
|
||||||
|
Yap_worker_pid(0) = getpid();
|
||||||
|
}
|
||||||
|
#endif /* YAPOR_COW */
|
||||||
|
for (proc = 1; proc < Yap_number_workers; proc++) {
|
||||||
|
int son;
|
||||||
|
son = fork();
|
||||||
|
if (son == -1)
|
||||||
|
Yap_Error(FATAL_ERROR, TermNil, "fork error (init_yapor_workers)");
|
||||||
|
if (son == 0) {
|
||||||
|
/* new worker */
|
||||||
|
worker_id = proc;
|
||||||
|
Yap_remap_optyap_memory();
|
||||||
|
LOCAL = REMOTE(worker_id);
|
||||||
|
InitWorker(worker_id);
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
Yap_worker_pid(proc) = son;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* YAPOR */
|
||||||
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
static void
|
static void
|
||||||
InitThreadHandle(int wid)
|
InitThreadHandle(int wid)
|
||||||
@ -1189,7 +1238,7 @@ Yap_InitThread(int new_id)
|
|||||||
if (new_id) {
|
if (new_id) {
|
||||||
if (!(new_s = (struct worker_local *)calloc(sizeof(struct worker_local), 1)))
|
if (!(new_s = (struct worker_local *)calloc(sizeof(struct worker_local), 1)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
Yap_WLocal[new_id] = new_s;
|
Yap_local[new_id] = new_s;
|
||||||
}
|
}
|
||||||
InitWorker(new_id);
|
InitWorker(new_id);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1241,11 +1290,11 @@ struct global_data Yap_Global;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(THREADS)
|
#if defined(THREADS)
|
||||||
struct worker_local *Yap_WLocal[MAX_THREADS];
|
struct worker_local *Yap_local[MAX_THREADS];
|
||||||
#elif defined(YAPOR)
|
#elif defined(YAPOR)
|
||||||
struct worker_local *Yap_WLocal;
|
struct worker_local *Yap_local;
|
||||||
#else /* !THREADS && !YAPOR */
|
#else /* !THREADS && !YAPOR */
|
||||||
struct worker_local Yap_WLocal;
|
struct worker_local Yap_local;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1255,7 +1304,7 @@ InitCodes(void)
|
|||||||
#if THREADS
|
#if THREADS
|
||||||
int wid;
|
int wid;
|
||||||
for (wid = 1; wid < MAX_THREADS; wid++) {
|
for (wid = 1; wid < MAX_THREADS; wid++) {
|
||||||
Yap_WLocal[wid] = NULL;
|
Yap_local[wid] = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#include "ihstruct.h"
|
#include "ihstruct.h"
|
||||||
@ -1304,7 +1353,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
/* initialise system stuff */
|
/* initialise system stuff */
|
||||||
#if PUSH_REGS
|
#if PUSH_REGS
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
if (!(Yap_WLocal[0] = (struct worker_local *)calloc(sizeof(struct worker_local), 1)))
|
if (!(Yap_local[0] = (struct worker_local *)calloc(sizeof(struct worker_local), 1)))
|
||||||
return;
|
return;
|
||||||
pthread_key_create(&Yap_yaamregs_key, NULL);
|
pthread_key_create(&Yap_yaamregs_key, NULL);
|
||||||
pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)&Yap_standard_regs);
|
||||||
@ -1319,8 +1368,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
Yap_regp = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
Yap_regp = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
||||||
Yap_regp->worker_id_ = 0;
|
#endif /* THREADS */
|
||||||
#endif
|
|
||||||
/* Init signal handling and time */
|
/* Init signal handling and time */
|
||||||
/* also init memory page size, required by later functions */
|
/* also init memory page size, required by later functions */
|
||||||
Yap_InitSysbits ();
|
Yap_InitSysbits ();
|
||||||
@ -1338,8 +1386,10 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
Atts = 2048*sizeof(CELL);
|
Atts = 2048*sizeof(CELL);
|
||||||
else
|
else
|
||||||
Atts = AdjustPageSize(Atts * K);
|
Atts = AdjustPageSize(Atts * K);
|
||||||
#ifdef YAPOR
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
worker_id = 0;
|
worker_id = 0;
|
||||||
|
#endif /* YAPOR || THREADS */
|
||||||
|
#ifdef YAPOR
|
||||||
if (n_workers > MAX_WORKERS)
|
if (n_workers > MAX_WORKERS)
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers");
|
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers");
|
||||||
#ifdef YAPOR_COPY
|
#ifdef YAPOR_COPY
|
||||||
@ -1355,13 +1405,16 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
|
||||||
Yap_init_optyap_memory(Trail, Heap, Stack+Atts, n_workers);
|
Yap_init_optyap_memory(Trail, Heap, Stack+Atts, n_workers);
|
||||||
#else
|
#else
|
||||||
Yap_InitMemory (Trail, Heap, Stack+Atts);
|
Yap_InitMemory(Trail, Heap, Stack+Atts);
|
||||||
#endif
|
#endif
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
Yap_init_optyap_data(max_table_size, n_workers, sch_loop, delay_load);
|
Yap_init_global_optyap_data(max_table_size, n_workers, sch_loop, delay_load);
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
Yap_AttsSize = Atts;
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
LOCAL = REMOTE(0); /* point to the first area */
|
||||||
|
#endif /* YAPOR || THREADS */
|
||||||
|
|
||||||
|
Yap_AttsSize = Atts;
|
||||||
Yap_InitTime ();
|
Yap_InitTime ();
|
||||||
/* InitAbsmi must be done before InitCodes */
|
/* InitAbsmi must be done before InitCodes */
|
||||||
/* This must be done before initialising predicates */
|
/* This must be done before initialising predicates */
|
||||||
|
15
C/threads.c
15
C/threads.c
@ -53,13 +53,13 @@ allocate_new_tid(void)
|
|||||||
int new_worker_id = 0;
|
int new_worker_id = 0;
|
||||||
LOCK(Yap_ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
while(new_worker_id < MAX_THREADS &&
|
while(new_worker_id < MAX_THREADS &&
|
||||||
Yap_WLocal[new_worker_id] &&
|
Yap_local[new_worker_id] &&
|
||||||
(FOREIGN_ThreadHandle(new_worker_id).in_use == TRUE ||
|
(FOREIGN_ThreadHandle(new_worker_id).in_use == TRUE ||
|
||||||
FOREIGN_ThreadHandle(new_worker_id).zombie == TRUE) )
|
FOREIGN_ThreadHandle(new_worker_id).zombie == TRUE) )
|
||||||
new_worker_id++;
|
new_worker_id++;
|
||||||
if (new_worker_id >= MAX_THREADS) {
|
if (new_worker_id >= MAX_THREADS) {
|
||||||
new_worker_id = -1;
|
new_worker_id = -1;
|
||||||
} else if (!Yap_WLocal[new_worker_id]) {
|
} else if (!Yap_local[new_worker_id]) {
|
||||||
DEBUG_TLOCK_ACCESS(new_worker_id, 0);
|
DEBUG_TLOCK_ACCESS(new_worker_id, 0);
|
||||||
if (!Yap_InitThread(new_worker_id)) {
|
if (!Yap_InitThread(new_worker_id)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -182,16 +182,11 @@ setup_engine(int myworker_id, int init_thread)
|
|||||||
pthread_setspecific(Yap_yaamregs_key, (void *)FOREIGN_ThreadHandle(myworker_id).default_yaam_regs);
|
pthread_setspecific(Yap_yaamregs_key, (void *)FOREIGN_ThreadHandle(myworker_id).default_yaam_regs);
|
||||||
}
|
}
|
||||||
worker_id = myworker_id;
|
worker_id = myworker_id;
|
||||||
|
LOCAL = REMOTE(worker_id);
|
||||||
Yap_InitExStacks(FOREIGN_ThreadHandle(myworker_id).tsize, FOREIGN_ThreadHandle(myworker_id).ssize);
|
Yap_InitExStacks(FOREIGN_ThreadHandle(myworker_id).tsize, FOREIGN_ThreadHandle(myworker_id).ssize);
|
||||||
CurrentModule = FOREIGN_ThreadHandle(myworker_id).cmod;
|
CurrentModule = FOREIGN_ThreadHandle(myworker_id).cmod;
|
||||||
Yap_InitTime();
|
Yap_InitTime();
|
||||||
Yap_InitYaamRegs();
|
Yap_InitYaamRegs();
|
||||||
#ifdef YAPOR
|
|
||||||
Yap_init_local();
|
|
||||||
#endif
|
|
||||||
#ifdef TABLING
|
|
||||||
new_dependency_frame(REMOTE_top_dep_fr(myworker_id)), FALSE, NULL, NULL, NULL, NULL, NULL);
|
|
||||||
#endif
|
|
||||||
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
|
Yap_ReleasePreAllocCodeSpace(Yap_PreAllocCodeSpace());
|
||||||
/* I exist */
|
/* I exist */
|
||||||
Yap_NOfThreadsCreated++;
|
Yap_NOfThreadsCreated++;
|
||||||
@ -447,7 +442,7 @@ Yap_thread_attach_engine(int wid)
|
|||||||
FOREIGN_ThreadHandle(wid).pthread_handle = pthread_self();
|
FOREIGN_ThreadHandle(wid).pthread_handle = pthread_self();
|
||||||
FOREIGN_ThreadHandle(wid).ref_count++;
|
FOREIGN_ThreadHandle(wid).ref_count++;
|
||||||
pthread_setspecific(Yap_yaamregs_key, (const void *)FOREIGN_ThreadHandle(wid).default_yaam_regs);
|
pthread_setspecific(Yap_yaamregs_key, (const void *)FOREIGN_ThreadHandle(wid).default_yaam_regs);
|
||||||
worker_id = wid;
|
worker_id = wid; /* ricroc: for what I understand, this shouldn't be necessary */
|
||||||
DEBUG_TLOCK_ACCESS(9, wid);
|
DEBUG_TLOCK_ACCESS(9, wid);
|
||||||
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
pthread_mutex_unlock(&(FOREIGN_ThreadHandle(wid).tlock));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -836,7 +831,7 @@ p_nof_threads( USES_REGS1 )
|
|||||||
int i = 0, wid;
|
int i = 0, wid;
|
||||||
LOCK(Yap_ThreadHandlesLock);
|
LOCK(Yap_ThreadHandlesLock);
|
||||||
for (wid = 0; wid < MAX_THREADS; wid++) {
|
for (wid = 0; wid < MAX_THREADS; wid++) {
|
||||||
if (!Yap_WLocal[wid]) break;
|
if (!Yap_local[wid]) break;
|
||||||
if (FOREIGN_ThreadHandle(wid).in_use)
|
if (FOREIGN_ThreadHandle(wid).in_use)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
12
C/write.c
12
C/write.c
@ -746,26 +746,26 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
lastw = separator;
|
lastw = separator;
|
||||||
if (wglb->keep_terms) {
|
if (wglb->keep_terms) {
|
||||||
/* garbage collection may be called */
|
/* garbage collection may be called */
|
||||||
sl = Yap_InitSlot(t);
|
sl = Yap_InitSlot(t PASS_REGS);
|
||||||
}
|
}
|
||||||
writeTerm(HeadOfTerm(t), 999, depth + 1, FALSE, wglb, &nrwt);
|
writeTerm(HeadOfTerm(t), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||||
restore_from_write(&nrwt, wglb);
|
restore_from_write(&nrwt, wglb);
|
||||||
if (wglb->keep_terms) {
|
if (wglb->keep_terms) {
|
||||||
/* garbage collection may be called */
|
/* garbage collection may be called */
|
||||||
t = Yap_GetFromSlot(sl);
|
t = Yap_GetFromSlot(sl PASS_REGS);
|
||||||
Yap_RecoverSlots(1);
|
Yap_RecoverSlots(1 PASS_REGS);
|
||||||
}
|
}
|
||||||
wrputs(",",wglb->writewch);
|
wrputs(",",wglb->writewch);
|
||||||
if (wglb->keep_terms) {
|
if (wglb->keep_terms) {
|
||||||
/* garbage collection may be called */
|
/* garbage collection may be called */
|
||||||
sl = Yap_InitSlot(t);
|
sl = Yap_InitSlot(t PASS_REGS);
|
||||||
}
|
}
|
||||||
writeTerm(TailOfTerm(t), 999, depth + 1, FALSE, wglb, &nrwt);
|
writeTerm(TailOfTerm(t), 999, depth + 1, FALSE, wglb, &nrwt);
|
||||||
restore_from_write(&nrwt, wglb);
|
restore_from_write(&nrwt, wglb);
|
||||||
if (wglb->keep_terms) {
|
if (wglb->keep_terms) {
|
||||||
/* garbage collection may be called */
|
/* garbage collection may be called */
|
||||||
t = Yap_GetFromSlot(sl);
|
t = Yap_GetFromSlot(sl PASS_REGS);
|
||||||
Yap_RecoverSlots(1);
|
Yap_RecoverSlots(1 PASS_REGS);
|
||||||
}
|
}
|
||||||
wrputc(')', wglb->writewch);
|
wrputc(')', wglb->writewch);
|
||||||
lastw = separator;
|
lastw = separator;
|
||||||
|
18
H/Regs.h
18
H/Regs.h
@ -126,9 +126,10 @@ typedef struct regstore_t
|
|||||||
#endif /* YAPOR_SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
struct pred_entry *PP_;
|
struct pred_entry *PP_;
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
unsigned int worker_id_;
|
||||||
|
struct worker_local *worker_local_;
|
||||||
/* recursive write-locks for PredEntry */
|
/* recursive write-locks for PredEntry */
|
||||||
yamop **PREG_ADDR_;
|
yamop **PREG_ADDR_;
|
||||||
unsigned int worker_id_;
|
|
||||||
#ifdef YAPOR_SBA
|
#ifdef YAPOR_SBA
|
||||||
choiceptr BSEG_;
|
choiceptr BSEG_;
|
||||||
struct or_frame *frame_head_, *frame_tail_;
|
struct or_frame *frame_head_, *frame_tail_;
|
||||||
@ -138,9 +139,6 @@ typedef struct regstore_t
|
|||||||
int sba_size_;
|
int sba_size_;
|
||||||
#endif /* YAPOR_SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#endif /* YAPOR || THREADS */
|
#endif /* YAPOR || THREADS */
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
|
||||||
struct local_data *LOCAL_;
|
|
||||||
#endif
|
|
||||||
#if PUSH_REGS
|
#if PUSH_REGS
|
||||||
/* On a X86 machine, the best solution is to keep the
|
/* On a X86 machine, the best solution is to keep the
|
||||||
X registers on a global variable, whose address is known between
|
X registers on a global variable, whose address is known between
|
||||||
@ -642,8 +640,9 @@ EXTERN inline void restore_B(void) {
|
|||||||
#endif /* YAPOR_SBA || TABLING */
|
#endif /* YAPOR_SBA || TABLING */
|
||||||
#define PP (Yap_REGS.PP_)
|
#define PP (Yap_REGS.PP_)
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
#define worker_id (Yap_REGS.worker_id_)
|
#define worker_id (Yap_REGS.worker_id_)
|
||||||
#define PREG_ADDR (Yap_REGS.PREG_ADDR_)
|
#define LOCAL (Yap_REGS.worker_local_)
|
||||||
|
#define PREG_ADDR (Yap_REGS.PREG_ADDR_)
|
||||||
#ifdef YAPOR_SBA
|
#ifdef YAPOR_SBA
|
||||||
#define BSEG Yap_REGS.BSEG_
|
#define BSEG Yap_REGS.BSEG_
|
||||||
#define binding_array Yap_REGS.binding_array_
|
#define binding_array Yap_REGS.binding_array_
|
||||||
@ -653,10 +652,9 @@ EXTERN inline void restore_B(void) {
|
|||||||
#define frame_head Yap_REGS.frame_head_
|
#define frame_head Yap_REGS.frame_head_
|
||||||
#define frame_tail Yap_REGS.frame_tail_
|
#define frame_tail Yap_REGS.frame_tail_
|
||||||
#endif /* YAPOR_SBA */
|
#endif /* YAPOR_SBA */
|
||||||
#endif /* YAPOR */
|
#else
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#define LOCAL (&Yap_local)
|
||||||
#define LOCAL Yap_REGS.LOCAL_
|
#endif /* YAPOR || THREADS */
|
||||||
#endif
|
|
||||||
#define CurrentModule Yap_REGS.CurrentModule_
|
#define CurrentModule Yap_REGS.CurrentModule_
|
||||||
#define ARITH_EXCEPTION Yap_REGS.ARITH_EXCEPTION_
|
#define ARITH_EXCEPTION Yap_REGS.ARITH_EXCEPTION_
|
||||||
#define Yap_isint Yap_REGS.isint_
|
#define Yap_isint Yap_REGS.isint_
|
||||||
|
19
H/YapHeap.h
19
H/YapHeap.h
@ -189,20 +189,19 @@ extern struct global_data Yap_Global;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(THREADS)
|
#if defined(THREADS)
|
||||||
extern struct worker_local *Yap_WLocal[MAX_THREADS];
|
extern struct worker_local *Yap_local[MAX_THREADS];
|
||||||
#define WL (Yap_WLocal[worker_id])
|
#define FOREIGN(wid) (Yap_local[wid])
|
||||||
#define FOREIGN(wid) (Yap_WLocal[(wid)])
|
#define REMOTE(wid) (Yap_local[wid])
|
||||||
#elif defined(YAPOR)
|
#elif defined(YAPOR)
|
||||||
extern struct worker_local *Yap_WLocal;
|
extern struct worker_local *Yap_local;
|
||||||
#define WL (Yap_WLocal+worker_id)
|
#define FOREIGN(wid) (Yap_local + wid)
|
||||||
#define FOREIGN(wid) (Yap_WLocal+wid)
|
#define REMOTE(wid) (Yap_local + wid)
|
||||||
#else /* !THREADS && !YAPOR */
|
#else /* !THREADS && !YAPOR */
|
||||||
extern struct worker_local Yap_WLocal;
|
extern struct worker_local Yap_local;
|
||||||
#define WL (&Yap_WLocal)
|
#define FOREIGN(wid) (&Yap_local)
|
||||||
#define FOREIGN(wid) (&Yap_WLocal)
|
#define REMOTE(wid) (&Yap_local)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SYSTEM_MALLOC
|
#ifdef USE_SYSTEM_MALLOC
|
||||||
extern struct various_codes *Yap_heap_regs;
|
extern struct various_codes *Yap_heap_regs;
|
||||||
#else
|
#else
|
||||||
|
37
H/dglobals.h
37
H/dglobals.h
@ -21,6 +21,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define Yap_Initialised Yap_global->initialised
|
||||||
|
#define Yap_InitialisedFromPL Yap_global->initialised_from_pl
|
||||||
|
#define Yap_PL_Argc Yap_global->pl_argc
|
||||||
|
#define Yap_PL_Argv Yap_global->pl_argv
|
||||||
|
|
||||||
|
#define Yap_HaltHooks Yap_global->yap_halt_hook
|
||||||
|
|
||||||
|
#define Yap_AllowLocalExpansion Yap_global->allow_local_expansion
|
||||||
|
#define Yap_AllowGlobalExpansion Yap_global->allow_global_expansion
|
||||||
|
#define Yap_AllowTrailExpansion Yap_global->allow_trail_expansion
|
||||||
|
#define Yap_SizeOfOverflow Yap_global->size_of_overflow
|
||||||
|
|
||||||
|
#define Yap_AGcLastCall Yap_global->agc_last_call
|
||||||
|
|
||||||
|
#define Yap_AGcThreshold Yap_global->agc_threshold
|
||||||
|
#define Yap_AGCHook Yap_global->agc_hook
|
||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
@ -36,29 +52,10 @@
|
|||||||
#define Yap_BGL Yap_global->bgl
|
#define Yap_BGL Yap_global->bgl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define Yap_AllowLocalExpansion Yap_global->allow_local_expansion
|
|
||||||
#define Yap_AllowGlobalExpansion Yap_global->allow_global_expansion
|
|
||||||
#define Yap_AllowTrailExpansion Yap_global->allow_trail_expansion
|
|
||||||
#define Yap_SizeOfOverflow Yap_global->size_of_overflow
|
|
||||||
|
|
||||||
#define Yap_AGcLastCall Yap_global->agc_last_call
|
|
||||||
|
|
||||||
#define Yap_AGcThreshold Yap_global->agc_threshold
|
|
||||||
#define Yap_AGCHook Yap_global->agc_hook
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
#define Yap_ThreadHandlesLock Yap_global->thread_handles_lock
|
#define Yap_ThreadHandlesLock Yap_global->thread_handles_lock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
#define Yap_optyap_data Yap_global->optyap_data
|
#define Yap_optyap_data Yap_global->optyap_data
|
||||||
#define REMOTE Yap_global->remote
|
#endif /* YAPOR || TABLING */
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Yap_Initialised Yap_global->initialised
|
|
||||||
#define Yap_InitialisedFromPL Yap_global->initialised_from_pl
|
|
||||||
#define Yap_PL_Argc Yap_global->pl_argc
|
|
||||||
#define Yap_PL_Argv Yap_global->pl_argv
|
|
||||||
|
|
||||||
#define Yap_HaltHooks Yap_global->yap_halt_hook
|
|
||||||
|
|
||||||
|
207
H/dlocals.h
207
H/dlocals.h
@ -5,133 +5,130 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LOCAL_c_input_stream WL->c_input_stream
|
#define LOCAL_c_input_stream LOCAL->c_input_stream
|
||||||
#define LOCAL_c_output_stream WL->c_output_stream
|
#define LOCAL_c_output_stream LOCAL->c_output_stream
|
||||||
#define LOCAL_c_error_stream WL->c_error_stream
|
#define LOCAL_c_error_stream LOCAL->c_error_stream
|
||||||
|
|
||||||
#define LOCAL_OldASP WL->rinfo.old_ASP
|
#define LOCAL_OldASP LOCAL->rinfo.old_ASP
|
||||||
#define LOCAL_OldLCL0 WL->rinfo.old_LCL0
|
#define LOCAL_OldLCL0 LOCAL->rinfo.old_LCL0
|
||||||
#define LOCAL_OldTR WL->rinfo.old_TR
|
#define LOCAL_OldTR LOCAL->rinfo.old_TR
|
||||||
#define LOCAL_OldGlobalBase WL->rinfo.old_GlobalBase
|
#define LOCAL_OldGlobalBase LOCAL->rinfo.old_GlobalBase
|
||||||
#define LOCAL_OldH WL->rinfo.old_H
|
#define LOCAL_OldH LOCAL->rinfo.old_H
|
||||||
#define LOCAL_OldH0 WL->rinfo.old_H0
|
#define LOCAL_OldH0 LOCAL->rinfo.old_H0
|
||||||
#define LOCAL_OldTrailBase WL->rinfo.old_TrailBase
|
#define LOCAL_OldTrailBase LOCAL->rinfo.old_TrailBase
|
||||||
#define LOCAL_OldTrailTop WL->rinfo.old_TrailTop
|
#define LOCAL_OldTrailTop LOCAL->rinfo.old_TrailTop
|
||||||
#define LOCAL_OldHeapBase WL->rinfo.old_HeapBase
|
#define LOCAL_OldHeapBase LOCAL->rinfo.old_HeapBase
|
||||||
#define LOCAL_OldHeapTop WL->rinfo.old_HeapTop
|
#define LOCAL_OldHeapTop LOCAL->rinfo.old_HeapTop
|
||||||
#define LOCAL_ClDiff WL->rinfo.cl_diff
|
#define LOCAL_ClDiff LOCAL->rinfo.cl_diff
|
||||||
#define LOCAL_GDiff WL->rinfo.g_diff
|
#define LOCAL_GDiff LOCAL->rinfo.g_diff
|
||||||
#define LOCAL_HDiff WL->rinfo.h_diff
|
#define LOCAL_HDiff LOCAL->rinfo.h_diff
|
||||||
#define LOCAL_GDiff0 WL->rinfo.g_diff0
|
#define LOCAL_GDiff0 LOCAL->rinfo.g_diff0
|
||||||
#define LOCAL_GSplit WL->rinfo.g_split
|
#define LOCAL_GSplit LOCAL->rinfo.g_split
|
||||||
#define LOCAL_LDiff WL->rinfo.l_diff
|
#define LOCAL_LDiff LOCAL->rinfo.l_diff
|
||||||
#define LOCAL_TrDiff WL->rinfo.tr_diff
|
#define LOCAL_TrDiff LOCAL->rinfo.tr_diff
|
||||||
#define LOCAL_XDiff WL->rinfo.x_diff
|
#define LOCAL_XDiff LOCAL->rinfo.x_diff
|
||||||
#define LOCAL_DelayDiff WL->rinfo.delay_diff
|
#define LOCAL_DelayDiff LOCAL->rinfo.delay_diff
|
||||||
#define LOCAL_BaseDiff WL->rinfo.base_diff
|
#define LOCAL_BaseDiff LOCAL->rinfo.base_diff
|
||||||
#define LOCAL_ReductionsCounter WL->call_counters.reductions
|
#define LOCAL_ReductionsCounter LOCAL->call_counters.reductions
|
||||||
#define LOCAL_PredEntriesCounter WL->call_counters.reductions_retries
|
#define LOCAL_PredEntriesCounter LOCAL->call_counters.reductions_retries
|
||||||
#define LOCAL_RetriesCounter WL->call_counters.retries
|
#define LOCAL_RetriesCounter LOCAL->call_counters.retries
|
||||||
#define LOCAL_ReductionsCounterOn WL->call_counters.reductions_on
|
#define LOCAL_ReductionsCounterOn LOCAL->call_counters.reductions_on
|
||||||
#define LOCAL_PredEntriesCounterOn WL->call_counters.reductions_retries_on
|
#define LOCAL_PredEntriesCounterOn LOCAL->call_counters.reductions_retries_on
|
||||||
#define LOCAL_RetriesCounterOn WL->call_counters.retries_on
|
#define LOCAL_RetriesCounterOn LOCAL->call_counters.retries_on
|
||||||
#define LOCAL_InterruptsDisabled WL->interrupts_disabled
|
#define LOCAL_InterruptsDisabled LOCAL->interrupts_disabled
|
||||||
|
|
||||||
|
|
||||||
#define LOCAL_ConsultSp WL->consultsp
|
#define LOCAL_ConsultSp LOCAL->consultsp
|
||||||
|
|
||||||
#define LOCAL_ConsultCapacity WL->consultcapacity
|
#define LOCAL_ConsultCapacity LOCAL->consultcapacity
|
||||||
|
|
||||||
#define LOCAL_ConsultBase WL->consultbase
|
#define LOCAL_ConsultBase LOCAL->consultbase
|
||||||
|
|
||||||
#define LOCAL_ConsultLow WL->consultlow
|
#define LOCAL_ConsultLow LOCAL->consultlow
|
||||||
|
|
||||||
#define LOCAL_GlobalArena WL->global_arena
|
#define LOCAL_GlobalArena LOCAL->global_arena
|
||||||
#define LOCAL_GlobalArenaOverflows WL->global_arena_overflows
|
#define LOCAL_GlobalArenaOverflows LOCAL->global_arena_overflows
|
||||||
#define LOCAL_ArenaOverflows WL->arena_overflows
|
#define LOCAL_ArenaOverflows LOCAL->arena_overflows
|
||||||
#define LOCAL_DepthArenas WL->depth_arenas
|
#define LOCAL_DepthArenas LOCAL->depth_arenas
|
||||||
#define LOCAL_ArithError WL->arith_error
|
#define LOCAL_ArithError LOCAL->arith_error
|
||||||
#define LOCAL_LastAssertedPred WL->last_asserted_pred
|
#define LOCAL_LastAssertedPred LOCAL->last_asserted_pred
|
||||||
#define LOCAL_DebugOn WL->debug_on
|
#define LOCAL_DebugOn LOCAL->debug_on
|
||||||
#define LOCAL_ScannerStack WL->scanner_stack
|
#define LOCAL_ScannerStack LOCAL->scanner_stack
|
||||||
#define LOCAL_ScannerExtraBlocks WL->scanner_extra_blocks
|
#define LOCAL_ScannerExtraBlocks LOCAL->scanner_extra_blocks
|
||||||
#define LOCAL_BallTerm WL->ball_term
|
#define LOCAL_BallTerm LOCAL->ball_term
|
||||||
#define LOCAL_ActiveSignals WL->active_signals
|
#define LOCAL_ActiveSignals LOCAL->active_signals
|
||||||
#define LOCAL_IPredArity WL->i_pred_arity
|
#define LOCAL_IPredArity LOCAL->i_pred_arity
|
||||||
#define LOCAL_ProfEnd WL->prof_end
|
#define LOCAL_ProfEnd LOCAL->prof_end
|
||||||
#define LOCAL_UncaughtThrow WL->uncaught_throw
|
#define LOCAL_UncaughtThrow LOCAL->uncaught_throw
|
||||||
#define LOCAL_DoingUndefp WL->doing_undefp
|
#define LOCAL_DoingUndefp LOCAL->doing_undefp
|
||||||
#define LOCAL_StartLine WL->start_line
|
#define LOCAL_StartLine LOCAL->start_line
|
||||||
#define LOCAL_ScratchPad WL->scratchpad
|
#define LOCAL_ScratchPad LOCAL->scratchpad
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
#define LOCAL_WokenGoals WL->woken_goals
|
#define LOCAL_WokenGoals LOCAL->woken_goals
|
||||||
#define LOCAL_AttsMutableList WL->atts_mutable_list
|
#define LOCAL_AttsMutableList LOCAL->atts_mutable_list
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOCAL_GcGeneration WL->gc_generation
|
#define LOCAL_GcGeneration LOCAL->gc_generation
|
||||||
#define LOCAL_GcPhase WL->gc_phase
|
#define LOCAL_GcPhase LOCAL->gc_phase
|
||||||
#define LOCAL_GcCurrentPhase WL->gc_current_phase
|
#define LOCAL_GcCurrentPhase LOCAL->gc_current_phase
|
||||||
#define LOCAL_GcCalls WL->gc_calls
|
#define LOCAL_GcCalls LOCAL->gc_calls
|
||||||
#define LOCAL_TotGcTime WL->tot_gc_time
|
#define LOCAL_TotGcTime LOCAL->tot_gc_time
|
||||||
#define LOCAL_TotGcRecovered WL->tot_gc_recovered
|
#define LOCAL_TotGcRecovered LOCAL->tot_gc_recovered
|
||||||
#define LOCAL_LastGcTime WL->last_gc_time
|
#define LOCAL_LastGcTime LOCAL->last_gc_time
|
||||||
#define LOCAL_LastSSTime WL->last_ss_time
|
#define LOCAL_LastSSTime LOCAL->last_ss_time
|
||||||
#if LOW_LEVEL_TRACER
|
#if LOW_LEVEL_TRACER
|
||||||
#define LOCAL_total_choicepoints WL->total_cps
|
#define LOCAL_total_choicepoints LOCAL->total_cps
|
||||||
#endif
|
#endif
|
||||||
#define LOCAL_consult_level WL->consult_level_
|
#define LOCAL_consult_level LOCAL->consult_level_
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
#define LOCAL_SignalLock WL->signal_lock
|
#define LOCAL_SignalLock LOCAL->signal_lock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOCAL_total_marked WL->tot_marked
|
#define LOCAL_total_marked LOCAL->tot_marked
|
||||||
#define LOCAL_total_oldies WL->tot_oldies
|
#define LOCAL_total_oldies LOCAL->tot_oldies
|
||||||
#define LOCAL_current_B WL->wl_current_B
|
#define LOCAL_current_B LOCAL->wl_current_B
|
||||||
#define LOCAL_prev_HB WL->wl_prev_HB
|
#define LOCAL_prev_HB LOCAL->wl_prev_HB
|
||||||
#define LOCAL_HGEN WL->hgen
|
#define LOCAL_HGEN LOCAL->hgen
|
||||||
#define LOCAL_iptop WL->ip_top
|
#define LOCAL_iptop LOCAL->ip_top
|
||||||
|
|
||||||
#if defined(GC_NO_TAGS)
|
#if defined(GC_NO_TAGS)
|
||||||
#define LOCAL_bp WL->b_p
|
#define LOCAL_bp LOCAL->b_p
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
#define LOCAL_sTR LOCAL->wl_sTR
|
||||||
#define LOCAL_sTR WL->wl_sTR
|
#define LOCAL_sTR0 LOCAL->wl_sTR0
|
||||||
#define LOCAL_sTR0 WL->wl_sTR0
|
#define LOCAL_new_TR LOCAL->new_tr
|
||||||
#define LOCAL_new_TR WL->new_tr
|
#define LOCAL_cont_top0 LOCAL->conttop0
|
||||||
#else
|
#define LOCAL_cont_top LOCAL->conttop
|
||||||
#define LOCAL_sTR WL->wl_sTR
|
#define LOCAL_discard_trail_entries LOCAL->disc_trail_entries
|
||||||
#define LOCAL_sTR0 WL->wl_sTR0
|
#define LOCAL_gc_ma_hash_table LOCAL->Gc_ma_hash_table
|
||||||
#define LOCAL_new_TR WL->new_tr
|
#define LOCAL_gc_ma_h_top LOCAL->Gc_ma_h_top
|
||||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
#define LOCAL_gc_ma_h_list LOCAL->Gc_ma_h_list
|
||||||
#define LOCAL_cont_top0 WL->conttop0
|
#define LOCAL_gc_timestamp LOCAL->Gc_timestamp
|
||||||
#define LOCAL_cont_top WL->conttop
|
#define LOCAL_db_vec LOCAL->DB_vec
|
||||||
#define LOCAL_discard_trail_entries WL->disc_trail_entries
|
#define LOCAL_db_vec0 LOCAL->DB_vec0
|
||||||
#define LOCAL_gc_ma_hash_table WL->Gc_ma_hash_table
|
#define LOCAL_db_root LOCAL->DB_root
|
||||||
#define LOCAL_gc_ma_h_top WL->Gc_ma_h_top
|
#define LOCAL_db_nil LOCAL->DB_nil
|
||||||
#define LOCAL_gc_ma_h_list WL->Gc_ma_h_list
|
#define LOCAL_gc_restore LOCAL->gc_restore
|
||||||
#define LOCAL_gc_timestamp WL->Gc_timestamp
|
#define LOCAL_DynamicArrays LOCAL->dynamic_arrays
|
||||||
#define LOCAL_db_vec WL->DB_vec
|
#define LOCAL_StaticArrays LOCAL->static_arrays
|
||||||
#define LOCAL_db_vec0 WL->DB_vec0
|
#define LOCAL_GlobalVariables LOCAL->global_variables
|
||||||
#define LOCAL_db_root WL->DB_root
|
#define LOCAL_AllowRestart LOCAL->allow_restart
|
||||||
#define LOCAL_db_nil WL->DB_nil
|
|
||||||
#define LOCAL_gc_restore WL->gc_restore
|
|
||||||
#define LOCAL_DynamicArrays WL->dynamic_arrays
|
|
||||||
#define LOCAL_StaticArrays WL->static_arrays
|
|
||||||
#define LOCAL_GlobalVariables WL->global_variables
|
|
||||||
#define LOCAL_AllowRestart WL->allow_restart
|
|
||||||
|
|
||||||
#define LOCAL_CMemFirstBlock WL->cmem_first_block
|
#define LOCAL_CMemFirstBlock LOCAL->cmem_first_block
|
||||||
#define LOCAL_CMemFirstBlockSz WL->cmem_first_block_sz
|
#define LOCAL_CMemFirstBlockSz LOCAL->cmem_first_block_sz
|
||||||
|
|
||||||
#define LOCAL_LabelFirstArray WL->label_first_array
|
#define LOCAL_LabelFirstArray LOCAL->label_first_array
|
||||||
#define LOCAL_LabelFirstArraySz WL->label_first_array_sz
|
#define LOCAL_LabelFirstArraySz LOCAL->label_first_array_sz
|
||||||
|
|
||||||
#define LOCAL_PL_local_data_p WL->Yap_ld_
|
#define LOCAL_PL_local_data_p LOCAL->Yap_ld_
|
||||||
#define LOCAL_execution WL->_execution
|
#define LOCAL_execution LOCAL->_execution
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
#define LOCAL_ThreadHandle WL->thread_handle
|
#define LOCAL_ThreadHandle LOCAL->thread_handle
|
||||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
#define FOREIGN_ThreadHandle(wid) (Yap_local[(wid)]->thread_handle)
|
||||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
#define MY_ThreadHandle (Yap_local[worker_id]->thread_handle)
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
#define LOCAL_optyap_data LOCAL->optyap_data
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
|
|
||||||
|
39
H/hglobals.h
39
H/hglobals.h
@ -19,9 +19,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct global_data {
|
typedef struct global_data {
|
||||||
|
|
||||||
|
int initialised;
|
||||||
|
int initialised_from_pl;
|
||||||
|
int pl_argc;
|
||||||
|
char **pl_argv;
|
||||||
|
|
||||||
|
struct halt_hook *yap_halt_hook;
|
||||||
|
|
||||||
|
int allow_local_expansion;
|
||||||
|
int allow_global_expansion;
|
||||||
|
int allow_trail_expansion;
|
||||||
|
UInt size_of_overflow;
|
||||||
|
|
||||||
|
UInt agc_last_call;
|
||||||
|
|
||||||
|
UInt agc_threshold;
|
||||||
|
Agc_hook agc_hook;
|
||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
UInt n_of_threads;
|
UInt n_of_threads;
|
||||||
@ -36,29 +52,10 @@ typedef struct global_data {
|
|||||||
lockvar bgl;
|
lockvar bgl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int allow_local_expansion;
|
|
||||||
int allow_global_expansion;
|
|
||||||
int allow_trail_expansion;
|
|
||||||
UInt size_of_overflow;
|
|
||||||
|
|
||||||
UInt agc_last_call;
|
|
||||||
|
|
||||||
UInt agc_threshold;
|
|
||||||
Agc_hook agc_hook;
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
lockvar thread_handles_lock;
|
lockvar thread_handles_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
struct global_optyap_data optyap_data;
|
struct global_optyap_data optyap_data;
|
||||||
struct local_data remote[MAX_WORKERS];
|
#endif /* YAPOR || TABLING */
|
||||||
#endif
|
|
||||||
|
|
||||||
int initialised;
|
|
||||||
int initialised_from_pl;
|
|
||||||
int pl_argc;
|
|
||||||
char **pl_argv;
|
|
||||||
|
|
||||||
struct halt_hook *yap_halt_hook;
|
|
||||||
} w_shared;
|
} w_shared;
|
||||||
|
19
H/hlocals.h
19
H/hlocals.h
@ -96,15 +96,9 @@ typedef struct worker_local {
|
|||||||
#if defined(GC_NO_TAGS)
|
#if defined(GC_NO_TAGS)
|
||||||
char* b_p;
|
char* b_p;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
tr_fr_ptr wl_sTR;
|
||||||
Term* wl_sTR;
|
tr_fr_ptr wl_sTR0;
|
||||||
Term* wl_sTR0;
|
tr_fr_ptr new_tr;
|
||||||
Term* new_tr;
|
|
||||||
#else
|
|
||||||
struct trail_frame* wl_sTR;
|
|
||||||
struct trail_frame* wl_sTR0;
|
|
||||||
struct trail_frame* new_tr;
|
|
||||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
|
||||||
struct gc_mark_continuation* conttop0;
|
struct gc_mark_continuation* conttop0;
|
||||||
struct gc_mark_continuation* conttop;
|
struct gc_mark_continuation* conttop;
|
||||||
int disc_trail_entries;
|
int disc_trail_entries;
|
||||||
@ -132,8 +126,11 @@ typedef struct worker_local {
|
|||||||
struct open_query_struct* _execution;
|
struct open_query_struct* _execution;
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
struct thandle thread_handle;
|
struct thandle thread_handle;
|
||||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
#define FOREIGN_ThreadHandle(wid) (Yap_local[(wid)]->thread_handle)
|
||||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
#define MY_ThreadHandle (Yap_local[worker_id]->thread_handle)
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
struct local_optyap_data optyap_data;
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
} w_local;
|
} w_local;
|
||||||
|
39
H/iglobals.h
39
H/iglobals.h
@ -19,9 +19,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void InitGlobal(void) {
|
static void InitGlobal(void) {
|
||||||
|
|
||||||
|
Yap_Initialised = FALSE;
|
||||||
|
Yap_InitialisedFromPL = FALSE;
|
||||||
|
Yap_PL_Argc = 0;
|
||||||
|
Yap_PL_Argv = NULL;
|
||||||
|
|
||||||
|
Yap_HaltHooks = NULL;
|
||||||
|
|
||||||
|
Yap_AllowLocalExpansion = TRUE;
|
||||||
|
Yap_AllowGlobalExpansion = TRUE;
|
||||||
|
Yap_AllowTrailExpansion = TRUE;
|
||||||
|
Yap_SizeOfOverflow = 0;
|
||||||
|
|
||||||
|
Yap_AGcLastCall = 0;
|
||||||
|
|
||||||
|
Yap_AGcThreshold = 10000;
|
||||||
|
Yap_AGCHook = NULL;
|
||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
Yap_NOfThreads = 1;
|
Yap_NOfThreads = 1;
|
||||||
@ -36,29 +52,10 @@ static void InitGlobal(void) {
|
|||||||
INIT_LOCK(Yap_BGL);
|
INIT_LOCK(Yap_BGL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Yap_AllowLocalExpansion = TRUE;
|
|
||||||
Yap_AllowGlobalExpansion = TRUE;
|
|
||||||
Yap_AllowTrailExpansion = TRUE;
|
|
||||||
Yap_SizeOfOverflow = 0;
|
|
||||||
|
|
||||||
Yap_AGcLastCall = 0;
|
|
||||||
|
|
||||||
Yap_AGcThreshold = 10000;
|
|
||||||
Yap_AGCHook = NULL;
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
INIT_LOCK(Yap_ThreadHandlesLock);
|
INIT_LOCK(Yap_ThreadHandlesLock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
#endif
|
|
||||||
|
|
||||||
Yap_Initialised = FALSE;
|
|
||||||
Yap_InitialisedFromPL = FALSE;
|
|
||||||
Yap_PL_Argc = 0;
|
|
||||||
Yap_PL_Argv = NULL;
|
|
||||||
|
|
||||||
Yap_HaltHooks = NULL;
|
|
||||||
}
|
}
|
||||||
|
13
H/ilocals.h
13
H/ilocals.h
@ -94,15 +94,9 @@ static void InitWorker(int wid) {
|
|||||||
#if defined(GC_NO_TAGS)
|
#if defined(GC_NO_TAGS)
|
||||||
FOREIGN(wid)->b_p = NULL;
|
FOREIGN(wid)->b_p = NULL;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
|
||||||
FOREIGN(wid)->wl_sTR = NULL;
|
FOREIGN(wid)->wl_sTR = NULL;
|
||||||
FOREIGN(wid)->wl_sTR0 = NULL;
|
FOREIGN(wid)->wl_sTR0 = NULL;
|
||||||
FOREIGN(wid)->new_tr = NULL;
|
FOREIGN(wid)->new_tr = NULL;
|
||||||
#else
|
|
||||||
FOREIGN(wid)->wl_sTR = NULL;
|
|
||||||
FOREIGN(wid)->wl_sTR0 = NULL;
|
|
||||||
FOREIGN(wid)->new_tr = NULL;
|
|
||||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
|
||||||
FOREIGN(wid)->conttop0 = NULL;
|
FOREIGN(wid)->conttop0 = NULL;
|
||||||
FOREIGN(wid)->conttop = NULL;
|
FOREIGN(wid)->conttop = NULL;
|
||||||
FOREIGN(wid)->disc_trail_entries = 0;
|
FOREIGN(wid)->disc_trail_entries = 0;
|
||||||
@ -130,8 +124,11 @@ static void InitWorker(int wid) {
|
|||||||
FOREIGN(wid)->_execution = NULL;
|
FOREIGN(wid)->_execution = NULL;
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
InitThreadHandle(wid);
|
InitThreadHandle(wid);
|
||||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
#define FOREIGN_ThreadHandle(wid) (Yap_local[(wid)]->thread_handle)
|
||||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
#define MY_ThreadHandle (Yap_local[worker_id]->thread_handle)
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
Yap_init_local_optyap_data(wid);
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
39
H/rglobals.h
39
H/rglobals.h
@ -19,9 +19,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void RestoreGlobal(void) {
|
static void RestoreGlobal(void) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if THREADS
|
#if THREADS
|
||||||
|
|
||||||
|
|
||||||
@ -36,29 +52,10 @@ static void RestoreGlobal(void) {
|
|||||||
REINIT_LOCK(Yap_BGL);
|
REINIT_LOCK(Yap_BGL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
REINIT_LOCK(Yap_ThreadHandlesLock);
|
REINIT_LOCK(Yap_ThreadHandlesLock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
13
H/rlocals.h
13
H/rlocals.h
@ -94,15 +94,9 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
#if defined(GC_NO_TAGS)
|
#if defined(GC_NO_TAGS)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -130,8 +124,11 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
|
|
||||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
#define FOREIGN_ThreadHandle(wid) (Yap_local[(wid)]->thread_handle)
|
||||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
#define MY_ThreadHandle (Yap_local[worker_id]->thread_handle)
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,18 +45,18 @@
|
|||||||
|
|
||||||
static Int null_id = 0;
|
static Int null_id = 0;
|
||||||
|
|
||||||
STATIC_PROTO(Int c_db_my_connect,(void));
|
STATIC_PROTO(Int c_db_my_connect,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_disconnect,(void));
|
STATIC_PROTO(Int c_db_my_disconnect,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_number_of_fields,(void));
|
STATIC_PROTO(Int c_db_my_number_of_fields,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_get_attributes_types,(void));
|
STATIC_PROTO(Int c_db_my_get_attributes_types,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_query,(void));
|
STATIC_PROTO(Int c_db_my_query,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_table_write,(void));
|
STATIC_PROTO(Int c_db_my_table_write,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_row,(void));
|
STATIC_PROTO(Int c_db_my_row,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_row_cut,(void));
|
STATIC_PROTO(Int c_db_my_row_cut,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_get_fields_properties,(void));
|
STATIC_PROTO(Int c_db_my_get_fields_properties,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_get_next_result_set,(void));
|
STATIC_PROTO(Int c_db_my_get_next_result_set,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_get_database,(void));
|
STATIC_PROTO(Int c_db_my_get_database,( USES_REGS1 ));
|
||||||
STATIC_PROTO(Int c_db_my_change_database,(void));
|
STATIC_PROTO(Int c_db_my_change_database,( USES_REGS1 ));
|
||||||
|
|
||||||
void Yap_InitMYDDAS_MySQLPreds(void)
|
void Yap_InitMYDDAS_MySQLPreds(void)
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ void Yap_InitBackMYDDAS_MySQLPreds(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_connect(void) {
|
c_db_my_connect( USES_REGS1 ) {
|
||||||
Term arg_host = Deref(ARG1);
|
Term arg_host = Deref(ARG1);
|
||||||
Term arg_user = Deref(ARG2);
|
Term arg_user = Deref(ARG2);
|
||||||
Term arg_passwd = Deref(ARG3);
|
Term arg_passwd = Deref(ARG3);
|
||||||
@ -163,7 +163,7 @@ c_db_my_connect(void) {
|
|||||||
|
|
||||||
/* db_query: SQLQuery x ResultSet x Connection */
|
/* db_query: SQLQuery x ResultSet x Connection */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_query(void) {
|
c_db_my_query( USES_REGS1 ) {
|
||||||
Term arg_sql_query = Deref(ARG1);
|
Term arg_sql_query = Deref(ARG1);
|
||||||
Term arg_result_set = Deref(ARG2);
|
Term arg_result_set = Deref(ARG2);
|
||||||
Term arg_conn = Deref(ARG3);
|
Term arg_conn = Deref(ARG3);
|
||||||
@ -337,7 +337,7 @@ c_db_my_query(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_number_of_fields(void) {
|
c_db_my_number_of_fields( USES_REGS1 ) {
|
||||||
Term arg_relation = Deref(ARG1);
|
Term arg_relation = Deref(ARG1);
|
||||||
Term arg_conn = Deref(ARG2);
|
Term arg_conn = Deref(ARG2);
|
||||||
Term arg_fields = Deref(ARG3);
|
Term arg_fields = Deref(ARG3);
|
||||||
@ -381,7 +381,7 @@ c_db_my_number_of_fields(void) {
|
|||||||
|
|
||||||
/* db_get_attributes_types: RelName x Connection -> TypesList */
|
/* db_get_attributes_types: RelName x Connection -> TypesList */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_get_attributes_types(void) {
|
c_db_my_get_attributes_types( USES_REGS1 ) {
|
||||||
Term arg_relation = Deref(ARG1);
|
Term arg_relation = Deref(ARG1);
|
||||||
Term arg_conn = Deref(ARG2);
|
Term arg_conn = Deref(ARG2);
|
||||||
Term arg_types_list = Deref(ARG3);
|
Term arg_types_list = Deref(ARG3);
|
||||||
@ -442,7 +442,7 @@ c_db_my_get_attributes_types(void) {
|
|||||||
|
|
||||||
/* db_disconnect */
|
/* db_disconnect */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_disconnect(void) {
|
c_db_my_disconnect( USES_REGS1 ) {
|
||||||
Term arg_conn = Deref(ARG1);
|
Term arg_conn = Deref(ARG1);
|
||||||
|
|
||||||
MYSQL *conn = (MYSQL *) IntegerOfTerm(arg_conn);
|
MYSQL *conn = (MYSQL *) IntegerOfTerm(arg_conn);
|
||||||
@ -461,7 +461,7 @@ c_db_my_disconnect(void) {
|
|||||||
|
|
||||||
/* db_table_write: Result Set */
|
/* db_table_write: Result Set */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_table_write(void) {
|
c_db_my_table_write( USES_REGS1 ) {
|
||||||
Term arg_res_set = Deref(ARG1);
|
Term arg_res_set = Deref(ARG1);
|
||||||
|
|
||||||
MYSQL_RES *res_set = (MYSQL_RES *) IntegerOfTerm(arg_res_set);
|
MYSQL_RES *res_set = (MYSQL_RES *) IntegerOfTerm(arg_res_set);
|
||||||
@ -473,7 +473,7 @@ c_db_my_table_write(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_row_cut(void) {
|
c_db_my_row_cut( USES_REGS1 ) {
|
||||||
MYSQL_RES *mysql_res=NULL;
|
MYSQL_RES *mysql_res=NULL;
|
||||||
|
|
||||||
mysql_res = (MYSQL_RES *) IntegerOfTerm(EXTRA_CBACK_CUT_ARG(Term,1));
|
mysql_res = (MYSQL_RES *) IntegerOfTerm(EXTRA_CBACK_CUT_ARG(Term,1));
|
||||||
@ -483,7 +483,7 @@ c_db_my_row_cut(void) {
|
|||||||
|
|
||||||
/* db_row: ResultSet x Arity_ListOfArgs x ListOfArgs -> */
|
/* db_row: ResultSet x Arity_ListOfArgs x ListOfArgs -> */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_row(void) {
|
c_db_my_row( USES_REGS1 ) {
|
||||||
#ifdef MYDDAS_STATS
|
#ifdef MYDDAS_STATS
|
||||||
/* Measure time used by the */
|
/* Measure time used by the */
|
||||||
/* c_db_my_row function */
|
/* c_db_my_row function */
|
||||||
@ -598,7 +598,7 @@ c_db_my_row(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_get_fields_properties(void) {
|
c_db_my_get_fields_properties( USES_REGS1 ) {
|
||||||
Term nome_relacao = Deref(ARG1);
|
Term nome_relacao = Deref(ARG1);
|
||||||
Term arg_conn = Deref(ARG2);
|
Term arg_conn = Deref(ARG2);
|
||||||
Term fields_properties_list = Deref(ARG3);
|
Term fields_properties_list = Deref(ARG3);
|
||||||
@ -680,7 +680,7 @@ c_db_my_get_fields_properties(void) {
|
|||||||
|
|
||||||
/* c_db_my_get_next_result_set: Connection * NextResSet */
|
/* c_db_my_get_next_result_set: Connection * NextResSet */
|
||||||
static Int
|
static Int
|
||||||
c_db_my_get_next_result_set(void) {
|
c_db_my_get_next_result_set( USES_REGS1 ) {
|
||||||
Term arg_conn = Deref(ARG1);
|
Term arg_conn = Deref(ARG1);
|
||||||
Term arg_next_res_set = Deref(ARG2);
|
Term arg_next_res_set = Deref(ARG2);
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ c_db_my_get_next_result_set(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_get_database(void) {
|
c_db_my_get_database( USES_REGS1 ) {
|
||||||
Term arg_con = Deref(ARG1);
|
Term arg_con = Deref(ARG1);
|
||||||
Term arg_database = Deref(ARG2);
|
Term arg_database = Deref(ARG2);
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ c_db_my_get_database(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
c_db_my_change_database(void) {
|
c_db_my_change_database( USES_REGS1 ) {
|
||||||
Term arg_con = Deref(ARG1);
|
Term arg_con = Deref(ARG1);
|
||||||
Term arg_database = Deref(ARG2);
|
Term arg_database = Deref(ARG2);
|
||||||
|
|
||||||
|
@ -173,6 +173,8 @@ static Term get_point(char *func){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term get_linestring(char *func){
|
static Term get_linestring(char *func){
|
||||||
|
CACHE_REGS
|
||||||
|
|
||||||
Term *c_list;
|
Term *c_list;
|
||||||
Term list;
|
Term list;
|
||||||
Functor functor;
|
Functor functor;
|
||||||
@ -203,6 +205,8 @@ static Term get_linestring(char *func){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term get_polygon(char *func){
|
static Term get_polygon(char *func){
|
||||||
|
CACHE_REGS
|
||||||
|
|
||||||
uint32 r;
|
uint32 r;
|
||||||
int i;
|
int i;
|
||||||
Functor functor;
|
Functor functor;
|
||||||
@ -233,6 +237,8 @@ static Term get_polygon(char *func){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Term get_geometry(uint32 type){
|
static Term get_geometry(uint32 type){
|
||||||
|
CACHE_REGS
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case WKBPOINT:
|
case WKBPOINT:
|
||||||
return get_point("point");
|
return get_point("point");
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
** Global functions **
|
** Global functions **
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
void Yap_init_optyap_data(int max_table_size, int n_workers, int sch_loop, int delay_load) {
|
void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop, int delay_load) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* global data related to memory management */
|
/* global data related to memory management */
|
||||||
@ -108,6 +108,7 @@ void Yap_init_optyap_data(int max_table_size, int n_workers, int sch_loop, int d
|
|||||||
Yap_performance_mode = PERFORMANCE_OFF;
|
Yap_performance_mode = PERFORMANCE_OFF;
|
||||||
|
|
||||||
/* global data related to or-parallelism */
|
/* global data related to or-parallelism */
|
||||||
|
ALLOC_OR_FRAME(Yap_root_or_fr);
|
||||||
BITMAP_clear(Yap_bm_present_workers);
|
BITMAP_clear(Yap_bm_present_workers);
|
||||||
for (i = 0; i < Yap_number_workers; i++)
|
for (i = 0; i < Yap_number_workers; i++)
|
||||||
BITMAP_insert(Yap_bm_present_workers, i);
|
BITMAP_insert(Yap_bm_present_workers, i);
|
||||||
@ -144,7 +145,7 @@ void Yap_init_optyap_data(int max_table_size, int n_workers, int sch_loop, int d
|
|||||||
Yap_last_sg_fr = NULL;
|
Yap_last_sg_fr = NULL;
|
||||||
Yap_check_sg_fr = NULL;
|
Yap_check_sg_fr = NULL;
|
||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
Yap_root_dep_fr = NULL;
|
new_dependency_frame(Yap_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
||||||
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
||||||
CELL *pt = Yap_table_var_enumerator_addr(i);
|
CELL *pt = Yap_table_var_enumerator_addr(i);
|
||||||
RESET_VARIABLE(pt);
|
RESET_VARIABLE(pt);
|
||||||
@ -159,43 +160,41 @@ void Yap_init_optyap_data(int max_table_size, int n_workers, int sch_loop, int d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Yap_init_local(void) {
|
void Yap_init_local_optyap_data(int wid) {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
/* local data related to or-parallelism */
|
/* local data related to or-parallelism */
|
||||||
LOCAL = REMOTE + worker_id;
|
Set_REMOTE_top_cp(wid, (choiceptr) Yap_LocalBase);
|
||||||
Set_LOCAL_top_cp((choiceptr) Yap_LocalBase);
|
REMOTE_top_or_fr(wid) = Yap_root_or_fr;
|
||||||
LOCAL_top_or_fr = Yap_root_or_fr;
|
REMOTE_load(wid) = 0;
|
||||||
LOCAL_load = 0;
|
REMOTE_share_request(wid) = MAX_WORKERS;
|
||||||
LOCAL_share_request = MAX_WORKERS;
|
REMOTE_reply_signal(wid) = worker_ready;
|
||||||
LOCAL_reply_signal = worker_ready;
|
|
||||||
#ifdef YAPOR_COPY
|
#ifdef YAPOR_COPY
|
||||||
INIT_LOCK(LOCAL_lock_signals);
|
INIT_LOCK(REMOTE_lock_signals(wid));
|
||||||
#endif /* YAPOR_COPY */
|
#endif /* YAPOR_COPY */
|
||||||
Set_LOCAL_prune_request(NULL);
|
Set_REMOTE_prune_request(wid, NULL);
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
INIT_LOCK(LOCAL_lock);
|
INIT_LOCK(REMOTE_lock(wid));
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* local data related to tabling */
|
/* local data related to tabling */
|
||||||
LOCAL_next_free_ans_node = NULL;
|
REMOTE_next_free_ans_node(wid) = NULL;
|
||||||
LOCAL_top_sg_fr = NULL;
|
REMOTE_top_sg_fr(wid) = NULL;
|
||||||
LOCAL_top_dep_fr = Yap_root_dep_fr;
|
REMOTE_top_dep_fr(wid) = Yap_root_dep_fr;
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
Set_LOCAL_top_cp_on_stack((choiceptr) Yap_LocalBase); /* ??? */
|
Set_REMOTE_top_cp_on_stack(wid, (choiceptr) Yap_LocalBase); /* ??? */
|
||||||
LOCAL_top_susp_or_fr = Yap_root_or_fr;
|
REMOTE_top_susp_or_fr(wid) = Yap_root_or_fr;
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_root_frames(void) {
|
void Yap_init_root_frames(void) {
|
||||||
#ifdef YAPOR
|
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
/* root or frame */
|
|
||||||
or_fr_ptr or_fr;
|
|
||||||
|
|
||||||
ALLOC_OR_FRAME(or_fr);
|
#ifdef YAPOR
|
||||||
|
/* root or frame */
|
||||||
|
or_fr_ptr or_fr = Yap_root_or_fr;
|
||||||
INIT_LOCK(OrFr_lock(or_fr));
|
INIT_LOCK(OrFr_lock(or_fr));
|
||||||
OrFr_alternative(or_fr) = NULL;
|
OrFr_alternative(or_fr) = NULL;
|
||||||
BITMAP_copy(OrFr_members(or_fr), Yap_bm_present_workers);
|
BITMAP_copy(OrFr_members(or_fr), Yap_bm_present_workers);
|
||||||
@ -215,63 +214,14 @@ void make_root_frames(void) {
|
|||||||
OrFr_nearest_suspnode(or_fr) = or_fr;
|
OrFr_nearest_suspnode(or_fr) = or_fr;
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
OrFr_next(or_fr) = NULL;
|
OrFr_next(or_fr) = NULL;
|
||||||
Yap_root_or_fr = or_fr;
|
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* root dependency frame */
|
/* root dependency frame */
|
||||||
if (!Yap_root_dep_fr) {
|
DepFr_cons_cp(Yap_root_dep_fr) = B;
|
||||||
new_dependency_frame(Yap_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
|
||||||
#ifdef TABLING
|
|
||||||
DepFr_cons_cp(Yap_root_dep_fr) = B;
|
|
||||||
#endif /* TABLING */
|
|
||||||
}
|
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef YAPOR
|
|
||||||
void init_workers(void) {
|
|
||||||
CACHE_REGS
|
|
||||||
int proc;
|
|
||||||
#ifdef YAPOR_THREADS
|
|
||||||
return;
|
|
||||||
#endif /* YAPOR_THREADS */
|
|
||||||
#ifdef YAPOR_COW
|
|
||||||
if (Yap_number_workers> 1) {
|
|
||||||
int son;
|
|
||||||
son = fork();
|
|
||||||
if (son == -1)
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "fork error (init_workers)");
|
|
||||||
if (son > 0) {
|
|
||||||
/* I am the father, I must stay here and wait for my children to all die */
|
|
||||||
struct sigaction sigact;
|
|
||||||
|
|
||||||
Yap_master_worker = getpid();
|
|
||||||
sigact.sa_handler = SIG_DFL;
|
|
||||||
sigemptyset(&sigact.sa_mask);
|
|
||||||
sigact.sa_flags = SA_RESTART;
|
|
||||||
sigaction(SIGINT, &sigact, NULL);
|
|
||||||
pause();
|
|
||||||
exit(0);
|
|
||||||
} else Yap_worker_pid(0) = getpid();
|
|
||||||
}
|
|
||||||
#endif /* YAPOR_COW */
|
|
||||||
for (proc = 1; proc < Yap_number_workers; proc++) {
|
|
||||||
int son;
|
|
||||||
son = fork();
|
|
||||||
if (son == -1)
|
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "fork error (init_workers)");
|
|
||||||
if (son == 0) {
|
|
||||||
/* new worker */
|
|
||||||
worker_id = proc;
|
|
||||||
Yap_remap_optyap_memory();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else Yap_worker_pid(proc) = son;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* YAPOR */
|
|
||||||
|
|
||||||
|
|
||||||
void itos(int i, char *s) {
|
void itos(int i, char *s) {
|
||||||
int n,r,j;
|
int n,r,j;
|
||||||
|
@ -81,7 +81,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
|||||||
|
|
||||||
/* initial allocation - model independent */
|
/* initial allocation - model independent */
|
||||||
ExtraArea = ADJUST_SIZE_TO_PAGE(sizeof(struct global_data) + MAX_WORKERS * sizeof(struct worker_local));
|
ExtraArea = ADJUST_SIZE_TO_PAGE(sizeof(struct global_data) + MAX_WORKERS * sizeof(struct worker_local));
|
||||||
Yap_WLocal = (struct worker_local *)(MMAP_ADDR - ExtraArea);
|
Yap_local = (struct worker_local *)(MMAP_ADDR - ExtraArea);
|
||||||
Yap_global = (struct global_data *)(MMAP_ADDR - sizeof(struct global_data));
|
Yap_global = (struct global_data *)(MMAP_ADDR - sizeof(struct global_data));
|
||||||
Yap_HeapBase = (ADDR) MMAP_ADDR;
|
Yap_HeapBase = (ADDR) MMAP_ADDR;
|
||||||
Yap_GlobalBase = (ADDR) (MMAP_ADDR + HeapArea);
|
Yap_GlobalBase = (ADDR) (MMAP_ADDR + HeapArea);
|
||||||
@ -102,7 +102,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
|||||||
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
||||||
/* map total area in a single go */
|
/* map total area in a single go */
|
||||||
open_mapfile(TotalArea);
|
open_mapfile(TotalArea);
|
||||||
if (mmap((void *) Yap_WLocal, (size_t) TotalArea, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd_mapfile, 0) == (void *) -1)
|
if (mmap((void *) Yap_local, (size_t) TotalArea, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd_mapfile, 0) == (void *) -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_init_optyap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_init_optyap_memory)");
|
||||||
#else /* SHM_MEMORY_MAPPING_SCHEME */
|
#else /* SHM_MEMORY_MAPPING_SCHEME */
|
||||||
/* most systems are limited regarding what we can allocate */
|
/* most systems are limited regarding what we can allocate */
|
||||||
@ -111,7 +111,7 @@ void Yap_init_optyap_memory(long TrailAuxArea, long HeapArea, long GlobalLocalAr
|
|||||||
shm_map_memory(0, ExtraArea + HeapArea, (void *) MMAP_ADDR);
|
shm_map_memory(0, ExtraArea + HeapArea, (void *) MMAP_ADDR);
|
||||||
#else /* YAPOR_COPY || YAPOR_SBA */
|
#else /* YAPOR_COPY || YAPOR_SBA */
|
||||||
/* place as segment n otherwise (0..n-1 reserved for worker areas */
|
/* place as segment n otherwise (0..n-1 reserved for worker areas */
|
||||||
shm_map_memory(n_workers, ExtraArea + HeapArea, (void *) Yap_WLocal);
|
shm_map_memory(n_workers, ExtraArea + HeapArea, (void *) Yap_local);
|
||||||
{ int i;
|
{ int i;
|
||||||
for (i = 0; i < n_workers; i++)
|
for (i = 0; i < n_workers; i++)
|
||||||
shm_map_memory(i, Yap_worker_area_size, Yap_GlobalBase + Yap_worker_area_size * i);
|
shm_map_memory(i, Yap_worker_area_size, Yap_GlobalBase + Yap_worker_area_size * i);
|
||||||
@ -167,7 +167,7 @@ void Yap_remap_optyap_memory(void) {
|
|||||||
int i;
|
int i;
|
||||||
void *remap_addr = Yap_GlobalBase;
|
void *remap_addr = Yap_GlobalBase;
|
||||||
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
||||||
long remap_offset = (ADDR) remap_addr - (ADDR) Yap_WLocal;
|
long remap_offset = (ADDR) remap_addr - (ADDR) Yap_local;
|
||||||
if (munmap(remap_addr, (size_t)(Yap_worker_area_size * Yap_number_workers)) == -1)
|
if (munmap(remap_addr, (size_t)(Yap_worker_area_size * Yap_number_workers)) == -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "munmap error (Yap_remap_optyap_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "munmap error (Yap_remap_optyap_memory)");
|
||||||
for (i = 0; i < Yap_number_workers; i++)
|
for (i = 0; i < Yap_number_workers; i++)
|
||||||
|
@ -484,6 +484,7 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
|
|||||||
#else
|
#else
|
||||||
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||||
#endif /* USE_PAGES_MALLOC */
|
#endif /* USE_PAGES_MALLOC */
|
||||||
|
fflush(Yap_stdout);
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,9 @@ void Yap_remap_optyap_memory(void);
|
|||||||
** opt.init.c **
|
** opt.init.c **
|
||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
void Yap_init_optyap_data(int, int, int, int);
|
void Yap_init_global_optyap_data(int, int, int, int);
|
||||||
void Yap_init_local(void);
|
void Yap_init_local_optyap_data(int);
|
||||||
void make_root_frames(void);
|
void Yap_init_root_frames(void);
|
||||||
#ifdef YAPOR
|
|
||||||
void init_workers(void);
|
|
||||||
#endif /* YAPOR */
|
|
||||||
void itos(int, char *);
|
void itos(int, char *);
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,12 +132,12 @@ struct global_pages {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************
|
/*****************************************
|
||||||
** Struct global_locks **
|
** Struct global_optyap_locks **
|
||||||
**********************************/
|
*****************************************/
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
struct global_locks {
|
struct global_optyap_locks {
|
||||||
lockvar bitmap_idle_workers;
|
lockvar bitmap_idle_workers;
|
||||||
lockvar bitmap_root_cp_workers;
|
lockvar bitmap_root_cp_workers;
|
||||||
lockvar bitmap_invisible_workers;
|
lockvar bitmap_invisible_workers;
|
||||||
@ -160,7 +160,7 @@ struct global_locks {
|
|||||||
* Struct global_optyap_data **
|
* Struct global_optyap_data **
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
struct global_optyap_data{
|
struct global_optyap_data {
|
||||||
/* global data related to memory management */
|
/* global data related to memory management */
|
||||||
struct global_pages pages;
|
struct global_pages pages;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ struct global_optyap_data{
|
|||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
volatile bitmap pruning_workers;
|
volatile bitmap pruning_workers;
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
struct global_locks locks;
|
struct global_optyap_locks locks;
|
||||||
volatile unsigned int branch[MAX_WORKERS][MAX_BRANCH_DEPTH];
|
volatile unsigned int branch[MAX_WORKERS][MAX_BRANCH_DEPTH];
|
||||||
volatile char parallel_execution_mode; /* TRUE / FALSE */
|
volatile char parallel_execution_mode; /* TRUE / FALSE */
|
||||||
volatile int answers;
|
volatile int answers;
|
||||||
@ -251,7 +251,7 @@ struct global_optyap_data{
|
|||||||
#define Yap_number_goals (Yap_optyap_data.number_of_executed_goals)
|
#define Yap_number_goals (Yap_optyap_data.number_of_executed_goals)
|
||||||
#define Yap_performance_mode (Yap_optyap_data.performance_mode)
|
#define Yap_performance_mode (Yap_optyap_data.performance_mode)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define Get_Yap_root_cp() offset_to_cptr(Yap_optyap_data.root_choice_point_offset)
|
#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))
|
#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point_offset = cptr_to_offset(bptr))
|
||||||
#else
|
#else
|
||||||
#define Yap_root_cp (Yap_optyap_data.root_choice_point)
|
#define Yap_root_cp (Yap_optyap_data.root_choice_point)
|
||||||
@ -293,12 +293,12 @@ struct global_optyap_data{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************
|
/******************************************
|
||||||
** Struct local_signals **
|
** Struct local_optyap_signals **
|
||||||
***********************************/
|
******************************************/
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
struct local_signals{
|
struct local_optyap_signals{
|
||||||
#if defined(YAPOR_COPY) || defined(YAPOR_THREADS)
|
#if defined(YAPOR_COPY) || defined(YAPOR_THREADS)
|
||||||
lockvar lock;
|
lockvar lock;
|
||||||
volatile enum {
|
volatile enum {
|
||||||
@ -341,11 +341,11 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/********************************
|
/***************************************
|
||||||
** Struct local_data **
|
** Struct local_optyap_data **
|
||||||
********************************/
|
***************************************/
|
||||||
|
|
||||||
struct local_data{
|
struct local_optyap_data {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
lockvar lock;
|
lockvar lock;
|
||||||
/* local data related to or-parallelism */
|
/* local data related to or-parallelism */
|
||||||
@ -362,7 +362,7 @@ struct local_data{
|
|||||||
choiceptr prune_request;
|
choiceptr prune_request;
|
||||||
#endif
|
#endif
|
||||||
volatile int share_request;
|
volatile int share_request;
|
||||||
struct local_signals share_signals;
|
struct local_optyap_signals share_signals;
|
||||||
volatile struct {
|
volatile struct {
|
||||||
CELL start;
|
CELL start;
|
||||||
CELL end;
|
CELL end;
|
||||||
@ -394,95 +394,95 @@ struct local_data{
|
|||||||
#endif /* (TABLING || !YAPOR_COW) && MULTI_ASSIGNMENT_VARIABLES */
|
#endif /* (TABLING || !YAPOR_COW) && MULTI_ASSIGNMENT_VARIABLES */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOCAL_lock (LOCAL->lock)
|
#define LOCAL_lock (LOCAL_optyap_data.lock)
|
||||||
#define LOCAL_load (LOCAL->load)
|
#define LOCAL_load (LOCAL_optyap_data.load)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define Get_LOCAL_top_cp() offset_to_cptr(LOCAL->top_choice_point_offset)
|
#define Get_LOCAL_top_cp() offset_to_cptr(LOCAL_optyap_data.top_choice_point_offset)
|
||||||
#define Set_LOCAL_top_cp(cpt) (LOCAL->top_choice_point_offset = cptr_to_offset(cpt))
|
#define Set_LOCAL_top_cp(cpt) (LOCAL_optyap_data.top_choice_point_offset = cptr_to_offset(cpt))
|
||||||
#else
|
#else
|
||||||
#define LOCAL_top_cp (LOCAL->top_choice_point)
|
#define LOCAL_top_cp (LOCAL_optyap_data.top_choice_point)
|
||||||
#define Get_LOCAL_top_cp() (LOCAL->top_choice_point)
|
#define Get_LOCAL_top_cp() (LOCAL_optyap_data.top_choice_point)
|
||||||
#define Set_LOCAL_top_cp(cpt) (LOCAL->top_choice_point = cpt)
|
#define Set_LOCAL_top_cp(cpt) (LOCAL_optyap_data.top_choice_point = cpt)
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define LOCAL_top_or_fr (LOCAL->top_or_frame)
|
#define LOCAL_top_or_fr (LOCAL_optyap_data.top_or_frame)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define Get_LOCAL_prune_request() offset_to_cptr_with_null(LOCAL->prune_request_offset)
|
#define Get_LOCAL_prune_request() offset_to_cptr_with_null(LOCAL_optyap_data.prune_request_offset)
|
||||||
#define Set_LOCAL_prune_request(cpt) (LOCAL->prune_request_offset = cptr_to_offset_with_null(cpt))
|
#define Set_LOCAL_prune_request(cpt) (LOCAL_optyap_data.prune_request_offset = cptr_to_offset_with_null(cpt))
|
||||||
#else
|
#else
|
||||||
#define LOCAL_prune_request (LOCAL->prune_request)
|
#define LOCAL_prune_request (LOCAL_optyap_data.prune_request)
|
||||||
#define Get_LOCAL_prune_request() (LOCAL->prune_request)
|
#define Get_LOCAL_prune_request() (LOCAL_optyap_data.prune_request)
|
||||||
#define Set_LOCAL_prune_request(cpt) (LOCAL->prune_request = cpt)
|
#define Set_LOCAL_prune_request(cpt) (LOCAL_optyap_data.prune_request = cpt)
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define LOCAL_share_request (LOCAL->share_request)
|
#define LOCAL_share_request (LOCAL_optyap_data.share_request)
|
||||||
#define LOCAL_reply_signal (LOCAL->share_signals.reply_signal)
|
#define LOCAL_reply_signal (LOCAL_optyap_data.share_signals.reply_signal)
|
||||||
#define LOCAL_p_fase_signal (LOCAL->share_signals.P_fase)
|
#define LOCAL_p_fase_signal (LOCAL_optyap_data.share_signals.P_fase)
|
||||||
#define LOCAL_q_fase_signal (LOCAL->share_signals.Q_fase)
|
#define LOCAL_q_fase_signal (LOCAL_optyap_data.share_signals.Q_fase)
|
||||||
#define LOCAL_lock_signals (LOCAL->share_signals.lock)
|
#define LOCAL_lock_signals (LOCAL_optyap_data.share_signals.lock)
|
||||||
#define LOCAL_start_global_copy (LOCAL->global_copy.start)
|
#define LOCAL_start_global_copy (LOCAL_optyap_data.global_copy.start)
|
||||||
#define LOCAL_end_global_copy (LOCAL->global_copy.end)
|
#define LOCAL_end_global_copy (LOCAL_optyap_data.global_copy.end)
|
||||||
#define LOCAL_start_local_copy (LOCAL->local_copy.start)
|
#define LOCAL_start_local_copy (LOCAL_optyap_data.local_copy.start)
|
||||||
#define LOCAL_end_local_copy (LOCAL->local_copy.end)
|
#define LOCAL_end_local_copy (LOCAL_optyap_data.local_copy.end)
|
||||||
#define LOCAL_start_trail_copy (LOCAL->trail_copy.start)
|
#define LOCAL_start_trail_copy (LOCAL_optyap_data.trail_copy.start)
|
||||||
#define LOCAL_end_trail_copy (LOCAL->trail_copy.end)
|
#define LOCAL_end_trail_copy (LOCAL_optyap_data.trail_copy.end)
|
||||||
#define LOCAL_next_free_ans_node (LOCAL->next_free_answer_trie_node)
|
#define LOCAL_next_free_ans_node (LOCAL_optyap_data.next_free_answer_trie_node)
|
||||||
#define LOCAL_top_sg_fr (LOCAL->top_subgoal_frame)
|
#define LOCAL_top_sg_fr (LOCAL_optyap_data.top_subgoal_frame)
|
||||||
#define LOCAL_top_dep_fr (LOCAL->top_dependency_frame)
|
#define LOCAL_top_dep_fr (LOCAL_optyap_data.top_dependency_frame)
|
||||||
#define LOCAL_pruning_scope (LOCAL->bottom_pruning_scope)
|
#define LOCAL_pruning_scope (LOCAL_optyap_data.bottom_pruning_scope)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define Get_LOCAL_top_cp_on_stack() offset_to_cptr(LOCAL->top_choice_point_on_stack_offset)
|
#define Get_LOCAL_top_cp_on_stack() offset_to_cptr(LOCAL_optyap_data.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))
|
#define Set_LOCAL_top_cp_on_stack(cpt) (LOCAL_optyap_data.top_choice_point_on_stack_offset = cptr_to_offset(cpt))
|
||||||
#else
|
#else
|
||||||
#define LOCAL_top_cp_on_stack (LOCAL->top_choice_point_on_stack)
|
#define LOCAL_top_cp_on_stack (LOCAL_optyap_data.top_choice_point_on_stack)
|
||||||
#define Get_LOCAL_top_cp_on_stack() (LOCAL->top_choice_point_on_stack)
|
#define Get_LOCAL_top_cp_on_stack() (LOCAL_optyap_data.top_choice_point_on_stack)
|
||||||
#define Set_LOCAL_top_cp_on_stack(cpt) (LOCAL->top_choice_point_on_stack = cpt)
|
#define Set_LOCAL_top_cp_on_stack(cpt) (LOCAL_optyap_data.top_choice_point_on_stack = cpt)
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define LOCAL_top_susp_or_fr (LOCAL->top_or_frame_with_suspensions)
|
#define LOCAL_top_susp_or_fr (LOCAL_optyap_data.top_or_frame_with_suspensions)
|
||||||
#define LOCAL_ma_timestamp (LOCAL->ma_timestamp)
|
#define LOCAL_ma_timestamp (LOCAL_optyap_data.ma_timestamp)
|
||||||
#define LOCAL_ma_h_top (LOCAL->ma_h_top)
|
#define LOCAL_ma_h_top (LOCAL_optyap_data.ma_h_top)
|
||||||
#define LOCAL_ma_hash_table (LOCAL->ma_hash_table)
|
#define LOCAL_ma_hash_table (LOCAL_optyap_data.ma_hash_table)
|
||||||
|
|
||||||
|
|
||||||
#define REMOTE_lock(worker) (REMOTE[worker].lock)
|
#define REMOTE_lock(wid) (REMOTE(wid)->optyap_data.lock)
|
||||||
#define REMOTE_load(worker) (REMOTE[worker].load)
|
#define REMOTE_load(wid) (REMOTE(wid)->optyap_data.load)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define REMOTE_top_cp(worker) offset_to_cptr(REMOTE[worker].top_choice_point_offset)
|
#define REMOTE_top_cp(wid) offset_to_cptr(REMOTE(wid)->optyap_data.top_choice_point_offset)
|
||||||
#define Set_REMOTE_top_cp(worker, bptr) (REMOTE[worker].top_choice_point_offset = cptr_to_offset(bptr))
|
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_offset = cptr_to_offset(bptr))
|
||||||
#else
|
#else
|
||||||
#define REMOTE_top_cp(worker) (REMOTE[worker].top_choice_point)
|
#define REMOTE_top_cp(wid) (REMOTE(wid)->optyap_data.top_choice_point)
|
||||||
#define Set_REMOTE_top_cp(worker, bptr) (REMOTE[worker].top_choice_point = (bptr))
|
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point = (bptr))
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define REMOTE_top_or_fr(worker) (REMOTE[worker].top_or_frame)
|
#define REMOTE_top_or_fr(wid) (REMOTE(wid)->optyap_data.top_or_frame)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define Get_REMOTE_prune_request(worker) offset_to_cptr_with_null(REMOTE[worker].prune_request_offset)
|
#define Get_REMOTE_prune_request(wid) offset_to_cptr_with_null(REMOTE(wid)->optyap_data.prune_request_offset)
|
||||||
#define Set_REMOTE_prune_request(worker,cp) (REMOTE[worker].prune_request_offset = cptr_to_offset_with_null(cp))
|
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data.prune_request_offset = cptr_to_offset_with_null(cp))
|
||||||
#else
|
#else
|
||||||
#define REMOTE_prune_request(worker) (REMOTE[worker].prune_request)
|
#define REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data.prune_request)
|
||||||
#define Get_REMOTE_prune_request(worker) (REMOTE[worker].prune_request)
|
#define Get_REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data.prune_request)
|
||||||
#define Set_REMOTE_prune_request(worker,cp) (REMOTE[worker].prune_request = cp)
|
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data.prune_request = cp)
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define REMOTE_share_request(worker) (REMOTE[worker].share_request)
|
#define REMOTE_share_request(wid) (REMOTE(wid)->optyap_data.share_request)
|
||||||
#define REMOTE_reply_signal(worker) (REMOTE[worker].share_signals.reply_signal)
|
#define REMOTE_reply_signal(wid) (REMOTE(wid)->optyap_data.share_signals.reply_signal)
|
||||||
#define REMOTE_p_fase_signal(worker) (REMOTE[worker].share_signals.P_fase)
|
#define REMOTE_p_fase_signal(wid) (REMOTE(wid)->optyap_data.share_signals.P_fase)
|
||||||
#define REMOTE_q_fase_signal(worker) (REMOTE[worker].share_signals.Q_fase)
|
#define REMOTE_q_fase_signal(wid) (REMOTE(wid)->optyap_data.share_signals.Q_fase)
|
||||||
#define REMOTE_lock_signals(worker) (REMOTE[worker].share_signals.lock)
|
#define REMOTE_lock_signals(wid) (REMOTE(wid)->optyap_data.share_signals.lock)
|
||||||
#define REMOTE_start_global_copy(worker) (REMOTE[worker].global_copy.start)
|
#define REMOTE_start_global_copy(wid) (REMOTE(wid)->optyap_data.global_copy.start)
|
||||||
#define REMOTE_end_global_copy(worker) (REMOTE[worker].global_copy.end)
|
#define REMOTE_end_global_copy(wid) (REMOTE(wid)->optyap_data.global_copy.end)
|
||||||
#define REMOTE_start_local_copy(worker) (REMOTE[worker].local_copy.start)
|
#define REMOTE_start_local_copy(wid) (REMOTE(wid)->optyap_data.local_copy.start)
|
||||||
#define REMOTE_end_local_copy(worker) (REMOTE[worker].local_copy.end)
|
#define REMOTE_end_local_copy(wid) (REMOTE(wid)->optyap_data.local_copy.end)
|
||||||
#define REMOTE_start_trail_copy(worker) (REMOTE[worker].trail_copy.start)
|
#define REMOTE_start_trail_copy(wid) (REMOTE(wid)->optyap_data.trail_copy.start)
|
||||||
#define REMOTE_end_trail_copy(worker) (REMOTE[worker].trail_copy.end)
|
#define REMOTE_end_trail_copy(wid) (REMOTE(wid)->optyap_data.trail_copy.end)
|
||||||
#define REMOTE_next_free_ans_node(worker) (REMOTE[worker].next_free_answer_trie_node)
|
#define REMOTE_next_free_ans_node(wid) (REMOTE(wid)->optyap_data.next_free_answer_trie_node)
|
||||||
#define REMOTE_top_sg_fr(worker) (REMOTE[worker].top_subgoal_frame)
|
#define REMOTE_top_sg_fr(wid) (REMOTE(wid)->optyap_data.top_subgoal_frame)
|
||||||
#define REMOTE_top_dep_fr(worker) (REMOTE[worker].top_dependency_frame)
|
#define REMOTE_top_dep_fr(wid) (REMOTE(wid)->optyap_data.top_dependency_frame)
|
||||||
#define REMOTE_pruning_scope(worker) (REMOTE[worker].bottom_pruning_scope)
|
#define REMOTE_pruning_scope(wid) (REMOTE(wid)->optyap_data.bottom_pruning_scope)
|
||||||
#ifdef YAPOR_THREADS
|
#ifdef YAPOR_THREADS
|
||||||
#define REMOTE_top_cp_on_stack(worker) offset_to_cptr(REMOTE[worker].top_choice_point_on_stack_offset)
|
#define REMOTE_top_cp_on_stack(wid) offset_to_cptr(REMOTE(wid)->optyap_data.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))
|
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_on_stack_offset = cptr_to_offset(bptr))
|
||||||
#else
|
#else
|
||||||
#define REMOTE_top_cp_on_stack(worker) (REMOTE[worker].top_choice_point_on_stack)
|
#define REMOTE_top_cp_on_stack(wid) (REMOTE(wid)->optyap_data.top_choice_point_on_stack)
|
||||||
#define Set_REMOTE_top_cp_on_stack(worker, bptr) (REMOTE[worker].top_choice_point_on_stack = (bptr))
|
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_on_stack = (bptr))
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
#define REMOTE_top_susp_or_fr(worker) (REMOTE[worker].top_or_frame_with_suspensions)
|
#define REMOTE_top_susp_or_fr(wid) (REMOTE(wid)->optyap_data.top_or_frame_with_suspensions)
|
||||||
|
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
@ -98,7 +98,7 @@ int p_share_work(void) {
|
|||||||
share_private_nodes(worker_q);
|
share_private_nodes(worker_q);
|
||||||
if ((son = fork()) == 0) {
|
if ((son = fork()) == 0) {
|
||||||
worker_id = worker_q; /* child becomes requesting worker */
|
worker_id = worker_q; /* child becomes requesting worker */
|
||||||
LOCAL = REMOTE + worker_id;
|
LOCAL = REMOTE(worker_id);
|
||||||
LOCAL_reply_signal = worker_ready;
|
LOCAL_reply_signal = worker_ready;
|
||||||
PUT_IN_REQUESTABLE(worker_id);
|
PUT_IN_REQUESTABLE(worker_id);
|
||||||
PUT_BUSY(worker_id);
|
PUT_BUSY(worker_id);
|
||||||
|
@ -645,6 +645,7 @@ static inline CELL *expand_auxiliary_stack(CELL *stack) {
|
|||||||
|
|
||||||
static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (EQUAL_OR_YOUNGER_CP(GetOrFr_node(LOCAL_top_susp_or_fr), prune_cp))
|
if (EQUAL_OR_YOUNGER_CP(GetOrFr_node(LOCAL_top_susp_or_fr), prune_cp))
|
||||||
pruning_over_tabling_data_structures();
|
pruning_over_tabling_data_structures();
|
||||||
|
@ -1363,6 +1363,7 @@ void show_table(tab_ent_ptr tab_ent, int show_mode) {
|
|||||||
fprintf(Yap_stdout, " Answer trie nodes: %ld\n", TrStat_ans_nodes);
|
fprintf(Yap_stdout, " Answer trie nodes: %ld\n", TrStat_ans_nodes);
|
||||||
fprintf(Yap_stdout, " Global trie references: %ld\n", TrStat_gt_refs);
|
fprintf(Yap_stdout, " Global trie references: %ld\n", TrStat_gt_refs);
|
||||||
}
|
}
|
||||||
|
fflush(Yap_stdout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2491,9 +2491,9 @@ PL_create_engine(const PL_thread_attr_t *attr)
|
|||||||
yapt.tsize = attr->global_size;
|
yapt.tsize = attr->global_size;
|
||||||
yapt.alias = (YAP_Term)attr->alias;
|
yapt.alias = (YAP_Term)attr->alias;
|
||||||
yapt.cancel = attr->cancel;
|
yapt.cancel = attr->cancel;
|
||||||
return Yap_WLocal+YAP_ThreadCreateEngine(&yapt);
|
return Yap_local+YAP_ThreadCreateEngine(&yapt);
|
||||||
} else {
|
} else {
|
||||||
return Yap_WLocal+YAP_ThreadCreateEngine(NULL);
|
return Yap_local+YAP_ThreadCreateEngine(NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2519,7 +2519,7 @@ PL_set_engine(PL_engine_t engine, PL_engine_t *old)
|
|||||||
int cwid = PL_thread_self(), nwid;
|
int cwid = PL_thread_self(), nwid;
|
||||||
|
|
||||||
if (cwid >= 0) {
|
if (cwid >= 0) {
|
||||||
if (old) *old = (PL_engine_t)(Yap_WLocal[cwid]);
|
if (old) *old = (PL_engine_t)(Yap_local[cwid]);
|
||||||
}
|
}
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
if (cwid < 0)
|
if (cwid < 0)
|
||||||
@ -2561,7 +2561,7 @@ PL_set_engine(PL_engine_t engine, PL_engine_t *old)
|
|||||||
}
|
}
|
||||||
return PL_ENGINE_SET;
|
return PL_ENGINE_SET;
|
||||||
#else
|
#else
|
||||||
if (old) *old = (PL_engine_t)&Yap_WLocal;
|
if (old) *old = (PL_engine_t)&Yap_local;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
48
misc/GLOBALS
48
misc/GLOBALS
@ -14,13 +14,30 @@
|
|||||||
// init code (optional)
|
// init code (optional)
|
||||||
// restore code (optional)
|
// restore code (optional)
|
||||||
//
|
//
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Stuff that must be shared by all threads or workers
|
// Stuff that must be shared by all threads or workers
|
||||||
START_GLOBAL_DATA
|
START_GLOBAL_DATA
|
||||||
|
|
||||||
|
// initialization: tell whether the system has been initialised and by whom.
|
||||||
|
int initialised Yap_Initialised =FALSE
|
||||||
|
int initialised_from_pl Yap_InitialisedFromPL =FALSE
|
||||||
|
int pl_argc Yap_PL_Argc =0
|
||||||
|
char **pl_argv Yap_PL_Argv =NULL
|
||||||
|
|
||||||
|
// halt hooks
|
||||||
|
struct halt_hook *yap_halt_hook Yap_HaltHooks =NULL
|
||||||
|
|
||||||
|
// stack overflow expansion/gc control
|
||||||
|
int allow_local_expansion Yap_AllowLocalExpansion =TRUE
|
||||||
|
int allow_global_expansion Yap_AllowGlobalExpansion =TRUE
|
||||||
|
int allow_trail_expansion Yap_AllowTrailExpansion =TRUE
|
||||||
|
UInt size_of_overflow Yap_SizeOfOverflow =0
|
||||||
|
// amount of space recovered in all garbage collections
|
||||||
|
UInt agc_last_call Yap_AGcLastCall =0
|
||||||
|
// amount of space recovered in all garbage collections
|
||||||
|
UInt agc_threshold Yap_AGcThreshold =10000
|
||||||
|
Agc_hook agc_hook Yap_AGCHook =NULL
|
||||||
|
|
||||||
/* multi-thread support */
|
/* multi-thread support */
|
||||||
#if THREADS
|
#if THREADS
|
||||||
/* number of threads and processes in system */
|
/* number of threads and processes in system */
|
||||||
@ -37,37 +54,14 @@ UInt threads_total_time Yap_ThreadsTotalTime =0L
|
|||||||
lockvar bgl Yap_BGL MkLock
|
lockvar bgl Yap_BGL MkLock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// stack overflow expansion/gc control
|
|
||||||
int allow_local_expansion Yap_AllowLocalExpansion =TRUE
|
|
||||||
int allow_global_expansion Yap_AllowGlobalExpansion =TRUE
|
|
||||||
int allow_trail_expansion Yap_AllowTrailExpansion =TRUE
|
|
||||||
UInt size_of_overflow Yap_SizeOfOverflow =0
|
|
||||||
// amount of space recovered in all garbage collections
|
|
||||||
UInt agc_last_call Yap_AGcLastCall =0
|
|
||||||
// amount of space recovered in all garbage collections
|
|
||||||
UInt agc_threshold Yap_AGcThreshold =10000
|
|
||||||
Agc_hook agc_hook Yap_AGCHook =NULL
|
|
||||||
|
|
||||||
|
|
||||||
// Threads Array
|
// Threads Array
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
lockvar thread_handles_lock Yap_ThreadHandlesLock MkLock
|
lockvar thread_handles_lock Yap_ThreadHandlesLock MkLock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Ricardo's stuff
|
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
struct global_optyap_data optyap_data Yap_optyap_data void
|
struct global_optyap_data optyap_data Yap_optyap_data void
|
||||||
struct local_data remote[MAX_WORKERS] REMOTE void
|
#endif /* YAPOR || TABLING */
|
||||||
#endif
|
|
||||||
|
|
||||||
// initialization: tell whether the system has been initialised and by whom.
|
|
||||||
int initialised Yap_Initialised =FALSE
|
|
||||||
int initialised_from_pl Yap_InitialisedFromPL =FALSE
|
|
||||||
int pl_argc Yap_PL_Argc =0
|
|
||||||
char **pl_argv Yap_PL_Argv =NULL
|
|
||||||
|
|
||||||
// halt hooks
|
|
||||||
struct halt_hook *yap_halt_hook Yap_HaltHooks =NULL
|
|
||||||
|
|
||||||
END_GLOBAL_DATA
|
END_GLOBAL_DATA
|
||||||
|
|
||||||
|
21
misc/LOCALS
21
misc/LOCALS
@ -103,16 +103,9 @@ CELL** ip_top LOCAL_iptop =NULL
|
|||||||
#if defined(GC_NO_TAGS)
|
#if defined(GC_NO_TAGS)
|
||||||
char* b_p LOCAL_bp =NULL
|
char* b_p LOCAL_bp =NULL
|
||||||
#endif
|
#endif
|
||||||
|
tr_fr_ptr wl_sTR LOCAL_sTR =NULL
|
||||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
tr_fr_ptr wl_sTR0 LOCAL_sTR0 =NULL
|
||||||
Term* wl_sTR LOCAL_sTR =NULL
|
tr_fr_ptr new_tr LOCAL_new_TR =NULL
|
||||||
Term* wl_sTR0 LOCAL_sTR0 =NULL
|
|
||||||
Term* new_tr LOCAL_new_TR =NULL
|
|
||||||
#else
|
|
||||||
struct trail_frame* wl_sTR LOCAL_sTR =NULL
|
|
||||||
struct trail_frame* wl_sTR0 LOCAL_sTR0 =NULL
|
|
||||||
struct trail_frame* new_tr LOCAL_new_TR =NULL
|
|
||||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
|
||||||
struct gc_mark_continuation* conttop0 LOCAL_cont_top0 =NULL
|
struct gc_mark_continuation* conttop0 LOCAL_cont_top0 =NULL
|
||||||
struct gc_mark_continuation* conttop LOCAL_cont_top =NULL
|
struct gc_mark_continuation* conttop LOCAL_cont_top =NULL
|
||||||
int disc_trail_entries LOCAL_discard_trail_entries =0
|
int disc_trail_entries LOCAL_discard_trail_entries =0
|
||||||
@ -146,10 +139,14 @@ struct open_query_struct* _execution LOCAL_execution =NULL
|
|||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
struct thandle thread_handle LOCAL_ThreadHandle InitThreadHandle(wid)
|
struct thandle thread_handle LOCAL_ThreadHandle InitThreadHandle(wid)
|
||||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
#define FOREIGN_ThreadHandle(wid) (Yap_local[(wid)]->thread_handle)
|
||||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
#define MY_ThreadHandle (Yap_local[worker_id]->thread_handle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
|
struct local_optyap_data optyap_data LOCAL_optyap_data Yap_init_local_optyap_data(wid)
|
||||||
|
#endif /* YAPOR || TABLING */
|
||||||
|
|
||||||
// END WORKER LOCAL STUFF
|
// END WORKER LOCAL STUFF
|
||||||
END_WORKER_LOCAL
|
END_WORKER_LOCAL
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ fetch_name(Global) :-
|
|||||||
Global = "Yap_global->".
|
Global = "Yap_global->".
|
||||||
fetch_name(Global) :-
|
fetch_name(Global) :-
|
||||||
globals(worker), !,
|
globals(worker), !,
|
||||||
Global = "WL->".
|
Global = "LOCAL->".
|
||||||
fetch_name(Global) :-
|
fetch_name(Global) :-
|
||||||
globals(worker_init), !,
|
globals(worker_init), !,
|
||||||
Global = "FOREIGN(wid)->".
|
Global = "FOREIGN(wid)->".
|
||||||
@ -264,6 +264,10 @@ gen_init(Inp,Init) :-
|
|||||||
split(Inp," ",[_, _, _, Init0| _]),
|
split(Inp," ",[_, _, _, Init0| _]),
|
||||||
append("Yap_Init",_,Init0), !,
|
append("Yap_Init",_,Init0), !,
|
||||||
append([" ",Init0,";"],Init).
|
append([" ",Init0,";"],Init).
|
||||||
|
gen_init(Inp,Init) :-
|
||||||
|
split(Inp," ",[_, _, _, Init0| _]),
|
||||||
|
append("Yap_init",_,Init0), !,
|
||||||
|
append([" ",Init0,";"],Init).
|
||||||
gen_init(Inp,Out) :-
|
gen_init(Inp,Out) :-
|
||||||
split(Inp," ",[_, Field, MacroName, "MkAT", AtomName]), !,
|
split(Inp," ",[_, Field, MacroName, "MkAT", AtomName]), !,
|
||||||
cut_c_stuff(Field, RField),
|
cut_c_stuff(Field, RField),
|
||||||
|
@ -4740,7 +4740,7 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
|
|||||||
#if THREADS
|
#if THREADS
|
||||||
if (wid) {
|
if (wid) {
|
||||||
/* copy from other worker */
|
/* copy from other worker */
|
||||||
memcpy(p, Yap_WLocal[worker_id]->Yap_ld_, sizeof(struct PL_local_data));
|
memcpy(p, Yap_local[worker_id]->Yap_ld_, sizeof(struct PL_local_data));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return p;
|
return p;
|
||||||
|
Reference in New Issue
Block a user