Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Vítor Santos Costa 2011-04-22 12:21:38 +01:00
commit f49459fcfc
13 changed files with 121 additions and 117 deletions

View File

@ -3159,7 +3159,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
#endif /* TABLING */
#ifdef TABLING_INNER_CUTS
case clause_with_cut_op:
code_p = a_e(_clause_with_cut, code_p);
code_p = a_e(_clause_with_cut, code_p, pass_no);
break;
#endif /* TABLING_INNER_CUTS */
#ifdef SFUNC

View File

@ -1245,7 +1245,7 @@ p_b_setval( USES_REGS1 )
return TRUE;
#else
WRITE_UNLOCK(ge->GRWLock);
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR,t,"update_array");
return FALSE;
#endif
}

View File

@ -28,7 +28,7 @@
#if HAVE_STRING_H
#include <string.h>
#endif
#if THREADS && !defined(TABLING)
#if YAPOR_THREADS
#include <opt.mavar.h>
#endif

43
H/Yap.h
View File

@ -22,18 +22,23 @@
#if (defined(YAPOR_COPY) && (defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS))) || (defined(YAPOR_COW) && (defined(YAPOR_SBA) || defined(YAPOR_THREADS))) || (defined(YAPOR_SBA) && defined(YAPOR_THREADS))
#error Do not define multiple or-parallel models
#endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA)) || (YAPOR_COW && YAPOR_SBA) */
#endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA || YAPOR_THREADS)) || (YAPOR_COW && (YAPOR_SBA || YAPOR_THREADS)) || (YAPOR_SBA || YAPOR_THREADS) */
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
#define YAPOR 1
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
#define FIXED_STACKS 1
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA || YAPOR_THREADS */
#if defined(TABLING) && (defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS))
#error Currently TABLING only works with YAPOR_COPY
#error TABLING only works with YAPOR_COPY
#endif /* TABLING && (YAPOR_COW || YAPOR_SBA || YAPOR_THREADS) */
#if defined(THREADS) && (defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_COPY))
#error THREADS only works with YAPOR_THREADS
#endif /* THREADS && (YAPOR_COW || YAPOR_SBA || YAPOR_COPY) */
#include "config.h"
#if defined(YAPOR) || defined(TABLING) || defined(THREADS)
#if defined(YAPOR) || defined(TABLING)
#include "opt.config.h"
#endif /* YAPOR || TABLING */
@ -51,27 +56,23 @@
#define MULTI_ASSIGNMENT_VARIABLES 1
#ifdef YAPOR
#define FIXED_STACKS 1
#ifdef THREADS
#undef YAPOR_COW
#undef YAPOR_SBA
#undef YAPOR_COPY
#endif
#endif /* YAPOR */
#if defined(YAPOR) || defined(THREADS)
#define MULTIPLE_STACKS 1
#endif
#if defined(YAPOR) || defined(THREADS)
#define PARALLEL_YAP 1
#endif
#endif /* YAPOR || THREADS */
#if defined(YAPOR) || defined(TABLING)
#undef TRAILING_REQUIRES_BRANCH
#endif /* YAPOR || TABLING */
#if defined(TABLING) || defined(YAPOR_SBA)
#define FROZEN_STACKS 1
#endif /* TABLING || YAPOR_SBA */
#if defined(THREADS) || defined(SUPPORT_CONDOR)
#define USE_SYSTEM_MALLOC 1
#endif /* THREADS || SUPPORT_CONDOR */
#ifdef ANALYST
#ifdef USE_THREADED_CODE
#undef USE_THREADED_CODE
@ -84,14 +85,6 @@
#endif
#endif
#if defined(THREADS) || defined(SUPPORT_CONDOR)
#define USE_SYSTEM_MALLOC 1
#endif
#if defined(TABLING) || defined(YAPOR_YAPOR_SBA)
#define FROZEN_STACKS 1
#endif /* TABLING || YAPOR_YAPOR_SBA */
#ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */
/* adjust a config.h from mingw32 to work with vc++ */
#ifdef HAVE_GCC

