diff --git a/C/absmi.c b/C/absmi.c index 6491394a4..6e8818d36 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -2692,6 +2692,7 @@ Yap_absmi(int inp) a execute_c, just wait a bit more */ if (ActiveSignals & YAP_CREEP_SIGNAL || (PREG->opc != Yap_opcode(_procceed) && + PREG->opc != Yap_opcode(_safe_procceed) && PREG->opc != Yap_opcode(_cut_e))) { GONext(); } @@ -3086,6 +3087,24 @@ Yap_absmi(int inp) CACHE_A1(); JMPNext(); + BOp(safe_procceed, p); + CACHE_Y_AS_ENV(YREG); + check_trail(TR); + check_stack(NoStackDeallocate, H); + ALWAYS_LOOKAHEAD(CPREG->opc); + PREG = CPREG; + /* for profiler */ + save_pc(); + ENV_YREG = ENV; +#ifdef DEPTH_LIMIT + DEPTH = ENV_YREG[E_DEPTH]; +#endif + WRITEBACK_Y_AS_ENV(); + ALWAYS_GONext(); + ALWAYS_END_PREFETCH(); + ENDCACHE_Y_AS_ENV(); + ENDBOp(); + BOp(procceed, p); CACHE_Y_AS_ENV(YREG); ALWAYS_LOOKAHEAD(CPREG->opc); diff --git a/C/amasm.c b/C/amasm.c index 62ed4ff2b..89e73d0f1 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -3507,7 +3507,11 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp !clinfo.alloc_found) code_p = a_e(_unlock_lu, code_p, pass_no); #endif - code_p = a_pl(_procceed, cip->CurrentPred, code_p, pass_no); + if (clinfo.alloc_found) { + code_p = a_pl(_safe_procceed, cip->CurrentPred, code_p, pass_no); + } else { + code_p = a_pl(_procceed, cip->CurrentPred, code_p, pass_no); + } break; case call_op: code_p = a_p(_call, &clinfo, code_p, pass_no, cip); diff --git a/C/analyst.c b/C/analyst.c index 1e32eec50..6ebee805f 100644 --- a/C/analyst.c +++ b/C/analyst.c @@ -118,6 +118,7 @@ p_show_op_counters() print_instruction(_call_cpred); print_instruction(_call_c_wfail); print_instruction(_procceed); + print_instruction(_safe_procceed); print_instruction(_allocate); print_instruction(_deallocate); @@ -479,7 +480,8 @@ p_show_ops_by_group(void) Yap_opcount[_fcall]; c_control.nproceeds = - Yap_opcount[_procceed]; + Yap_opcount[_procceed]+ + Yap_opcount[_safe_procceed]; c_control.ncallbips = Yap_opcount[_call_cpred] + diff --git a/C/dbase.c b/C/dbase.c index 8fafffcd1..9302c6225 100755 --- a/C/dbase.c +++ b/C/dbase.c @@ -3439,7 +3439,7 @@ lu_recorded(PredEntry *pe) { PELOCK(66,pe); PP = pe; #endif - if (opc == _procceed) { + if (opc == _procceed || opc == _safe_procceed) { P = pe->CodeOfPred; } else { if (P->opc != Yap_opcode(_execute_cpred)) { @@ -3504,7 +3504,7 @@ p_recorded(void) if (!Yap_unify(GetDBLUKey(ap), ARG1)) return FALSE; - if (opc == _procceed) { + if (opc == _procceed || opc == _safe_procceed) { P = cl->ClCode; } else { CP = P; diff --git a/C/index.c b/C/index.c index db02e1eff..6a107a574 100644 --- a/C/index.c +++ b/C/index.c @@ -1396,6 +1396,7 @@ has_cut(yamop *pc) return FALSE; case _deallocate: case _procceed: + case _safe_procceed: pc = NEXTOP(pc,p); break; /* instructions type sc */ diff --git a/H/YapOpcodes.h b/H/YapOpcodes.h index 740093710..c8c99d7db 100644 --- a/H/YapOpcodes.h +++ b/H/YapOpcodes.h @@ -43,6 +43,7 @@ OPCODE(dexecute ,pp), OPCODE(fcall ,Osbpp), OPCODE(call ,Osbpp), + OPCODE(safe_procceed ,p), OPCODE(procceed ,p), OPCODE(allocate ,e), OPCODE(deallocate ,p), diff --git a/H/rclause.h b/H/rclause.h index a8dffffcf..71034a4ba 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -424,6 +424,7 @@ restore_opcodes(yamop *pc, yamop *max) case _lock_lu: case _procceed: case _retry_profiled: + case _safe_procceed: pc->u.p.p = PtoPredAdjust(pc->u.p.p); pc = NEXTOP(pc,p); break; diff --git a/H/walkclause.h b/H/walkclause.h index f73e9114b..4f169003c 100644 --- a/H/walkclause.h +++ b/H/walkclause.h @@ -335,6 +335,7 @@ case _deallocate: case _enter_profiling: case _retry_profiled: + case _safe_procceed: pc = NEXTOP(pc,p); break; /* instructions type plxxs */