2009-10-28 13:11:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-30 23:59:00 +00:00
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REINIT_LOCK(Yap_heap_regs->bgl);
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WL
|
|
|
|
#define WL wl[worker_id]
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifndef WL
|
|
|
|
#define WL wl
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if USE_DL_MALLOC
|
|
|
|
|
|
|
|
|
2010-02-03 22:54:47 +00:00
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
REINIT_LOCK(Yap_heap_regs->dlmalloc_lock);
|
|
|
|
#endif
|
2009-10-30 23:59:00 +00:00
|
|
|
#endif
|
|
|
|
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
|
|
|
#ifndef HeapUsed
|
|
|
|
#define HeapUsed Yap_givemallinfo()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-11-18 15:48:29 +00:00
|
|
|
#if USE_THREADED_CODE
|
|
|
|
Yap_heap_regs->op_rtable = OpRTableAdjust(Yap_heap_regs->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);
|
2009-11-27 11:21:24 +00:00
|
|
|
Yap_heap_regs->orlast_op = Yap_opcode(_or_last);
|
2009-11-18 15:48:29 +00:00
|
|
|
Yap_heap_regs->undef_op = Yap_opcode(_undef_p);
|
|
|
|
|
|
|
|
|
2009-10-30 23:59:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestoreInvisibleAtoms();
|
|
|
|
RestoreWideAtoms();
|
|
|
|
RestoreAtoms();
|
|
|
|
|
|
|
|
#include "ratoms.h"
|
2009-10-28 13:11:35 +00:00
|
|
|
#ifdef EUROTRA
|
|
|
|
Yap_heap_regs->term_dollar_u = AtomTermAdjust(Yap_heap_regs->term_dollar_u);
|
|
|
|
#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->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->current_modules = ModEntryPtrAdjust(Yap_heap_regs->current_modules);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestorePredHash();
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
#ifdef COROUTINING
|
|
|
|
Yap_heap_regs->wake_up_code = PtoPredAdjust(Yap_heap_regs->wake_up_code);
|
|
|
|
#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);
|
2009-11-27 11:21:24 +00:00
|
|
|
Yap_heap_regs->pred_safe_call_cleanup = PtoPredAdjust(Yap_heap_regs->pred_safe_call_cleanup);
|
2009-10-30 23:59:00 +00:00
|
|
|
#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);
|
|
|
|
#endif /* YAPOR */
|
2009-10-28 13:11:35 +00:00
|
|
|
|
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
REINIT_LOCK(Yap_heap_regs->low_level_trace_lock);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
|
|
|
|
|
|
|
|
RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
|
|
|
|
|
2009-10-30 23:59:00 +00:00
|
|
|
RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
|
2009-10-28 13:11:35 +00:00
|
|
|
#ifdef BEAM
|
|
|
|
Yap_heap_regs->beam_retry_code->opc = Yap_opcode(_beam_retry_code);
|
|
|
|
#endif /* BEAM */
|
|
|
|
#ifdef YAPOR
|
|
|
|
|
2009-10-30 23:59:00 +00:00
|
|
|
RestoreOtaplInst(GETWORK,_getwork,PredGetwork);
|
|
|
|
RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq);
|
2009-10-28 13:11:35 +00:00
|
|
|
Yap_heap_regs->getwork_first_time->opc = Yap_opcode(_getwork_first_time);
|
|
|
|
#endif /* YAPOR */
|
|
|
|
#ifdef TABLING
|
2009-11-03 15:06:48 +00:00
|
|
|
RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail);
|
|
|
|
RestoreOtaplInst(TRY_ANSWER,_table_try_answer,PredFail);
|
|
|
|
RestoreOtaplInst(ANSWER_RESOLUTION,_table_answer_resolution,PredFail);
|
2009-10-30 23:59:00 +00:00
|
|
|
RestoreOtaplInst(COMPLETION,_table_completion,PredFail);
|
2009-10-28 13:11:35 +00:00
|
|
|
#endif /* TABLING */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yap_heap_regs->debugger_p_before_spy = PtoOpAdjust(Yap_heap_regs->debugger_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);
|
2009-10-28 15:20:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
REINIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
|
|
|
#endif
|
|
|
|
RestoreDBTermsList();
|
|
|
|
|
|
|
|
|
|
|
|
RestoreExpandList();
|
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
REINIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
|
|
|
REINIT_LOCK(Yap_heap_regs->op_list_lock);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2009-10-28 15:53:23 +00:00
|
|
|
|
2009-11-02 12:53:51 +00:00
|
|
|
|
2009-10-28 15:53:23 +00:00
|
|
|
RestoreUdiControlBlocks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestoreIntKeys();
|
|
|
|
RestoreIntLUKeys();
|
|
|
|
RestoreIntBBKeys();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestoreDBErasedMarker();
|
|
|
|
RestoreLogDBErasedMarker();
|
2009-10-30 23:59:00 +00:00
|
|
|
|
|
|
|
RestoreDeadStaticClauses();
|
|
|
|
RestoreDeadMegaClauses();
|
|
|
|
RestoreDeadStaticIndices();
|
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
#ifdef COROUTINING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yap_heap_regs->op_list = OpListAdjust(Yap_heap_regs->op_list);
|
|
|
|
|
|
|
|
|
|
|
|
RestoreStreams();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestoreAliases();
|
|
|
|
|
|
|
|
Yap_heap_regs->atprompt = AtomAdjust(Yap_heap_regs->atprompt);
|
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_LIBREADLINE
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yap_heap_regs->yap_lib_dir = CodeCharPAdjust(Yap_heap_regs->yap_lib_dir);
|
|
|
|
|
|
|
|
Yap_heap_regs->last_wtime = CodeVoidPAdjust(Yap_heap_regs->last_wtime);
|
|
|
|
|
|
|
|
|
|
|
|
#if LOW_PROF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* LOW_PROF */
|
|
|
|
|
|
|
|
RestoreForeignCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-18 01:55:09 +00:00
|
|
|
|
|
|
|
#ifdef THREADS
|
|
|
|
REINIT_LOCK(Yap_heap_regs->thread_handles_lock);
|
|
|
|
|
|
|
|
#endif
|