diff --git a/C/cdmgr.c b/C/cdmgr.c index 9dd938664..34374c7f3 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -2841,7 +2841,7 @@ p_rmspy( USES_REGS1 ) return FALSE; } #if THREADS - if (!(pred->PredFlags & ThreadLocalPredFlag)) { + if (pred->PredFlags & ThreadLocalPredFlag) { pred->OpcodeOfPred = Yap_opcode(_thread_local); pred->PredFlags ^= SpiedPredFlag; UNLOCKPE(39,pred); @@ -5288,8 +5288,6 @@ p_continue_static_clause( USES_REGS1 ) static void add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) { - CACHE_REGS - char *code_end = (char *)cl + cl->ClSize; Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_LU_INDEX); cl = cl->ChildIndex; @@ -5302,7 +5300,6 @@ add_code_in_lu_index(LogUpdIndex *cl, PredEntry *pp) static void add_code_in_static_index(StaticIndex *cl, PredEntry *pp) { - CACHE_REGS char *code_end = (char *)cl + cl->ClSize; Yap_inform_profiler_of_clause(cl, code_end, pp, GPROF_STATIC_INDEX); cl = cl->ChildIndex; @@ -5315,7 +5312,6 @@ add_code_in_static_index(StaticIndex *cl, PredEntry *pp) static void add_code_in_pred(PredEntry *pp) { - CACHE_REGS yamop *clcode; PELOCK(49,pp); @@ -5387,7 +5383,6 @@ add_code_in_pred(PredEntry *pp) { void Yap_dump_code_area_for_profiler(void) { - CACHE_REGS ModEntry *me = CurrentModules; while (me) { diff --git a/C/compiler.c b/C/compiler.c index 579d0a167..610ae0e0e 100644 --- a/C/compiler.c +++ b/C/compiler.c @@ -916,6 +916,22 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) { CACHE_REGS Term t = Deref(t1); + /* be caareful, has to be first occurrence */ + if (Op == _save_by) { + if (!IsNewVar(t)) { + char s[32]; + + LOCAL_Error_TYPE = TYPE_ERROR_VARIABLE; + LOCAL_Error_Term = t; + LOCAL_ErrorMessage = LOCAL_ErrorSay; + Yap_bip_name(Op, s); + sprintf(LOCAL_ErrorMessage, "compiling %s/2 on bound variable", s); + save_machine_regs(); + siglongjmp(cglobs->cint.CompilerBotch,1); + } + c_var(t, save_b_flag, 1, 0, cglobs); + return; + } if (!IsVarTerm(t) || IsNewVar(t)) { Term tn = MkVarTerm(); c_eq(t, tn, cglobs); @@ -923,8 +939,6 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) { } if (Op == _cut_by) c_var(t, commit_b_flag, 1, 0, cglobs); - else if (Op == _save_by) - c_var(t, save_b_flag, 1, 0, cglobs); else c_var(t, f_flag,(unsigned int)Op, 0, cglobs); }