Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3

This commit is contained in:
Vítor Santos Costa 2012-05-22 16:22:06 +01:00
commit 01749939fa
5 changed files with 23 additions and 6 deletions

View File

@ -190,6 +190,7 @@ thread_die(int wid, int always_die)
LOCAL_top_dep_fr = NULL; LOCAL_top_dep_fr = NULL;
#ifdef USE_PAGES_MALLOC #ifdef USE_PAGES_MALLOC
DETACH_PAGES(_pages_void); DETACH_PAGES(_pages_void);
#endif /* USE_PAGES_MALLOC */
DETACH_PAGES(_pages_tab_ent); DETACH_PAGES(_pages_tab_ent);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING) #if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
DETACH_PAGES(_pages_sg_ent); DETACH_PAGES(_pages_sg_ent);
@ -205,7 +206,6 @@ thread_die(int wid, int always_die)
#endif /* THREADS_FULL_SHARING */ #endif /* THREADS_FULL_SHARING */
DETACH_PAGES(_pages_gt_node); DETACH_PAGES(_pages_gt_node);
DETACH_PAGES(_pages_gt_hash); DETACH_PAGES(_pages_gt_hash);
#endif /* USE_PAGES_MALLOC */
#ifdef OUTPUT_THREADS_TABLING #ifdef OUTPUT_THREADS_TABLING
fclose(LOCAL_thread_output); fclose(LOCAL_thread_output);
#endif /* OUTPUT_THREADS_TABLING */ #endif /* OUTPUT_THREADS_TABLING */

View File

@ -71,8 +71,10 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
int i; int i;
/* global data related to memory management */ /* global data related to memory management */
#ifdef USE_PAGES_MALLOC
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_alloc, void *); INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_alloc, void *);
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_void, void *); INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_void, void *);
#endif /* USE_PAGES_MALLOC */
#ifdef TABLING #ifdef TABLING
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tab_ent, struct table_entry); INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tab_ent, struct table_entry);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING) #if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
@ -180,7 +182,9 @@ void Yap_init_local_optyap_data(int wid) {
#ifdef YAPOR #ifdef YAPOR
REMOTE_next_free_ans_node(wid) = NULL; REMOTE_next_free_ans_node(wid) = NULL;
#elif THREADS #elif THREADS
#ifdef USE_PAGES_MALLOC
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_void(wid), void *); INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_void(wid), void *);
#endif
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_tab_ent(wid), struct table_entry); INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_tab_ent(wid), struct table_entry);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING) #if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_ent(wid), struct subgoal_entry); INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_ent(wid), struct subgoal_entry);

View File

