Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
This commit is contained in:
commit
51e49d6660
@ -310,7 +310,7 @@
|
|||||||
#if defined(GLOBAL_TRIE_LOCK_AT_NODE_LEVEL) || defined(GLOBAL_TRIE_LOCK_AT_WRITE_LEVEL)
|
#if defined(GLOBAL_TRIE_LOCK_AT_NODE_LEVEL) || defined(GLOBAL_TRIE_LOCK_AT_WRITE_LEVEL)
|
||||||
#define GLOBAL_TRIE_LOCK_USING_NODE_FIELD 1
|
#define GLOBAL_TRIE_LOCK_USING_NODE_FIELD 1
|
||||||
#endif
|
#endif
|
||||||
#elif TRIE_LOCK_USING_GLOBAL_ARRAY
|
#elif defined(TRIE_LOCK_USING_GLOBAL_ARRAY)
|
||||||
#if defined(SUBGOAL_TRIE_LOCK_AT_NODE_LEVEL) || defined(SUBGOAL_TRIE_LOCK_AT_WRITE_LEVEL)
|
#if defined(SUBGOAL_TRIE_LOCK_AT_NODE_LEVEL) || defined(SUBGOAL_TRIE_LOCK_AT_WRITE_LEVEL)
|
||||||
#define SUBGOAL_TRIE_LOCK_USING_GLOBAL_ARRAY 1
|
#define SUBGOAL_TRIE_LOCK_USING_GLOBAL_ARRAY 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -412,7 +412,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
|||||||
sg_node_ptr sg_node;
|
sg_node_ptr sg_node;
|
||||||
|
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = GLOBAL_root_tab_ent;
|
||||||
while(tab_ent) {
|
while (tab_ent) {
|
||||||
hash = TabEnt_hash_chain(tab_ent);
|
hash = TabEnt_hash_chain(tab_ent);
|
||||||
TabEnt_hash_chain(tab_ent) = NULL;
|
TabEnt_hash_chain(tab_ent) = NULL;
|
||||||
free_subgoal_hash_chain(hash);
|
free_subgoal_hash_chain(hash);
|
||||||
@ -438,7 +438,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
|
|||||||
|
|
||||||
static Int p_abolish_all_local_tables( USES_REGS1 ) {
|
static Int p_abolish_all_local_tables( USES_REGS1 ) {
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
|
p_abolish_all_tables( PASS_REGS1 );
|
||||||
#else
|
#else
|
||||||
p_abolish_all_tables();
|
p_abolish_all_tables();
|
||||||
#endif /* THREADS */
|
#endif /* THREADS */
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
#ifdef MMAP_MEMORY_MAPPING_SCHEME
|
||||||
#define PATH_MAX 1000
|
#define PATH_MAX 1000
|
||||||
char mapfile_path[PATH_MAX];
|
char mapfile_path[PATH_MAX];
|
||||||
#elif SHM_MEMORY_MAPPING_SCHEME
|
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
|
||||||
int shm_mapid[MAX_WORKERS + 2];
|
int shm_mapid[MAX_WORKERS + 2];
|
||||||
#endif /* MEMORY_MAPPING_SCHEME */
|
#endif /* MEMORY_MAPPING_SCHEME */
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void Yap_init_yapor_global_local_memory(void) {
|
|||||||
if (close(fd_mapfile) == -1)
|
if (close(fd_mapfile) == -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_global_local_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_global_local_memory)");
|
||||||
}
|
}
|
||||||
#elif SHM_MEMORY_MAPPING_SCHEME
|
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
|
||||||
/* place as segment MAX_WORKERS (0..MAX_WORKERS-1 reserved for worker areas) */
|
/* place as segment MAX_WORKERS (0..MAX_WORKERS-1 reserved for worker areas) */
|
||||||
shm_map_memory(MAX_WORKERS, GLOBAL_LOCAL_STRUCTS_AREA, (void *) Yap_local);
|
shm_map_memory(MAX_WORKERS, GLOBAL_LOCAL_STRUCTS_AREA, (void *) Yap_local);
|
||||||
#endif /* MEMORY_MAPPING_SCHEME */
|
#endif /* MEMORY_MAPPING_SCHEME */
|
||||||
@ -121,7 +121,7 @@ void Yap_init_yapor_stacks_memory(UInt TrailStackArea, UInt HeapStackArea, UInt
|
|||||||
if (close(fd_mapfile) == -1)
|
if (close(fd_mapfile) == -1)
|
||||||
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_stacks_memory)");
|
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_stacks_memory)");
|
||||||
}
|
}
|
||||||
#elif SHM_MEMORY_MAPPING_SCHEME
|
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
|
||||||
/* place heap stack segment as MAX_WORKERS+1 */
|
/* place heap stack segment as MAX_WORKERS+1 */
|
||||||
shm_map_memory(MAX_WORKERS + 1, HeapStackArea, (void *) Yap_HeapBase);
|
shm_map_memory(MAX_WORKERS + 1, HeapStackArea, (void *) Yap_HeapBase);
|
||||||
#if defined(YAPOR_COPY) || defined(YAPOR_SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_SBA)
|
||||||
@ -225,7 +225,7 @@ void Yap_unmap_yapor_memory (void) {
|
|||||||
INFORMATION_MESSAGE("Removing mapfile \"%s\"", mapfile_path);
|
INFORMATION_MESSAGE("Removing mapfile \"%s\"", mapfile_path);
|
||||||
else
|
else
|
||||||
INFORMATION_MESSAGE("Can't remove mapfile \"%s\"", mapfile_path);
|
INFORMATION_MESSAGE("Can't remove mapfile \"%s\"", mapfile_path);
|
||||||
#elif SHM_MEMORY_MAPPING_SCHEME
|
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
|
||||||
#if defined(YAPOR_COPY) || defined(YAPOR_SBA)
|
#if defined(YAPOR_COPY) || defined(YAPOR_SBA)
|
||||||
shm_unmap_memory(MAX_WORKERS);
|
shm_unmap_memory(MAX_WORKERS);
|
||||||
shm_unmap_memory(MAX_WORKERS + 1);
|
shm_unmap_memory(MAX_WORKERS + 1);
|
||||||
|
@ -60,10 +60,10 @@ static void complete_suspension_branch(susp_fr_ptr susp_fr, choiceptr top_cp, or
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* chain dependency frames to release (using DepFr_next) */
|
/* chain dependency frames to release (using DepFr_next) */
|
||||||
while (IS_UNLOCKED(DepFr_lock(aux_dep_fr)) &&
|
while (IS_UNLOCKED_DEP_FR(aux_dep_fr) &&
|
||||||
YOUNGER_CP(DepFr_cons_cp(aux_dep_fr), top_cp)) {
|
YOUNGER_CP(DepFr_cons_cp(aux_dep_fr), top_cp)) {
|
||||||
dep_fr_ptr next_dep_fr;
|
dep_fr_ptr next_dep_fr;
|
||||||
LOCK(DepFr_lock(aux_dep_fr));
|
LOCK_DEP_FR(aux_dep_fr);
|
||||||
next_dep_fr = DepFr_next(aux_dep_fr);
|
next_dep_fr = DepFr_next(aux_dep_fr);
|
||||||
DepFr_next(aux_dep_fr) = *chain_dep_fr;
|
DepFr_next(aux_dep_fr) = *chain_dep_fr;
|
||||||
*chain_dep_fr = aux_dep_fr;
|
*chain_dep_fr = aux_dep_fr;
|
||||||
@ -192,7 +192,7 @@ void public_completion(void) {
|
|||||||
/* chain dependency frames to release */
|
/* chain dependency frames to release */
|
||||||
chain_dep_fr = NULL;
|
chain_dep_fr = NULL;
|
||||||
while (YOUNGER_CP(DepFr_cons_cp(LOCAL_top_dep_fr), Get_LOCAL_top_cp())) {
|
while (YOUNGER_CP(DepFr_cons_cp(LOCAL_top_dep_fr), Get_LOCAL_top_cp())) {
|
||||||
LOCK(DepFr_lock(LOCAL_top_dep_fr));
|
LOCK_DEP_FR(LOCAL_top_dep_fr);
|
||||||
next_dep_fr = DepFr_next(LOCAL_top_dep_fr);
|
next_dep_fr = DepFr_next(LOCAL_top_dep_fr);
|
||||||
DepFr_next(LOCAL_top_dep_fr) = chain_dep_fr;
|
DepFr_next(LOCAL_top_dep_fr) = chain_dep_fr;
|
||||||
chain_dep_fr = LOCAL_top_dep_fr;
|
chain_dep_fr = LOCAL_top_dep_fr;
|
||||||
|
@ -401,11 +401,11 @@
|
|||||||
YENV2MEM;
|
YENV2MEM;
|
||||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||||
MEM2YENV;
|
MEM2YENV;
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_state(sg_fr) == ready) {
|
if (SgFr_state(sg_fr) == ready) {
|
||||||
/* subgoal new */
|
/* subgoal new */
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
#ifdef DETERMINISTIC_TABLING
|
#ifdef DETERMINISTIC_TABLING
|
||||||
if (IsMode_Batched(TabEnt_mode(tab_ent))) {
|
if (IsMode_Batched(TabEnt_mode(tab_ent))) {
|
||||||
store_deterministic_generator_node(tab_ent, sg_fr);
|
store_deterministic_generator_node(tab_ent, sg_fr);
|
||||||
@ -424,7 +424,7 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
CELL *subs_ptr = YENV;
|
CELL *subs_ptr = YENV;
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
SgFr_try_answer(sg_fr) = ans_node;
|
SgFr_try_answer(sg_fr) = ans_node;
|
||||||
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
@ -438,7 +438,7 @@
|
|||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
int leader_dep_on_stack;
|
int leader_dep_on_stack;
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
@ -460,11 +460,11 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
if (ans_node == NULL) {
|
if (ans_node == NULL) {
|
||||||
/* no answers --> fail */
|
/* no answers --> fail */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
||||||
/* yes answer --> procceed */
|
/* yes answer --> procceed */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
YENV = ENV;
|
YENV = ENV;
|
||||||
@ -480,7 +480,7 @@
|
|||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
||||||
/* load answers from the trie */
|
/* load answers from the trie */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
if(TrNode_child(ans_node) != NULL) {
|
if(TrNode_child(ans_node) != NULL) {
|
||||||
store_loader_node(tab_ent, ans_node);
|
store_loader_node(tab_ent, ans_node);
|
||||||
}
|
}
|
||||||
@ -493,7 +493,7 @@
|
|||||||
/* execute compiled code from the trie */
|
/* execute compiled code from the trie */
|
||||||
if (SgFr_state(sg_fr) < compiled)
|
if (SgFr_state(sg_fr) < compiled)
|
||||||
update_answer_trie(sg_fr);
|
update_answer_trie(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
*--YENV = 0; /* vars_arity */
|
*--YENV = 0; /* vars_arity */
|
||||||
@ -519,11 +519,11 @@
|
|||||||
YENV2MEM;
|
YENV2MEM;
|
||||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||||
MEM2YENV;
|
MEM2YENV;
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_state(sg_fr) == ready) {
|
if (SgFr_state(sg_fr) == ready) {
|
||||||
/* subgoal new */
|
/* subgoal new */
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, PREG->u.Otapl.d);
|
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, PREG->u.Otapl.d);
|
||||||
PREG = NEXTOP(PREG, Otapl);
|
PREG = NEXTOP(PREG, Otapl);
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
@ -535,7 +535,7 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
CELL *subs_ptr = YENV;
|
CELL *subs_ptr = YENV;
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
SgFr_try_answer(sg_fr) = ans_node;
|
SgFr_try_answer(sg_fr) = ans_node;
|
||||||
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
@ -549,7 +549,7 @@
|
|||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
int leader_dep_on_stack;
|
int leader_dep_on_stack;
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
@ -571,11 +571,11 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
if (ans_node == NULL) {
|
if (ans_node == NULL) {
|
||||||
/* no answers --> fail */
|
/* no answers --> fail */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
||||||
/* yes answer --> procceed */
|
/* yes answer --> procceed */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
YENV = ENV;
|
YENV = ENV;
|
||||||
@ -591,7 +591,7 @@
|
|||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
||||||
/* load answers from the trie */
|
/* load answers from the trie */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
if(TrNode_child(ans_node) != NULL) {
|
if(TrNode_child(ans_node) != NULL) {
|
||||||
store_loader_node(tab_ent, ans_node);
|
store_loader_node(tab_ent, ans_node);
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@
|
|||||||
/* execute compiled code from the trie */
|
/* execute compiled code from the trie */
|
||||||
if (SgFr_state(sg_fr) < compiled)
|
if (SgFr_state(sg_fr) < compiled)
|
||||||
update_answer_trie(sg_fr);
|
update_answer_trie(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
*--YENV = 0; /* vars_arity */
|
*--YENV = 0; /* vars_arity */
|
||||||
@ -630,11 +630,11 @@
|
|||||||
YENV2MEM;
|
YENV2MEM;
|
||||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||||
MEM2YENV;
|
MEM2YENV;
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_state(sg_fr) == ready) {
|
if (SgFr_state(sg_fr) == ready) {
|
||||||
/* subgoal new */
|
/* subgoal new */
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, NEXTOP(PREG,Otapl));
|
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, NEXTOP(PREG,Otapl));
|
||||||
PREG = PREG->u.Otapl.d;
|
PREG = PREG->u.Otapl.d;
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
@ -646,7 +646,7 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
CELL *subs_ptr = YENV;
|
CELL *subs_ptr = YENV;
|
||||||
init_subgoal_frame(sg_fr);
|
init_subgoal_frame(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
SgFr_try_answer(sg_fr) = ans_node;
|
SgFr_try_answer(sg_fr) = ans_node;
|
||||||
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
@ -660,7 +660,7 @@
|
|||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
int leader_dep_on_stack;
|
int leader_dep_on_stack;
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
store_consumer_node(tab_ent, sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
@ -682,11 +682,11 @@
|
|||||||
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
ans_node_ptr ans_node = SgFr_first_answer(sg_fr);
|
||||||
if (ans_node == NULL) {
|
if (ans_node == NULL) {
|
||||||
/* no answers --> fail */
|
/* no answers --> fail */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
} else if (ans_node == SgFr_answer_trie(sg_fr)) {
|
||||||
/* yes answer --> procceed */
|
/* yes answer --> procceed */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) CPREG;
|
PREG = (yamop *) CPREG;
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
YENV = ENV;
|
YENV = ENV;
|
||||||
@ -702,7 +702,7 @@
|
|||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
if (IsMode_LoadAnswers(TabEnt_mode(tab_ent))) {
|
||||||
/* load answers from the trie */
|
/* load answers from the trie */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
if(TrNode_child(ans_node) != NULL) {
|
if(TrNode_child(ans_node) != NULL) {
|
||||||
store_loader_node(tab_ent, ans_node);
|
store_loader_node(tab_ent, ans_node);
|
||||||
}
|
}
|
||||||
@ -715,7 +715,7 @@
|
|||||||
/* execute compiled code from the trie */
|
/* execute compiled code from the trie */
|
||||||
if (SgFr_state(sg_fr) < compiled)
|
if (SgFr_state(sg_fr) < compiled)
|
||||||
update_answer_trie(sg_fr);
|
update_answer_trie(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
*--YENV = 0; /* vars_arity */
|
*--YENV = 0; /* vars_arity */
|
||||||
@ -999,7 +999,7 @@
|
|||||||
TAG_AS_ANSWER_LEAF_NODE(ans_node);
|
TAG_AS_ANSWER_LEAF_NODE(ans_node);
|
||||||
UNLOCK_ANSWER_NODE(ans_node);
|
UNLOCK_ANSWER_NODE(ans_node);
|
||||||
#ifndef ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL
|
#ifndef ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
#endif /* ! ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL */
|
#endif /* ! ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL */
|
||||||
if (SgFr_first_answer(sg_fr) == NULL)
|
if (SgFr_first_answer(sg_fr) == NULL)
|
||||||
SgFr_first_answer(sg_fr) = ans_node;
|
SgFr_first_answer(sg_fr) = ans_node;
|
||||||
@ -1015,7 +1015,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* DEBUG_TABLING */
|
#endif /* DEBUG_TABLING */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
if (IS_BATCHED_GEN_CP(gcp)) {
|
if (IS_BATCHED_GEN_CP(gcp)) {
|
||||||
#ifdef TABLING_EARLY_COMPLETION
|
#ifdef TABLING_EARLY_COMPLETION
|
||||||
if (gcp == PROTECT_FROZEN_B(B) && (*subs_ptr == 0 || gcp->cp_ap == COMPLETION)) {
|
if (gcp == PROTECT_FROZEN_B(B) && (*subs_ptr == 0 || gcp->cp_ap == COMPLETION)) {
|
||||||
@ -1087,7 +1087,7 @@
|
|||||||
OPTYAP_ERROR_CHECKING(answer_resolution, SCH_top_shared_cp(B) && B->cp_or_fr->alternative != ANSWER_RESOLUTION);
|
OPTYAP_ERROR_CHECKING(answer_resolution, SCH_top_shared_cp(B) && B->cp_or_fr->alternative != ANSWER_RESOLUTION);
|
||||||
OPTYAP_ERROR_CHECKING(answer_resolution, !SCH_top_shared_cp(B) && B->cp_ap != ANSWER_RESOLUTION);
|
OPTYAP_ERROR_CHECKING(answer_resolution, !SCH_top_shared_cp(B) && B->cp_ap != ANSWER_RESOLUTION);
|
||||||
dep_fr = CONS_CP(B)->cp_dep_fr;
|
dep_fr = CONS_CP(B)->cp_dep_fr;
|
||||||
LOCK(DepFr_lock(dep_fr));
|
LOCK_DEP_FR(dep_fr);
|
||||||
ans_node = DepFr_last_answer(dep_fr);
|
ans_node = DepFr_last_answer(dep_fr);
|
||||||
if (TrNode_child(ans_node)) {
|
if (TrNode_child(ans_node)) {
|
||||||
/* unconsumed answers */
|
/* unconsumed answers */
|
||||||
@ -1104,10 +1104,10 @@
|
|||||||
#endif /* MODE_DIRECTED_TABLING */
|
#endif /* MODE_DIRECTED_TABLING */
|
||||||
ans_node = TrNode_child(ans_node);
|
ans_node = TrNode_child(ans_node);
|
||||||
DepFr_last_answer(dep_fr) = ans_node;
|
DepFr_last_answer(dep_fr) = ans_node;
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
consume_answer_and_procceed(dep_fr, ans_node);
|
consume_answer_and_procceed(dep_fr, ans_node);
|
||||||
}
|
}
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (B == DepFr_leader_cp(LOCAL_top_dep_fr)) {
|
if (B == DepFr_leader_cp(LOCAL_top_dep_fr)) {
|
||||||
@ -1146,7 +1146,7 @@
|
|||||||
/* check for dependency frames with unconsumed answers */
|
/* check for dependency frames with unconsumed answers */
|
||||||
dep_fr = DepFr_next(dep_fr);
|
dep_fr = DepFr_next(dep_fr);
|
||||||
while (YOUNGER_CP(DepFr_cons_cp(dep_fr), chain_cp)) {
|
while (YOUNGER_CP(DepFr_cons_cp(dep_fr), chain_cp)) {
|
||||||
LOCK(DepFr_lock(dep_fr));
|
LOCK_DEP_FR(dep_fr);
|
||||||
ans_node = DepFr_last_answer(dep_fr);
|
ans_node = DepFr_last_answer(dep_fr);
|
||||||
if (TrNode_child(ans_node)) {
|
if (TrNode_child(ans_node)) {
|
||||||
/* dependency frame with unconsumed answers */
|
/* dependency frame with unconsumed answers */
|
||||||
@ -1167,7 +1167,7 @@
|
|||||||
if (YOUNGER_CP(DepFr_backchain_cp(dep_fr), top_chain_cp))
|
if (YOUNGER_CP(DepFr_backchain_cp(dep_fr), top_chain_cp))
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
DepFr_backchain_cp(dep_fr) = top_chain_cp;
|
DepFr_backchain_cp(dep_fr) = top_chain_cp;
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
|
|
||||||
chain_cp = DepFr_cons_cp(dep_fr);
|
chain_cp = DepFr_cons_cp(dep_fr);
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
@ -1243,7 +1243,7 @@
|
|||||||
TRAIL_LINK(B->cp_tr);
|
TRAIL_LINK(B->cp_tr);
|
||||||
consume_answer_and_procceed(dep_fr, ans_node);
|
consume_answer_and_procceed(dep_fr, ans_node);
|
||||||
}
|
}
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
dep_fr = DepFr_next(dep_fr);
|
dep_fr = DepFr_next(dep_fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1400,7 +1400,7 @@
|
|||||||
/* check for dependency frames with unconsumed answers */
|
/* check for dependency frames with unconsumed answers */
|
||||||
dep_fr = LOCAL_top_dep_fr;
|
dep_fr = LOCAL_top_dep_fr;
|
||||||
while (YOUNGER_CP(DepFr_cons_cp(dep_fr), B)) {
|
while (YOUNGER_CP(DepFr_cons_cp(dep_fr), B)) {
|
||||||
LOCK(DepFr_lock(dep_fr));
|
LOCK_DEP_FR(dep_fr);
|
||||||
ans_node = DepFr_last_answer(dep_fr);
|
ans_node = DepFr_last_answer(dep_fr);
|
||||||
if (TrNode_child(ans_node)) {
|
if (TrNode_child(ans_node)) {
|
||||||
/* dependency frame with unconsumed answers */
|
/* dependency frame with unconsumed answers */
|
||||||
@ -1428,7 +1428,7 @@
|
|||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
DepFr_backchain_cp(dep_fr) = B->cp_b;
|
DepFr_backchain_cp(dep_fr) = B->cp_b;
|
||||||
}
|
}
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
|
|
||||||
#ifdef DEBUG_OPTYAP
|
#ifdef DEBUG_OPTYAP
|
||||||
if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) {
|
if (GLOBAL_parallel_mode == PARALLEL_MODE_RUNNING) {
|
||||||
@ -1479,7 +1479,7 @@
|
|||||||
TRAIL_LINK(B->cp_tr);
|
TRAIL_LINK(B->cp_tr);
|
||||||
consume_answer_and_procceed(dep_fr, ans_node);
|
consume_answer_and_procceed(dep_fr, ans_node);
|
||||||
}
|
}
|
||||||
UNLOCK(DepFr_lock(dep_fr));
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
DepFr_timestamp(dep_fr) = timestamp;
|
DepFr_timestamp(dep_fr) = timestamp;
|
||||||
#endif /* TIMESTAMP_CHECK */
|
#endif /* TIMESTAMP_CHECK */
|
||||||
@ -1569,7 +1569,7 @@
|
|||||||
TR = B->cp_tr;
|
TR = B->cp_tr;
|
||||||
SET_BB(B);
|
SET_BB(B);
|
||||||
LOCK_OR_FRAME(LOCAL_top_or_fr);
|
LOCK_OR_FRAME(LOCAL_top_or_fr);
|
||||||
LOCK(DepFr_lock(LOCAL_top_dep_fr));
|
LOCK_DEP_FR(LOCAL_top_dep_fr);
|
||||||
ans_node = DepFr_last_answer(LOCAL_top_dep_fr);
|
ans_node = DepFr_last_answer(LOCAL_top_dep_fr);
|
||||||
if (TrNode_child(ans_node)) {
|
if (TrNode_child(ans_node)) {
|
||||||
/* unconsumed answers */
|
/* unconsumed answers */
|
||||||
@ -1587,11 +1587,11 @@
|
|||||||
#endif /* MODE_DIRECTED_TABLING */
|
#endif /* MODE_DIRECTED_TABLING */
|
||||||
ans_node = TrNode_child(ans_node);
|
ans_node = TrNode_child(ans_node);
|
||||||
DepFr_last_answer(LOCAL_top_dep_fr) = ans_node;
|
DepFr_last_answer(LOCAL_top_dep_fr) = ans_node;
|
||||||
UNLOCK(DepFr_lock(LOCAL_top_dep_fr));
|
UNLOCK_DEP_FR(LOCAL_top_dep_fr);
|
||||||
consume_answer_and_procceed(LOCAL_top_dep_fr, ans_node);
|
consume_answer_and_procceed(LOCAL_top_dep_fr, ans_node);
|
||||||
}
|
}
|
||||||
/* no unconsumed answers */
|
/* no unconsumed answers */
|
||||||
UNLOCK(DepFr_lock(LOCAL_top_dep_fr));
|
UNLOCK_DEP_FR(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( GetOrFr_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)) );
|
||||||
@ -1679,10 +1679,10 @@
|
|||||||
GONext();
|
GONext();
|
||||||
} else {
|
} else {
|
||||||
/* execute compiled code from the trie */
|
/* execute compiled code from the trie */
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_state(sg_fr) < compiled)
|
if (SgFr_state(sg_fr) < compiled)
|
||||||
update_answer_trie(sg_fr);
|
update_answer_trie(sg_fr);
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
|
||||||
PREFETCH_OP(PREG);
|
PREFETCH_OP(PREG);
|
||||||
*--YENV = 0; /* vars_arity */
|
*--YENV = 0; /* vars_arity */
|
||||||
|
@ -254,6 +254,7 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
SgFr_gen_worker(SG_FR) = worker_id; \
|
SgFr_gen_worker(SG_FR) = worker_id; \
|
||||||
SgFr_gen_top_or_fr(SG_FR) = LOCAL_top_or_fr
|
SgFr_gen_top_or_fr(SG_FR) = LOCAL_top_or_fr
|
||||||
#define DepFr_init_yapor_fields(DEP_FR, DEP_ON_STACK, TOP_OR_FR) \
|
#define DepFr_init_yapor_fields(DEP_FR, DEP_ON_STACK, TOP_OR_FR) \
|
||||||
|
INIT_LOCK_DEP_FR(DEP_FR); \
|
||||||
DepFr_leader_dep_is_on_stack(DEP_FR) = DEP_ON_STACK; \
|
DepFr_leader_dep_is_on_stack(DEP_FR) = DEP_ON_STACK; \
|
||||||
DepFr_top_or_fr(DEP_FR) = TOP_OR_FR; \
|
DepFr_top_or_fr(DEP_FR) = TOP_OR_FR; \
|
||||||
DepFr_init_timestamp_field(DEP_FR)
|
DepFr_init_timestamp_field(DEP_FR)
|
||||||
@ -292,6 +293,28 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define AnsHash_init_previous_field(HASH, SG_FR)
|
#define AnsHash_init_previous_field(HASH, SG_FR)
|
||||||
#endif /* MODE_DIRECTED_TABLING */
|
#endif /* MODE_DIRECTED_TABLING */
|
||||||
|
|
||||||
|
#if defined(YAPOR) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||||
|
#define INIT_LOCK_SG_FR(SG_FR) INIT_LOCK(SgFr_lock(SG_FR))
|
||||||
|
#define LOCK_SG_FR(SG_FR) LOCK(SgFr_lock(SG_FR))
|
||||||
|
#define UNLOCK_SG_FR(SG_FR) UNLOCK(SgFr_lock(SG_FR))
|
||||||
|
#else
|
||||||
|
#define INIT_LOCK_SG_FR(SG_FR)
|
||||||
|
#define LOCK_SG_FR(SG_FR)
|
||||||
|
#define UNLOCK_SG_FR(SG_FR)
|
||||||
|
#endif /* YAPOR || THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
|
||||||
|
|
||||||
|
#ifdef YAPOR
|
||||||
|
#define INIT_LOCK_DEP_FR(DEP_FR) INIT_LOCK(DepFr_lock(DEP_FR))
|
||||||
|
#define LOCK_DEP_FR(DEP_FR) LOCK(DepFr_lock(DEP_FR))
|
||||||
|
#define UNLOCK_DEP_FR(DEP_FR) UNLOCK(DepFr_lock(DEP_FR))
|
||||||
|
#define IS_UNLOCKED_DEP_FR(DEP_FR) IS_UNLOCKED(DepFr_lock(DEP_FR))
|
||||||
|
#else
|
||||||
|
#define INIT_LOCK_DEP_FR(DEF_FR)
|
||||||
|
#define LOCK_DEP_FR(DEP_FR)
|
||||||
|
#define UNLOCK_DEP_FR(DEP_FR)
|
||||||
|
#define IS_UNLOCKED_DEP_FR(DEP_FR)
|
||||||
|
#endif /* YAPOR */
|
||||||
|
|
||||||
#ifdef SUBGOAL_TRIE_LOCK_AT_ENTRY_LEVEL
|
#ifdef SUBGOAL_TRIE_LOCK_AT_ENTRY_LEVEL
|
||||||
#define LOCK_SUBGOAL_TRIE(TAB_ENT) LOCK(TabEnt_lock(TAB_ENT))
|
#define LOCK_SUBGOAL_TRIE(TAB_ENT) LOCK(TabEnt_lock(TAB_ENT))
|
||||||
#define UNLOCK_SUBGOAL_TRIE(TAB_ENT) UNLOCK(TabEnt_lock(TAB_ENT))
|
#define UNLOCK_SUBGOAL_TRIE(TAB_ENT) UNLOCK(TabEnt_lock(TAB_ENT))
|
||||||
@ -309,8 +332,8 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#endif /* SUBGOAL_TRIE_LOCK_AT_ENTRY_LEVEL */
|
#endif /* SUBGOAL_TRIE_LOCK_AT_ENTRY_LEVEL */
|
||||||
|
|
||||||
#ifdef ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL
|
#ifdef ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL
|
||||||
#define LOCK_ANSWER_TRIE(SG_FR) LOCK(SgFr_lock(SG_FR))
|
#define LOCK_ANSWER_TRIE(SG_FR) LOCK_SG_FR(SG_FR)
|
||||||
#define UNLOCK_ANSWER_TRIE(SG_FR) UNLOCK(SgFr_lock(SG_FR))
|
#define UNLOCK_ANSWER_TRIE(SG_FR) UNLOCK_SG_FR(SG_FR)
|
||||||
#define AnsHash_init_chain_fields(HASH, SG_FR) \
|
#define AnsHash_init_chain_fields(HASH, SG_FR) \
|
||||||
AnsHash_init_previous_field(HASH, SG_FR); \
|
AnsHash_init_previous_field(HASH, SG_FR); \
|
||||||
Hash_next(HASH) = SgFr_hash_chain(SG_FR); \
|
Hash_next(HASH) = SgFr_hash_chain(SG_FR); \
|
||||||
@ -319,18 +342,18 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define LOCK_ANSWER_TRIE(SG_FR)
|
#define LOCK_ANSWER_TRIE(SG_FR)
|
||||||
#define UNLOCK_ANSWER_TRIE(SG_FR)
|
#define UNLOCK_ANSWER_TRIE(SG_FR)
|
||||||
#define AnsHash_init_chain_fields(HASH, SG_FR) \
|
#define AnsHash_init_chain_fields(HASH, SG_FR) \
|
||||||
LOCK(SgFr_lock(SG_FR)); \
|
LOCK_SG_FR(SG_FR); \
|
||||||
AnsHash_init_previous_field(HASH, SG_FR); \
|
AnsHash_init_previous_field(HASH, SG_FR); \
|
||||||
Hash_next(HASH) = SgFr_hash_chain(SG_FR); \
|
Hash_next(HASH) = SgFr_hash_chain(SG_FR); \
|
||||||
SgFr_hash_chain(SG_FR) = HASH; \
|
SgFr_hash_chain(SG_FR) = HASH; \
|
||||||
UNLOCK(SgFr_lock(SG_FR))
|
UNLOCK_SG_FR(SG_FR)
|
||||||
#endif /* ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL */
|
#endif /* ANSWER_TRIE_LOCK_AT_ENTRY_LEVEL */
|
||||||
|
|
||||||
#ifdef SUBGOAL_TRIE_LOCK_USING_NODE_FIELD
|
#ifdef SUBGOAL_TRIE_LOCK_USING_NODE_FIELD
|
||||||
#define LOCK_SUBGOAL_NODE(NODE) LOCK(TrNode_lock(NODE))
|
#define LOCK_SUBGOAL_NODE(NODE) LOCK(TrNode_lock(NODE))
|
||||||
#define UNLOCK_SUBGOAL_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
#define UNLOCK_SUBGOAL_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
||||||
#define SgNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
#define SgNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
||||||
#elif SUBGOAL_TRIE_LOCK_USING_GLOBAL_ARRAY
|
#elif defined(SUBGOAL_TRIE_LOCK_USING_GLOBAL_ARRAY)
|
||||||
#define LOCK_SUBGOAL_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
#define LOCK_SUBGOAL_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define UNLOCK_SUBGOAL_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
#define UNLOCK_SUBGOAL_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define SgNode_init_lock_field(NODE)
|
#define SgNode_init_lock_field(NODE)
|
||||||
@ -344,7 +367,7 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define LOCK_ANSWER_NODE(NODE) LOCK(TrNode_lock(NODE))
|
#define LOCK_ANSWER_NODE(NODE) LOCK(TrNode_lock(NODE))
|
||||||
#define UNLOCK_ANSWER_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
#define UNLOCK_ANSWER_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
||||||
#define AnsNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
#define AnsNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
||||||
#elif ANSWER_TRIE_LOCK_USING_GLOBAL_ARRAY
|
#elif defined(ANSWER_TRIE_LOCK_USING_GLOBAL_ARRAY)
|
||||||
#define LOCK_ANSWER_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
#define LOCK_ANSWER_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define UNLOCK_ANSWER_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
#define UNLOCK_ANSWER_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define AnsNode_init_lock_field(NODE)
|
#define AnsNode_init_lock_field(NODE)
|
||||||
@ -358,7 +381,7 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
#define LOCK_GLOBAL_NODE(NODE) LOCK(TrNode_lock(NODE))
|
#define LOCK_GLOBAL_NODE(NODE) LOCK(TrNode_lock(NODE))
|
||||||
#define UNLOCK_GLOBAL_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
#define UNLOCK_GLOBAL_NODE(NODE) UNLOCK(TrNode_lock(NODE))
|
||||||
#define GtNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
#define GtNode_init_lock_field(NODE) INIT_LOCK(TrNode_lock(NODE))
|
||||||
#elif GLOBAL_TRIE_LOCK_USING_GLOBAL_ARRAY
|
#elif defined(GLOBAL_TRIE_LOCK_USING_GLOBAL_ARRAY)
|
||||||
#define LOCK_GLOBAL_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
#define LOCK_GLOBAL_NODE(NODE) LOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define UNLOCK_GLOBAL_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
#define UNLOCK_GLOBAL_NODE(NODE) UNLOCK(HASH_TRIE_LOCK(NODE))
|
||||||
#define GtNode_init_lock_field(NODE)
|
#define GtNode_init_lock_field(NODE)
|
||||||
@ -398,7 +421,7 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
{ register ans_node_ptr ans_node; \
|
{ register ans_node_ptr ans_node; \
|
||||||
new_answer_trie_node(ans_node, 0, 0, NULL, NULL, NULL); \
|
new_answer_trie_node(ans_node, 0, 0, NULL, NULL, NULL); \
|
||||||
ALLOC_SUBGOAL_FRAME(SG_FR); \
|
ALLOC_SUBGOAL_FRAME(SG_FR); \
|
||||||
INIT_LOCK(SgFr_lock(SG_FR)); \
|
INIT_LOCK_SG_FR(SG_FR); \
|
||||||
SgFr_code(SG_FR) = CODE; \
|
SgFr_code(SG_FR) = CODE; \
|
||||||
SgFr_state(SG_FR) = ready; \
|
SgFr_state(SG_FR) = ready; \
|
||||||
SgFr_hash_chain(SG_FR) = NULL; \
|
SgFr_hash_chain(SG_FR) = NULL; \
|
||||||
@ -417,7 +440,6 @@ static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames(tg_sol_fr_ptr, int);
|
|||||||
|
|
||||||
#define new_dependency_frame(DEP_FR, DEP_ON_STACK, TOP_OR_FR, LEADER_CP, CONS_CP, SG_FR, NEXT) \
|
#define new_dependency_frame(DEP_FR, DEP_ON_STACK, TOP_OR_FR, LEADER_CP, CONS_CP, SG_FR, NEXT) \
|
||||||
ALLOC_DEPENDENCY_FRAME(DEP_FR); \
|
ALLOC_DEPENDENCY_FRAME(DEP_FR); \
|
||||||
INIT_LOCK(DepFr_lock(DEP_FR)); \
|
|
||||||
DepFr_init_yapor_fields(DEP_FR, DEP_ON_STACK, TOP_OR_FR); \
|
DepFr_init_yapor_fields(DEP_FR, DEP_ON_STACK, TOP_OR_FR); \
|
||||||
DepFr_backchain_cp(DEP_FR) = NULL; \
|
DepFr_backchain_cp(DEP_FR) = NULL; \
|
||||||
DepFr_leader_cp(DEP_FR) = NORM_CP(LEADER_CP); \
|
DepFr_leader_cp(DEP_FR) = NORM_CP(LEADER_CP); \
|
||||||
@ -584,9 +606,9 @@ static inline void adjust_freeze_registers(void) {
|
|||||||
|
|
||||||
|
|
||||||
static inline void mark_as_completed(sg_fr_ptr sg_fr) {
|
static inline void mark_as_completed(sg_fr_ptr sg_fr) {
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
SgFr_state(sg_fr) = complete;
|
SgFr_state(sg_fr) = complete;
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
#ifdef MODE_DIRECTED_TABLING
|
#ifdef MODE_DIRECTED_TABLING
|
||||||
if (SgFr_invalid_chain(sg_fr)) {
|
if (SgFr_invalid_chain(sg_fr)) {
|
||||||
ans_node_ptr current_node, next_node;
|
ans_node_ptr current_node, next_node;
|
||||||
@ -805,23 +827,23 @@ static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
|||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
sg_fr = LOCAL_top_sg_fr;
|
sg_fr = LOCAL_top_sg_fr;
|
||||||
LOCAL_top_sg_fr = SgFr_next(sg_fr);
|
LOCAL_top_sg_fr = SgFr_next(sg_fr);
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_first_answer(sg_fr) == NULL) {
|
if (SgFr_first_answer(sg_fr) == NULL) {
|
||||||
/* no answers --> ready */
|
/* no answers --> ready */
|
||||||
SgFr_state(sg_fr) = ready;
|
SgFr_state(sg_fr) = ready;
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
} else if (SgFr_first_answer(sg_fr) == SgFr_answer_trie(sg_fr)) {
|
} else if (SgFr_first_answer(sg_fr) == SgFr_answer_trie(sg_fr)) {
|
||||||
/* yes answer --> complete */
|
/* yes answer --> complete */
|
||||||
#ifndef TABLING_EARLY_COMPLETION
|
#ifndef TABLING_EARLY_COMPLETION
|
||||||
/* with early completion, at this point the subgoal should be already completed */
|
/* with early completion, at this point the subgoal should be already completed */
|
||||||
SgFr_state(sg_fr) = complete;
|
SgFr_state(sg_fr) = complete;
|
||||||
#endif /* TABLING_EARLY_COMPLETION */
|
#endif /* TABLING_EARLY_COMPLETION */
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
} else {
|
} else {
|
||||||
/* answers --> incomplete/ready */
|
/* answers --> incomplete/ready */
|
||||||
#ifdef INCOMPLETE_TABLING
|
#ifdef INCOMPLETE_TABLING
|
||||||
SgFr_state(sg_fr) = incomplete;
|
SgFr_state(sg_fr) = incomplete;
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
#ifdef MODE_DIRECTED_TABLING
|
#ifdef MODE_DIRECTED_TABLING
|
||||||
if (SgFr_invalid_chain(sg_fr)) {
|
if (SgFr_invalid_chain(sg_fr)) {
|
||||||
ans_node_ptr current_node, next_node;
|
ans_node_ptr current_node, next_node;
|
||||||
@ -865,7 +887,7 @@ static inline void abolish_incomplete_subgoals(choiceptr prune_cp) {
|
|||||||
SgFr_last_answer(sg_fr) = NULL;
|
SgFr_last_answer(sg_fr) = NULL;
|
||||||
node = TrNode_child(SgFr_answer_trie(sg_fr));
|
node = TrNode_child(SgFr_answer_trie(sg_fr));
|
||||||
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL;
|
TrNode_child(SgFr_answer_trie(sg_fr)) = NULL;
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
free_answer_trie(node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
free_answer_trie(node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
|
||||||
#if defined(MODE_DIRECTED_TABLING) && ! defined(YAPOR)
|
#if defined(MODE_DIRECTED_TABLING) && ! defined(YAPOR)
|
||||||
/* free invalid answer nodes */
|
/* free invalid answer nodes */
|
||||||
@ -1098,14 +1120,14 @@ static inline void CUT_validate_tg_answers(tg_sol_fr_ptr valid_solutions) {
|
|||||||
FREE_TG_SOLUTION_FRAME(free_solution);
|
FREE_TG_SOLUTION_FRAME(free_solution);
|
||||||
} while (ltt_valid_solutions);
|
} while (ltt_valid_solutions);
|
||||||
if (first_answer) {
|
if (first_answer) {
|
||||||
LOCK(SgFr_lock(sg_fr));
|
LOCK_SG_FR(sg_fr);
|
||||||
if (SgFr_first_answer(sg_fr) == NULL) {
|
if (SgFr_first_answer(sg_fr) == NULL) {
|
||||||
SgFr_first_answer(sg_fr) = first_answer;
|
SgFr_first_answer(sg_fr) = first_answer;
|
||||||
} else {
|
} else {
|
||||||
TrNode_child(SgFr_last_answer(sg_fr)) = first_answer;
|
TrNode_child(SgFr_last_answer(sg_fr)) = first_answer;
|
||||||
}
|
}
|
||||||
SgFr_last_answer(sg_fr) = last_answer;
|
SgFr_last_answer(sg_fr) = last_answer;
|
||||||
UNLOCK(SgFr_lock(sg_fr));
|
UNLOCK_SG_FR(sg_fr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -49,7 +49,6 @@ typedef struct table_entry {
|
|||||||
#define TabEnt_mode_directed(X) ((X)->mode_directed_array)
|
#define TabEnt_mode_directed(X) ((X)->mode_directed_array)
|
||||||
#ifdef THREADS_NO_SHARING
|
#ifdef THREADS_NO_SHARING
|
||||||
#define TabEnt_subgoal_trie(X) ((X)->subgoal_trie[worker_id])
|
#define TabEnt_subgoal_trie(X) ((X)->subgoal_trie[worker_id])
|
||||||
// ricroc: error tabling+threads
|
|
||||||
//#define TabEnt_subgoal_trie(X,I) ((X)->subgoal_trie[I])
|
//#define TabEnt_subgoal_trie(X,I) ((X)->subgoal_trie[I])
|
||||||
#else
|
#else
|
||||||
#define TabEnt_subgoal_trie(X) ((X)->subgoal_trie)
|
#define TabEnt_subgoal_trie(X) ((X)->subgoal_trie)
|
||||||
@ -243,9 +242,7 @@ typedef enum { /* do not change order !!! */
|
|||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
typedef struct subgoal_entry {
|
typedef struct subgoal_entry {
|
||||||
// ricroc: error tabling+threads
|
#if defined(YAPOR) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||||
//#if defined(YAPOR) || defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar lock;
|
lockvar lock;
|
||||||
#endif /* YAPOR || THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
|
#endif /* YAPOR || THREADS_FULL_SHARING || THREADS_CONSUMER_SHARING */
|
||||||
yamop *code_of_subgoal;
|
yamop *code_of_subgoal;
|
||||||
@ -386,12 +383,8 @@ typedef struct subgoal_frame {
|
|||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
typedef struct dependency_frame {
|
typedef struct dependency_frame {
|
||||||
// ricroc: error tabling+threads
|
|
||||||
//#ifdef YAPOR
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar lock;
|
|
||||||
#endif /* YAPOR */
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
lockvar lock;
|
||||||
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
|
||||||
|
Reference in New Issue
Block a user