|
|
{ | { |
int j; | int j; |
/* Then save the whole heap */ | /* Then save the whole heap */ |
#if defined(YAPOR) || defined(TABLING) |
#if defined(YAPOR) || defined(TABLING) && !defined(YAP_MEMORY_ALLOC_SCHEME) |
/* skip the local and global data structures */ | /* skip the local and global data structures */ |
j = Unsigned(&GLOBAL) - Unsigned(Yap_HeapBase); | j = Unsigned(&GLOBAL) - Unsigned(Yap_HeapBase); |
putout(j); | putout(j); |
|
|
static int | static int |
CopyCode(void) | CopyCode(void) |
{ | { |
#if defined(YAPOR) || defined(TABLING) |
#if (defined(YAPOR) || defined(TABLING)) && !defined(YAP_MEMORY_ALLOC_SCHEME) |
/* skip the local and global data structures */ | /* skip the local and global data structures */ |
CELL j = get_cell(); | CELL j = get_cell(); |
if (Yap_ErrorMessage) | if (Yap_ErrorMessage) |
|
|
/* ----------------------------------------- ** | /* ----------------------------------------- ** |
** memory alloc scheme (define one) ** | ** memory alloc scheme (define one) ** |
** ----------------------------------------- */ | ** ----------------------------------------- */ |
#define SHM_MEMORY_ALLOC_SCHEME 1 |
/* #define SHM_MEMORY_ALLOC_SCHEME 1 */ |
/* #define YAP_MEMORY_ALLOC_SCHEME 1 */ |
#define YAP_MEMORY_ALLOC_SCHEME 1 |
/* #define MALLOC_MEMORY_ALLOC_SCHEME 1 */ | /* #define MALLOC_MEMORY_ALLOC_SCHEME 1 */ |
| |
/* ------------------------------------------- ** | /* ------------------------------------------- ** |
|
|
| |
| |
void init_local(void) { | void init_local(void) { |
|
#if defined(YAPOR) || defined(THREADS) |
|
LOCAL = REMOTE + worker_id; |
|
#endif |
#ifdef YAPOR | #ifdef YAPOR |
/* local data related to or-parallelism */ | /* local data related to or-parallelism */ |
LOCAL = REMOTE + worker_id; |
|
LOCAL_top_cp = B_BASE; | LOCAL_top_cp = B_BASE; |
LOCAL_top_or_fr = GLOBAL_root_or_fr; | LOCAL_top_or_fr = GLOBAL_root_or_fr; |
LOCAL_load = 0; | LOCAL_load = 0; |
|
|
** ---------------------- */ | ** ---------------------- */ |
| |
struct pages { | struct pages { |
#ifdef YAPOR |
#if defined(YAPOR) || defined(THREADS) |
lockvar lock; | lockvar lock; |
#endif /* YAPOR */ | #endif /* YAPOR */ |
volatile long pages_allocated; | volatile long pages_allocated; |
|
|
** --------------------------- */ | ** --------------------------- */ |
| |
struct local_data{ | struct local_data{ |
|
#if defined(YAPOR) || defined(THREADS) |
|
lockvar lock; |
|
#endif |
#ifdef YAPOR | #ifdef YAPOR |
/* local data related to or-parallelism */ | /* local data related to or-parallelism */ |
lockvar lock; |
|
volatile int load; | volatile int load; |
choiceptr top_choice_point; | choiceptr top_choice_point; |
struct or_frame *top_or_frame; | struct or_frame *top_or_frame; |
|
|
** ---------------------------- */ | ** ---------------------------- */ |
| |
typedef struct table_entry { | typedef struct table_entry { |
#ifdef YAPOR |
#if defined(YAPOR) || defined(THREADS) |
lockvar lock; | lockvar lock; |
#endif /* YAPOR */ | #endif /* YAPOR */ |
struct pred_entry *pred_entry; | struct pred_entry *pred_entry; |
|
|
** ------------------------------ */ | ** ------------------------------ */ |
| |
typedef struct subgoal_frame { | typedef struct subgoal_frame { |
#ifdef YAPOR |
#if defined(YAPOR) || defined(THREADS) |
lockvar lock; | lockvar lock; |
|
#endif |
|
#ifdef YAPOR |
int generator_worker; | int generator_worker; |
struct or_frame *top_or_frame_on_generator_branch; | struct or_frame *top_or_frame_on_generator_branch; |
#endif /* YAPOR */ | #endif /* YAPOR */ |
|
|
** --------------------------------- */ | ** --------------------------------- */ |
| |
typedef struct dependency_frame { | typedef struct dependency_frame { |
#ifdef YAPOR |
#if defined(YAPOR) || defined(THREADS) |
lockvar lock; | lockvar lock; |
|
#endif |
|
#ifdef YAPOR |
int leader_dependency_is_on_stack; | int leader_dependency_is_on_stack; |
struct or_frame *top_or_frame; | struct or_frame *top_or_frame; |
#ifdef TIMESTAMP_CHECK | #ifdef TIMESTAMP_CHECK |