fix one more CP field to offset.

This commit is contained in:
Vitor Santos Costa 2010-02-02 23:42:15 +00:00
parent 929995f5a1
commit 9c85f67eee
6 changed files with 31 additions and 10 deletions

View File

@ -213,7 +213,7 @@ void make_root_frames(void) {
SetOrFr_node(or_fr, B_BASE);
OrFr_nearest_livenode(or_fr) = NULL;
OrFr_depth(or_fr) = 0;
OrFr_pend_prune_cp(or_fr) = NULL;
Set_OrFr_pend_prune_cp(or_fr, NULL);
OrFr_nearest_leftnode(or_fr) = or_fr;
OrFr_qg_solutions(or_fr) = NULL;
#ifdef TABLING_INNER_CUTS

View File

@ -154,7 +154,7 @@ void prune_shared_branch(choiceptr prune_cp) {
while (Get_LOCAL_top_cp() != leftmost_cp) {
ltt = BRANCH_LTT(worker_id, OrFr_depth(LOCAL_top_or_fr));
LOCK_OR_FRAME(LOCAL_top_or_fr);
if (OrFr_pend_prune_cp(LOCAL_top_or_fr))
if (Get_OrFr_pend_prune_cp(LOCAL_top_or_fr))
prune_more = 0;
aux_qg_solutions = OrFr_qg_solutions(LOCAL_top_or_fr);
#ifdef TABLING_INNER_CUTS
@ -214,10 +214,10 @@ void prune_shared_branch(choiceptr prune_cp) {
if (tg_solutions)
tg_solutions = CUT_store_tg_answers(leftmost_or_fr, tg_solutions, ltt);
#endif /* TABLING_INNER_CUTS */
if (OrFr_pend_prune_cp(leftmost_or_fr))
if (Get_OrFr_pend_prune_cp(leftmost_or_fr))
prune_more = 0;
OrFr_alternative(leftmost_or_fr) = NULL;
OrFr_pend_prune_cp(leftmost_or_fr) = prune_cp;
Set_OrFr_pend_prune_cp(leftmost_or_fr, prune_cp);
OrFr_pend_prune_ltt(leftmost_or_fr) = ltt;
UNLOCK_OR_FRAME(leftmost_or_fr);
#ifdef TABLING_INNER_CUTS

View File

@ -200,7 +200,7 @@ int q_share_work(int worker_p) {
return FALSE;
}
#ifdef YAPOR_ERRORS
if (OrFr_pend_prune_cp(LOCAL_top_or_fr) &&
if (Get_OrFr_pend_prune_cp(LOCAL_top_or_fr) &&
BRANCH_LTT(worker_p, OrFr_depth(LOCAL_top_or_fr)) < OrFr_pend_prune_ltt(LOCAL_top_or_fr))
YAPOR_ERROR_MESSAGE("prune ltt > worker_p branch ltt (q_share_work)");
#endif /* YAPOR_ERRORS */

View File

@ -285,14 +285,14 @@ int move_up_one_node(or_fr_ptr nearest_livenode) {
/* pending prune ? */
if (OrFr_pend_prune_cp(LOCAL_top_or_fr)
if (Get_OrFr_pend_prune_cp(LOCAL_top_or_fr)
&& ! Get_LOCAL_prune_request()
&& CUT_last_worker_left_pending_prune(LOCAL_top_or_fr)) {
#ifdef TABLING
choiceptr aux_cp = Get_LOCAL_top_cp();
#endif /* TABLIG */
choiceptr prune_cp = OrFr_pend_prune_cp(LOCAL_top_or_fr);
OrFr_pend_prune_cp(LOCAL_top_or_fr) = NULL;
choiceptr prune_cp = Get_OrFr_pend_prune_cp(LOCAL_top_or_fr);
Set_OrFr_pend_prune_cp(LOCAL_top_or_fr, NULL);
BRANCH(worker_id, OrFr_depth(LOCAL_top_or_fr)) = OrFr_pend_prune_ltt(LOCAL_top_or_fr);
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
prune_shared_branch(prune_cp);

View File

@ -39,7 +39,11 @@ typedef struct or_frame {
struct or_frame *nearest_livenode;
/* cut support */
int depth;
#ifdef THREADS
Int pending_prune_cp_offset;
#else
choiceptr pending_prune_cp;
#endif
volatile int pending_prune_ltt;
struct or_frame *nearest_leftnode;
struct query_goal_solution_frame *query_solutions;
@ -69,7 +73,14 @@ typedef struct or_frame {
#endif
#define OrFr_nearest_livenode(X) ((X)->nearest_livenode)
#define OrFr_depth(X) ((X)->depth)
#ifdef THREADS
#define Get_OrFr_pend_prune_cp(X) offset_to_cptr_with_null((X)->pending_prune_cp_offset)
#define Set_OrFr_pend_prune_cp(X,V) ((X)->pending_prune_cp_offset = cptr_to_offset_with_null(V))
#else
#define OrFr_pend_prune_cp(X) ((X)->pending_prune_cp)
#define Get_OrFr_pend_prune_cp(X) ((X)->pending_prune_cp)
#define Set_OrFr_pend_prune_cp(X,V) ((X)->pending_prune_cp = (V))
#endif
#define OrFr_pend_prune_ltt(X) ((X)->pending_prune_ltt)
#define OrFr_nearest_leftnode(X) ((X)->nearest_leftnode)
#define OrFr_qg_solutions(X) ((X)->query_solutions)

View File

@ -36,6 +36,16 @@
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)
#undef COMPUTE_SEGMENTS_TO_COPY_TO
#define COMPUTE_SEGMENTS_TO_COPY_TO(Q) \
REMOTE_start_global_copy(Q) = (CELL) (H0); \
REMOTE_end_global_copy(Q) = (CELL) (B->cp_h); \
REMOTE_start_local_copy(Q) = (CELL) (B); \
REMOTE_end_local_copy(Q) = (CELL) (REMOTE_top_cp(Q)); \
REMOTE_end_local_copy(Q) = (CELL) (GetOrFr_node(GLOBAL_root_or_fr)); \
REMOTE_start_trail_copy(Q) = (CELL) (Yap_TrailBase); \
REMOTE_start_trail_copy(Q) = (CELL) (REMOTE_top_cp(Q)->cp_tr); \
REMOTE_end_trail_copy(Q) = (CELL) (TR)
/* ------------------------------------- **
** Local functions declaration **
@ -145,7 +155,7 @@ int q_share_work(int worker_p) {
return FALSE;
}
#ifdef YAPOR_ERRORS
if (OrFr_pend_prune_cp(LOCAL_top_or_fr) &&
if (Get_OrFr_pend_prune_cp(LOCAL_top_or_fr) &&
BRANCH_LTT(worker_p, OrFr_depth(LOCAL_top_or_fr)) < OrFr_pend_prune_ltt(LOCAL_top_or_fr))
YAPOR_ERROR_MESSAGE("prune ltt > worker_p branch ltt (q_share_work)");
#endif /* YAPOR_ERRORS */
@ -354,7 +364,7 @@ void share_private_nodes(int worker_q) {
INIT_LOCK(OrFr_lock(or_frame));
SetOrFr_node(or_frame, sharing_node);
OrFr_alternative(or_frame) = sharing_node->cp_ap;
OrFr_pend_prune_cp(or_frame) = NULL;
Set_OrFr_pend_prune_cp(or_frame, NULL);
OrFr_nearest_leftnode(or_frame) = LOCAL_top_or_fr;
OrFr_qg_solutions(or_frame) = NULL;
#ifdef TABLING_INNER_CUTS