make it compile

support non-incremental copy.
This commit is contained in:
Vítor Manuel de Morais Santos Costa 2010-01-29 12:28:23 +00:00
parent f56b9ab426
commit d0fdcba231

View File

@ -41,6 +41,15 @@ static void share_private_nodes(int worker_q);
** Local macros **
** ---------------------- */
#if FULL_COPY
#define COMPUTE_SEGMENTS_TO_COPY_TO(Q) \
REMOTE_start_global_copy(Q) = (CELL) (H0); \
REMOTE_end_global_copy(Q) = (CELL) (H); \
REMOTE_start_local_copy(Q) = (CELL) (B); \
REMOTE_end_local_copy(Q) = (CELL) (LCL0); \
REMOTE_start_trail_copy(Q) = (CELL) (Yap_TrailBase); \
REMOTE_end_trail_copy(Q) = (CELL) (TR)
#else
#define COMPUTE_SEGMENTS_TO_COPY_TO(Q) \
REMOTE_start_global_copy(Q) = (CELL) (REMOTE_top_cp(Q)->cp_h); \
REMOTE_end_global_copy(Q) = (CELL) (B->cp_h); \
@ -48,6 +57,7 @@ static void share_private_nodes(int worker_q);
REMOTE_end_local_copy(Q) = (CELL) (REMOTE_top_cp(Q)); \
REMOTE_start_trail_copy(Q) = (CELL) (REMOTE_top_cp(Q)->cp_tr); \
REMOTE_end_trail_copy(Q) = (CELL) (TR)
#endif
#define P_COPY_GLOBAL_TO(Q) \
memcpy((void *) (worker_offset(Q) + REMOTE_start_global_copy(Q)), \
@ -117,7 +127,7 @@ void free_root_choice_point(void) {
}
void p_share_work(void) {
int p_share_work(void) {
int worker_q = LOCAL_share_request;
if (! BITMAP_member(OrFr_members(REMOTE_top_or_fr(worker_q)), worker_id) ||
@ -127,7 +137,7 @@ void p_share_work(void) {
REMOTE_reply_signal(LOCAL_share_request) = no_sharing;
LOCAL_share_request = MAX_WORKERS;
PUT_OUT_REQUESTABLE(worker_id);
return;
return 0;
}
/* sharing request accepted */
COMPUTE_SEGMENTS_TO_COPY_TO(worker_q);
@ -135,7 +145,7 @@ void p_share_work(void) {
REMOTE_p_fase_signal(worker_q) = P_idle;
#ifndef TABLING
/* wait for incomplete installations */
while (LOCAL_reply_signal != ready);
while (LOCAL_reply_signal != worker_ready);
#endif /* TABLING */
LOCAL_reply_signal = sharing;
REMOTE_reply_signal(worker_q) = sharing;
@ -175,7 +185,7 @@ sync_with_q:
LOCAL_share_request = MAX_WORKERS;
PUT_IN_REQUESTABLE(worker_id);
return;
return 1;
}
@ -196,7 +206,7 @@ int q_share_work(int worker_p) {
#endif /* YAPOR_ERRORS */
/* there is no pending prune with worker p at right --> safe move to worker p branch */
BRANCH(worker_id, OrFr_depth(LOCAL_top_or_fr)) = BRANCH(worker_p, OrFr_depth(LOCAL_top_or_fr));
SetLOCAL_prune_request = NULL;
LOCAL_prune_request = NULL;
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
/* unbind variables */
@ -256,10 +266,10 @@ int q_share_work(int worker_p) {
UNLOCK_WORKER(worker_p);
/* wait for an answer */
while (LOCAL_reply_signal == ready);
while (LOCAL_reply_signal == worker_ready);
if (LOCAL_reply_signal == no_sharing) {
/* sharing request refused */
LOCAL_reply_signal = ready;
LOCAL_reply_signal = worker_ready;
return FALSE;
}
@ -302,6 +312,7 @@ sync_with_p:
#endif /* TABLING */
while (LOCAL_reply_signal != copy_done);
#if INCREMENTAL_COPY
/* install fase --> TR and LOCAL_top_cp->cp_tr are equal */
aux_tr = ((choiceptr) LOCAL_start_local_copy)->cp_tr;
Yap_NEW_MAHASH((ma_h_inner_struct *)H);
@ -347,12 +358,13 @@ sync_with_p:
#endif /* MULTI_ASSIGNMENT_VARIABLES */
}
}
#endif /* incremental */
/* update registers and return */
#ifndef TABLING
REMOTE_reply_signal(worker_p) = ready;
REMOTE_reply_signal(worker_p) = worker_ready;
#endif /* TABLING */
LOCAL_reply_signal = ready;
LOCAL_reply_signal = worker_ready;
PUT_IN_REQUESTABLE(worker_id);
TR = (tr_fr_ptr) LOCAL_end_trail_copy;
#ifdef TABLING