icompile table+orp
This commit is contained in:
parent
5ef31fbfd2
commit
a498dc1265
@ -3073,7 +3073,11 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||||||
*entry_codep = code_p;
|
*entry_codep = code_p;
|
||||||
if (tabled) {
|
if (tabled) {
|
||||||
#if TABLING
|
#if TABLING
|
||||||
|
#ifdef YAPOR
|
||||||
|
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, 1, 0, code_p, pass_no, cip);
|
||||||
|
#else
|
||||||
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, code_p, pass_no, cip);
|
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, code_p, pass_no, cip);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (dynamic) {
|
if (dynamic) {
|
||||||
|
@ -980,10 +980,13 @@ has_cut(yamop *pc)
|
|||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
case _table_load_answer:
|
case _table_load_answer:
|
||||||
case _table_try_answer:
|
case _table_try_answer:
|
||||||
case _table_try_me_single:
|
case _table_try_single:
|
||||||
case _table_try_me:
|
case _table_try_me:
|
||||||
case _table_retry_me:
|
case _table_retry_me:
|
||||||
case _table_trust_me:
|
case _table_trust_me:
|
||||||
|
case _table_try:
|
||||||
|
case _table_retry:
|
||||||
|
case _table_trust:
|
||||||
case _table_answer_resolution:
|
case _table_answer_resolution:
|
||||||
case _table_completion:
|
case _table_completion:
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
@ -82,7 +82,7 @@ static Int p_tabling_statistics(void);
|
|||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
#if defined(YAPOR) && defined(TABLING)
|
#if defined(YAPOR) && defined(TABLING)
|
||||||
static int p_opt_statistics(void);
|
static Int p_opt_statistics(void);
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
|
|
||||||
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
|
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
|
||||||
@ -872,7 +872,7 @@ Int p_tabling_statistics(void) {
|
|||||||
|
|
||||||
#if defined(YAPOR) && defined(TABLING)
|
#if defined(YAPOR) && defined(TABLING)
|
||||||
static
|
static
|
||||||
int p_opt_statistics(void) {
|
Int p_opt_statistics(void) {
|
||||||
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
#ifdef SHM_MEMORY_ALLOC_SCHEME
|
||||||
long pages_in_use = 0, bytes_in_use = 0;
|
long pages_in_use = 0, bytes_in_use = 0;
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ struct local_signals{
|
|||||||
sharing = 1,
|
sharing = 1,
|
||||||
nodes_shared = 2,
|
nodes_shared = 2,
|
||||||
copy_done = 3,
|
copy_done = 3,
|
||||||
ready = 4
|
worker_ready = 4
|
||||||
} reply;
|
} reply;
|
||||||
};
|
};
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
@ -342,7 +342,11 @@ struct local_data{
|
|||||||
choiceptr bottom_pruning_scope;
|
choiceptr bottom_pruning_scope;
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
#ifdef THREADS
|
||||||
|
Int top_choice_point_on_stack_offset;
|
||||||
|
#else
|
||||||
choiceptr top_choice_point_on_stack;
|
choiceptr top_choice_point_on_stack;
|
||||||
|
#endif
|
||||||
struct or_frame *top_or_frame_with_suspensions;
|
struct or_frame *top_or_frame_with_suspensions;
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
@ -256,7 +256,7 @@ void prune_shared_branch(choiceptr prune_cp) {
|
|||||||
end_prune_more:
|
end_prune_more:
|
||||||
CUT_reset_prune_request();
|
CUT_reset_prune_request();
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
Set_LOCAL_top_cp_on_stack(LOCAL_top_cp);
|
Set_LOCAL_top_cp_on_stack(Get_LOCAL_top_cp());
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -365,7 +365,7 @@ void share_private_nodes(int worker_q) {
|
|||||||
next_node_on_branch = sharing_node;
|
next_node_on_branch = sharing_node;
|
||||||
STACK_PUSH_UP(or_frame, stack);
|
STACK_PUSH_UP(or_frame, stack);
|
||||||
STACK_CHECK_EXPAND1(stack, stack_limit, stack_base);
|
STACK_CHECK_EXPAND1(stack, stack_limit, stack_base);
|
||||||
STACK_PUSH(sharing_node, stack);
|
STACK_PUSH_UP(sharing_node, stack); /* vsc: STACK_PUSH -> STACK_PUSH_UP? */
|
||||||
STACK_CHECK_EXPAND1(stack, stack_limit, stack_base);
|
STACK_CHECK_EXPAND1(stack, stack_limit, stack_base);
|
||||||
sharing_node = consumer_cp;
|
sharing_node = consumer_cp;
|
||||||
dep_frame = DepFr_next(dep_frame);
|
dep_frame = DepFr_next(dep_frame);
|
||||||
@ -527,7 +527,7 @@ void share_private_nodes(int worker_q) {
|
|||||||
/* update top shared nodes */
|
/* update top shared nodes */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
Set_REMOTE_top_cp_on_stack(worker_q,B);
|
Set_REMOTE_top_cp_on_stack(worker_q,B);
|
||||||
Set_LOCAL_top_cp_on_stack, B);
|
Set_LOCAL_top_cp_on_stack( B );
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
Set_REMOTE_top_cp(worker_q,B);
|
Set_REMOTE_top_cp(worker_q,B);
|
||||||
Set_LOCAL_top_cp(B);
|
Set_LOCAL_top_cp(B);
|
||||||
@ -536,7 +536,7 @@ void share_private_nodes(int worker_q) {
|
|||||||
|
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
/* update worker Q pruning scope */
|
/* update worker Q pruning scope */
|
||||||
if (LOCAL_pruning_scope && EQUAL_OR_YOUNGER_CP(Get_LOCAL_top_cp(), LOCAL_pruning_scope)) {
|
if (LOCAL_pruning_scope && EQUAL_OR_YOUNGER_CP(Get_LOCAL_top_cp(), LOCAL_pruning_scope)) {
|
||||||
REMOTE_pruning_scope(worker_q) = LOCAL_pruning_scope;
|
REMOTE_pruning_scope(worker_q) = LOCAL_pruning_scope;
|
||||||
PUT_IN_PRUNING(worker_q);
|
PUT_IN_PRUNING(worker_q);
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,9 +303,14 @@
|
|||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (SCH_top_shared_cp(B)) {
|
if (SCH_top_shared_cp(B)) {
|
||||||
|
#if 0
|
||||||
PROBLEM: cp_last_answer field is local to the cp!
|
PROBLEM: cp_last_answer field is local to the cp!
|
||||||
-> we need a shared data structure to avoid redundant computations!
|
-> we need a shared data structure to avoid redundant computations!
|
||||||
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
|
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
|
||||||
|
#else
|
||||||
|
fprintf(stderr,"PROBLEM: cp_last_answer field is local to the cp!\n");
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
subs_ptr = (CELL *) (LOAD_CP(B) + 1);
|
subs_ptr = (CELL *) (LOAD_CP(B) + 1);
|
||||||
@ -918,7 +923,7 @@
|
|||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) &&
|
if (BITMAP_member(members, i) &&
|
||||||
BRANCH_LTT(i, depth) > ltt &&
|
BRANCH_LTT(i, depth) > ltt &&
|
||||||
EQUAL_OR_YOUNGER_CP(OrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i)))
|
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i)))
|
||||||
goto pending_table_new_answer;
|
goto pending_table_new_answer;
|
||||||
}
|
}
|
||||||
BITMAP_minus(prune_members, members);
|
BITMAP_minus(prune_members, members);
|
||||||
@ -933,7 +938,7 @@
|
|||||||
for (i = 0; i < number_workers; i++) {
|
for (i = 0; i < number_workers; i++) {
|
||||||
if (BITMAP_member(members, i) &&
|
if (BITMAP_member(members, i) &&
|
||||||
BRANCH_LTT(i, depth) > ltt &&
|
BRANCH_LTT(i, depth) > ltt &&
|
||||||
EQUAL_OR_YOUNGER_CP(OrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i))) {
|
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i))) {
|
||||||
/* update nearest leftnode data */
|
/* update nearest leftnode data */
|
||||||
or_fr = LOCAL_top_or_fr;
|
or_fr = LOCAL_top_or_fr;
|
||||||
nearest_or_fr = OrFr_nearest_leftnode(or_fr);
|
nearest_or_fr = OrFr_nearest_leftnode(or_fr);
|
||||||
@ -1153,9 +1158,9 @@
|
|||||||
end_or_fr = DepFr_top_or_fr(dep_fr);
|
end_or_fr = DepFr_top_or_fr(dep_fr);
|
||||||
if (start_or_fr != end_or_fr) {
|
if (start_or_fr != end_or_fr) {
|
||||||
LOCAL_top_or_fr = end_or_fr;
|
LOCAL_top_or_fr = end_or_fr;
|
||||||
Set_LOCAL_top_cp(OrFr_node(end_or_fr));
|
Set_LOCAL_top_cp(GetOrFr_node(end_or_fr));
|
||||||
do {
|
do {
|
||||||
while (YOUNGER_CP(OrFr_node(start_or_fr), OrFr_node(end_or_fr))) {
|
while (YOUNGER_CP(GetOrFr_node(start_or_fr), GetOrFr_node(end_or_fr))) {
|
||||||
LOCK_OR_FRAME(start_or_fr);
|
LOCK_OR_FRAME(start_or_fr);
|
||||||
BITMAP_delete(OrFr_members(start_or_fr), worker_id);
|
BITMAP_delete(OrFr_members(start_or_fr), worker_id);
|
||||||
if (BITMAP_empty(OrFr_members(start_or_fr))) {
|
if (BITMAP_empty(OrFr_members(start_or_fr))) {
|
||||||
@ -1187,7 +1192,7 @@
|
|||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
start_or_fr = OrFr_next(start_or_fr);
|
start_or_fr = OrFr_next(start_or_fr);
|
||||||
}
|
}
|
||||||
while (YOUNGER_CP(OrFr_node(end_or_fr), OrFr_node(start_or_fr))) {
|
while (YOUNGER_CP(GetOrFr_node(end_or_fr), GetOrFr_node(start_or_fr))) {
|
||||||
LOCK_OR_FRAME(end_or_fr);
|
LOCK_OR_FRAME(end_or_fr);
|
||||||
BITMAP_insert(OrFr_members(end_or_fr), worker_id);
|
BITMAP_insert(OrFr_members(end_or_fr), worker_id);
|
||||||
BRANCH(worker_id, OrFr_depth(end_or_fr)) = 1;
|
BRANCH(worker_id, OrFr_depth(end_or_fr)) = 1;
|
||||||
@ -1247,7 +1252,7 @@
|
|||||||
start_or_fr = LOCAL_top_or_fr;
|
start_or_fr = LOCAL_top_or_fr;
|
||||||
if (start_or_fr != end_or_fr) {
|
if (start_or_fr != end_or_fr) {
|
||||||
LOCAL_top_or_fr = end_or_fr;
|
LOCAL_top_or_fr = end_or_fr;
|
||||||
Set_LOCAL_top_cp(OrFr_node(end_or_fr));
|
Set_LOCAL_top_cp(GetOrFr_node(end_or_fr));
|
||||||
while (start_or_fr != end_or_fr) {
|
while (start_or_fr != end_or_fr) {
|
||||||
LOCK_OR_FRAME(start_or_fr);
|
LOCK_OR_FRAME(start_or_fr);
|
||||||
BITMAP_delete(OrFr_members(start_or_fr), worker_id);
|
BITMAP_delete(OrFr_members(start_or_fr), worker_id);
|
||||||
@ -1447,7 +1452,7 @@
|
|||||||
or_frame = OrFr_next(or_frame);
|
or_frame = OrFr_next(or_frame);
|
||||||
}
|
}
|
||||||
LOCAL_top_or_fr = DepFr_top_or_fr(dep_fr);
|
LOCAL_top_or_fr = DepFr_top_or_fr(dep_fr);
|
||||||
Set_LOCAL_top_cp(OrFr_node(LOCAL_top_or_fr));
|
Set_LOCAL_top_cp(GetOrFr_node(LOCAL_top_or_fr));
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef OPTYAP_ERRORS
|
#ifdef OPTYAP_ERRORS
|
||||||
@ -1508,7 +1513,7 @@
|
|||||||
if (YOUNGER_CP(B_FZ, B)) {
|
if (YOUNGER_CP(B_FZ, B)) {
|
||||||
suspend_branch();
|
suspend_branch();
|
||||||
/* check for suspension frames to be resumed */
|
/* check for suspension frames to be resumed */
|
||||||
while (YOUNGER_CP(OrFr_node(LOCAL_top_susp_or_fr), Get_LOCAL_top_cp())) {
|
while (YOUNGER_CP(GetOrFr_node(LOCAL_top_susp_or_fr), Get_LOCAL_top_cp())) {
|
||||||
or_fr_ptr susp_or_fr;
|
or_fr_ptr susp_or_fr;
|
||||||
susp_fr_ptr resume_fr;
|
susp_fr_ptr resume_fr;
|
||||||
susp_or_fr = LOCAL_top_susp_or_fr;
|
susp_or_fr = LOCAL_top_susp_or_fr;
|
||||||
@ -1524,7 +1529,7 @@
|
|||||||
OrFr_nearest_suspnode(susp_or_fr) = susp_or_fr;
|
OrFr_nearest_suspnode(susp_or_fr) = susp_or_fr;
|
||||||
}
|
}
|
||||||
UNLOCK_OR_FRAME(susp_or_fr);
|
UNLOCK_OR_FRAME(susp_or_fr);
|
||||||
rebind_variables(OrFr_node(susp_or_fr)->cp_tr, B->cp_tr);
|
rebind_variables(GetOrFr_node(susp_or_fr)->cp_tr, B->cp_tr);
|
||||||
resume_suspension_frame(resume_fr, susp_or_fr);
|
resume_suspension_frame(resume_fr, susp_or_fr);
|
||||||
B = Get_LOCAL_top_cp();
|
B = Get_LOCAL_top_cp();
|
||||||
SET_BB(B_FZ);
|
SET_BB(B_FZ);
|
||||||
@ -1542,7 +1547,7 @@
|
|||||||
if (frame_with_suspensions_not_collected(LOCAL_top_or_fr))
|
if (frame_with_suspensions_not_collected(LOCAL_top_or_fr))
|
||||||
collect_suspension_frames(LOCAL_top_or_fr);
|
collect_suspension_frames(LOCAL_top_or_fr);
|
||||||
/* check for suspension frames to be resumed */
|
/* check for suspension frames to be resumed */
|
||||||
while (EQUAL_OR_YOUNGER_CP(OrFr_node(LOCAL_top_susp_or_fr), Get_LOCAL_top_cp())) {
|
while (EQUAL_OR_YOUNGER_CP(GetOrFr_node(LOCAL_top_susp_or_fr), Get_LOCAL_top_cp())) {
|
||||||
or_fr_ptr susp_or_fr;
|
or_fr_ptr susp_or_fr;
|
||||||
susp_fr_ptr resume_fr;
|
susp_fr_ptr resume_fr;
|
||||||
susp_or_fr = LOCAL_top_susp_or_fr;
|
susp_or_fr = LOCAL_top_susp_or_fr;
|
||||||
@ -1559,7 +1564,7 @@
|
|||||||
if (YOUNGER_CP(B_FZ, B)) {
|
if (YOUNGER_CP(B_FZ, B)) {
|
||||||
suspend_branch();
|
suspend_branch();
|
||||||
}
|
}
|
||||||
rebind_variables(OrFr_node(susp_or_fr)->cp_tr, B->cp_tr);
|
rebind_variables(GetOrFr_node(susp_or_fr)->cp_tr, B->cp_tr);
|
||||||
resume_suspension_frame(resume_fr, susp_or_fr);
|
resume_suspension_frame(resume_fr, susp_or_fr);
|
||||||
B = Get_LOCAL_top_cp();
|
B = Get_LOCAL_top_cp();
|
||||||
SET_BB(B_FZ);
|
SET_BB(B_FZ);
|
||||||
@ -1605,7 +1610,7 @@
|
|||||||
UNLOCK(DepFr_lock(LOCAL_top_dep_fr));
|
UNLOCK(DepFr_lock(LOCAL_top_dep_fr));
|
||||||
if (OrFr_owners(LOCAL_top_or_fr) > 1) {
|
if (OrFr_owners(LOCAL_top_or_fr) > 1) {
|
||||||
/* more owners -> move up one node */
|
/* more owners -> move up one node */
|
||||||
Set_LOCAL_top_cp_on_stack( OrFr_node(OrFr_next_on_stack(LOCAL_top_or_fr)) );
|
Set_LOCAL_top_cp_on_stack( GetOrFr_node(OrFr_next_on_stack(LOCAL_top_or_fr)) );
|
||||||
BITMAP_delete(OrFr_members(LOCAL_top_or_fr), worker_id);
|
BITMAP_delete(OrFr_members(LOCAL_top_or_fr), worker_id);
|
||||||
OrFr_owners(LOCAL_top_or_fr)--;
|
OrFr_owners(LOCAL_top_or_fr)--;
|
||||||
LOCAL_top_dep_fr = DepFr_next(LOCAL_top_dep_fr);
|
LOCAL_top_dep_fr = DepFr_next(LOCAL_top_dep_fr);
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
** ------------------ */
|
** ------------------ */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#if HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
#include "opt.mavar.h"
|
#include "opt.mavar.h"
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +107,12 @@ STD_PROTO(static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames, (tg_sol_fr_p
|
|||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT, STACK_BASE) \
|
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT, STACK_BASE) \
|
||||||
if (STACK_LIMIT >= STACK) { \
|
if (STACK_LIMIT >= STACK) { \
|
||||||
Yap_Error(INTERNAL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)")
|
Yap_Error(INTERNAL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)"); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* should work for now */
|
||||||
|
#define STACK_CHECK_EXPAND1(STACK, STACK_LIMIT, STACK_BASE) STACK_CHECK_EXPAND(STACK, STACK_LIMIT, STACK_BASE)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT, STACK_BASE) \
|
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT, STACK_BASE) \
|
||||||
if (STACK_LIMIT >= STACK) { \
|
if (STACK_LIMIT >= STACK) { \
|
||||||
|
@ -341,9 +341,9 @@ void resume_suspension_frame(susp_fr_ptr resume_fr, or_fr_ptr top_or_fr) {
|
|||||||
SetOrFr_node(top_or_fr, Get_LOCAL_top_cp());
|
SetOrFr_node(top_or_fr, Get_LOCAL_top_cp());
|
||||||
LOCAL_top_sg_fr = SuspFr_top_sg_fr(resume_fr);
|
LOCAL_top_sg_fr = SuspFr_top_sg_fr(resume_fr);
|
||||||
LOCAL_top_dep_fr = SuspFr_top_dep_fr(resume_fr);
|
LOCAL_top_dep_fr = SuspFr_top_dep_fr(resume_fr);
|
||||||
Set_LOCAL_top_cp_on_stack( OrFr_node(SuspFr_top_or_fr_on_stack(resume_fr)) );
|
Set_LOCAL_top_cp_on_stack( GetOrFr_node(SuspFr_top_or_fr_on_stack(resume_fr)) );
|
||||||
sg_frame = LOCAL_top_sg_fr;
|
sg_frame = LOCAL_top_sg_fr;
|
||||||
while (sg_frame && YOUNGER_CP(SgFr_gen_cp(sg_frame), LOCAL_top_cp_on_stack)) {
|
while (sg_frame && YOUNGER_CP(SgFr_gen_cp(sg_frame), Get_LOCAL_top_cp_on_stack())) {
|
||||||
SgFr_gen_worker(sg_frame) = worker_id;
|
SgFr_gen_worker(sg_frame) = worker_id;
|
||||||
sg_frame = SgFr_next(sg_frame);
|
sg_frame = SgFr_next(sg_frame);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user