View File

@ -21,12 +21,9 @@
** memory alloc scheme (mandatory, define one) **
**********************************************************/
#ifdef USE_SYSTEM_MALLOC
#define MALLOC_MEMORY_ALLOC_SCHEME 1
#else
#define YAP_MEMORY_ALLOC_SCHEME 1
#endif
/* #define SHM_MEMORY_ALLOC_SCHEME 1 */
/* #define MALLOC_MEMORY_ALLOC_SCHEME 1 */
/* #define OPTYAP_PAGES_MEMORY_ALLOC_SCHEME 1 */
@ -156,20 +153,23 @@
** Parameter Checks **
************************************************************************/
#if !defined(SHM_MEMORY_ALLOC_SCHEME) && !defined(MALLOC_MEMORY_ALLOC_SCHEME) && !defined(YAP_MEMORY_ALLOC_SCHEME)
#if !defined(OPTYAP_PAGES_MEMORY_ALLOC_SCHEME) && !defined(MALLOC_MEMORY_ALLOC_SCHEME) && !defined(YAP_MEMORY_ALLOC_SCHEME)
#error Define a memory alloc scheme
#endif /* !SHM_MEMORY_ALLOC_SCHEME && !MALLOC_MEMORY_ALLOC_SCHEME && !YAP_MEMORY_ALLOC_SCHEME */
#if defined(SHM_MEMORY_ALLOC_SCHEME)
#if defined(MALLOC_MEMORY_ALLOC_SCHEME) || defined(YAP_MEMORY_ALLOC_SCHEME)
#endif /* !OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && !MALLOC_MEMORY_ALLOC_SCHEME && !YAP_MEMORY_ALLOC_SCHEME */
#if (defined(OPTYAP_PAGES_MEMORY_ALLOC_SCHEME) && (defined(MALLOC_MEMORY_ALLOC_SCHEME) || defined(YAP_MEMORY_ALLOC_SCHEME))) || (defined(MALLOC_MEMORY_ALLOC_SCHEME) && defined(YAP_MEMORY_ALLOC_SCHEME))
#error Do not define multiple memory alloc schemes
#endif /* MALLOC_MEMORY_ALLOC_SCHEME || YAP_MEMORY_ALLOC_SCHEME */
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#if defined(MALLOC_MEMORY_ALLOC_SCHEME) && defined(YAP_MEMORY_ALLOC_SCHEME)
#error Do not define multiple memory alloc schemes
#endif /* MALLOC_MEMORY_ALLOC_SCHEME && YAP_MEMORY_ALLOC_SCHEME */
#endif /* (OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && (MALLOC_MEMORY_ALLOC_SCHEME || YAP_MEMORY_ALLOC_SCHEME)) || (MALLOC_MEMORY_ALLOC_SCHEME && YAP_MEMORY_ALLOC_SCHEME) */
#ifdef USE_SYSTEM_MALLOC
#define MALLOC_MEMORY_ALLOC_SCHEME 1
#undef YAP_MEMORY_ALLOC_SCHEME
#undef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#endif /* USE_SYSTEM_MALLOC */
#if defined(YAPOR) && defined(MALLOC_MEMORY_ALLOC_SCHEME)
#error YAPOR is incompatible with MALLOC_MEMORY_ALLOC_SCHEME
#endif /* YAPOR && TABLING && (MALLOC_MEMORY_ALLOC_SCHEME || YAP_MEMORY_ALLOC_SCHEME) */
#endif /* YAPOR && MALLOC_MEMORY_ALLOC_SCHEME */
#ifndef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#undef LIMIT_TABLING
#endif /* !OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
#ifdef YAPOR
#ifdef i386 /* For i386 machines we use shared memory segments */
@ -237,10 +237,6 @@
#undef DEBUG_TABLING
#endif /* !TABLING */
#ifndef SHM_MEMORY_ALLOC_SCHEME
#undef LIMIT_TABLING
#endif /* !SHM_MEMORY_ALLOC_SCHEME */
#if defined(DEBUG_YAPOR) && defined(DEBUG_TABLING)
#define DEBUG_OPTYAP
#endif /* DEBUG_YAPOR && DEBUG_TABLING */

