make consult_level a local variable

assert() within consult should act as a normal assert.
This commit is contained in:
Vítor Santos Costa 2011-04-22 13:01:10 +01:00
parent f49459fcfc
commit c940245182
6 changed files with 12 additions and 6 deletions

View File

@ -2507,6 +2507,8 @@ p_compile_dynamic( USES_REGS1 )
if (RepAtom(AtomOfTerm(t1))->StrOfAE[0] == 'f') mode = asserta;
else mode = assertz;
} else mode = IntegerOfTerm(t1);
if (mode == assertz && consult_level)
mode = consult;
old_optimize = optimizer_on;
optimizer_on = FALSE;
YAPEnterCriticalSection();
@ -2530,8 +2532,6 @@ p_compile_dynamic( USES_REGS1 )
return TRUE;
}
static int consult_level = 0;
static Atom
YapConsultingFile ( USES_REGS1 )
{

View File

@ -81,6 +81,7 @@
#if LOW_LEVEL_TRACER
#define Yap_total_choicepoints WL->total_cps
#endif
#define consult_level WL->consult_level_
#if defined(YAPOR) || defined(THREADS)
#define SignalLock WL->signal_lock
@ -134,7 +135,7 @@
#define PL_local_data_p WL->Yap_ld_
#define execution WL->_execution
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#if MULTIPLE_STACKS
#define WORKER WL->worker
#endif
#ifdef THREADS

View File

@ -83,6 +83,7 @@ typedef struct worker_local {
#if LOW_LEVEL_TRACER
Int total_cps;
#endif
int consult_level_;
#if defined(YAPOR) || defined(THREADS)
lockvar signal_lock;
@ -136,7 +137,7 @@ typedef struct worker_local {
struct PL_local_data *Yap_ld_;
struct open_query_struct* _execution;
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#if MULTIPLE_STACKS
struct worker worker;
#endif
#ifdef THREADS

View File

@ -81,6 +81,7 @@ static void InitWorker(int wid) {
#if LOW_LEVEL_TRACER
FOREIGN(wid)->total_cps = 0;
#endif
FOREIGN(wid)->consult_level_ = 0;
#if defined(YAPOR) || defined(THREADS)
INIT_LOCK(FOREIGN(wid)->signal_lock);
@ -134,7 +135,7 @@ static void InitWorker(int wid) {
FOREIGN(wid)->Yap_ld_ = Yap_InitThreadIO(wid);
FOREIGN(wid)->_execution = NULL;
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#if MULTIPLE_STACKS
#endif
#ifdef THREADS

View File

@ -82,6 +82,7 @@ static void RestoreWorker(int wid USES_REGS) {
#endif
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(FOREIGN(wid)->signal_lock);
@ -134,7 +135,7 @@ static void RestoreWorker(int wid USES_REGS) {
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS)
#if MULTIPLE_STACKS
#endif
#ifdef THREADS

View File

@ -89,6 +89,8 @@ Int last_ss_time LastSSTime =0L
Int total_cps Yap_total_choicepoints =0
#endif
int consult_level_ consult_level =0
// global variables that cannot be global in a thread/or-p implementation
#if defined(YAPOR) || defined(THREADS)
lockvar signal_lock SignalLock MkLock