This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/misc/HEAPFIELDS

332 lines
11 KiB
Plaintext
Raw Normal View History

//
// File defining fields in the Yap_heap_codes global structure
//
// these fields used to spread all over the place, because they must be used in 4 ways:
// - they must be defined somewhere
// - they have an #ifdef to get a shorter name
// - they must be initialised somewhere
// - they must be restorable and collectable (from the atom gc).
//
//
// The defs include 4+ components:
// Type
// name in structured
// global name
// init code and restore code (optional)
//
2015-10-22 00:33:38 +01:00
//
//
// MkAT (MkAtomTerm) cvts from a predefined atom to a term
// MkPred constructs a pred_entry
// MkOp gets an opcode
// void does nothing
// =VALUE inits as VALUE
// Init... sets up call to InitFunc
// Restore... sets up call to RestoreFunc
//
2009-10-30 23:59:00 +00:00
2016-01-03 02:06:09 +00:00
START_HEAP
2009-10-30 23:59:00 +00:00
/* memory management */
2016-01-03 02:06:09 +00:00
UInt Yap_HoleSize void void
struct malloc_state *Yap_av void void
2009-10-30 23:59:00 +00:00
#if USE_DL_MALLOC
2016-01-03 02:06:09 +00:00
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void void
UInt Yap_NOfMemoryHoles void void
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar DLMallocLock MkLock
#endif
2009-10-30 23:59:00 +00:00
#endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
#ifndef HeapUsed
2015-10-22 00:33:38 +01:00
#define HeapUsed Yap_givemallinfo()
2009-10-30 23:59:00 +00:00
#endif
2016-01-03 02:06:09 +00:00
Int NotHeapUsed void void
2009-10-30 23:59:00 +00:00
#else
2016-01-03 02:06:09 +00:00
Int HeapUsed void void
2009-10-30 23:59:00 +00:00
#endif
2016-01-03 02:06:09 +00:00
Int HeapMax void void
ADDR HeapTop void void
ADDR HeapLim void void
struct FREEB *FreeBlocks void void
2009-10-30 23:59:00 +00:00
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar FreeBlocksLock MkLock
lockvar HeapUsedLock MkLock
lockvar HeapTopLock MkLock
int HeapTopOwner =-1 void
2009-10-30 23:59:00 +00:00
#endif
2016-01-03 02:06:09 +00:00
UInt MaxStack =0 void
UInt MaxTrail =0 void
2009-10-30 23:59:00 +00:00
/* execution info */
2015-08-07 22:57:53 +01:00
/* OPCODE REVERSE TABLE, needed to recover op tables */
#if USE_THREADED_CODE
2016-01-03 02:06:09 +00:00
op_entry *OP_RTABLE void OpRTableAdjust
#endif
/* popular opcodes */
2016-01-03 02:06:09 +00:00
OPCODE EXECUTE_CPRED_OP_CODE MkOp _execute_cpred
OPCODE EXPAND_OP_CODE MkOp _expand_index
OPCODE FAIL_OPCODE MkOp _op_fail
OPCODE INDEX_OPCODE MkOp _index_pred
OPCODE LOCKPRED_OPCODE MkOp _lock_pred
OPCODE ORLAST_OPCODE MkOp _or_last
OPCODE UNDEF_OPCODE MkOp _undef_p
OPCODE RETRY_USERC_OPCODE MkOp _retry_userc
OPCODE EXECUTE_CPRED_OPCODE MkOp _execute_cpred
2009-10-30 23:59:00 +00:00
/* atom tables */
2016-01-03 02:06:09 +00:00
UInt NOfAtoms void void
UInt AtomHashTableSize void void
UInt WideAtomHashTableSize void void
UInt NOfWideAtoms void void
AtomHashEntry INVISIBLECHAIN InitInvisibleAtoms() RestoreInvisibleAtoms()
AtomHashEntry *WideHashChain InitWideAtoms() RestoreWideAtoms()
AtomHashEntry *HashChain InitAtoms() RestoreAtoms()
2009-10-30 23:59:00 +00:00
/* use atom defs here */
ATOMS
#ifdef EUROTRA
2016-01-03 02:06:09 +00:00
Term TermDollarU MkAT AtomDollarU
#endif
2015-10-22 00:33:38 +01:00
//modules
2016-01-03 02:06:09 +00:00
Term USER_MODULE MkAT AtomUser
Term IDB_MODULE MkAT AtomIDB
Term ATTRIBUTES_MODULE MkAT AtomAttributes
Term CHARSIO_MODULE MkAT AtomCharsio
Term CHTYPE_MODULE MkAT AtomChType
Term TERMS_MODULE MkAT AtomTerms
Term SYSTEM_MODULE MkAT AtomSystem
Term READUTIL_MODULE MkAT AtomReadutil
Term HACKS_MODULE MkAT AtomYapHacks
Term ARG_MODULE MkAT AtomArg
Term GLOBALS_MODULE MkAT AtomNb
Term SWI_MODULE MkAT AtomSwi
Term DBLOAD_MODULE MkAT AtomDBLoad
Term RANGE_MODULE MkAT AtomRange
Term ERROR_MODULE MkAT AtomError
//
// Module list
//
2016-01-03 02:06:09 +00:00
struct mod_entry *CurrentModules =NULL ModEntryPtrAdjust
// make sure we have the modules set at this point.
// don't actually want to define a field
2016-01-03 02:06:09 +00:00
void void Yap_InitModules() void
// hidden predicates
2016-01-03 02:06:09 +00:00
Prop HIDDEN_PREDICATES =NULL RestoreHiddenPredicates()
// make sure we have the streams set at this point.
// don't actually want to define a field
2016-01-03 02:06:09 +00:00
void void Yap_InitPlIO() void
2016-01-03 02:06:09 +00:00
union flagTerm* GLOBAL_Flags =0 void
UInt GLOBAL_flagCount Yap_InitFlags(true) RestoreFlags(GLOBAL_flagCount)
/* Anderson's JIT */
2016-01-03 02:06:09 +00:00
yap_exec_mode Yap_ExecutionMode =INTERPRETED void
/* The Predicate Hash Table: fast access to predicates. */
UInt PredsInHashTable =0 void
uint64_t PredHashTableSize =0 void
2016-01-03 02:06:09 +00:00
struct pred_entry **PredHash InitPredHash() RestorePredHash()
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
rwlock_t PredHashRWLock void
#endif
/* Well-Known Predicates */
2016-01-03 02:06:09 +00:00
struct pred_entry *CreepCode MkPred AtomCreep 1 PROLOG_MODULE
struct pred_entry *UndefCode MkPred AtomUndefp 2 PROLOG_MODULE
struct pred_entry *SpyCode MkPred AtomSpy 1 PROLOG_MODULE
struct pred_entry *PredFail MkPred AtomFail 0 PROLOG_MODULE
struct pred_entry *PredTrue MkPred AtomTrue 0 PROLOG_MODULE
#ifdef COROUTINING
2016-01-03 02:06:09 +00:00
struct pred_entry *WakeUpCode MkPred AtomWakeUpGoal 2 PROLOG_MODULE
#endif
2016-01-03 02:06:09 +00:00
struct pred_entry *PredGoalExpansion MkPred FunctorGoalExpansion USER_MODULE
struct pred_entry *PredMetaCall MkPred FunctorMetaCall PROLOG_MODULE
struct pred_entry *PredTraceMetaCall MkPred FunctorTraceMetaCall PROLOG_MODULE
struct pred_entry *PredDollarCatch MkPred FunctorCatch PROLOG_MODULE
struct pred_entry *PredRecordedWithKey MkPred FunctorRecordedWithKey PROLOG_MODULE
struct pred_entry *PredLogUpdClause MkPred FunctorDoLogUpdClause PROLOG_MODULE
struct pred_entry *PredLogUpdClauseErase MkPred FunctorDoLogUpdClauseErase PROLOG_MODULE
struct pred_entry *PredLogUpdClause0 MkPred FunctorDoLogUpdClause PROLOG_MODULE
struct pred_entry *PredStaticClause MkPred FunctorDoStaticClause PROLOG_MODULE
struct pred_entry *PredThrow MkPred FunctorThrow PROLOG_MODULE
struct pred_entry *PredHandleThrow MkPred FunctorHandleThrow PROLOG_MODULE
struct pred_entry *PredIs MkPred FunctorIs PROLOG_MODULE
struct pred_entry *PredSafeCallCleanup MkPred FunctorSafeCallCleanup PROLOG_MODULE
struct pred_entry *PredRestoreRegs MkPred FunctorRestoreRegs PROLOG_MODULE
struct pred_entry *PredCommentHook MkPred FunctorCommentHook PROLOG_MODULE
2009-10-30 23:59:00 +00:00
#ifdef YAPOR
2016-01-03 02:06:09 +00:00
struct pred_entry *PredGetwork MkPred AtomGetwork 0 PROLOG_MODULE
2009-10-30 23:59:00 +00:00
#endif /* YAPOR */
2016-01-03 02:06:09 +00:00
struct pred_entry *PredProcedure MkLogPred FunctorProcedure PROLOG_MODULE
/* low-level tracer */
#ifdef LOW_LEVEL_TRACER
2016-01-03 02:06:09 +00:00
int Yap_do_low_level_trace =FALSE void
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar Yap_low_level_trace_lock MkLock
#endif
#endif
/* code management info */
2016-01-03 02:06:09 +00:00
UInt Yap_ClauseSpace =0 void
UInt Yap_IndexSpace_Tree =0 void
UInt Yap_IndexSpace_EXT =0 void
UInt Yap_IndexSpace_SW =0 void
UInt Yap_LUClauseSpace =0 void
UInt Yap_LUIndexSpace_Tree =0 void
UInt Yap_LUIndexSpace_CP =0 void
UInt Yap_LUIndexSpace_EXT =0 void
UInt Yap_LUIndexSpace_SW =0 void
/* static code: may be shared by many predicate or may be used for meta-execution */
2016-01-03 02:06:09 +00:00
yamop COMMA_CODE[5] void void
yamop DUMMYCODE[1] MkInstE _op_fail
yamop FAILCODE[1] MkInstE _op_fail
yamop NOCODE[1] MkInstE _Nstop
2016-01-03 02:06:09 +00:00
yamop ENV_FOR_TRUSTFAIL[2] InitEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail) RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail)
yamop *TRUSTFAILCODE void
yamop ENV_FOR_YESCODE[2] InitEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail) RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail)
yamop *YESCODE void
2016-01-03 02:06:09 +00:00
yamop RTRYCODE[1] InitOtaplInst(RTRYCODE,_retry_and_mark,PredFail) RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail)
#ifdef BEAM
2016-01-03 02:06:09 +00:00
yamop BEAM_RETRY_CODE[1] MkInstE _beam_retry_code
#endif /* BEAM */
#ifdef YAPOR
2016-01-03 02:06:09 +00:00
yamop GETWORK[1] InitOtaplInst(GETWORK,_getwork,PredGetwork) RestoreOtaplInst(GETWORK,_getwork,PredGetwork)
yamop GETWORK_SEQ[1] InitOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq) RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq)
yamop GETWORK_FIRST_TIME[1] MkInstE _getwork_first_time
#endif /* YAPOR */
#ifdef TABLING
2016-01-03 02:06:09 +00:00
yamop LOAD_ANSWER[1] InitOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail) RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail)
yamop TRY_ANSWER[1] InitOtaplInst(TRY_ANSWER,_table_try_answer,PredFail) RestoreOtaplInst(TRY_ANSWER,_table_try_answer,PredFail)
yamop ANSWER_RESOLUTION[1] InitOtaplInst(ANSWER_RESOLUTION,_table_answer_resolution,PredFail) RestoreOtaplInst(ANSWER_RESOLUTION,_table_answer_resolution,PredFail)
yamop COMPLETION[1] InitOtaplInst(COMPLETION,_table_completion,PredFail) RestoreOtaplInst(COMPLETION,_table_completion,PredFail)
#ifdef THREADS_CONSUMER_SHARING
2016-01-03 02:06:09 +00:00
yamop ANSWER_RESOLUTION_COMPLETION[1] InitOtaplInst(ANSWER_RESOLUTION_COMPLETION,_table_answer_resolution_completion,PredFail) RestoreOtaplInst(ANSWER_RESOLUTION_COMPLETION,_table_answer_resolution_completion,PredFail)
#endif /* THREADS_CONSUMER_SHARING */
#endif /* TABLING */
/* */
/* PREG just before we enter $spy. We use that to find out the clause which */
/* was calling the debugged goal. */
/* */
2016-01-03 02:06:09 +00:00
yamop *P_before_spy =NULL PtoOpAdjust
/* support recorded_k */
2016-01-03 02:06:09 +00:00
yamop *RETRY_C_RECORDEDP_CODE =NULL PtoOpAdjust
yamop *RETRY_C_RECORDED_K_CODE =NULL PtoOpAdjust
R
2009-10-28 15:20:46 +00:00
/* compiler flags */
2016-01-03 02:06:09 +00:00
int PROFILING =FALSE void
int CALL_COUNTING =FALSE void
int optimizer_on =TRUE void
int compile_mode =0 void
int profiling =FALSE void
int call_counting =FALSE void
2009-10-28 15:20:46 +00:00
/********* whether we should try to compile array references ******************/
2016-01-03 02:06:09 +00:00
int compile_arrays =FALSE void
2009-10-28 15:20:46 +00:00
/* DBTerms: pre-compiled ground terms */
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar DBTermsListLock MkLock
2009-10-28 15:20:46 +00:00
#endif
2016-01-03 02:06:09 +00:00
struct dbterm_list *DBTermsList =NULL RestoreDBTermsList()
2009-10-28 15:20:46 +00:00
/* JITI support */
2016-01-03 02:06:09 +00:00
yamop *ExpandClausesFirst =NULL void
yamop *ExpandClausesLast =NULL RestoreExpandList()
UInt Yap_ExpandClauses =0 void
2009-10-28 15:20:46 +00:00
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar ExpandClausesListLock MkLock
lockvar OpListLock MkLock
2009-10-28 15:20:46 +00:00
#endif
/* instrumentation */
#ifdef DEBUG
2016-01-03 02:06:09 +00:00
UInt Yap_NewCps =0L void
UInt Yap_LiveCps =0L void
UInt Yap_DirtyCps =0L void
UInt Yap_FreedCps =0L void
2009-10-28 15:20:46 +00:00
#endif
2016-01-03 02:06:09 +00:00
UInt Yap_expand_clauses_sz =0L void
2009-10-28 15:20:46 +00:00
2009-10-28 15:53:23 +00:00
/* UDI support */
2016-01-03 02:06:09 +00:00
struct udi_info *UdiControlBlocks =NULL RestoreUdiControlBlocks()
2009-10-28 15:20:46 +00:00
2009-10-28 15:53:23 +00:00
/* data-base statistics */
/* system boots in compile mode */
2016-01-03 02:06:09 +00:00
Int STATIC_PREDICATES_MARKED =FALSE void
2009-10-28 15:20:46 +00:00
2009-10-28 15:53:23 +00:00
/* Internal Database */
2016-01-03 02:06:09 +00:00
Prop *INT_KEYS =NULL RestoreIntKeys()
Prop *INT_LU_KEYS =NULL RestoreIntLUKeys()
Prop *INT_BB_KEYS =NULL RestoreIntBBKeys()
2009-10-28 15:53:23 +00:00
/* Internal Database Statistics */
2016-01-03 02:06:09 +00:00
UInt INT_KEYS_SIZE =INT_KEYS_DEFAULT_SIZE void
UInt INT_KEYS_TIMESTAMP =0L void
UInt INT_BB_KEYS_SIZE =INT_KEYS_DEFAULT_SIZE void
2009-10-28 15:53:23 +00:00
/* Internal Data-Base Control */
2016-01-03 02:06:09 +00:00
int UPDATE_MODE =UPDATE_MODE_LOGICAL void
2009-10-28 15:53:23 +00:00
/* nasty IDB stuff */
2016-01-03 02:06:09 +00:00
struct DB_STRUCT *DBErasedMarker InitDBErasedMarker() RestoreDBErasedMarker()
struct logic_upd_clause *LogDBErasedMarker InitLogDBErasedMarker() RestoreLogDBErasedMarker()
2009-10-28 15:53:23 +00:00
2009-10-30 23:59:00 +00:00
/* Dead clauses and IDB entries */
2016-01-03 02:06:09 +00:00
struct static_clause *DeadStaticClauses =NULL RestoreDeadStaticClauses()
struct static_mega_clause *DeadMegaClauses =NULL RestoreDeadMegaClauses()
struct static_index *DeadStaticIndices =NULL RestoreDeadStaticIndices()
struct logic_upd_clause *DBErasedList =NULL RestoreDBErasedList()
struct logic_upd_index *DBErasedIList =NULL RestoreDBErasedIList()
2009-10-30 23:59:00 +00:00
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar DeadStaticClausesLock MkLock
lockvar DeadMegaClausesLock MkLock
lockvar DeadStaticIndicesLock MkLock
2009-10-30 23:59:00 +00:00
#endif
#ifdef COROUTINING
/* number of attribute modules */
2016-01-03 02:06:09 +00:00
int NUM_OF_ATTS =1 void
2009-10-30 23:59:00 +00:00
/* initialised by memory allocator */
2016-01-03 02:06:09 +00:00
UInt Yap_AttsSize void void
2009-10-30 23:59:00 +00:00
#endif
/* Operators */
2016-01-03 02:06:09 +00:00
struct operator_entry *OpList =NULL OpListAdjust
2009-10-30 23:59:00 +00:00
/* foreign code loaded */
2016-01-03 02:06:09 +00:00
struct ForeignLoadItem *ForeignCodeLoaded =NULL RestoreForeignCode()
ADDR ForeignCodeBase =NULL void
ADDR ForeignCodeTop =NULL void
ADDR ForeignCodeMax =NULL void
2009-12-18 01:55:09 +00:00
/* recorded terms */
2016-01-03 02:06:09 +00:00
struct record_list *Yap_Records =NULL RestoreYapRecords()
2016-01-03 02:06:09 +00:00
Atom EmptyWakeups[MAX_EMPTY_WAKEUPS] InitEmptyWakeups() RestoreEmptyWakeups()
int MaxEmptyWakeups =0
2013-04-30 21:23:01 +01:00
/* SWI blobs */
2016-01-03 02:06:09 +00:00
struct YAP_blob_t *BlobTypes =NULL RestoreBlobTypes()
struct AtomEntryStruct *Blobs =NULL RestoreBlobs()
UInt NOfBlobs =0
UInt NOfBlobsMax =256
2011-12-22 10:27:56 +00:00
#if defined(YAPOR) || defined(THREADS)
2016-01-03 02:06:09 +00:00
lockvar Blobs_Lock MkLock
2011-12-22 10:27:56 +00:00
#endif
2016-01-03 02:06:09 +00:00
END_HEAP