more data structures.
This commit is contained in:
parent
d3f969e1b1
commit
838b14cb77
24
C/init.c
24
C/init.c
@ -1032,11 +1032,6 @@ InitCodes(void)
|
||||
#include "iatoms.h"
|
||||
#include "ihstruct.h"
|
||||
Yap_InitModules();
|
||||
INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
||||
Yap_heap_regs->expand_clauses_first = NULL;
|
||||
Yap_heap_regs->expand_clauses_last = NULL;
|
||||
Yap_heap_regs->expand_clauses = 0;
|
||||
|
||||
#ifdef THREADS
|
||||
INIT_LOCK(Yap_heap_regs->thread_handles_lock);
|
||||
{
|
||||
@ -1074,7 +1069,6 @@ InitCodes(void)
|
||||
INIT_LOCK(Yap_heap_regs->dead_static_clauses_lock);
|
||||
INIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock);
|
||||
INIT_LOCK(Yap_heap_regs->dead_static_indices_lock);
|
||||
INIT_LOCK(Yap_heap_regs->op_list_lock);
|
||||
Yap_heap_regs->heap_top_owner = -1;
|
||||
{
|
||||
int i;
|
||||
@ -1129,20 +1123,8 @@ InitCodes(void)
|
||||
Yap_heap_regs->wl.consultbase = Yap_heap_regs->wl.consultsp =
|
||||
Yap_heap_regs->wl.consultlow + Yap_heap_regs->wl.consultcapacity;
|
||||
#endif /* YAPOR */
|
||||
#if DEBUG
|
||||
Yap_heap_regs->new_cps = 0;
|
||||
Yap_heap_regs->live_cps = 0;
|
||||
Yap_heap_regs->dirty_cps = 0;
|
||||
Yap_heap_regs->freed_cps = 0;
|
||||
#endif
|
||||
Yap_heap_regs->system_profiling = FALSE;
|
||||
Yap_heap_regs->system_call_counting = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_all = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_on = FALSE;
|
||||
Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
||||
Yap_heap_regs->compiler_compile_mode = 0; /* fast will be for native code */
|
||||
Yap_heap_regs->compiler_optimizer_on = TRUE;
|
||||
Yap_heap_regs->compiler_compile_arrays = FALSE;
|
||||
Yap_heap_regs->maxdepth = 0;
|
||||
Yap_heap_regs->maxlist = 0;
|
||||
Yap_heap_regs->maxwriteargs = 0;
|
||||
@ -1197,8 +1179,6 @@ InitCodes(void)
|
||||
Yap_heap_regs->db_erased_marker =
|
||||
(DBRef)Yap_AllocCodeSpace(sizeof(DBStruct));
|
||||
Yap_LUClauseSpace += sizeof(DBStruct);
|
||||
INIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
||||
Yap_heap_regs->dbterms_list = NULL;
|
||||
Yap_heap_regs->db_erased_marker->id = FunctorDBRef;
|
||||
Yap_heap_regs->db_erased_marker->Flags = ErasedMask;
|
||||
Yap_heap_regs->db_erased_marker->Code = NULL;
|
||||
@ -1220,9 +1200,6 @@ InitCodes(void)
|
||||
// INIT_LOCK(Yap_heap_regs->logdb_erased_marker->ClLock);
|
||||
INIT_CLREF_COUNT(Yap_heap_regs->logdb_erased_marker);
|
||||
Yap_heap_regs->yap_streams = NULL;
|
||||
#if DEBUG
|
||||
Yap_heap_regs->expand_clauses_sz = 0L;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1338,7 +1315,6 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
||||
#endif
|
||||
/* InitAbsmi must be done before InitCodes */
|
||||
/* This must be done before initialising predicates */
|
||||
Yap_heap_regs->system_pred_goal_expansion_func = FALSE;
|
||||
for (i = 0; i <= LAST_FLAG; i++) {
|
||||
yap_flags[i] = 0;
|
||||
}
|
||||
|
54
H/YapHeap.h
54
H/YapHeap.h
@ -270,36 +270,6 @@ typedef struct various_codes {
|
||||
/* Terms multiply used */
|
||||
#include "hstruct.h"
|
||||
|
||||
/* compiler flags */
|
||||
int system_profiling;
|
||||
int system_call_counting;
|
||||
int system_pred_goal_expansion_all;
|
||||
int system_pred_goal_expansion_func;
|
||||
int system_pred_goal_expansion_on;
|
||||
int compiler_optimizer_on;
|
||||
int compiler_compile_mode;
|
||||
int compiler_profiling;
|
||||
int compiler_call_counting;
|
||||
/********* whether we should try to compile array references ******************/
|
||||
int compiler_compile_arrays;
|
||||
|
||||
/* DBTerms: pre-compiled ground terms */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dbterms_list_lock; /* protect DBTermList */
|
||||
#endif
|
||||
struct dbterm_list *dbterms_list;
|
||||
|
||||
/* JITI support */
|
||||
yamop *expand_clauses_first, *expand_clauses_last;
|
||||
UInt expand_clauses;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar expand_clauses_list_lock;
|
||||
lockvar op_list_lock;
|
||||
#endif
|
||||
/* instrumentation */
|
||||
UInt new_cps, live_cps, dirty_cps, freed_cps;
|
||||
UInt expand_clauses_sz;
|
||||
|
||||
/* UDI support */
|
||||
struct udi_info *udi_control_blocks;
|
||||
|
||||
@ -438,11 +408,6 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define HeapMax Yap_heap_regs->heap_max
|
||||
#define HeapTop Yap_heap_regs->heap_top
|
||||
#define HeapLim Yap_heap_regs->heap_lim
|
||||
#define ExpandClausesFirst Yap_heap_regs->expand_clauses_first
|
||||
#define ExpandClausesLast Yap_heap_regs->expand_clauses_last
|
||||
#define ExpandClausesListLock Yap_heap_regs->expand_clauses_list_lock
|
||||
#define Yap_ExpandClauses Yap_heap_regs->expand_clauses
|
||||
#define OpListLock Yap_heap_regs->op_list_lock
|
||||
#define INVISIBLECHAIN Yap_heap_regs->invisiblechain
|
||||
#define max_depth Yap_heap_regs->maxdepth
|
||||
#define max_list Yap_heap_regs->maxlist
|
||||
@ -450,11 +415,6 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define AtPrompt (&(Yap_heap_regs->atprompt ))
|
||||
#define Prompt Yap_heap_regs->prompt
|
||||
#define UdiControlBlocks Yap_heap_regs->udi_control_blocks
|
||||
#define PROFILING Yap_heap_regs->system_profiling
|
||||
#define CALL_COUNTING Yap_heap_regs->system_call_counting
|
||||
#define PRED_GOAL_EXPANSION_ALL Yap_heap_regs->system_pred_goal_expansion_all
|
||||
#define PRED_GOAL_EXPANSION_FUNC Yap_heap_regs->system_pred_goal_expansion_func
|
||||
#define PRED_GOAL_EXPANSION_ON Yap_heap_regs->system_pred_goal_expansion_on
|
||||
#define UPDATE_MODE Yap_heap_regs->update_mode
|
||||
#define STATIC_PREDICATES_MARKED Yap_heap_regs->static_predicates_marked
|
||||
#define yap_flags Yap_heap_regs->yap_flags_field
|
||||
@ -486,7 +446,6 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define LogDBErasedMarker Yap_heap_regs->logdb_erased_marker
|
||||
#define DBErasedList Yap_heap_regs->db_erased_list
|
||||
#define DBErasedIList Yap_heap_regs->db_erased_ilist
|
||||
#define Yap_expand_clauses_sz Yap_heap_regs->expand_clauses_sz
|
||||
#define Stream Yap_heap_regs->yap_streams
|
||||
#define output_msg Yap_heap_regs->debugger_output_msg
|
||||
#define NOfFileAliases Yap_heap_regs->n_of_file_aliases
|
||||
@ -611,11 +570,6 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define GlobalArenaOverflows Yap_heap_regs->WL.global_arena_overflows
|
||||
#define Yap_AllowRestart Yap_heap_regs->WL.allow_restart
|
||||
#define GlobalDelayArena Yap_heap_regs->WL.global_delay_arena
|
||||
#define profiling Yap_heap_regs->compiler_profiling
|
||||
#define call_counting Yap_heap_regs->compiler_call_counting
|
||||
#define compile_arrays Yap_heap_regs->compiler_compile_arrays
|
||||
#define optimizer_on Yap_heap_regs->compiler_optimizer_on
|
||||
#define compile_mode Yap_heap_regs->compiler_compile_mode
|
||||
#define ForeignCodeBase Yap_heap_regs->foreign_code_base;
|
||||
#define ForeignCodeTop Yap_heap_regs->foreign_code_top;
|
||||
#define ForeignCodeMax Yap_heap_regs->foreign_code_max;
|
||||
@ -628,7 +582,6 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define GlobalHoldEntry Yap_heap_regs->global_hold_entry
|
||||
#define DeadStaticClauses Yap_heap_regs->dead_static_clauses
|
||||
#define DeadMegaClauses Yap_heap_regs->dead_mega_clauses
|
||||
#define DBTermsList Yap_heap_regs->dbterms_list
|
||||
#define DeadStaticIndices Yap_heap_regs->dead_static_indices
|
||||
#define Yap_AllowLocalExpansion Yap_heap_regs->allow_local_expansion
|
||||
#define Yap_AllowGlobalExpansion Yap_heap_regs->allow_global_expansion
|
||||
@ -646,16 +599,9 @@ extern struct various_codes *Yap_heap_regs;
|
||||
#define ThreadsTotalTime Yap_heap_regs->threads_total_time
|
||||
#define DeadStaticClausesLock Yap_heap_regs->dead_static_clauses_lock
|
||||
#define DeadMegaClausesLock Yap_heap_regs->dead_mega_clauses_lock
|
||||
#define DBTermsListLock Yap_heap_regs->dbterms_list_lock
|
||||
#define DeadStaticIndicesLock Yap_heap_regs->dead_static_indices_lock
|
||||
#define ModulesLock Yap_heap_regs->modules_lock
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
#define Yap_NewCps Yap_heap_regs->new_cps
|
||||
#define Yap_LiveCps Yap_heap_regs->live_cps
|
||||
#define Yap_DirtyCps Yap_heap_regs->dirty_cps
|
||||
#define Yap_FreedCps Yap_heap_regs->freed_cps
|
||||
#endif
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
#define GLOBAL Yap_heap_regs->global
|
||||
#define REMOTE Yap_heap_regs->remote
|
||||
|
33
H/dhstruct.h
33
H/dhstruct.h
@ -139,3 +139,36 @@
|
||||
|
||||
#define RETRY_C_RECORDEDP_CODE Yap_heap_regs->retry_recordedp_code
|
||||
#define RETRY_C_RECORDED_K_CODE Yap_heap_regs->retry_recorded_k_code
|
||||
|
||||
#define PROFILING Yap_heap_regs->system_profiling
|
||||
#define CALL_COUNTING Yap_heap_regs->system_call_counting
|
||||
#define PRED_GOAL_EXPANSION_ALL Yap_heap_regs->system_pred_goal_expansion_all
|
||||
#define PRED_GOAL_EXPANSION_FUNC Yap_heap_regs->system_pred_goal_expansion_func
|
||||
#define PRED_GOAL_EXPANSION_ON Yap_heap_regs->system_pred_goal_expansion_on
|
||||
#define optimizer_on Yap_heap_regs->compiler_optimizer_on
|
||||
#define compile_mode Yap_heap_regs->compiler_compile_mode
|
||||
#define profiling Yap_heap_regs->compiler_profiling
|
||||
#define call_counting Yap_heap_regs->compiler_call_counting
|
||||
|
||||
#define compile_arrays Yap_heap_regs->compiler_compile_arrays
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define DBTermsListLock Yap_heap_regs->dbterms_list_lock
|
||||
#endif
|
||||
#define DBTermsList Yap_heap_regs->dbterms_list
|
||||
|
||||
#define ExpandClausesFirst Yap_heap_regs->expand_clauses_first
|
||||
#define ExpandClausesLast Yap_heap_regs->expand_clauses_last
|
||||
#define Yap_ExpandClauses Yap_heap_regs->expand_clauses
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define ExpandClausesListLock Yap_heap_regs->expand_clauses_list_lock
|
||||
#define OpListLock Yap_heap_regs->op_list_lock
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define Yap_NewCps Yap_heap_regs->new_cps
|
||||
#define Yap_LiveCps Yap_heap_regs->live_cps
|
||||
#define Yap_DirtyCps Yap_heap_regs->dirty_cps
|
||||
#define Yap_FreedCps Yap_heap_regs->freed_cps
|
||||
#define Yap_expand_clauses_sz Yap_heap_regs->expand_clauses_sz
|
||||
#endif
|
||||
|
33
H/hstruct.h
33
H/hstruct.h
@ -139,3 +139,36 @@
|
||||
|
||||
yamop *retry_recordedp_code;
|
||||
yamop *retry_recorded_k_code;
|
||||
|
||||
int system_profiling;
|
||||
int system_call_counting;
|
||||
int system_pred_goal_expansion_all;
|
||||
int system_pred_goal_expansion_func;
|
||||
int system_pred_goal_expansion_on;
|
||||
int compiler_optimizer_on;
|
||||
int compiler_compile_mode;
|
||||
int compiler_profiling;
|
||||
int compiler_call_counting;
|
||||
|
||||
int compiler_compile_arrays;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dbterms_list_lock;
|
||||
#endif
|
||||
struct dbterm_list *dbterms_list;
|
||||
|
||||
yamop *expand_clauses_first;
|
||||
yamop *expand_clauses_last;
|
||||
UInt expand_clauses;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar expand_clauses_list_lock;
|
||||
lockvar op_list_lock;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
UInt new_cps;
|
||||
UInt live_cps;
|
||||
UInt dirty_cps;
|
||||
UInt freed_cps;
|
||||
UInt expand_clauses_sz;
|
||||
#endif
|
||||
|
33
H/ihstruct.h
33
H/ihstruct.h
@ -139,3 +139,36 @@
|
||||
|
||||
Yap_heap_regs->retry_recordedp_code = NULL;
|
||||
Yap_heap_regs->retry_recorded_k_code = NULL;
|
||||
|
||||
Yap_heap_regs->system_profiling = FALSE;
|
||||
Yap_heap_regs->system_call_counting = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_all = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_func = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_on = FALSE;
|
||||
Yap_heap_regs->compiler_optimizer_on = TRUE;
|
||||
Yap_heap_regs->compiler_compile_mode = 0;
|
||||
Yap_heap_regs->compiler_profiling = FALSE;
|
||||
Yap_heap_regs->compiler_call_counting = FALSE;
|
||||
|
||||
Yap_heap_regs->compiler_compile_arrays = FALSE;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
||||
#endif
|
||||
Yap_heap_regs->dbterms_list = NULL;
|
||||
|
||||
Yap_heap_regs->expand_clauses_first = NULL;
|
||||
Yap_heap_regs->expand_clauses_last = NULL;
|
||||
Yap_heap_regs->expand_clauses = 0;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
||||
INIT_LOCK(Yap_heap_regs->op_list_lock);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
Yap_heap_regs->new_cps = 0L;
|
||||
Yap_heap_regs->live_cps = 0L;
|
||||
Yap_heap_regs->dirty_cps = 0L;
|
||||
Yap_heap_regs->freed_cps = 0L;
|
||||
Yap_heap_regs->expand_clauses_sz = 0L;
|
||||
#endif
|
||||
|
34
H/rheap.h
34
H/rheap.h
@ -640,11 +640,22 @@ RestoreOtaplInst(yamop start[1], OPCODE opc)
|
||||
#endif /* TABLING */
|
||||
}
|
||||
|
||||
/* restore the failcodes */
|
||||
static void
|
||||
restore_codes(void)
|
||||
static void
|
||||
RestoreDBTermsList(void)
|
||||
{
|
||||
if (Yap_heap_regs->dbterms_list) {
|
||||
struct dbterm_list *dbl = PtoDBTLAdjust(Yap_heap_regs->dbterms_list);
|
||||
Yap_heap_regs->dbterms_list = dbl;
|
||||
while (dbl) {
|
||||
RestoreDBTermEntry(dbl);
|
||||
dbl = dbl->next_dbl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
RestoreExpandList(void)
|
||||
{
|
||||
Yap_heap_regs->heap_top = AddrAdjust(OldHeapTop);
|
||||
if (Yap_heap_regs->expand_clauses_first)
|
||||
Yap_heap_regs->expand_clauses_first = PtoOpAdjust(Yap_heap_regs->expand_clauses_first);
|
||||
if (Yap_heap_regs->expand_clauses_last)
|
||||
@ -656,6 +667,13 @@ restore_codes(void)
|
||||
ptr = ptr->u.sssllp.snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* restore the failcodes */
|
||||
static void
|
||||
restore_codes(void)
|
||||
{
|
||||
Yap_heap_regs->heap_top = AddrAdjust(OldHeapTop);
|
||||
#if !defined(THREADS) && !defined(YAPOR)
|
||||
/* restore consult stack. It consists of heap pointers, so it
|
||||
is easy to fix.
|
||||
@ -708,14 +726,6 @@ restore_codes(void)
|
||||
mc = mc->ClNext;
|
||||
}
|
||||
}
|
||||
if (Yap_heap_regs->dbterms_list) {
|
||||
struct dbterm_list *dbl = PtoDBTLAdjust(Yap_heap_regs->dbterms_list);
|
||||
Yap_heap_regs->dbterms_list = dbl;
|
||||
while (dbl) {
|
||||
RestoreDBTermEntry(dbl);
|
||||
dbl = dbl->next_dbl;
|
||||
}
|
||||
}
|
||||
if (Yap_heap_regs->dead_static_indices) {
|
||||
StaticIndex *si = (StaticIndex *)AddrAdjust((ADDR)(Yap_heap_regs->dead_static_indices));
|
||||
Yap_heap_regs->dead_static_indices = si;
|
||||
|
33
H/rhstruct.h
33
H/rhstruct.h
@ -139,3 +139,36 @@
|
||||
|
||||
Yap_heap_regs->retry_recordedp_code = PtoOpAdjust(Yap_heap_regs->retry_recordedp_code);
|
||||
Yap_heap_regs->retry_recorded_k_code = PtoOpAdjust(Yap_heap_regs->retry_recorded_k_code);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
||||
#endif
|
||||
RestoreDBTermsList();
|
||||
|
||||
|
||||
RestoreExpandList();
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->op_list_lock);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -155,3 +155,42 @@ yamop *debugger_p_before_spy P_before_spy =NULL PtoOpAdjust
|
||||
yamop *retry_recordedp_code RETRY_C_RECORDEDP_CODE =NULL PtoOpAdjust
|
||||
yamop *retry_recorded_k_code RETRY_C_RECORDED_K_CODE =NULL PtoOpAdjust
|
||||
|
||||
/* compiler flags */
|
||||
int system_profiling PROFILING =FALSE void
|
||||
int system_call_counting CALL_COUNTING =FALSE void
|
||||
int system_pred_goal_expansion_all PRED_GOAL_EXPANSION_ALL =FALSE void
|
||||
int system_pred_goal_expansion_func PRED_GOAL_EXPANSION_FUNC =FALSE void
|
||||
int system_pred_goal_expansion_on PRED_GOAL_EXPANSION_ON =FALSE void
|
||||
int compiler_optimizer_on optimizer_on =TRUE void
|
||||
int compiler_compile_mode compile_mode =0 void
|
||||
int compiler_profiling profiling =FALSE void
|
||||
int compiler_call_counting call_counting =FALSE void
|
||||
/********* whether we should try to compile array references ******************/
|
||||
int compiler_compile_arrays compile_arrays =FALSE void
|
||||
|
||||
/* DBTerms: pre-compiled ground terms */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar dbterms_list_lock DBTermsListLock MkLock
|
||||
#endif
|
||||
struct dbterm_list *dbterms_list DBTermsList =NULL RestoreDBTermsList()
|
||||
|
||||
/* JITI support */
|
||||
yamop *expand_clauses_first ExpandClausesFirst =NULL void
|
||||
yamop *expand_clauses_last ExpandClausesLast =NULL RestoreExpandList()
|
||||
UInt expand_clauses Yap_ExpandClauses =0 void
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar expand_clauses_list_lock ExpandClausesListLock MkLock
|
||||
lockvar op_list_lock OpListLock MkLock
|
||||
#endif
|
||||
/* instrumentation */
|
||||
#ifdef DEBUG
|
||||
UInt new_cps Yap_NewCps =0L void
|
||||
UInt live_cps Yap_LiveCps =0L void
|
||||
UInt dirty_cps Yap_DirtyCps =0L void
|
||||
UInt freed_cps Yap_FreedCps =0L void
|
||||
UInt expand_clauses_sz Yap_expand_clauses_sz =0L void
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user