diff --git a/H/iglobals.h b/H/iglobals.h index 18789bf6e..6cf2ab9fa 100644 --- a/H/iglobals.h +++ b/H/iglobals.h @@ -24,30 +24,30 @@ static void InitGlobal(void) { #if THREADS - Yap_global->n_of_threads = 1; + Yap_NOfThreads = 1; - Yap_global->n_of_threads_created = 1; + Yap_NOfThreadsCreated = 1; - Yap_global->threads_total_time = 0L; + Yap_ThreadsTotalTime = 0L; #endif #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_global->bgl); + INIT_LOCK(Yap_BGL); #endif - Yap_global->allow_local_expansion = TRUE; - Yap_global->allow_global_expansion = TRUE; - Yap_global->allow_trail_expansion = TRUE; - Yap_global->size_of_overflow = 0; + Yap_AllowLocalExpansion = TRUE; + Yap_AllowGlobalExpansion = TRUE; + Yap_AllowTrailExpansion = TRUE; + Yap_SizeOfOverflow = 0; - Yap_global->agc_last_call = 0; + Yap_AGcLastCall = 0; - Yap_global->agc_threshold = 10000; - Yap_global->agc_hook = NULL; + Yap_AGcThreshold = 10000; + Yap_AGCHook = NULL; #ifdef THREADS - INIT_LOCK(Yap_global->thread_handles_lock); + INIT_LOCK(Yap_ThreadHandlesLock); #endif #if defined(YAPOR) || defined(TABLING) @@ -55,10 +55,10 @@ static void InitGlobal(void) { #endif - Yap_global->initialised = FALSE; - Yap_global->initialised_from_pl = FALSE; - Yap_global->pl_argc = 0; - Yap_global->pl_argv = NULL; + Yap_Initialised = FALSE; + Yap_InitialisedFromPL = FALSE; + Yap_PL_Argc = 0; + Yap_PL_Argv = NULL; - Yap_global->yap_halt_hook = NULL; + Yap_HaltHooks = NULL; } diff --git a/H/ihstruct.h b/H/ihstruct.h index 45ab202c3..c17ef8c96 100644 --- a/H/ihstruct.h +++ b/H/ihstruct.h @@ -35,7 +35,7 @@ #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_heap_regs->dlmalloc_lock); + INIT_LOCK(DLMallocLock); #endif #endif #if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO) @@ -51,10 +51,10 @@ #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_heap_regs->free_blocks_lock); - INIT_LOCK(Yap_heap_regs->heap_used_lock); - INIT_LOCK(Yap_heap_regs->heap_top_lock); - Yap_heap_regs->heap_top_owner = -1; + INIT_LOCK(FreeBlocksLock); + INIT_LOCK(HeapUsedLock); + INIT_LOCK(HeapTopLock); + HeapTopOwner = -1; #endif @@ -62,13 +62,13 @@ #endif - Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); - Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); - Yap_heap_regs->fail_op = Yap_opcode(_op_fail); - Yap_heap_regs->index_op = Yap_opcode(_index_pred); - Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred); - Yap_heap_regs->orlast_op = Yap_opcode(_or_last); - Yap_heap_regs->undef_op = Yap_opcode(_undef_p); + EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred); + EXPAND_OP_CODE = Yap_opcode(_expand_index); + FAIL_OPCODE = Yap_opcode(_op_fail); + INDEX_OPCODE = Yap_opcode(_index_pred); + LOCKPRED_OPCODE = Yap_opcode(_lock_pred); + ORLAST_OPCODE = Yap_opcode(_or_last); + UNDEF_OPCODE = Yap_opcode(_undef_p); @@ -80,100 +80,100 @@ #include "iatoms.h" #ifdef EUROTRA - Yap_heap_regs->term_dollar_u = MkAtomTerm(AtomDollarU); + TermDollarU = MkAtomTerm(AtomDollarU); #endif - Yap_heap_regs->term_prolog = MkAtomTerm(AtomProlog); - Yap_heap_regs->term_refound_var = MkAtomTerm(AtomRefoundVar); - Yap_heap_regs->user_module = MkAtomTerm(AtomUser); - Yap_heap_regs->idb_module = MkAtomTerm(AtomIDB); - Yap_heap_regs->attributes_module = MkAtomTerm(AtomAttributes); - Yap_heap_regs->charsio_module = MkAtomTerm(AtomCharsio); - Yap_heap_regs->terms_module = MkAtomTerm(AtomTerms); - Yap_heap_regs->system_module = MkAtomTerm(AtomSystem); - Yap_heap_regs->operating_system_module = MkAtomTerm(AtomOperatingSystemSupport); - Yap_heap_regs->readutil_module = MkAtomTerm(AtomReadutil); - Yap_heap_regs->hacks_module = MkAtomTerm(AtomYapHacks); - Yap_heap_regs->arg_module = MkAtomTerm(AtomArg); - Yap_heap_regs->globals_module = MkAtomTerm(AtomNb); - Yap_heap_regs->swi_module = MkAtomTerm(AtomSwi); - Yap_heap_regs->dbload_module = MkAtomTerm(AtomDBLoad); + TermProlog = MkAtomTerm(AtomProlog); + TermReFoundVar = MkAtomTerm(AtomRefoundVar); + USER_MODULE = MkAtomTerm(AtomUser); + IDB_MODULE = MkAtomTerm(AtomIDB); + ATTRIBUTES_MODULE = MkAtomTerm(AtomAttributes); + CHARSIO_MODULE = MkAtomTerm(AtomCharsio); + TERMS_MODULE = MkAtomTerm(AtomTerms); + SYSTEM_MODULE = MkAtomTerm(AtomSystem); + OPERATING_SYSTEM_MODULE = MkAtomTerm(AtomOperatingSystemSupport); + READUTIL_MODULE = MkAtomTerm(AtomReadutil); + HACKS_MODULE = MkAtomTerm(AtomYapHacks); + ARG_MODULE = MkAtomTerm(AtomArg); + GLOBALS_MODULE = MkAtomTerm(AtomNb); + SWI_MODULE = MkAtomTerm(AtomSwi); + DBLOAD_MODULE = MkAtomTerm(AtomDBLoad); - Yap_heap_regs->current_modules = NULL; + CurrentModules = NULL; Yap_InitModules(); - Yap_heap_regs->execution_mode = INTERPRETED; + Yap_ExecutionMode = INTERPRETED; InitPredHash(); #if defined(YAPOR) || defined(THREADS) #endif - Yap_heap_regs->preds_in_hash_table = 0; + PredsInHashTable = 0; - Yap_heap_regs->creep_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE)); - Yap_heap_regs->undef_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE)); - Yap_heap_regs->spy_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE)); - Yap_heap_regs->pred_fail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE)); - Yap_heap_regs->pred_true = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE)); + CreepCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE)); + UndefCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE)); + SpyCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE)); + PredFail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE)); + PredTrue = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE)); #ifdef COROUTINING - Yap_heap_regs->wake_up_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomWakeUpGoal,2),PROLOG_MODULE)); + WakeUpCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomWakeUpGoal,2),PROLOG_MODULE)); #endif - Yap_heap_regs->pred_goal_expansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE)); - Yap_heap_regs->pred_meta_call = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE)); - Yap_heap_regs->pred_dollar_catch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE)); - Yap_heap_regs->pred_recorded_with_key = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE)); - Yap_heap_regs->pred_log_upd_clause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); - Yap_heap_regs->pred_log_upd_clause_erase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE)); - Yap_heap_regs->pred_log_upd_clause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); - Yap_heap_regs->pred_static_clause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE)); - Yap_heap_regs->pred_throw = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE)); - Yap_heap_regs->pred_handle_throw = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE)); - Yap_heap_regs->pred_is = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE)); - Yap_heap_regs->pred_safe_call_cleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE)); - Yap_heap_regs->pred_restore_regs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE)); + PredGoalExpansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE)); + PredMetaCall = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE)); + PredDollarCatch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE)); + PredRecordedWithKey = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE)); + PredLogUpdClause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); + PredLogUpdClauseErase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE)); + PredLogUpdClause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); + PredStaticClause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE)); + PredThrow = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE)); + PredHandleThrow = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE)); + PredIs = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE)); + PredSafeCallCleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE)); + PredRestoreRegs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE)); #ifdef YAPOR - Yap_heap_regs->pred_getwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE)); - Yap_heap_regs->pred_getwork_seq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE)); + PredGetwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE)); + PredGetworkSeq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE)); #endif /* YAPOR */ #ifdef LOW_LEVEL_TRACER - Yap_heap_regs->yap_do_low_level_trace = FALSE; + Yap_do_low_level_trace = FALSE; #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_heap_regs->low_level_trace_lock); + INIT_LOCK(Yap_low_level_trace_lock); #endif #endif - Yap_heap_regs->clause_space = 0; - Yap_heap_regs->index_space_Tree = 0; - Yap_heap_regs->index_space_EXT = 0; - Yap_heap_regs->index_space_SW = 0; - Yap_heap_regs->lu_clause_space = 0; - Yap_heap_regs->lu_index_space_Tree = 0; - Yap_heap_regs->lu_index_space_CP = 0; - Yap_heap_regs->lu_index_space_EXT = 0; - Yap_heap_regs->lu_index_space_SW = 0; + Yap_ClauseSpace = 0; + Yap_IndexSpace_Tree = 0; + Yap_IndexSpace_EXT = 0; + Yap_IndexSpace_SW = 0; + Yap_LUClauseSpace = 0; + Yap_LUIndexSpace_Tree = 0; + Yap_LUIndexSpace_CP = 0; + Yap_LUIndexSpace_EXT = 0; + Yap_LUIndexSpace_SW = 0; - Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail); - Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail); - Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop); + DUMMYCODE->opc = Yap_opcode(_op_fail); + FAILCODE->opc = Yap_opcode(_op_fail); + NOCODE->opc = Yap_opcode(_Nstop); InitEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail); InitEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail); InitOtaplInst(RTRYCODE,_retry_and_mark,PredFail); #ifdef BEAM - Yap_heap_regs->beam_retry_code->opc = Yap_opcode(_beam_retry_code); + BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code); #endif /* BEAM */ #ifdef YAPOR - Yap_heap_regs->seq_def = FALSE; + SEQUENTIAL_IS_DEFAULT = FALSE; InitOtaplInst(GETWORK,_getwork,PredGetwork); InitOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq); - Yap_heap_regs->getwork_first_time->opc = Yap_opcode(_getwork_first_time); + GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time); #endif /* YAPOR */ #ifdef TABLING InitOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail); @@ -185,121 +185,121 @@ - Yap_heap_regs->debugger_p_before_spy = NULL; + P_before_spy = NULL; - Yap_heap_regs->retry_recordedp_code = NULL; - Yap_heap_regs->retry_recorded_k_code = NULL; + RETRY_C_RECORDEDP_CODE = NULL; + RETRY_C_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; + PROFILING = FALSE; + CALL_COUNTING = FALSE; + PRED_GOAL_EXPANSION_ALL = FALSE; + PRED_GOAL_EXPANSION_FUNC = FALSE; + PRED_GOAL_EXPANSION_ON = FALSE; + optimizer_on = TRUE; + compile_mode = 0; + profiling = FALSE; + call_counting = FALSE; - Yap_heap_regs->compiler_compile_arrays = FALSE; + compile_arrays = FALSE; #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_heap_regs->dbterms_list_lock); + INIT_LOCK(DBTermsListLock); #endif - Yap_heap_regs->dbterms_list = NULL; + DBTermsList = NULL; - Yap_heap_regs->expand_clauses_first = NULL; - Yap_heap_regs->expand_clauses_last = NULL; - Yap_heap_regs->expand_clauses = 0; + ExpandClausesFirst = NULL; + ExpandClausesLast = NULL; + Yap_ExpandClauses = 0; #if defined(YAPOR) || defined(THREADS) - INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock); - INIT_LOCK(Yap_heap_regs->op_list_lock); + INIT_LOCK(ExpandClausesListLock); + INIT_LOCK(OpListLock); #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_NewCps = 0L; + Yap_LiveCps = 0L; + Yap_DirtyCps = 0L; + Yap_FreedCps = 0L; #endif - Yap_heap_regs->expand_clauses_sz = 0L; + Yap_expand_clauses_sz = 0L; - Yap_heap_regs->udi_control_blocks = NULL; + UdiControlBlocks = NULL; - Yap_heap_regs->static_predicates_marked = FALSE; + STATIC_PREDICATES_MARKED = FALSE; - Yap_heap_regs->IntKeys = NULL; - Yap_heap_regs->IntLUKeys = NULL; - Yap_heap_regs->IntBBKeys = NULL; + INT_KEYS = NULL; + INT_LU_KEYS = NULL; + INT_BB_KEYS = NULL; - Yap_heap_regs->int_keys_size = INT_KEYS_DEFAULT_SIZE; - Yap_heap_regs->int_keys_timestamp = 0L; - Yap_heap_regs->int_bb_keys_size = INT_KEYS_DEFAULT_SIZE; + INT_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE; + INT_KEYS_TIMESTAMP = 0L; + INT_BB_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE; - Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL; + UPDATE_MODE = UPDATE_MODE_LOGICAL; InitDBErasedMarker(); InitLogDBErasedMarker(); - Yap_heap_regs->dead_static_clauses = NULL; - Yap_heap_regs->dead_mega_clauses = NULL; - Yap_heap_regs->dead_static_indices = NULL; - Yap_heap_regs->db_erased_list = NULL; - Yap_heap_regs->db_erased_ilist = NULL; + DeadStaticClauses = NULL; + DeadMegaClauses = NULL; + DeadStaticIndices = NULL; + DBErasedList = NULL; + DBErasedIList = NULL; #if defined(YAPOR) || defined(THREADS) - 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(DeadStaticClausesLock); + INIT_LOCK(DeadMegaClausesLock); + INIT_LOCK(DeadStaticIndicesLock); #endif #ifdef COROUTINING - Yap_heap_regs->num_of_atts = 1; + NUM_OF_ATTS = 1; #endif InitFlags(); - Yap_heap_regs->op_list = NULL; + OpList = NULL; - Yap_heap_regs->yap_streams = NULL; + Stream = NULL; - Yap_heap_regs->n_of_file_aliases = 0; - Yap_heap_regs->sz_of_file_aliases = 0; - Yap_heap_regs->file_aliases = NULL; + NOfFileAliases = 0; + SzOfFileAliases = 0; + FileAliases = NULL; - Yap_heap_regs->atprompt = AtomNil; + AtPrompt = AtomNil; - Yap_heap_regs->char_conversion_table = NULL; - Yap_heap_regs->char_conversion_table2 = NULL; + CharConversionTable = NULL; + CharConversionTable2 = NULL; - Yap_heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR; + ParserErrorStyle = EXCEPTION_ON_PARSER_ERROR; - Yap_heap_regs->yap_lib_dir = NULL; + Yap_LibDir = NULL; - Yap_heap_regs->last_wtime = NULL; + LastWtimePtr = NULL; - Yap_heap_regs->debugger_output_msg = 0L; + output_msg = 0L; #if LOW_PROF - Yap_heap_regs->profiler_on = FALSE; - Yap_heap_regs->offline_profiler = FALSE; - Yap_heap_regs->f_prof = NULL; - Yap_heap_regs->f_preds = NULL; - Yap_heap_regs->prof_preds = 0L; + ProfilerOn = FALSE; + Yap_OffLineProfiler = FALSE; + FProf = NULL; + FPreds = NULL; + ProfPreds = 0L; #endif /* LOW_PROF */ - Yap_heap_regs->foreign_code_loaded = NULL; - Yap_heap_regs->foreign_code_base = NULL; - Yap_heap_regs->foreign_code_top = NULL; - Yap_heap_regs->foreign_code_max = NULL; + ForeignCodeLoaded = NULL; + ForeignCodeBase = NULL; + ForeignCodeTop = NULL; + ForeignCodeMax = NULL; - Yap_heap_regs->yap_records = NULL; + Yap_Records = NULL; InitSWIAtoms(); - Yap_heap_regs->swi_blob_types = NULL; - Yap_heap_regs->swi_blobs = NULL; + SWI_BlobTypes = NULL; + SWI_Blobs = NULL; diff --git a/H/rglobals.h b/H/rglobals.h index c7bdffff9..6199df6a9 100644 --- a/H/rglobals.h +++ b/H/rglobals.h @@ -33,7 +33,7 @@ static void RestoreGlobal(void) { #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_global->bgl); + REINIT_LOCK(Yap_BGL); #endif @@ -47,7 +47,7 @@ static void RestoreGlobal(void) { #ifdef THREADS - REINIT_LOCK(Yap_global->thread_handles_lock); + REINIT_LOCK(Yap_ThreadHandlesLock); #endif #if defined(YAPOR) || defined(TABLING) diff --git a/H/rhstruct.h b/H/rhstruct.h index 71e37aad3..323c3daf7 100644 --- a/H/rhstruct.h +++ b/H/rhstruct.h @@ -35,7 +35,7 @@ #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->dlmalloc_lock); + REINIT_LOCK(DLMallocLock); #endif #endif #if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO) @@ -51,24 +51,24 @@ #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->free_blocks_lock); - REINIT_LOCK(Yap_heap_regs->heap_used_lock); - REINIT_LOCK(Yap_heap_regs->heap_top_lock); + REINIT_LOCK(FreeBlocksLock); + REINIT_LOCK(HeapUsedLock); + REINIT_LOCK(HeapTopLock); #endif #if USE_THREADED_CODE - Yap_heap_regs->op_rtable = OpRTableAdjust(Yap_heap_regs->op_rtable); + OP_RTABLE = OpRTableAdjust(OP_RTABLE); #endif - Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); - Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); - Yap_heap_regs->fail_op = Yap_opcode(_op_fail); - Yap_heap_regs->index_op = Yap_opcode(_index_pred); - Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred); - Yap_heap_regs->orlast_op = Yap_opcode(_or_last); - Yap_heap_regs->undef_op = Yap_opcode(_undef_p); + EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred); + EXPAND_OP_CODE = Yap_opcode(_expand_index); + FAIL_OPCODE = Yap_opcode(_op_fail); + INDEX_OPCODE = Yap_opcode(_index_pred); + LOCKPRED_OPCODE = Yap_opcode(_lock_pred); + ORLAST_OPCODE = Yap_opcode(_or_last); + UNDEF_OPCODE = Yap_opcode(_undef_p); @@ -80,27 +80,27 @@ #include "ratoms.h" #ifdef EUROTRA - Yap_heap_regs->term_dollar_u = AtomTermAdjust(Yap_heap_regs->term_dollar_u); + TermDollarU = AtomTermAdjust(TermDollarU); #endif - Yap_heap_regs->term_prolog = AtomTermAdjust(Yap_heap_regs->term_prolog); - Yap_heap_regs->term_refound_var = AtomTermAdjust(Yap_heap_regs->term_refound_var); - Yap_heap_regs->user_module = AtomTermAdjust(Yap_heap_regs->user_module); - Yap_heap_regs->idb_module = AtomTermAdjust(Yap_heap_regs->idb_module); - Yap_heap_regs->attributes_module = AtomTermAdjust(Yap_heap_regs->attributes_module); - Yap_heap_regs->charsio_module = AtomTermAdjust(Yap_heap_regs->charsio_module); - Yap_heap_regs->terms_module = AtomTermAdjust(Yap_heap_regs->terms_module); - Yap_heap_regs->system_module = AtomTermAdjust(Yap_heap_regs->system_module); - Yap_heap_regs->operating_system_module = AtomTermAdjust(Yap_heap_regs->operating_system_module); - Yap_heap_regs->readutil_module = AtomTermAdjust(Yap_heap_regs->readutil_module); - Yap_heap_regs->hacks_module = AtomTermAdjust(Yap_heap_regs->hacks_module); - Yap_heap_regs->arg_module = AtomTermAdjust(Yap_heap_regs->arg_module); - Yap_heap_regs->globals_module = AtomTermAdjust(Yap_heap_regs->globals_module); - Yap_heap_regs->swi_module = AtomTermAdjust(Yap_heap_regs->swi_module); - Yap_heap_regs->dbload_module = AtomTermAdjust(Yap_heap_regs->dbload_module); + TermProlog = AtomTermAdjust(TermProlog); + TermReFoundVar = AtomTermAdjust(TermReFoundVar); + USER_MODULE = AtomTermAdjust(USER_MODULE); + IDB_MODULE = AtomTermAdjust(IDB_MODULE); + ATTRIBUTES_MODULE = AtomTermAdjust(ATTRIBUTES_MODULE); + CHARSIO_MODULE = AtomTermAdjust(CHARSIO_MODULE); + TERMS_MODULE = AtomTermAdjust(TERMS_MODULE); + SYSTEM_MODULE = AtomTermAdjust(SYSTEM_MODULE); + OPERATING_SYSTEM_MODULE = AtomTermAdjust(OPERATING_SYSTEM_MODULE); + READUTIL_MODULE = AtomTermAdjust(READUTIL_MODULE); + HACKS_MODULE = AtomTermAdjust(HACKS_MODULE); + ARG_MODULE = AtomTermAdjust(ARG_MODULE); + GLOBALS_MODULE = AtomTermAdjust(GLOBALS_MODULE); + SWI_MODULE = AtomTermAdjust(SWI_MODULE); + DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE); - Yap_heap_regs->current_modules = ModEntryPtrAdjust(Yap_heap_regs->current_modules); + CurrentModules = ModEntryPtrAdjust(CurrentModules); @@ -114,36 +114,36 @@ - Yap_heap_regs->creep_code = PtoPredAdjust(Yap_heap_regs->creep_code); - Yap_heap_regs->undef_code = PtoPredAdjust(Yap_heap_regs->undef_code); - Yap_heap_regs->spy_code = PtoPredAdjust(Yap_heap_regs->spy_code); - Yap_heap_regs->pred_fail = PtoPredAdjust(Yap_heap_regs->pred_fail); - Yap_heap_regs->pred_true = PtoPredAdjust(Yap_heap_regs->pred_true); + CreepCode = PtoPredAdjust(CreepCode); + UndefCode = PtoPredAdjust(UndefCode); + SpyCode = PtoPredAdjust(SpyCode); + PredFail = PtoPredAdjust(PredFail); + PredTrue = PtoPredAdjust(PredTrue); #ifdef COROUTINING - Yap_heap_regs->wake_up_code = PtoPredAdjust(Yap_heap_regs->wake_up_code); + WakeUpCode = PtoPredAdjust(WakeUpCode); #endif - Yap_heap_regs->pred_goal_expansion = PtoPredAdjust(Yap_heap_regs->pred_goal_expansion); - Yap_heap_regs->pred_meta_call = PtoPredAdjust(Yap_heap_regs->pred_meta_call); - Yap_heap_regs->pred_dollar_catch = PtoPredAdjust(Yap_heap_regs->pred_dollar_catch); - Yap_heap_regs->pred_recorded_with_key = PtoPredAdjust(Yap_heap_regs->pred_recorded_with_key); - Yap_heap_regs->pred_log_upd_clause = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause); - Yap_heap_regs->pred_log_upd_clause_erase = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause_erase); - Yap_heap_regs->pred_log_upd_clause0 = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause0); - Yap_heap_regs->pred_static_clause = PtoPredAdjust(Yap_heap_regs->pred_static_clause); - Yap_heap_regs->pred_throw = PtoPredAdjust(Yap_heap_regs->pred_throw); - Yap_heap_regs->pred_handle_throw = PtoPredAdjust(Yap_heap_regs->pred_handle_throw); - Yap_heap_regs->pred_is = PtoPredAdjust(Yap_heap_regs->pred_is); - Yap_heap_regs->pred_safe_call_cleanup = PtoPredAdjust(Yap_heap_regs->pred_safe_call_cleanup); - Yap_heap_regs->pred_restore_regs = PtoPredAdjust(Yap_heap_regs->pred_restore_regs); + PredGoalExpansion = PtoPredAdjust(PredGoalExpansion); + PredMetaCall = PtoPredAdjust(PredMetaCall); + PredDollarCatch = PtoPredAdjust(PredDollarCatch); + PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey); + PredLogUpdClause = PtoPredAdjust(PredLogUpdClause); + PredLogUpdClauseErase = PtoPredAdjust(PredLogUpdClauseErase); + PredLogUpdClause0 = PtoPredAdjust(PredLogUpdClause0); + PredStaticClause = PtoPredAdjust(PredStaticClause); + PredThrow = PtoPredAdjust(PredThrow); + PredHandleThrow = PtoPredAdjust(PredHandleThrow); + PredIs = PtoPredAdjust(PredIs); + PredSafeCallCleanup = PtoPredAdjust(PredSafeCallCleanup); + PredRestoreRegs = PtoPredAdjust(PredRestoreRegs); #ifdef YAPOR - Yap_heap_regs->pred_getwork = PtoPredAdjust(Yap_heap_regs->pred_getwork); - Yap_heap_regs->pred_getwork_seq = PtoPredAdjust(Yap_heap_regs->pred_getwork_seq); + PredGetwork = PtoPredAdjust(PredGetwork); + PredGetworkSeq = PtoPredAdjust(PredGetworkSeq); #endif /* YAPOR */ #ifdef LOW_LEVEL_TRACER #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->low_level_trace_lock); + REINIT_LOCK(Yap_low_level_trace_lock); #endif #endif @@ -158,22 +158,22 @@ - Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail); - Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail); - Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop); + DUMMYCODE->opc = Yap_opcode(_op_fail); + FAILCODE->opc = Yap_opcode(_op_fail); + NOCODE->opc = Yap_opcode(_Nstop); RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail); RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail); RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail); #ifdef BEAM - Yap_heap_regs->beam_retry_code->opc = Yap_opcode(_beam_retry_code); + BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code); #endif /* BEAM */ #ifdef YAPOR RestoreOtaplInst(GETWORK,_getwork,PredGetwork); RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq); - Yap_heap_regs->getwork_first_time->opc = Yap_opcode(_getwork_first_time); + GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time); #endif /* YAPOR */ #ifdef TABLING RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail); @@ -185,10 +185,10 @@ - Yap_heap_regs->debugger_p_before_spy = PtoOpAdjust(Yap_heap_regs->debugger_p_before_spy); + P_before_spy = PtoOpAdjust(P_before_spy); - 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); + RETRY_C_RECORDEDP_CODE = PtoOpAdjust(RETRY_C_RECORDEDP_CODE); + RETRY_C_RECORDED_K_CODE = PtoOpAdjust(RETRY_C_RECORDED_K_CODE); @@ -203,7 +203,7 @@ #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->dbterms_list_lock); + REINIT_LOCK(DBTermsListLock); #endif RestoreDBTermsList(); @@ -211,8 +211,8 @@ RestoreExpandList(); #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->expand_clauses_list_lock); - REINIT_LOCK(Yap_heap_regs->op_list_lock); + REINIT_LOCK(ExpandClausesListLock); + REINIT_LOCK(OpListLock); #endif #ifdef DEBUG @@ -247,9 +247,9 @@ RestoreDBErasedList(); RestoreDBErasedIList(); #if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(Yap_heap_regs->dead_static_clauses_lock); - REINIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock); - REINIT_LOCK(Yap_heap_regs->dead_static_indices_lock); + REINIT_LOCK(DeadStaticClausesLock); + REINIT_LOCK(DeadMegaClausesLock); + REINIT_LOCK(DeadStaticIndicesLock); #endif #ifdef COROUTINING @@ -260,7 +260,7 @@ - Yap_heap_regs->op_list = OpListAdjust(Yap_heap_regs->op_list); + OpList = OpListAdjust(OpList); RestoreStreams(); @@ -269,17 +269,17 @@ RestoreAliases(); - Yap_heap_regs->atprompt = AtomAdjust(Yap_heap_regs->atprompt); + AtPrompt = AtomAdjust(AtPrompt); - Yap_heap_regs->char_conversion_table = CodeCharPAdjust(Yap_heap_regs->char_conversion_table); - Yap_heap_regs->char_conversion_table2 = CodeCharPAdjust(Yap_heap_regs->char_conversion_table2); + CharConversionTable = CodeCharPAdjust(CharConversionTable); + CharConversionTable2 = CodeCharPAdjust(CharConversionTable2); - Yap_heap_regs->yap_lib_dir = CodeCharPAdjust(Yap_heap_regs->yap_lib_dir); + Yap_LibDir = CodeCharPAdjust(Yap_LibDir); - Yap_heap_regs->last_wtime = CodeVoidPAdjust(Yap_heap_regs->last_wtime); + LastWtimePtr = CodeVoidPAdjust(LastWtimePtr); #if LOW_PROF diff --git a/misc/buildheap b/misc/buildheap index cb34dd679..3afeb86d3 100644 --- a/misc/buildheap +++ b/misc/buildheap @@ -126,6 +126,10 @@ fetch_name(Global) :- fetch_name(Global) :- Global = "Yap_heap_regs->". +fetch_name(Global,RField,_) :- + globals(worker_init), !, + append("FOREIGN(wid)->",RField,Global). +fetch_name(Global,_,Global). % handle *field[4] cut_c_stuff([0'*|Name], RName) :- !, % 'cut * @@ -174,31 +178,31 @@ gen_hstruct(Inp,Out) :- glue(Inp2, " ", Inp3), gen_hstruct(Inp3,Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkAT", _]), !, - fetch_name(Global), - append([" ",Global,Field," = AtomTermAdjust(Yap_heap_regs->",Field,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkAT", _]), !, + fetch_name(Global,Field,MacroName), + append([" ",Global," = AtomTermAdjust(",Global,");"], Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkPred"| _]), !, + split(Inp," ",[_, Field, MacroName, "MkPred"| _]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = PtoPredAdjust(Yap_heap_regs->",RField,");"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = PtoPredAdjust(",Global,");"], Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkOp", Name]), !, - fetch_name(Global), - append([" ",Global,Field," = Yap_opcode(",Name,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !, + fetch_name(Global,Field,MacroName), + append([" ",Global," = Yap_opcode(",Name,");"], Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkLock"]), !, - fetch_name(Global), - append([" REINIT_LOCK(",Global,Field,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkLock"]), !, + fetch_name(Global,Field,MacroName), + append([" REINIT_LOCK(",Global,");"], Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkRWLock"]), !, - fetch_name(Global), - append([" REINIT_RWLOCK(",Global,Field,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !, + fetch_name(Global,Field,MacroName), + append([" REINIT_RWLOCK(",Global,");"], Out). gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkInstE",OP]), !, + split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out). gen_hstruct(Inp,"") :- split(Inp," ",[_, _, _, _]), !. gen_hstruct(Inp,"") :- @@ -208,11 +212,11 @@ gen_hstruct(Inp,Restore) :- append("Restore",_,Restore0), !, append([" ",Restore0,";"],Restore). %' gen_hstruct(Inp,Out) :- - split(Inp," ",[_, Field, _, _, Adjust]), + split(Inp," ",[_, Field, MacroName, _, Adjust]), append(Adjust,"Adjust",_), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = ",Adjust,"(",Global,RField,");"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = ",Adjust,"(",Global,");"], Out). gen_hstruct(Inp,_) :- split(Inp," ",[_, _, _| _]), format(user_error,"OOPS: could not gen_hstruct for ~s~n",[Inp]). @@ -261,48 +265,48 @@ gen_init(Inp,Init) :- append("Yap_Init",_,Init0), !, append([" ",Init0,";"],Init). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkAT", AtomName]), !, + split(Inp," ",[_, Field, MacroName, "MkAT", AtomName]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = MkAtomTerm(",AtomName,");"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = MkAtomTerm(",AtomName,");"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkOp", Name]), !, - fetch_name(Global), - append([" ",Global,Field," = Yap_opcode(",Name,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !, + fetch_name(Global,Field,MacroName), + append([" ",Global," = Yap_opcode(",Name,");"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkLock"]), !, - fetch_name(Global), - append([" INIT_LOCK(",Global,Field,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkLock"]), !, + fetch_name(Global,Field,MacroName), + append([" INIT_LOCK(",Global,");"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkRWLock"]), !, - fetch_name(Global), - append([" INIT_RWLOCK(",Global,Field,");"], Out). + split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !, + fetch_name(Global,Field,MacroName), + append([" INIT_RWLOCK(",Global,");"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkInstE",OP]), !, + split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkPred", Atom, "0", Module]), !, + split(Inp," ",[_, Field, MacroName, "MkPred", Atom, "0", Module]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkPred", Atom, Arity, Module]), !, + split(Inp," ",[_, Field, MacroName, "MkPred", Atom, Arity, Module]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, "MkPred", Fun, Module]), !, + split(Inp," ",[_, Field, MacroName, "MkPred", Fun, Module]), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out). gen_init(Inp,Out) :- - split(Inp," ",[_, Field, _, F0|_]), + split(Inp," ",[_, Field, MacroName, F0|_]), append("=",F,F0), !, cut_c_stuff(Field, RField), - fetch_name(Global), - append([" ",Global,RField," = ",F,";"], Out). + fetch_name(Global,RField,MacroName), + append([" ",Global," = ",F,";"], Out). gen_init(Inp,_) :- split(Inp," ",[_, _, _| _]), format(user_error,"OOPS: could not gen_init for ~s~n",[Inp]).