Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
This commit is contained in:
commit
01749939fa
@ -190,6 +190,7 @@ thread_die(int wid, int always_die)
|
||||
LOCAL_top_dep_fr = NULL;
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
DETACH_PAGES(_pages_void);
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
DETACH_PAGES(_pages_tab_ent);
|
||||
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||
DETACH_PAGES(_pages_sg_ent);
|
||||
@ -205,7 +206,6 @@ thread_die(int wid, int always_die)
|
||||
#endif /* THREADS_FULL_SHARING */
|
||||
DETACH_PAGES(_pages_gt_node);
|
||||
DETACH_PAGES(_pages_gt_hash);
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
#ifdef OUTPUT_THREADS_TABLING
|
||||
fclose(LOCAL_thread_output);
|
||||
#endif /* OUTPUT_THREADS_TABLING */
|
||||
|
@ -71,8 +71,10 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
||||
int i;
|
||||
|
||||
/* global data related to memory management */
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_alloc, void *);
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_void, void *);
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
#ifdef TABLING
|
||||
INIT_GLOBAL_PAGE_ENTRY(GLOBAL_pages_tab_ent, struct table_entry);
|
||||
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||
@ -180,7 +182,9 @@ void Yap_init_local_optyap_data(int wid) {
|
||||
#ifdef YAPOR
|
||||
REMOTE_next_free_ans_node(wid) = NULL;
|
||||
#elif THREADS
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_void(wid), void *);
|
||||
#endif
|
||||
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_tab_ent(wid), struct table_entry);
|
||||
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||
INIT_LOCAL_PAGE_ENTRY(REMOTE_pages_sg_ent(wid), struct subgoal_entry);
|
||||
|
@ -101,6 +101,15 @@ extern int Yap_page_size;
|
||||
/*******************************************************************************************
|
||||
** ! 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) \
|
||||
LOCK_PAGE_ENTRY(PG_ENT); \
|
||||
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); \
|
||||
}
|
||||
|
||||
#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_VOID_PAGE_NEXT_LEVEL(PG_HD) GET_ALLOC_PAGE(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) \
|
||||
LOCK(PgEnt_lock(GLOBAL_pages_alloc)); \
|
||||
|
@ -153,8 +153,10 @@ struct local_page_entry {
|
||||
***************************/
|
||||
|
||||
struct global_pages {
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
struct global_page_entry alloc_pages;
|
||||
struct global_page_entry void_pages;
|
||||
#endif /* USE_PAGES_MALLOC */
|
||||
|
||||
#ifdef TABLING
|
||||
struct global_page_entry table_entry_pages;
|
||||
@ -199,7 +201,9 @@ struct local_pages {
|
||||
#ifdef YAPOR
|
||||
struct answer_trie_node *next_free_answer_trie_node;
|
||||
#elif THREADS
|
||||
#ifdef USE_PAGES_MALLOC
|
||||
struct local_page_entry void_pages;
|
||||
#endif
|
||||
struct local_page_entry table_entry_pages;
|
||||
#if defined(THREADS_FULL_SHARING) || defined(THREADS_CONSUMER_SHARING)
|
||||
struct local_page_entry subgoal_entry_pages;
|
||||
|
@ -1524,7 +1524,7 @@ void abolish_table(tab_ent_ptr tab_ent) {
|
||||
CACHE_REGS
|
||||
sg_node_ptr sg_node;
|
||||
|
||||
#if defined(THREADS) && defined(USE_PAGES_MALLOC)
|
||||
#ifdef THREADS
|
||||
if (GLOBAL_NOfThreads == 1) {
|
||||
ATTACH_PAGES(_pages_tab_ent);
|
||||
#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_hash);
|
||||
}
|
||||
#endif /* THREADS && USE_PAGES_MALLOC */
|
||||
#endif /* THREADS */
|
||||
sg_node = get_subgoal_trie_for_abolish(tab_ent PASS_REGS);
|
||||
if (sg_node) {
|
||||
if (TrNode_child(sg_node)) {
|
||||
|
Reference in New Issue
Block a user