change hash function to not be inline
This commit is contained in:
parent
3d0e6659b6
commit
f0cf91548a
39
C/adtdefs.c
39
C/adtdefs.c
@ -28,12 +28,42 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#include "Yatom.h"
|
#include "Yatom.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
#include "clause.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_Hq
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uint64_t HashFunction(const unsigned char *CHP) {
|
||||||
|
/* djb2 */
|
||||||
|
uint64_t hash = 5381;
|
||||||
|
uint64_t c;
|
||||||
|
|
||||||
|
while ((c = (uint64_t)(*CHP++)) != '\0') {
|
||||||
|
/* hash = ((hash << 5) + hash) + c; hash * 33 + c */
|
||||||
|
hash = hash * (uint64_t)33 + c;
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
/*
|
||||||
|
UInt OUT=0, i = 1;
|
||||||
|
while(*CHP != '\0') { OUT += (UInt)(*CHP++); }
|
||||||
|
return OUT;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t WideHashFunction(wchar_t *CHP) {
|
||||||
|
UInt hash = 5381;
|
||||||
|
|
||||||
|
UInt c;
|
||||||
|
|
||||||
|
while ((c = *CHP++) != '\0') {
|
||||||
|
hash = hash * 33 ^ c;
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* this routine must be run at least having a read lock on ae */
|
/* this routine must be run at least having a read lock on ae */
|
||||||
static Prop
|
static Prop
|
||||||
GetFunctorProp(AtomEntry *ae,
|
GetFunctorProp(AtomEntry *ae,
|
||||||
@ -142,14 +172,17 @@ static inline Atom SearchWideAtom(const wchar_t *p, Atom a) {
|
|||||||
|
|
||||||
static Atom
|
static Atom
|
||||||
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
||||||
UInt hash;
|
uint64_t hash;
|
||||||
const unsigned char *p;
|
const unsigned char *p;
|
||||||
Atom a, na;
|
Atom a, na;
|
||||||
AtomEntry *ae;
|
AtomEntry *ae;
|
||||||
|
size_t sz = AtomHashTableSize;
|
||||||
|
|
||||||
/* compute hash */
|
/* compute hash */
|
||||||
p = atom;
|
p = atom;
|
||||||
hash = HashFunction(p) % AtomHashTableSize;
|
|
||||||
|
hash = HashFunction(p);
|
||||||
|
hash = hash % sz ;
|
||||||
|
|
||||||
/* we'll start by holding a read lock in order to avoid contention */
|
/* we'll start by holding a read lock in order to avoid contention */
|
||||||
READ_LOCK(HashChain[hash].AERWLock);
|
READ_LOCK(HashChain[hash].AERWLock);
|
||||||
|
301
H/dhstruct.h
301
H/dhstruct.h
@ -1,301 +0,0 @@
|
|||||||
|
|
||||||
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildheap"
|
|
||||||
please do not update, update misc/HEAPFIELDS instead */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define Yap_HoleSize Yap_heap_regs->hole_size
|
|
||||||
#define Yap_av Yap_heap_regs->av_
|
|
||||||
#if USE_DL_MALLOC
|
|
||||||
#define Yap_MemoryHoles Yap_heap_regs->memory_holes
|
|
||||||
#define Yap_NOfMemoryHoles Yap_heap_regs->nof_memory_holes
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define DLMallocLock Yap_heap_regs->dlmalloc_lock
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
|
||||||
#ifndef HeapUsed
|
|
||||||
#define HeapUsed Yap_givemallinfo()
|
|
||||||
#endif
|
|
||||||
#define NotHeapUsed Yap_heap_regs->heap_used
|
|
||||||
#else
|
|
||||||
#define HeapUsed Yap_heap_regs->heap_used
|
|
||||||
#endif
|
|
||||||
#define HeapMax Yap_heap_regs->heap_max
|
|
||||||
#define HeapTop Yap_heap_regs->heap_top
|
|
||||||
#define HeapLim Yap_heap_regs->heap_lim
|
|
||||||
#define FreeBlocks Yap_heap_regs->free_blocks
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define FreeBlocksLock Yap_heap_regs->free_blocks_lock
|
|
||||||
#define HeapUsedLock Yap_heap_regs->heap_used_lock
|
|
||||||
#define HeapTopLock Yap_heap_regs->heap_top_lock
|
|
||||||
#define HeapTopOwner Yap_heap_regs->heap_top_owner
|
|
||||||
#endif
|
|
||||||
#define MaxStack Yap_heap_regs->MaxStack_
|
|
||||||
#define MaxTrail Yap_heap_regs->MaxTrail_
|
|
||||||
|
|
||||||
|
|
||||||
#if USE_THREADED_CODE
|
|
||||||
#define OP_RTABLE Yap_heap_regs->op_rtable
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EXECUTE_CPRED_OP_CODE Yap_heap_regs->execute_cpred_op_code
|
|
||||||
#define EXPAND_OP_CODE Yap_heap_regs->expand_op_code
|
|
||||||
#define FAIL_OPCODE Yap_heap_regs->fail_op
|
|
||||||
#define INDEX_OPCODE Yap_heap_regs->index_op
|
|
||||||
#define LOCKPRED_OPCODE Yap_heap_regs->lockpred_op
|
|
||||||
#define ORLAST_OPCODE Yap_heap_regs->orlast_op
|
|
||||||
#define UNDEF_OPCODE Yap_heap_regs->undef_op
|
|
||||||
#define RETRY_USERC_OPCODE Yap_heap_regs->retry_userc_op
|
|
||||||
#define EXECUTE_CPRED_OPCODE Yap_heap_regs->execute_cpred_op
|
|
||||||
|
|
||||||
#define NOfAtoms Yap_heap_regs->n_of_atoms
|
|
||||||
#define AtomHashTableSize Yap_heap_regs->atom_hash_table_size
|
|
||||||
#define WideAtomHashTableSize Yap_heap_regs->wide_atom_hash_table_size
|
|
||||||
#define NOfWideAtoms Yap_heap_regs->n_of_wide_atoms
|
|
||||||
#define INVISIBLECHAIN Yap_heap_regs->invisiblechain
|
|
||||||
#define WideHashChain Yap_heap_regs->wide_hash_chain
|
|
||||||
#define HashChain Yap_heap_regs->hash_chain
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EUROTRA
|
|
||||||
#define TermDollarU Yap_heap_regs->term_dollar_u
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USER_MODULE Yap_heap_regs->user_module
|
|
||||||
#define IDB_MODULE Yap_heap_regs->idb_module
|
|
||||||
#define ATTRIBUTES_MODULE Yap_heap_regs->attributes_module
|
|
||||||
#define CHARSIO_MODULE Yap_heap_regs->charsio_module
|
|
||||||
#define CHTYPE_MODULE Yap_heap_regs->chtype_module
|
|
||||||
#define TERMS_MODULE Yap_heap_regs->terms_module
|
|
||||||
#define SYSTEM_MODULE Yap_heap_regs->system_module
|
|
||||||
#define READUTIL_MODULE Yap_heap_regs->readutil_module
|
|
||||||
#define HACKS_MODULE Yap_heap_regs->hacks_module
|
|
||||||
#define ARG_MODULE Yap_heap_regs->arg_module
|
|
||||||
#define GLOBALS_MODULE Yap_heap_regs->globals_module
|
|
||||||
#define SWI_MODULE Yap_heap_regs->swi_module
|
|
||||||
#define DBLOAD_MODULE Yap_heap_regs->dbload_module
|
|
||||||
#define RANGE_MODULE Yap_heap_regs->range_module
|
|
||||||
#define ERROR_MODULE Yap_heap_regs->error_module
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CurrentModules Yap_heap_regs->current_modules
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define HIDDEN_PREDICATES Yap_heap_regs->hidden_predicates
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define GLOBAL_Flags Yap_heap_regs->GLOBAL_Flags_
|
|
||||||
#define GLOBAL_flagCount Yap_heap_regs->GLOBAL_flagCount_
|
|
||||||
|
|
||||||
#define Yap_ExecutionMode Yap_heap_regs->execution_mode
|
|
||||||
|
|
||||||
#define PredHash Yap_heap_regs->pred_hash
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define PredHashRWLock Yap_heap_regs->pred_hash_rw_lock
|
|
||||||
#endif
|
|
||||||
#define PredsInHashTable Yap_heap_regs->preds_in_hash_table
|
|
||||||
#define PredHashTableSize Yap_heap_regs->pred_hash_table_size
|
|
||||||
|
|
||||||
#define CreepCode Yap_heap_regs->creep_code
|
|
||||||
#define UndefCode Yap_heap_regs->undef_code
|
|
||||||
#define SpyCode Yap_heap_regs->spy_code
|
|
||||||
#define PredFail Yap_heap_regs->pred_fail
|
|
||||||
#define PredTrue Yap_heap_regs->pred_true
|
|
||||||
#ifdef COROUTINING
|
|
||||||
#define WakeUpCode Yap_heap_regs->wake_up_code
|
|
||||||
#endif
|
|
||||||
#define PredGoalExpansion Yap_heap_regs->pred_goal_expansion
|
|
||||||
#define PredMetaCall Yap_heap_regs->pred_meta_call
|
|
||||||
#define PredTraceMetaCall Yap_heap_regs->pred_trace_meta_call
|
|
||||||
#define PredDollarCatch Yap_heap_regs->pred_dollar_catch
|
|
||||||
#define PredRecordedWithKey Yap_heap_regs->pred_recorded_with_key
|
|
||||||
#define PredLogUpdClause Yap_heap_regs->pred_log_upd_clause
|
|
||||||
#define PredLogUpdClauseErase Yap_heap_regs->pred_log_upd_clause_erase
|
|
||||||
#define PredLogUpdClause0 Yap_heap_regs->pred_log_upd_clause0
|
|
||||||
#define PredStaticClause Yap_heap_regs->pred_static_clause
|
|
||||||
#define PredThrow Yap_heap_regs->pred_throw
|
|
||||||
#define PredHandleThrow Yap_heap_regs->pred_handle_throw
|
|
||||||
#define PredIs Yap_heap_regs->pred_is
|
|
||||||
#define PredSafeCallCleanup Yap_heap_regs->pred_safe_call_cleanup
|
|
||||||
#define PredRestoreRegs Yap_heap_regs->pred_restore_regs
|
|
||||||
#define PredCommentHook Yap_heap_regs->pred_comment_hook
|
|
||||||
#ifdef YAPOR
|
|
||||||
#define PredGetwork Yap_heap_regs->pred_getwork
|
|
||||||
#define PredGetworkSeq Yap_heap_regs->pred_getwork_seq
|
|
||||||
#endif /* YAPOR */
|
|
||||||
|
|
||||||
#ifdef LOW_LEVEL_TRACER
|
|
||||||
#define Yap_do_low_level_trace Yap_heap_regs->yap_do_low_level_trace
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define Yap_low_level_trace_lock Yap_heap_regs->low_level_trace_lock
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Yap_ClauseSpace Yap_heap_regs->clause_space
|
|
||||||
#define Yap_IndexSpace_Tree Yap_heap_regs->index_space_Tree
|
|
||||||
#define Yap_IndexSpace_EXT Yap_heap_regs->index_space_EXT
|
|
||||||
#define Yap_IndexSpace_SW Yap_heap_regs->index_space_SW
|
|
||||||
#define Yap_LUClauseSpace Yap_heap_regs->lu_clause_space
|
|
||||||
#define Yap_LUIndexSpace_Tree Yap_heap_regs->lu_index_space_Tree
|
|
||||||
#define Yap_LUIndexSpace_CP Yap_heap_regs->lu_index_space_CP
|
|
||||||
#define Yap_LUIndexSpace_EXT Yap_heap_regs->lu_index_space_EXT
|
|
||||||
#define Yap_LUIndexSpace_SW Yap_heap_regs->lu_index_space_SW
|
|
||||||
|
|
||||||
#define COMMA_CODE Yap_heap_regs->comma_code
|
|
||||||
#define DUMMYCODE Yap_heap_regs->dummycode
|
|
||||||
#define FAILCODE Yap_heap_regs->failcode
|
|
||||||
#define NOCODE Yap_heap_regs->nocode
|
|
||||||
#define ENV_FOR_TRUSTFAIL Yap_heap_regs->env_for_trustfail
|
|
||||||
#define TRUSTFAILCODE Yap_heap_regs->trustfailcode
|
|
||||||
#define ENV_FOR_YESCODE Yap_heap_regs->env_for_yescode
|
|
||||||
#define YESCODE Yap_heap_regs->yescode
|
|
||||||
#define RTRYCODE Yap_heap_regs->rtrycode
|
|
||||||
#ifdef BEAM
|
|
||||||
#define BEAM_RETRY_CODE Yap_heap_regs->beam_retry_code
|
|
||||||
#endif /* BEAM */
|
|
||||||
#ifdef YAPOR
|
|
||||||
#define GETWORK Yap_heap_regs->getwork_code
|
|
||||||
#define GETWORK_SEQ Yap_heap_regs->getwork_seq_code
|
|
||||||
#define GETWORK_FIRST_TIME Yap_heap_regs->getwork_first_time
|
|
||||||
#endif /* YAPOR */
|
|
||||||
#ifdef TABLING
|
|
||||||
#define LOAD_ANSWER Yap_heap_regs->table_load_answer_code
|
|
||||||
#define TRY_ANSWER Yap_heap_regs->table_try_answer_code
|
|
||||||
#define ANSWER_RESOLUTION Yap_heap_regs->table_answer_resolution_code
|
|
||||||
#define COMPLETION Yap_heap_regs->table_completion_code
|
|
||||||
#ifdef THREADS_CONSUMER_SHARING
|
|
||||||
#define ANSWER_RESOLUTION_COMPLETION Yap_heap_regs->table_answer_resolution_completion_code
|
|
||||||
#endif /* THREADS_CONSUMER_SHARING */
|
|
||||||
#endif /* TABLING */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define P_before_spy Yap_heap_regs->debugger_p_before_spy
|
|
||||||
|
|
||||||
#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 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
|
|
||||||
#endif
|
|
||||||
#define Yap_expand_clauses_sz Yap_heap_regs->expand_clauses_sz
|
|
||||||
|
|
||||||
#define UdiControlBlocks Yap_heap_regs->udi_control_blocks
|
|
||||||
|
|
||||||
|
|
||||||
#define STATIC_PREDICATES_MARKED Yap_heap_regs->static_predicates_marked
|
|
||||||
|
|
||||||
#define INT_KEYS Yap_heap_regs->IntKeys
|
|
||||||
#define INT_LU_KEYS Yap_heap_regs->IntLUKeys
|
|
||||||
#define INT_BB_KEYS Yap_heap_regs->IntBBKeys
|
|
||||||
|
|
||||||
#define INT_KEYS_SIZE Yap_heap_regs->int_keys_size
|
|
||||||
#define INT_KEYS_TIMESTAMP Yap_heap_regs->int_keys_timestamp
|
|
||||||
#define INT_BB_KEYS_SIZE Yap_heap_regs->int_bb_keys_size
|
|
||||||
|
|
||||||
#define UPDATE_MODE Yap_heap_regs->update_mode
|
|
||||||
|
|
||||||
#define DBErasedMarker Yap_heap_regs->db_erased_marker
|
|
||||||
#define LogDBErasedMarker Yap_heap_regs->logdb_erased_marker
|
|
||||||
|
|
||||||
#define DeadStaticClauses Yap_heap_regs->dead_static_clauses
|
|
||||||
#define DeadMegaClauses Yap_heap_regs->dead_mega_clauses
|
|
||||||
#define DeadStaticIndices Yap_heap_regs->dead_static_indices
|
|
||||||
#define DBErasedList Yap_heap_regs->db_erased_list
|
|
||||||
#define DBErasedIList Yap_heap_regs->db_erased_ilist
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define DeadStaticClausesLock Yap_heap_regs->dead_static_clauses_lock
|
|
||||||
#define DeadMegaClausesLock Yap_heap_regs->dead_mega_clauses_lock
|
|
||||||
#define DeadStaticIndicesLock Yap_heap_regs->dead_static_indices_lock
|
|
||||||
#endif
|
|
||||||
#ifdef COROUTINING
|
|
||||||
|
|
||||||
#define NUM_OF_ATTS Yap_heap_regs->num_of_atts
|
|
||||||
|
|
||||||
#define Yap_AttsSize Yap_heap_regs->atts_size
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define OpList Yap_heap_regs->op_list
|
|
||||||
|
|
||||||
#define ForeignCodeLoaded Yap_heap_regs->foreign_code_loaded
|
|
||||||
#define ForeignCodeBase Yap_heap_regs->foreign_code_base
|
|
||||||
#define ForeignCodeTop Yap_heap_regs->foreign_code_top
|
|
||||||
#define ForeignCodeMax Yap_heap_regs->foreign_code_max
|
|
||||||
|
|
||||||
#define Yap_Records Yap_heap_regs->yap_records
|
|
||||||
|
|
||||||
#define SWI_Atoms Yap_heap_regs->swi_atoms
|
|
||||||
#define SWI_Functors Yap_heap_regs->swi_functors
|
|
||||||
#define SWI_ReverseHash Yap_heap_regs->swi_reverse_hash
|
|
||||||
|
|
||||||
#define AtomTranslations Yap_heap_regs->atom_translations
|
|
||||||
#define MaxAtomTranslations Yap_heap_regs->max_atom_translations
|
|
||||||
|
|
||||||
#define FunctorTranslations Yap_heap_regs->functor_translations
|
|
||||||
#define MaxFunctorTranslations Yap_heap_regs->max_functor_translations
|
|
||||||
#define EmptyWakeups Yap_heap_regs->empty_wakeups
|
|
||||||
#define MaxEmptyWakeups Yap_heap_regs->max_empty_wakeups
|
|
||||||
|
|
||||||
#define BlobTypes Yap_heap_regs->swi_blob_types
|
|
||||||
#define Blobs Yap_heap_regs->swi_blobs
|
|
||||||
#define NOfBlobs Yap_heap_regs->nofblobs
|
|
||||||
#define NOfBlobsMax Yap_heap_regs->nofblobsmax
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
#define Blobs_Lock Yap_heap_regs->blobs_lock
|
|
||||||
#endif
|
|
303
H/heap/dhstruct.h
Normal file
303
H/heap/dhstruct.h
Normal file
@ -0,0 +1,303 @@
|
|||||||
|
|
||||||
|
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||||
|
please do not update, update misc/HEAPFIELDS instead */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define Yap_HoleSize Yap_heap_regs->Yap_HoleSize_
|
||||||
|
#define Yap_av Yap_heap_regs->Yap_av_
|
||||||
|
#if USE_DL_MALLOC
|
||||||
|
#define void Yap_heap_regs->void_
|
||||||
|
#define Yap_NOfMemoryHoles Yap_heap_regs->Yap_NOfMemoryHoles_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define DLMallocLock Yap_heap_regs->DLMallocLock_
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||||
|
#ifndef HeapUsed
|
||||||
|
#define HeapUsed Yap_givemallinfo()
|
||||||
|
#endif
|
||||||
|
#define NotHeapUsed Yap_heap_regs->NotHeapUsed_
|
||||||
|
#else
|
||||||
|
#define HeapUsed Yap_heap_regs->HeapUsed_
|
||||||
|
#endif
|
||||||
|
#define HeapMax Yap_heap_regs->HeapMax_
|
||||||
|
#define HeapTop Yap_heap_regs->HeapTop_
|
||||||
|
#define HeapLim Yap_heap_regs->HeapLim_
|
||||||
|
#define FreeBlocks Yap_heap_regs->FreeBlocks_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define FreeBlocksLock Yap_heap_regs->FreeBlocksLock_
|
||||||
|
#define HeapUsedLock Yap_heap_regs->HeapUsedLock_
|
||||||
|
#define HeapTopLock Yap_heap_regs->HeapTopLock_
|
||||||
|
#define HeapTopOwner Yap_heap_regs->HeapTopOwner_
|
||||||
|
#endif
|
||||||
|
#define MaxStack Yap_heap_regs->MaxStack_
|
||||||
|
#define MaxTrail Yap_heap_regs->MaxTrail_
|
||||||
|
|
||||||
|
|
||||||
|
#if USE_THREADED_CODE
|
||||||
|
#define OP_RTABLE Yap_heap_regs->OP_RTABLE_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EXECUTE_CPRED_OP_CODE Yap_heap_regs->EXECUTE_CPRED_OP_CODE_
|
||||||
|
#define EXPAND_OP_CODE Yap_heap_regs->EXPAND_OP_CODE_
|
||||||
|
#define FAIL_OPCODE Yap_heap_regs->FAIL_OPCODE_
|
||||||
|
#define INDEX_OPCODE Yap_heap_regs->INDEX_OPCODE_
|
||||||
|
#define LOCKPRED_OPCODE Yap_heap_regs->LOCKPRED_OPCODE_
|
||||||
|
#define ORLAST_OPCODE Yap_heap_regs->ORLAST_OPCODE_
|
||||||
|
#define UNDEF_OPCODE Yap_heap_regs->UNDEF_OPCODE_
|
||||||
|
#define RETRY_USERC_OPCODE Yap_heap_regs->RETRY_USERC_OPCODE_
|
||||||
|
#define EXECUTE_CPRED_OPCODE Yap_heap_regs->EXECUTE_CPRED_OPCODE_
|
||||||
|
|
||||||
|
#define NOfAtoms Yap_heap_regs->NOfAtoms_
|
||||||
|
#define AtomHashTableSize Yap_heap_regs->AtomHashTableSize_
|
||||||
|
#define WideAtomHashTableSize Yap_heap_regs->WideAtomHashTableSize_
|
||||||
|
#define NOfWideAtoms Yap_heap_regs->NOfWideAtoms_
|
||||||
|
#define INVISIBLECHAIN Yap_heap_regs->INVISIBLECHAIN_
|
||||||
|
#define WideHashChain Yap_heap_regs->WideHashChain_
|
||||||
|
#define HashChain Yap_heap_regs->HashChain_
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef EUROTRA
|
||||||
|
#define TermDollarU Yap_heap_regs->TermDollarU_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USER_MODULE Yap_heap_regs->USER_MODULE_
|
||||||
|
#define IDB_MODULE Yap_heap_regs->IDB_MODULE_
|
||||||
|
#define ATTRIBUTES_MODULE Yap_heap_regs->ATTRIBUTES_MODULE_
|
||||||
|
#define CHARSIO_MODULE Yap_heap_regs->CHARSIO_MODULE_
|
||||||
|
#define CHTYPE_MODULE Yap_heap_regs->CHTYPE_MODULE_
|
||||||
|
#define TERMS_MODULE Yap_heap_regs->TERMS_MODULE_
|
||||||
|
#define SYSTEM_MODULE Yap_heap_regs->SYSTEM_MODULE_
|
||||||
|
#define READUTIL_MODULE Yap_heap_regs->READUTIL_MODULE_
|
||||||
|
#define HACKS_MODULE Yap_heap_regs->HACKS_MODULE_
|
||||||
|
#define ARG_MODULE Yap_heap_regs->ARG_MODULE_
|
||||||
|
#define GLOBALS_MODULE Yap_heap_regs->GLOBALS_MODULE_
|
||||||
|
#define SWI_MODULE Yap_heap_regs->SWI_MODULE_
|
||||||
|
#define DBLOAD_MODULE Yap_heap_regs->DBLOAD_MODULE_
|
||||||
|
#define RANGE_MODULE Yap_heap_regs->RANGE_MODULE_
|
||||||
|
#define ERROR_MODULE Yap_heap_regs->ERROR_MODULE_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CurrentModules Yap_heap_regs->CurrentModules_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define HIDDEN_PREDICATES Yap_heap_regs->HIDDEN_PREDICATES_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define GLOBAL_Flags Yap_heap_regs->GLOBAL_Flags_
|
||||||
|
#define GLOBAL_flagCount Yap_heap_regs->GLOBAL_flagCount_
|
||||||
|
|
||||||
|
#define Yap_ExecutionMode Yap_heap_regs->Yap_ExecutionMode_
|
||||||
|
|
||||||
|
#define PredHash Yap_heap_regs->PredHash_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define PredHashRWLock Yap_heap_regs->PredHashRWLock_
|
||||||
|
#endif
|
||||||
|
#define PredsInHashTable Yap_heap_regs->PredsInHashTable_
|
||||||
|
#define PredHashTableSize Yap_heap_regs->PredHashTableSize_
|
||||||
|
|
||||||
|
#define CreepCode Yap_heap_regs->CreepCode_
|
||||||
|
#define UndefCode Yap_heap_regs->UndefCode_
|
||||||
|
#define SpyCode Yap_heap_regs->SpyCode_
|
||||||
|
#define PredFail Yap_heap_regs->PredFail_
|
||||||
|
#define PredTrue Yap_heap_regs->PredTrue_
|
||||||
|
#ifdef COROUTINING
|
||||||
|
#define WakeUpCode Yap_heap_regs->WakeUpCode_
|
||||||
|
#endif
|
||||||
|
#define PredGoalExpansion Yap_heap_regs->PredGoalExpansion_
|
||||||
|
#define PredMetaCall Yap_heap_regs->PredMetaCall_
|
||||||
|
#define PredTraceMetaCall Yap_heap_regs->PredTraceMetaCall_
|
||||||
|
#define PredDollarCatch Yap_heap_regs->PredDollarCatch_
|
||||||
|
#define PredRecordedWithKey Yap_heap_regs->PredRecordedWithKey_
|
||||||
|
#define PredLogUpdClause Yap_heap_regs->PredLogUpdClause_
|
||||||
|
#define PredLogUpdClauseErase Yap_heap_regs->PredLogUpdClauseErase_
|
||||||
|
#define PredLogUpdClause0 Yap_heap_regs->PredLogUpdClause0_
|
||||||
|
#define PredStaticClause Yap_heap_regs->PredStaticClause_
|
||||||
|
#define PredThrow Yap_heap_regs->PredThrow_
|
||||||
|
#define PredHandleThrow Yap_heap_regs->PredHandleThrow_
|
||||||
|
#define PredIs Yap_heap_regs->PredIs_
|
||||||
|
#define PredSafeCallCleanup Yap_heap_regs->PredSafeCallCleanup_
|
||||||
|
#define PredRestoreRegs Yap_heap_regs->PredRestoreRegs_
|
||||||
|
#define PredCommentHook Yap_heap_regs->PredCommentHook_
|
||||||
|
#ifdef YAPOR
|
||||||
|
#define PredGetwork Yap_heap_regs->PredGetwork_
|
||||||
|
#endif /* YAPOR */
|
||||||
|
#define PredProcedure Yap_heap_regs->PredProcedure_
|
||||||
|
|
||||||
|
#ifdef LOW_LEVEL_TRACER
|
||||||
|
#define Yap_do_low_level_trace Yap_heap_regs->Yap_do_low_level_trace_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define Yap_low_level_trace_lock Yap_heap_regs->Yap_low_level_trace_lock_
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Yap_ClauseSpace Yap_heap_regs->Yap_ClauseSpace_
|
||||||
|
#define Yap_IndexSpace_Tree Yap_heap_regs->Yap_IndexSpace_Tree_
|
||||||
|
#define Yap_IndexSpace_EXT Yap_heap_regs->Yap_IndexSpace_EXT_
|
||||||
|
#define Yap_IndexSpace_SW Yap_heap_regs->Yap_IndexSpace_SW_
|
||||||
|
#define Yap_LUClauseSpace Yap_heap_regs->Yap_LUClauseSpace_
|
||||||
|
#define Yap_LUIndexSpace_Tree Yap_heap_regs->Yap_LUIndexSpace_Tree_
|
||||||
|
#define Yap_LUIndexSpace_CP Yap_heap_regs->Yap_LUIndexSpace_CP_
|
||||||
|
#define Yap_LUIndexSpace_EXT Yap_heap_regs->Yap_LUIndexSpace_EXT_
|
||||||
|
#define Yap_LUIndexSpace_SW Yap_heap_regs->Yap_LUIndexSpace_SW_
|
||||||
|
|
||||||
|
#define COMMA_CODE Yap_heap_regs->COMMA_CODE_
|
||||||
|
#define DUMMYCODE Yap_heap_regs->DUMMYCODE_
|
||||||
|
#define FAILCODE Yap_heap_regs->FAILCODE_
|
||||||
|
#define NOCODE Yap_heap_regs->NOCODE_
|
||||||
|
#define ENV_FOR_TRUSTFAIL Yap_heap_regs->ENV_FOR_TRUSTFAIL_
|
||||||
|
#define TRUSTFAILCODE Yap_heap_regs->TRUSTFAILCODE_
|
||||||
|
#define ENV_FOR_YESCODE Yap_heap_regs->ENV_FOR_YESCODE_
|
||||||
|
#define YESCODE Yap_heap_regs->YESCODE_
|
||||||
|
#define RTRYCODE Yap_heap_regs->RTRYCODE_
|
||||||
|
#ifdef BEAM
|
||||||
|
#define BEAM_RETRY_CODE Yap_heap_regs->BEAM_RETRY_CODE_
|
||||||
|
#endif /* BEAM */
|
||||||
|
#ifdef YAPOR
|
||||||
|
#define GETWORK Yap_heap_regs->GETWORK_
|
||||||
|
#define GETWORK_SEQ Yap_heap_regs->GETWORK_SEQ_
|
||||||
|
#define GETWORK_FIRST_TIME Yap_heap_regs->GETWORK_FIRST_TIME_
|
||||||
|
#endif /* YAPOR */
|
||||||
|
#ifdef TABLING
|
||||||
|
#define LOAD_ANSWER Yap_heap_regs->LOAD_ANSWER_
|
||||||
|
#define TRY_ANSWER Yap_heap_regs->TRY_ANSWER_
|
||||||
|
#define ANSWER_RESOLUTION Yap_heap_regs->ANSWER_RESOLUTION_
|
||||||
|
#define COMPLETION Yap_heap_regs->COMPLETION_
|
||||||
|
#ifdef THREADS_CONSUMER_SHARING
|
||||||
|
#define ANSWER_RESOLUTION_COMPLETION Yap_heap_regs->ANSWER_RESOLUTION_COMPLETION_
|
||||||
|
#endif /* THREADS_CONSUMER_SHARING */
|
||||||
|
#endif /* TABLING */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define P_before_spy Yap_heap_regs->P_before_spy_
|
||||||
|
|
||||||
|
#define RETRY_C_RECORDEDP_CODE Yap_heap_regs->RETRY_C_RECORDEDP_CODE_
|
||||||
|
#define RETRY_C_RECORDED_K_CODE Yap_heap_regs->RETRY_C_RECORDED_K_CODE_
|
||||||
|
|
||||||
|
#define PROFILING Yap_heap_regs->PROFILING_
|
||||||
|
#define CALL_COUNTING Yap_heap_regs->CALL_COUNTING_
|
||||||
|
#define optimizer_on Yap_heap_regs->optimizer_on_
|
||||||
|
#define compile_mode Yap_heap_regs->compile_mode_
|
||||||
|
#define profiling Yap_heap_regs->profiling_
|
||||||
|
#define call_counting Yap_heap_regs->call_counting_
|
||||||
|
|
||||||
|
#define compile_arrays Yap_heap_regs->compile_arrays_
|
||||||
|
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define DBTermsListLock Yap_heap_regs->DBTermsListLock_
|
||||||
|
#endif
|
||||||
|
#define DBTermsList Yap_heap_regs->DBTermsList_
|
||||||
|
|
||||||
|
#define ExpandClausesFirst Yap_heap_regs->ExpandClausesFirst_
|
||||||
|
#define ExpandClausesLast Yap_heap_regs->ExpandClausesLast_
|
||||||
|
#define Yap_ExpandClauses Yap_heap_regs->Yap_ExpandClauses_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define ExpandClausesListLock Yap_heap_regs->ExpandClausesListLock_
|
||||||
|
#define OpListLock Yap_heap_regs->OpListLock_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define Yap_NewCps Yap_heap_regs->Yap_NewCps_
|
||||||
|
#define Yap_LiveCps Yap_heap_regs->Yap_LiveCps_
|
||||||
|
#define Yap_DirtyCps Yap_heap_regs->Yap_DirtyCps_
|
||||||
|
#define Yap_FreedCps Yap_heap_regs->Yap_FreedCps_
|
||||||
|
#endif
|
||||||
|
#define Yap_expand_clauses_sz Yap_heap_regs->Yap_expand_clauses_sz_
|
||||||
|
|
||||||
|
#define UdiControlBlocks Yap_heap_regs->UdiControlBlocks_
|
||||||
|
|
||||||
|
|
||||||
|
#define STATIC_PREDICATES_MARKED Yap_heap_regs->STATIC_PREDICATES_MARKED_
|
||||||
|
|
||||||
|
#define INT_KEYS Yap_heap_regs->INT_KEYS_
|
||||||
|
#define INT_LU_KEYS Yap_heap_regs->INT_LU_KEYS_
|
||||||
|
#define INT_BB_KEYS Yap_heap_regs->INT_BB_KEYS_
|
||||||
|
|
||||||
|
#define INT_KEYS_SIZE Yap_heap_regs->INT_KEYS_SIZE_
|
||||||
|
#define INT_KEYS_TIMESTAMP Yap_heap_regs->INT_KEYS_TIMESTAMP_
|
||||||
|
#define INT_BB_KEYS_SIZE Yap_heap_regs->INT_BB_KEYS_SIZE_
|
||||||
|
|
||||||
|
#define UPDATE_MODE Yap_heap_regs->UPDATE_MODE_
|
||||||
|
|
||||||
|
#define DBErasedMarker Yap_heap_regs->DBErasedMarker_
|
||||||
|
#define LogDBErasedMarker Yap_heap_regs->LogDBErasedMarker_
|
||||||
|
|
||||||
|
#define DeadStaticClauses Yap_heap_regs->DeadStaticClauses_
|
||||||
|
#define DeadMegaClauses Yap_heap_regs->DeadMegaClauses_
|
||||||
|
#define DeadStaticIndices Yap_heap_regs->DeadStaticIndices_
|
||||||
|
#define DBErasedList Yap_heap_regs->DBErasedList_
|
||||||
|
#define DBErasedIList Yap_heap_regs->DBErasedIList_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define DeadStaticClausesLock Yap_heap_regs->DeadStaticClausesLock_
|
||||||
|
#define DeadMegaClausesLock Yap_heap_regs->DeadMegaClausesLock_
|
||||||
|
#define DeadStaticIndicesLock Yap_heap_regs->DeadStaticIndicesLock_
|
||||||
|
#endif
|
||||||
|
#ifdef COROUTINING
|
||||||
|
|
||||||
|
#define NUM_OF_ATTS Yap_heap_regs->NUM_OF_ATTS_
|
||||||
|
|
||||||
|
#define Yap_AttsSize Yap_heap_regs->Yap_AttsSize_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OpList Yap_heap_regs->OpList_
|
||||||
|
|
||||||
|
#define ForeignCodeLoaded Yap_heap_regs->ForeignCodeLoaded_
|
||||||
|
#define ForeignCodeBase Yap_heap_regs->ForeignCodeBase_
|
||||||
|
#define ForeignCodeTop Yap_heap_regs->ForeignCodeTop_
|
||||||
|
#define ForeignCodeMax Yap_heap_regs->ForeignCodeMax_
|
||||||
|
|
||||||
|
#define Yap_Records Yap_heap_regs->Yap_Records_
|
||||||
|
|
||||||
|
#define SWI_Atoms Yap_heap_regs->SWI_Atoms_
|
||||||
|
#define SWI_Functors Yap_heap_regs->SWI_Functors_
|
||||||
|
#define SWI_ReverseHash Yap_heap_regs->SWI_ReverseHash_
|
||||||
|
|
||||||
|
#define AtomTranslations Yap_heap_regs->AtomTranslations_
|
||||||
|
#define MaxAtomTranslations Yap_heap_regs->MaxAtomTranslations_
|
||||||
|
|
||||||
|
#define FunctorTranslations Yap_heap_regs->FunctorTranslations_
|
||||||
|
#define MaxFunctorTranslations Yap_heap_regs->MaxFunctorTranslations_
|
||||||
|
#define EmptyWakeups Yap_heap_regs->EmptyWakeups_
|
||||||
|
#define MaxEmptyWakeups Yap_heap_regs->MaxEmptyWakeups_
|
||||||
|
|
||||||
|
#define BlobTypes Yap_heap_regs->BlobTypes_
|
||||||
|
#define Blobs Yap_heap_regs->Blobs_
|
||||||
|
#define NOfBlobs Yap_heap_regs->NOfBlobs_
|
||||||
|
#define NOfBlobsMax Yap_heap_regs->NOfBlobsMax_
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
#define Blobs_Lock Yap_heap_regs->Blobs_Lock_
|
||||||
|
#endif
|
||||||
|
|
303
H/heap/hstruct.h
Executable file
303
H/heap/hstruct.h
Executable file
@ -0,0 +1,303 @@
|
|||||||
|
|
||||||
|
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildlocalglobal"
|
||||||
|
please do not update, update misc/HEAPFIELDS instead */
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
|
||||||
|
/* memory management */
|
||||||
|
UInt Yap_HoleSize_;
|
||||||
|
struct malloc_state *Yap_av_;
|
||||||
|
#if USE_DL_MALLOC
|
||||||
|
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void_;
|
||||||
|
UInt Yap_NOfMemoryHoles_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar DLMallocLock_;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||||
|
#ifndef HeapUsed
|
||||||
|
#define HeapUsed Yap_givemallinfo()
|
||||||
|
#endif
|
||||||
|
Int NotHeapUsed_;
|
||||||
|
#else
|
||||||
|
Int HeapUsed_;
|
||||||
|
#endif
|
||||||
|
Int HeapMax_;
|
||||||
|
ADDR HeapTop_;
|
||||||
|
ADDR HeapLim_;
|
||||||
|
struct FREEB *FreeBlocks_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar FreeBlocksLock_;
|
||||||
|
lockvar HeapUsedLock_;
|
||||||
|
lockvar HeapTopLock_;
|
||||||
|
int HeapTopOwner_;
|
||||||
|
#endif
|
||||||
|
UInt MaxStack_;
|
||||||
|
UInt MaxTrail_;
|
||||||
|
/* execution info */
|
||||||
|
/* OPCODE REVERSE TABLE, needed to recover op tables */
|
||||||
|
#if USE_THREADED_CODE
|
||||||
|
op_entry *OP_RTABLE_;
|
||||||
|
#endif
|
||||||
|
/* popular opcodes */
|
||||||
|
OPCODE EXECUTE_CPRED_OP_CODE_;
|
||||||
|
OPCODE EXPAND_OP_CODE_;
|
||||||
|
OPCODE FAIL_OPCODE_;
|
||||||
|
OPCODE INDEX_OPCODE_;
|
||||||
|
OPCODE LOCKPRED_OPCODE_;
|
||||||
|
OPCODE ORLAST_OPCODE_;
|
||||||
|
OPCODE UNDEF_OPCODE_;
|
||||||
|
OPCODE RETRY_USERC_OPCODE_;
|
||||||
|
OPCODE EXECUTE_CPRED_OPCODE_;
|
||||||
|
/* atom tables */
|
||||||
|
UInt NOfAtoms_;
|
||||||
|
UInt AtomHashTableSize_;
|
||||||
|
UInt WideAtomHashTableSize_;
|
||||||
|
UInt NOfWideAtoms_;
|
||||||
|
AtomHashEntry INVISIBLECHAIN_;
|
||||||
|
AtomHashEntry *WideHashChain_;
|
||||||
|
AtomHashEntry *HashChain_;
|
||||||
|
/* use atom defs here */
|
||||||
|
#include "tatoms.h"
|
||||||
|
#ifdef EUROTRA
|
||||||
|
Term TermDollarU_;
|
||||||
|
#endif
|
||||||
|
//modules
|
||||||
|
Term USER_MODULE_;
|
||||||
|
Term IDB_MODULE_;
|
||||||
|
Term ATTRIBUTES_MODULE_;
|
||||||
|
Term CHARSIO_MODULE_;
|
||||||
|
Term CHTYPE_MODULE_;
|
||||||
|
Term TERMS_MODULE_;
|
||||||
|
Term SYSTEM_MODULE_;
|
||||||
|
Term READUTIL_MODULE_;
|
||||||
|
Term HACKS_MODULE_;
|
||||||
|
Term ARG_MODULE_;
|
||||||
|
Term GLOBALS_MODULE_;
|
||||||
|
Term SWI_MODULE_;
|
||||||
|
Term DBLOAD_MODULE_;
|
||||||
|
Term RANGE_MODULE_;
|
||||||
|
Term ERROR_MODULE_;
|
||||||
|
//
|
||||||
|
// Module list
|
||||||
|
//
|
||||||
|
struct mod_entry *CurrentModules_;
|
||||||
|
// make sure we have the modules set at this point.
|
||||||
|
// don't actually want to define a field
|
||||||
|
|
||||||
|
// hidden predicates
|
||||||
|
Prop HIDDEN_PREDICATES_;
|
||||||
|
// make sure we have the streams set at this point.
|
||||||
|
// don't actually want to define a field
|
||||||
|
|
||||||
|
union flagTerm* GLOBAL_Flags_;
|
||||||
|
UInt GLOBAL_flagCount_;
|
||||||
|
/* Anderson's JIT */
|
||||||
|
yap_exec_mode Yap_ExecutionMode_;
|
||||||
|
/* The Predicate Hash Table: fast access to predicates. */
|
||||||
|
struct pred_entry **PredHash_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
rwlock_t PredHashRWLock_;
|
||||||
|
#endif
|
||||||
|
UInt PredsInHashTable_;
|
||||||
|
UInt PredHashTableSize_;
|
||||||
|
/* Well-Known Predicates */
|
||||||
|
struct pred_entry *CreepCode_;
|
||||||
|
struct pred_entry *UndefCode_;
|
||||||
|
struct pred_entry *SpyCode_;
|
||||||
|
struct pred_entry *PredFail_;
|
||||||
|
struct pred_entry *PredTrue_;
|
||||||
|
#ifdef COROUTINING
|
||||||
|
struct pred_entry *WakeUpCode_;
|
||||||
|
#endif
|
||||||
|
struct pred_entry *PredGoalExpansion_;
|
||||||
|
struct pred_entry *PredMetaCall_;
|
||||||
|
struct pred_entry *PredTraceMetaCall_;
|
||||||
|
struct pred_entry *PredDollarCatch_;
|
||||||
|
struct pred_entry *PredRecordedWithKey_;
|
||||||
|
struct pred_entry *PredLogUpdClause_;
|
||||||
|
struct pred_entry *PredLogUpdClauseErase_;
|
||||||
|
struct pred_entry *PredLogUpdClause0_;
|
||||||
|
struct pred_entry *PredStaticClause_;
|
||||||
|
struct pred_entry *PredThrow_;
|
||||||
|
struct pred_entry *PredHandleThrow_;
|
||||||
|
struct pred_entry *PredIs_;
|
||||||
|
struct pred_entry *PredSafeCallCleanup_;
|
||||||
|
struct pred_entry *PredRestoreRegs_;
|
||||||
|
struct pred_entry *PredCommentHook_;
|
||||||
|
#ifdef YAPOR
|
||||||
|
struct pred_entry *PredGetwork_;
|
||||||
|
#endif /* YAPOR */
|
||||||
|
struct pred_entry *PredProcedure_;
|
||||||
|
/* low-level tracer */
|
||||||
|
#ifdef LOW_LEVEL_TRACER
|
||||||
|
int Yap_do_low_level_trace_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar Yap_low_level_trace_lock_;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
/* code management info */
|
||||||
|
UInt Yap_ClauseSpace_;
|
||||||
|
UInt Yap_IndexSpace_Tree_;
|
||||||
|
UInt Yap_IndexSpace_EXT_;
|
||||||
|
UInt Yap_IndexSpace_SW_;
|
||||||
|
UInt Yap_LUClauseSpace_;
|
||||||
|
UInt Yap_LUIndexSpace_Tree_;
|
||||||
|
UInt Yap_LUIndexSpace_CP_;
|
||||||
|
UInt Yap_LUIndexSpace_EXT_;
|
||||||
|
UInt Yap_LUIndexSpace_SW_;
|
||||||
|
/* static code: may be shared by many predicate or may be used for meta-execution */
|
||||||
|
yamop COMMA_CODE_[5];
|
||||||
|
yamop DUMMYCODE_[1];
|
||||||
|
yamop FAILCODE_[1];
|
||||||
|
yamop NOCODE_[1];
|
||||||
|
yamop ENV_FOR_TRUSTFAIL_[2];
|
||||||
|
yamop *TRUSTFAILCODE_;
|
||||||
|
yamop ENV_FOR_YESCODE_[2];
|
||||||
|
yamop *YESCODE_;
|
||||||
|
yamop RTRYCODE_[1];
|
||||||
|
#ifdef BEAM
|
||||||
|
yamop BEAM_RETRY_CODE_[1];
|
||||||
|
#endif /* BEAM */
|
||||||
|
#ifdef YAPOR
|
||||||
|
yamop GETWORK_[1];
|
||||||
|
yamop GETWORK_SEQ_[1];
|
||||||
|
yamop GETWORK_FIRST_TIME_[1];
|
||||||
|
#endif /* YAPOR */
|
||||||
|
#ifdef TABLING
|
||||||
|
yamop LOAD_ANSWER_[1];
|
||||||
|
yamop TRY_ANSWER_[1];
|
||||||
|
yamop ANSWER_RESOLUTION_[1];
|
||||||
|
yamop COMPLETION_[1];
|
||||||
|
#ifdef THREADS_CONSUMER_SHARING
|
||||||
|
yamop ANSWER_RESOLUTION_COMPLETION_[1];
|
||||||
|
#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. */
|
||||||
|
/* */
|
||||||
|
yamop *P_before_spy_;
|
||||||
|
/* support recorded_k */
|
||||||
|
yamop *RETRY_C_RECORDEDP_CODE_;
|
||||||
|
yamop *RETRY_C_RECORDED_K_CODE_;
|
||||||
|
/* compiler flags */
|
||||||
|
int PROFILING_;
|
||||||
|
int CALL_COUNTING_;
|
||||||
|
int optimizer_on_;
|
||||||
|
int compile_mode_;
|
||||||
|
int profiling_;
|
||||||
|
int call_counting_;
|
||||||
|
/********* whether we should try to compile array references ******************/
|
||||||
|
int compile_arrays_;
|
||||||
|
/* DBTerms: pre-compiled ground terms */
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar DBTermsListLock_;
|
||||||
|
#endif
|
||||||
|
struct dbterm_list *DBTermsList_;
|
||||||
|
/* JITI support */
|
||||||
|
yamop *ExpandClausesFirst_;
|
||||||
|
yamop *ExpandClausesLast_;
|
||||||
|
UInt Yap_ExpandClauses_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar ExpandClausesListLock_;
|
||||||
|
lockvar OpListLock_;
|
||||||
|
#endif
|
||||||
|
/* instrumentation */
|
||||||
|
#ifdef DEBUG
|
||||||
|
UInt Yap_NewCps_;
|
||||||
|
UInt Yap_LiveCps_;
|
||||||
|
UInt Yap_DirtyCps_;
|
||||||
|
UInt Yap_FreedCps_;
|
||||||
|
#endif
|
||||||
|
UInt Yap_expand_clauses_sz_;
|
||||||
|
/* UDI support */
|
||||||
|
struct udi_info *UdiControlBlocks_;
|
||||||
|
/* data-base statistics */
|
||||||
|
/* system boots in compile mode */
|
||||||
|
Int STATIC_PREDICATES_MARKED_;
|
||||||
|
/* Internal Database */
|
||||||
|
Prop *INT_KEYS_;
|
||||||
|
Prop *INT_LU_KEYS_;
|
||||||
|
Prop *INT_BB_KEYS_;
|
||||||
|
/* Internal Database Statistics */
|
||||||
|
UInt INT_KEYS_SIZE_;
|
||||||
|
UInt INT_KEYS_TIMESTAMP_;
|
||||||
|
UInt INT_BB_KEYS_SIZE_;
|
||||||
|
/* Internal Data-Base Control */
|
||||||
|
int UPDATE_MODE_;
|
||||||
|
/* nasty IDB stuff */
|
||||||
|
struct DB_STRUCT *DBErasedMarker_;
|
||||||
|
struct logic_upd_clause *LogDBErasedMarker_;
|
||||||
|
/* Dead clauses and IDB entries */
|
||||||
|
struct static_clause *DeadStaticClauses_;
|
||||||
|
struct static_mega_clause *DeadMegaClauses_;
|
||||||
|
struct static_index *DeadStaticIndices_;
|
||||||
|
struct logic_upd_clause *DBErasedList_;
|
||||||
|
struct logic_upd_index *DBErasedIList_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar DeadStaticClausesLock_;
|
||||||
|
lockvar DeadMegaClausesLock_;
|
||||||
|
lockvar DeadStaticIndicesLock_;
|
||||||
|
#endif
|
||||||
|
#ifdef COROUTINING
|
||||||
|
/* number of attribute modules */
|
||||||
|
int NUM_OF_ATTS_;
|
||||||
|
/* initialised by memory allocator */
|
||||||
|
UInt Yap_AttsSize_;
|
||||||
|
#endif
|
||||||
|
/* Operators */
|
||||||
|
struct operator_entry *OpList_;
|
||||||
|
/* foreign code loaded */
|
||||||
|
struct ForeignLoadItem *ForeignCodeLoaded_;
|
||||||
|
ADDR ForeignCodeBase_;
|
||||||
|
ADDR ForeignCodeTop_;
|
||||||
|
ADDR ForeignCodeMax_;
|
||||||
|
/* recorded terms */
|
||||||
|
struct record_list *Yap_Records_;
|
||||||
|
/* SWI atoms and functors */
|
||||||
|
Atom *SWI_Atoms_;
|
||||||
|
Functor *SWI_Functors_;
|
||||||
|
swi_rev_hash SWI_ReverseHash_[N_SWI_HASH];
|
||||||
|
/* integer access to atoms */
|
||||||
|
Int AtomTranslations_;
|
||||||
|
Int MaxAtomTranslations_;
|
||||||
|
/* integer access to functors */
|
||||||
|
Int FunctorTranslations_;
|
||||||
|
Int MaxFunctorTranslations_;
|
||||||
|
Atom EmptyWakeups_[MAX_EMPTY_WAKEUPS];
|
||||||
|
int MaxEmptyWakeups_;
|
||||||
|
/* SWI blobs */
|
||||||
|
struct YAP_blob_t *BlobTypes_;
|
||||||
|
struct AtomEntryStruct *Blobs_;
|
||||||
|
UInt NOfBlobs_;
|
||||||
|
UInt NOfBlobsMax_;
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
lockvar Blobs_Lock_;
|
||||||
|
#endif
|
||||||
|
|
301
H/hstruct.h
301
H/hstruct.h
@ -1,301 +0,0 @@
|
|||||||
|
|
||||||
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildheap"
|
|
||||||
please do not update, update misc/HEAPFIELDS instead */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UInt hole_size;
|
|
||||||
struct malloc_state *av_;
|
|
||||||
#if USE_DL_MALLOC
|
|
||||||
struct memory_hole memory_holes[MAX_DLMALLOC_HOLES];
|
|
||||||
UInt nof_memory_holes;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar dlmalloc_lock;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
|
||||||
#ifndef HeapUsed
|
|
||||||
#define HeapUsed Yap_givemallinfo()
|
|
||||||
#endif
|
|
||||||
Int heap_used;
|
|
||||||
#else
|
|
||||||
Int heap_used;
|
|
||||||
#endif
|
|
||||||
Int heap_max;
|
|
||||||
ADDR heap_top;
|
|
||||||
ADDR heap_lim;
|
|
||||||
struct FREEB *free_blocks;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar free_blocks_lock;
|
|
||||||
lockvar heap_used_lock;
|
|
||||||
lockvar heap_top_lock;
|
|
||||||
int heap_top_owner;
|
|
||||||
#endif
|
|
||||||
UInt MaxStack_;
|
|
||||||
UInt MaxTrail_;
|
|
||||||
|
|
||||||
|
|
||||||
#if USE_THREADED_CODE
|
|
||||||
op_entry *op_rtable;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OPCODE execute_cpred_op_code;
|
|
||||||
OPCODE expand_op_code;
|
|
||||||
OPCODE fail_op;
|
|
||||||
OPCODE index_op;
|
|
||||||
OPCODE lockpred_op;
|
|
||||||
OPCODE orlast_op;
|
|
||||||
OPCODE undef_op;
|
|
||||||
OPCODE retry_userc_op;
|
|
||||||
OPCODE execute_cpred_op;
|
|
||||||
|
|
||||||
UInt n_of_atoms;
|
|
||||||
UInt atom_hash_table_size;
|
|
||||||
UInt wide_atom_hash_table_size;
|
|
||||||
UInt n_of_wide_atoms;
|
|
||||||
AtomHashEntry invisiblechain;
|
|
||||||
AtomHashEntry *wide_hash_chain;
|
|
||||||
AtomHashEntry *hash_chain;
|
|
||||||
|
|
||||||
#include "tatoms.h"
|
|
||||||
#ifdef EUROTRA
|
|
||||||
Term term_dollar_u;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Term user_module;
|
|
||||||
Term idb_module;
|
|
||||||
Term attributes_module;
|
|
||||||
Term charsio_module;
|
|
||||||
Term chtype_module;
|
|
||||||
Term terms_module;
|
|
||||||
Term system_module;
|
|
||||||
Term readutil_module;
|
|
||||||
Term hacks_module;
|
|
||||||
Term arg_module;
|
|
||||||
Term globals_module;
|
|
||||||
Term swi_module;
|
|
||||||
Term dbload_module;
|
|
||||||
Term range_module;
|
|
||||||
Term error_module;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mod_entry *current_modules;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Prop hidden_predicates;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
union flagTerm* GLOBAL_Flags_;
|
|
||||||
UInt GLOBAL_flagCount_;
|
|
||||||
|
|
||||||
yap_exec_mode execution_mode;
|
|
||||||
|
|
||||||
struct pred_entry **pred_hash;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
rwlock_t pred_hash_rw_lock;
|
|
||||||
#endif
|
|
||||||
UInt preds_in_hash_table;
|
|
||||||
UInt pred_hash_table_size;
|
|
||||||
|
|
||||||
struct pred_entry *creep_code;
|
|
||||||
struct pred_entry *undef_code;
|
|
||||||
struct pred_entry *spy_code;
|
|
||||||
struct pred_entry *pred_fail;
|
|
||||||
struct pred_entry *pred_true;
|
|
||||||
#ifdef COROUTINING
|
|
||||||
struct pred_entry *wake_up_code;
|
|
||||||
#endif
|
|
||||||
struct pred_entry *pred_goal_expansion;
|
|
||||||
struct pred_entry *pred_meta_call;
|
|
||||||
struct pred_entry *pred_trace_meta_call;
|
|
||||||
struct pred_entry *pred_dollar_catch;
|
|
||||||
struct pred_entry *pred_recorded_with_key;
|
|
||||||
struct pred_entry *pred_log_upd_clause;
|
|
||||||
struct pred_entry *pred_log_upd_clause_erase;
|
|
||||||
struct pred_entry *pred_log_upd_clause0;
|
|
||||||
struct pred_entry *pred_static_clause;
|
|
||||||
struct pred_entry *pred_throw;
|
|
||||||
struct pred_entry *pred_handle_throw;
|
|
||||||
struct pred_entry *pred_is;
|
|
||||||
struct pred_entry *pred_safe_call_cleanup;
|
|
||||||
struct pred_entry *pred_restore_regs;
|
|
||||||
struct pred_entry *pred_comment_hook;
|
|
||||||
#ifdef YAPOR
|
|
||||||
struct pred_entry *pred_getwork;
|
|
||||||
struct pred_entry *pred_getwork_seq;
|
|
||||||
#endif /* YAPOR */
|
|
||||||
|
|
||||||
#ifdef LOW_LEVEL_TRACER
|
|
||||||
int yap_do_low_level_trace;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar low_level_trace_lock;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UInt clause_space;
|
|
||||||
UInt index_space_Tree;
|
|
||||||
UInt index_space_EXT;
|
|
||||||
UInt index_space_SW;
|
|
||||||
UInt lu_clause_space;
|
|
||||||
UInt lu_index_space_Tree;
|
|
||||||
UInt lu_index_space_CP;
|
|
||||||
UInt lu_index_space_EXT;
|
|
||||||
UInt lu_index_space_SW;
|
|
||||||
|
|
||||||
yamop comma_code[5];
|
|
||||||
yamop dummycode[1];
|
|
||||||
yamop failcode[1];
|
|
||||||
yamop nocode[1];
|
|
||||||
yamop env_for_trustfail[2];
|
|
||||||
yamop *trustfailcode;
|
|
||||||
yamop env_for_yescode[2];
|
|
||||||
yamop *yescode;
|
|
||||||
yamop rtrycode[1];
|
|
||||||
#ifdef BEAM
|
|
||||||
yamop beam_retry_code[1];
|
|
||||||
#endif /* BEAM */
|
|
||||||
#ifdef YAPOR
|
|
||||||
yamop getwork_code[1];
|
|
||||||
yamop getwork_seq_code[1];
|
|
||||||
yamop getwork_first_time[1];
|
|
||||||
#endif /* YAPOR */
|
|
||||||
#ifdef TABLING
|
|
||||||
yamop table_load_answer_code[1];
|
|
||||||
yamop table_try_answer_code[1];
|
|
||||||
yamop table_answer_resolution_code[1];
|
|
||||||
yamop table_completion_code[1];
|
|
||||||
#ifdef THREADS_CONSUMER_SHARING
|
|
||||||
yamop table_answer_resolution_completion_code[1];
|
|
||||||
#endif /* THREADS_CONSUMER_SHARING */
|
|
||||||
#endif /* TABLING */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
yamop *debugger_p_before_spy;
|
|
||||||
|
|
||||||
yamop *retry_recordedp_code;
|
|
||||||
yamop *retry_recorded_k_code;
|
|
||||||
|
|
||||||
int system_profiling;
|
|
||||||
int system_call_counting;
|
|
||||||
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;
|
|
||||||
#endif
|
|
||||||
UInt expand_clauses_sz;
|
|
||||||
|
|
||||||
struct udi_info *udi_control_blocks;
|
|
||||||
|
|
||||||
|
|
||||||
Int static_predicates_marked;
|
|
||||||
|
|
||||||
Prop *IntKeys;
|
|
||||||
Prop *IntLUKeys;
|
|
||||||
Prop *IntBBKeys;
|
|
||||||
|
|
||||||
UInt int_keys_size;
|
|
||||||
UInt int_keys_timestamp;
|
|
||||||
UInt int_bb_keys_size;
|
|
||||||
|
|
||||||
int update_mode;
|
|
||||||
|
|
||||||
struct DB_STRUCT *db_erased_marker;
|
|
||||||
struct logic_upd_clause *logdb_erased_marker;
|
|
||||||
|
|
||||||
struct static_clause *dead_static_clauses;
|
|
||||||
struct static_mega_clause *dead_mega_clauses;
|
|
||||||
struct static_index *dead_static_indices;
|
|
||||||
struct logic_upd_clause *db_erased_list;
|
|
||||||
struct logic_upd_index *db_erased_ilist;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar dead_static_clauses_lock;
|
|
||||||
lockvar dead_mega_clauses_lock;
|
|
||||||
lockvar dead_static_indices_lock;
|
|
||||||
#endif
|
|
||||||
#ifdef COROUTINING
|
|
||||||
|
|
||||||
int num_of_atts;
|
|
||||||
|
|
||||||
UInt atts_size;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct operator_entry *op_list;
|
|
||||||
|
|
||||||
struct ForeignLoadItem *foreign_code_loaded;
|
|
||||||
ADDR foreign_code_base;
|
|
||||||
ADDR foreign_code_top;
|
|
||||||
ADDR foreign_code_max;
|
|
||||||
|
|
||||||
struct record_list *yap_records;
|
|
||||||
|
|
||||||
Atom *swi_atoms;
|
|
||||||
Functor *swi_functors;
|
|
||||||
struct swi_reverse_hash swi_reverse_hash[N_SWI_HASH];
|
|
||||||
|
|
||||||
Int atom_translations;
|
|
||||||
Int max_atom_translations;
|
|
||||||
|
|
||||||
Int functor_translations;
|
|
||||||
Int max_functor_translations;
|
|
||||||
Atom empty_wakeups[MAX_EMPTY_WAKEUPS];
|
|
||||||
int max_empty_wakeups;
|
|
||||||
|
|
||||||
struct YAP_blob_t *swi_blob_types;
|
|
||||||
struct AtomEntryStruct *swi_blobs;
|
|
||||||
UInt nofblobs;
|
|
||||||
UInt nofblobsmax;
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
|
||||||
lockvar blobs_lock;
|
|
||||||
#endif
|
|
Reference in New Issue
Block a user