View File

@ -40,7 +40,7 @@
** Macros **
*********************/
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#define STRUCTS_PER_PAGE(STR_TYPE) ((Yap_page_size - STRUCT_SIZE(struct page_header)) / STRUCT_SIZE(STR_TYPE))
#define INIT_PAGES(PG, STR_TYPE) \
@ -51,7 +51,7 @@
Pg_free_pg(PG) = NULL
#else
#define INIT_PAGES(PG, STR_TYPE) Pg_str_in_use(PG) = 0
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */

View File

@ -17,9 +17,9 @@
extern int Yap_page_size;
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#include <sys/shm.h>
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
#define SHMMAX 0x2000000 /* 32 Mbytes: works fine with linux */
/* #define SHMMAX 0x400000 - 4 Mbytes: shmget limit for Mac (?) */
@ -91,10 +91,10 @@ extern int Yap_page_size;
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) \
UPDATE_STATS(Pg_str_in_use(STR_PAGES), -1); \
FREE_BLOCK(STR)
#elif SHM_MEMORY_ALLOC_SCHEME
#elif OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef LIMIT_TABLING
/*************************************************************************************************
** SHM_MEMORY_ALLOC_SCHEME && LIMIT_TABLING **
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && LIMIT_TABLING **
*************************************************************************************************/
#define INIT_PAGE(PG_HD, STR_PAGES, STR_TYPE) \
{ int i; \
@ -233,7 +233,7 @@ extern int Yap_page_size;
LOCAL_next_free_ans_node = STRUCT_NEXT(STR)
#else
/*************************************************************************************************
** SHM_MEMORY_ALLOC_SCHEME && !LIMIT_TABLING **
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME && !LIMIT_TABLING **
*************************************************************************************************/
#define ALLOC_PAGE(PG_HD) \
LOCK(Pg_lock(Yap_pages_void)); \
@ -329,7 +329,7 @@ extern int Yap_page_size;
LOCAL_next_free_ans_node = STRUCT_NEXT(STR)
#endif /* LIMIT_TABLING */
/*************************************************************************************************
** SHM_MEMORY_ALLOC_SCHEME **
** OPTYAP_PAGES_MEMORY_ALLOC_SCHEME **
*************************************************************************************************/
#define FREE_PAGE(PG_HD) \
LOCK(Pg_lock(Yap_pages_void)); \

View File

@ -84,4 +84,9 @@ Yap_NEW_MAHASH(ma_h_inner_struct *top) {
LOCAL_ma_h_top = top;
return time;
}
#else
#define Yap_MAVAR_HASH(addr)
#define Yap_ALLOC_NEW_MASPACE()
#define Yap_lookup_ma_var(addr)
#define Yap_NEW_MAHASH(top)
#endif /* MULTI_ASSIGNMENT_VARIABLES */

View File

@ -477,14 +477,14 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
aux_bytes += show_statistics_global_trie_hashes();
fprintf(Yap_stdout, " Memory in use (III): %10ld bytes\n\n", aux_bytes);
total_bytes += aux_bytes;
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
total_bytes, Pg_str_in_use(Yap_pages_void));
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
#else
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return (TRUE);
}
@ -713,14 +713,14 @@ static Int p_show_statistics_or( USES_REGS1 ) {
aux_bytes += show_statistics_query_goal_answer_frames();
fprintf(Yap_stdout, " Memory in use (II): %10ld bytes\n\n", aux_bytes);
total_bytes += aux_bytes;
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes (%ld pages in use)\n",
total_bytes, Pg_str_in_use(Yap_pages_void));
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
#else
fprintf(Yap_stdout, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return (TRUE);
}
@ -769,14 +769,14 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
#endif /* TABLING_INNER_CUTS */
fprintf(Yap_stdout, " Memory in use (IV): %10ld bytes\n\n", aux_bytes);
total_bytes += aux_bytes;
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes (%ld pages in use)\n",
total_bytes, Pg_str_in_use(Yap_pages_void));
fprintf(Yap_stdout, "Total memory allocated: %10ld bytes (%ld pages in total)\n",
Pg_pg_alloc(Yap_pages_void) * Yap_page_size, Pg_pg_alloc(Yap_pages_void));
#else
fprintf(Yap_stdout, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return (TRUE);
}
@ -813,11 +813,11 @@ static Int p_get_optyap_statistics( USES_REGS1 ) {
bytes += Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
#endif /* TABLING_INNER_CUTS */
#endif /* YAPOR && TABLING */
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
structs = Pg_pg_alloc(Yap_pages_void) * Yap_page_size;
#else
structs = bytes;
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
}
#ifdef TABLING
if (value == 1) { /* table_entries */
@ -1025,7 +1025,7 @@ static inline void answer_to_stdout(char *answer) {
#ifdef TABLING
static inline long show_statistics_table_entries(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
tab_ent_ptr aux_ptr;
@ -1047,13 +1047,13 @@ static inline long show_statistics_table_entries(void) {
#else
fprintf(Yap_stdout, " Table entries: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry), Pg_str_in_use(Yap_pages_tab_ent));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_tab_ent) * sizeof(struct table_entry);
}
static inline long show_statistics_subgoal_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
sg_fr_ptr aux_ptr;
@ -1075,13 +1075,13 @@ static inline long show_statistics_subgoal_frames(void) {
#else
fprintf(Yap_stdout, " Subgoal frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame), Pg_str_in_use(Yap_pages_sg_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_sg_fr) * sizeof(struct subgoal_frame);
}
static inline long show_statistics_dependency_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
dep_fr_ptr aux_ptr;
@ -1103,13 +1103,13 @@ static inline long show_statistics_dependency_frames(void) {
#else
fprintf(Yap_stdout, " Dependency frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame), Pg_str_in_use(Yap_pages_dep_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_dep_fr) * sizeof(struct dependency_frame);
}
static inline long show_statistics_subgoal_trie_nodes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
sg_node_ptr aux_ptr;
@ -1131,13 +1131,13 @@ static inline long show_statistics_subgoal_trie_nodes(void) {
#else
fprintf(Yap_stdout, " Subgoal trie nodes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node), Pg_str_in_use(Yap_pages_sg_node));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_sg_node) * sizeof(struct subgoal_trie_node);
}
static inline long show_statistics_answer_trie_nodes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
ans_node_ptr aux_ptr;
@ -1159,13 +1159,13 @@ static inline long show_statistics_answer_trie_nodes(void) {
#else
fprintf(Yap_stdout, " Answer trie nodes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node), Pg_str_in_use(Yap_pages_ans_node));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_ans_node) * sizeof(struct answer_trie_node);
}
static inline long show_statistics_subgoal_trie_hashes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
sg_hash_ptr aux_ptr;
@ -1187,13 +1187,13 @@ static inline long show_statistics_subgoal_trie_hashes(void) {
#else
fprintf(Yap_stdout, " Subgoal trie hashes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash), Pg_str_in_use(Yap_pages_sg_hash));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_sg_hash) * sizeof(struct subgoal_trie_hash);
}
static inline long show_statistics_answer_trie_hashes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
ans_hash_ptr aux_ptr;
@ -1215,13 +1215,13 @@ static inline long show_statistics_answer_trie_hashes(void) {
#else
fprintf(Yap_stdout, " Answer trie hashes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash), Pg_str_in_use(Yap_pages_ans_hash));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_ans_hash) * sizeof(struct answer_trie_hash);
}
static inline long show_statistics_global_trie_nodes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
gt_node_ptr aux_ptr;
@ -1243,13 +1243,13 @@ static inline long show_statistics_global_trie_nodes(void) {
#else
fprintf(Yap_stdout, " Global trie nodes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node), Pg_str_in_use(Yap_pages_gt_node));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_gt_node) * sizeof(struct global_trie_node);
}
static inline long show_statistics_global_trie_hashes(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_TABLING
pg_hd_ptr pg_hd;
gt_hash_ptr aux_ptr;
@ -1271,7 +1271,7 @@ static inline long show_statistics_global_trie_hashes(void) {
#else
fprintf(Yap_stdout, " Global trie hashes: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash), Pg_str_in_use(Yap_pages_gt_hash));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_gt_hash) * sizeof(struct global_trie_hash);
}
#endif /* TABLING */
@ -1279,7 +1279,7 @@ static inline long show_statistics_global_trie_hashes(void) {
#ifdef YAPOR
static inline long show_statistics_or_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_YAPOR
pg_hd_ptr pg_hd;
or_fr_ptr aux_ptr;
@ -1301,13 +1301,13 @@ static inline long show_statistics_or_frames(void) {
#else
fprintf(Yap_stdout, " Or-frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame), Pg_str_in_use(Yap_pages_or_fr ));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_or_fr ) * sizeof(struct or_frame);
}
static inline long show_statistics_query_goal_solution_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_YAPOR
pg_hd_ptr pg_hd;
qg_sol_fr_ptr aux_ptr;
@ -1329,13 +1329,13 @@ static inline long show_statistics_query_goal_solution_frames(void) {
#else
fprintf(Yap_stdout, " Query goal solution frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame), Pg_str_in_use(Yap_pages_qg_sol_fr ));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_qg_sol_fr ) * sizeof(struct query_goal_solution_frame);
}
static inline long show_statistics_query_goal_answer_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_YAPOR
pg_hd_ptr pg_hd;
qg_ans_fr_ptr aux_ptr;
@ -1357,7 +1357,7 @@ static inline long show_statistics_query_goal_answer_frames(void) {
#else
fprintf(Yap_stdout, " Query goal answer frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame), Pg_str_in_use(Yap_pages_qg_ans_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_qg_ans_fr) * sizeof(struct query_goal_answer_frame);
}
#endif /* YAPOR */
@ -1365,7 +1365,7 @@ static inline long show_statistics_query_goal_answer_frames(void) {
#if defined(YAPOR) && defined(TABLING)
static inline long show_statistics_suspension_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_OPTYAP
pg_hd_ptr pg_hd;
susp_fr_ptr aux_ptr;
@ -1387,14 +1387,14 @@ static inline long show_statistics_suspension_frames(void) {
#else
fprintf(Yap_stdout, " Suspension frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame), Pg_str_in_use(Yap_pages_susp_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_susp_fr) * sizeof(struct suspension_frame);
}
#ifdef TABLING_INNER_CUTS
static inline long show_statistics_table_subgoal_solution_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_OPTYAP
pg_hd_ptr pg_hd;
tg_sol_fr_ptr aux_ptr;
@ -1416,13 +1416,13 @@ static inline long show_statistics_table_subgoal_solution_frames(void) {
#else
fprintf(Yap_stdout, " Table subgoal solution frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame), Pg_str_in_use(Yap_pages_tg_sol_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_tg_sol_fr) * sizeof(struct table_subgoal_solution_frame);
}
static inline long show_statistics_table_subgoal_answer_frames(void) {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef DEBUG_OPTYAP
pg_hd_ptr pg_hd;
tg_ans_fr_ptr aux_ptr;
@ -1444,7 +1444,7 @@ static inline long show_statistics_table_subgoal_answer_frames(void) {
#else
fprintf(Yap_stdout, " Table subgoal answer frames: %10ld bytes (%ld structs in use)\n",
Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame), Pg_str_in_use(Yap_pages_tg_ans_fr));
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
return Pg_str_in_use(Yap_pages_tg_ans_fr) * sizeof(struct table_subgoal_answer_frame);
}
#endif /* TABLING_INNER_CUTS */

View File

@ -76,14 +76,14 @@ typedef struct page_header {
***************************/
struct pages {
#ifdef SHM_MEMORY_ALLOC_SCHEME
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
#ifdef YAPOR
lockvar lock;
#endif /* YAPOR */
int structs_per_page;
struct page_header *first_free_page;
volatile long pages_allocated;
#endif /* SHM_MEMORY_ALLOC_SCHEME */
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
volatile long structs_in_use;
};

View File

@ -893,7 +893,7 @@
ltt = BRANCH_LTT(worker_id, depth);
BITMAP_intersection(members, prune_members, OrFr_members(LOCAL_top_or_fr));
if (members) {
for (i = 0; i < number_workers; i++) {
for (i = 0; i < Yap_number_workers; i++) {
if (BITMAP_member(members, i) &&
BRANCH_LTT(i, depth) > ltt &&
EQUAL_OR_YOUNGER_CP(Get_LOCAL_top_cp(), REMOTE_pruning_scope(i))) {
@ -939,7 +939,7 @@
ltt = BRANCH_LTT(worker_id, depth);
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
if (members) {
for (i = 0; i < number_workers; i++) {
for (i = 0; i < Yap_number_workers; i++) {
if (BITMAP_member(members, i) &&
BRANCH_LTT(i, depth) > ltt &&
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i)))
@ -954,7 +954,7 @@
ltt = BRANCH_LTT(worker_id, depth);
BITMAP_intersection(members, prune_members, OrFr_members(leftmost_or_fr));
if (members) {
for (i = 0; i < number_workers; i++) {
for (i = 0; i < Yap_number_workers; i++) {
if (BITMAP_member(members, i) &&
BRANCH_LTT(i, depth) > ltt &&
EQUAL_OR_YOUNGER_CP(GetOrFr_node(leftmost_or_fr), REMOTE_pruning_scope(i))) {

View File

@ -125,6 +125,9 @@ typedef struct global_trie_hash {
int number_of_buckets;
struct global_trie_node **buckets;
int number_of_nodes;
#ifdef OPTYAP_PAGES_MEMORY_ALLOC_SCHEME
struct global_trie_hash *next;
#endif /* OPTYAP_PAGES_MEMORY_ALLOC_SCHEME */
} *gt_hash_ptr;
#define Hash_mark(X) ((X)->mark)

41
configure vendored
View File

@ -1425,7 +1425,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-tabling support tabling
--enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads
--enable-or-parallelism support or-parallelism as: copy,sba,cow,threads
--enable-rational-trees support infinite rational trees
--enable-coroutining support co-routining, attributed variables and constraints
--enable-depth-limit support depth-bound computation
@ -3699,6 +3699,16 @@ fi
# Check whether --enable-or-parallelism was given.
if test "${enable_or_parallelism+set}" = set; then :
enableval=$enable_or_parallelism; orparallelism="$enableval"
case "$orparallelism" in
yes|copy|sba|cow|threads)
;;
*)
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--enable-or-parallelism=$orparallelism invalid option"; }
;;
esac
else
orparallelism=no
fi
@ -7487,42 +7497,39 @@ if test "$threads" = "yes"
YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE"
fi
case "$orparallelism" in
copy)
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--enable-or-parallelism=copy incompatible with threads"; }
;;
sba)
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=sba incompatible with threads
as_fn_error $? "--enable-or-parallelism=sba incompatible with threads"; }
;;
a-cow
See \`config.log' for more details" "$LINENO" 5 ; }
cow)
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=a-cow incompatible with threads
as_fn_error $? "--enable-or-parallelism=cow incompatible with threads"; }
;;
copy
See \`config.log' for more details" "$LINENO" 5 ; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=copy incompatible with threads
;;
yes|threads
See \`config.log' for more details" "$LINENO" 5 ; }
yes|threads)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
esac
else
case "$orparallelism" in
yes|copy)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
;;
sba)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1"
;;
a-cow)
cow)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
;;
threads)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
yes|copy)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
;;
esac
fi