@ -101,6 +101,15 @@ extern int Yap_page_size;
/******************************************************************************************* /*******************************************************************************************
** ! USE_PAGES_MALLOC ** ** ! USE_PAGES_MALLOC **
*******************************************************************************************/ *******************************************************************************************/
#define MOVE_PAGES(FROM_PG_ENT, TO_PG_ENT) \
UPDATE_STATS(PgEnt_strs_in_use(TO_PG_ENT), PgEnt_strs_in_use(FROM_PG_ENT)); \
PgEnt_strs_in_use(FROM_PG_ENT) = 0
#define DETACH_PAGES(_PG_ENT) \
LOCK(PgEnt_lock(GLOBAL##_PG_ENT)); \
MOVE_PAGES(LOCAL##_PG_ENT, GLOBAL##_PG_ENT); \
UNLOCK(PgEnt_lock(GLOBAL##_PG_ENT))
#define ATTACH_PAGES(_PG_ENT) \
MOVE_PAGES(GLOBAL##_PG_ENT, LOCAL##_PG_ENT)
#define GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \ #define GET_FREE_STRUCT(STR, STR_TYPE, PG_ENT, EXTRA_PG_ENT) \
LOCK_PAGE_ENTRY(PG_ENT); \ LOCK_PAGE_ENTRY(PG_ENT); \
UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), 1); \ UPDATE_STATS(PgEnt_strs_in_use(PG_ENT), 1); \
@ -141,14 +150,14 @@ extern int Yap_page_size;
MOVE_PAGES(GLOBAL##_PG_ENT, LOCAL##_PG_ENT); \ MOVE_PAGES(GLOBAL##_PG_ENT, LOCAL##_PG_ENT); \
} }
#define GET_PAGE_FIRST_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD)
#define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD)
#define GET_VOID_PAGE_NEXT_LEVEL(PG_HD)
/******************************************************************************************* /*******************************************************************************************
#define GET_PAGE_FIRST_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD) #define GET_PAGE_FIRST_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD)
#define GET_VOID_PAGE_NEXT_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD) #define GET_VOID_PAGE_NEXT_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD)
#define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD) #define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD)
*******************************************************************************************/ *******************************************************************************************/
#define GET_PAGE_FIRST_LEVEL(PG_HD) GET_ALLOC_PAGE(PG_HD)
#define GET_ALLOC_PAGE_NEXT_LEVEL(PG_HD) GET_VOID_PAGE(PG_HD)
#define GET_VOID_PAGE_NEXT_LEVEL(PG_HD)
#define GET_ALLOC_PAGE(PG_HD) \ #define GET_ALLOC_PAGE(PG_HD) \
LOCK(PgEnt_lock(GLOBAL_pages_alloc)); \ LOCK(PgEnt_lock(GLOBAL_pages_alloc)); \

View File

@ -153,8 +153,10 @@ struct local_page_entry {
***************************/ ***************************/
struct global_pages { struct global_pages {
#ifdef USE_PAGES_MALLOC
struct global_page_entry alloc_pages; struct global_page_entry alloc_pages;
struct global_page_entry void_pages; struct global_page_entry void_pages;
#endif /* USE_PAGES_MALLOC */
#ifdef TABLING #ifdef TABLING
struct global_page_entry table_entry_pages; struct global_page_entry table_entry_pages;
@ -199,7 +201,9 @@ struct local_pages {
#ifdef YAPOR #ifdef YAPOR
struct answer_trie_node *next_free_answer_trie_node; struct answer_trie_node *next_free_answer_trie_node;
#elif THREADS #elif THREADS
#ifdef USE_PAGES_MALLOC
struct local_page_entry void_pages; struct local_page_entry void_pages;
#endif
struct local_page_entry table_entry_pages; struct local_page_entry table_entry_pages;
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING) #if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
struct local_page_entry subgoal_entry_pages; struct local_page_entry subgoal_entry_pages;

View File

@ -1524,7 +1524,7 @@ void abolish_table(tab_ent_ptr tab_ent) {
CACHE_REGS CACHE_REGS
sg_node_ptr sg_node; sg_node_ptr sg_node;
#if defined(THREADS) && defined(USE_PAGES_MALLOC) #ifdef THREADS
if (GLOBAL_NOfThreads == 1) { if (GLOBAL_NOfThreads == 1) {
ATTACH_PAGES(_pages_tab_ent); ATTACH_PAGES(_pages_tab_ent);
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING) #if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
@ -1542,7 +1542,7 @@ void abolish_table(tab_ent_ptr tab_ent) {
ATTACH_PAGES(_pages_gt_node); ATTACH_PAGES(_pages_gt_node);
ATTACH_PAGES(_pages_gt_hash); ATTACH_PAGES(_pages_gt_hash);
} }
#endif /* THREADS && USE_PAGES_MALLOC */ #endif /* THREADS */
sg_node = get_subgoal_trie_for_abolish(tab_ent PASS_REGS); sg_node = get_subgoal_trie_for_abolish(tab_ent PASS_REGS);
if (sg_node) { if (sg_node) {
if (TrNode_child(sg_node)) { if (TrNode_child(sg_node)) {