| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | #define TRY_ME_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       store_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							|  |  |  |       store_yaam_regs((*_PREG)->u.Otapl.d, 0); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_ME_YAPOR \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_ME_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_ME_END; \ | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_ME_INSTINIT \
 | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       restore_yaam_regs((*_PREG)->u.Otapl.d); \ | 
					
						
							|  |  |  |       restore_at_least_one_arg((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY_ME_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY_ME_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_ME_END \
 | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRUST_ME_INSTINIT \
 | 
					
						
							|  |  |  |       CACHE_Y(B); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define TRUST_ME_YAPOR_IF \
 | 
					
						
							|  |  |  |       if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	restore_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       else \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define TRUST_ME_YAPOR_IF \
 | 
					
						
							|  |  |  |       if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	restore_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       else \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN STACKS */
 | 
					
						
							|  |  |  | #else /* YAPOR */
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define TRUST_ME_YAPOR_IF \
 | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define TRUST_ME_IF \
 | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN STACKS */
 | 
					
						
							|  |  |  | #endif /* YAPOR */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRUST_ME_END \
 | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ENTER_PROFILING_INSTINIT \
 | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  |       LOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \ | 
					
						
							|  |  |  |       (*_PREG)->u.p.p->StatisticsForPred->NOfEntries++; \ | 
					
						
							|  |  |  |       UNLOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       (*_PREG) = NEXTOP((*_PREG), p); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_PROFILED_INSTINIT \
 | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  |       LOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \ | 
					
						
							|  |  |  |       (*_PREG)->u.p.p->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  |       UNLOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       (*_PREG) = NEXTOP((*_PREG), p); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_ME_INSTINIT \
 | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  |       LOCK((*_PREG)->u.Otapl.p->StatisticsForPred->lock); \ | 
					
						
							|  |  |  |       (*_PREG)->u.Otapl.p->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  |       UNLOCK((*_PREG)->u.Otapl.p->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       restore_yaam_regs((*_PREG)->u.Otapl.d); \ | 
					
						
							|  |  |  |       restore_args((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_ME_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_ME_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_ME_END \
 | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_INSTINIT \
 | 
					
						
							|  |  |  |       CACHE_Y(B); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_IF \
 | 
					
						
							|  |  |  |       if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	restore_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |         S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       else \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_IF \
 | 
					
						
							|  |  |  |       if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	restore_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       else \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #else /* YAPOR */
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_IF \
 | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_IF \
 | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_args((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #endif /* YAPOR */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_ME_END \
 | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  |       LOCK((*_PREG)->u.Otapl.p->StatisticsForPred->lock); \ | 
					
						
							|  |  |  |       (*_PREG)->u.Otapl.p->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  |       UNLOCK((*_PREG)->u.Otapl.p->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       GONext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	UInt timestamp; \ | 
					
						
							|  |  |  | 	CACHE_Y(B); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[(*_PREG)->u.OtaLl.s]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, (*_PREG)->u.OtaLl.d)) { \ | 
					
						
							|  |  |  | 	  (*_PREG)=(*_PREG)->u.OtaLl.n; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  JMPNext(); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	else { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	  restore_yaam_regs((*_PREG)->u.OtaLl.n); \ | 
					
						
							|  |  |  | 	  restore_args((*_PREG)->u.OtaLl.s); \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  (*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | #ifdef THREADS
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_THREADS \
 | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	PP = (*_PREG)->u.OtaLl.d->ClPred; | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_POST_THREADS \
 | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	(*_PREG) = (*_PREG)->u.OtaLl.d->ClCode; | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_FROZEN \
 | 
					
						
							|  |  |  | 	S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_NOFROZEN \
 | 
					
						
							|  |  |  | 	set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_LOGICAL_END \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       BLOCK = (CELL)PROFILED_RETRY_LOGICAL_END; \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if MULTIPLE_STACKS
 | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	PELOCK(1, ap); \ | 
					
						
							|  |  |  | 	PP = ap; \ | 
					
						
							|  |  |  | 	DEC_CLREF_COUNT(cl); \ | 
					
						
							|  |  |  | 	B->cp_tr--; \ | 
					
						
							|  |  |  | 	TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \ | 
					
						
							|  |  |  | 	  if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	    if (lcl->ClRefCount == 1) { \ | 
					
						
							|  |  |  | 	      INC_CLREF_COUNT(lcl); \ | 
					
						
							|  |  |  | 	      TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } else { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  save_pc(); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	PELOCK(1, ap); \ | 
					
						
							|  |  |  | 	PP = ap; \ | 
					
						
							|  |  |  | 	DEC_CLREF_COUNT(cl); \ | 
					
						
							|  |  |  | 	B->cp_tr--; \ | 
					
						
							|  |  |  | 	TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \ | 
					
						
							|  |  |  | 	  if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	    if (lcl->ClRefCount == 1) { \ | 
					
						
							|  |  |  | 	      INC_CLREF_COUNT(lcl); \ | 
					
						
							|  |  |  | 	      TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } else { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  save_pc(); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG++; \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #else /* YAPOR */
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	PELOCK(1, ap); \ | 
					
						
							|  |  |  | 	PP = ap; \ | 
					
						
							|  |  |  | 	DEC_CLREF_COUNT(cl); \ | 
					
						
							|  |  |  | 	B->cp_tr--; \ | 
					
						
							|  |  |  | 	TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \ | 
					
						
							|  |  |  | 	  if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	    if (lcl->ClRefCount == 1) { \ | 
					
						
							|  |  |  | 	      INC_CLREF_COUNT(lcl); \ | 
					
						
							|  |  |  | 	      TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } else { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  save_pc(); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	PELOCK(1, ap); \ | 
					
						
							|  |  |  | 	PP = ap; \ | 
					
						
							|  |  |  | 	DEC_CLREF_COUNT(cl); \ | 
					
						
							|  |  |  | 	B->cp_tr--; \ | 
					
						
							|  |  |  | 	TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \ | 
					
						
							|  |  |  | 	  if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	    if (lcl->ClRefCount == 1) { \ | 
					
						
							|  |  |  | 	      INC_CLREF_COUNT(lcl); \ | 
					
						
							|  |  |  | 	      TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } else { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							|  |  |  | 	    Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	  save_pc(); \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #endif /* YAPOR */
 | 
					
						
							|  |  |  | #else /* MULTIPLE_STACKS */
 | 
					
						
							|  |  |  | #if FROZEN_STACKS
 | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  |  \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	  if (B->cp_tr > TR_FZ) \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	  if (B->cp_tr > TR_FZ) \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG++; \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #else /* YAPOR */
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	  if (B->cp_tr > TR_FZ) \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  |  \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	  if (B->cp_tr > TR_FZ) \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #endif /* YAPOR */
 | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	  SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							|  |  |  | 	  restore_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	  S_YREG++; \ | 
					
						
							|  |  |  | 	  set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  | 	} else \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #else /* YAPOR */
 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #else /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PredEntry *ap = cl->ClPred; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \ | 
					
						
							|  |  |  | 	if (!VALID_TIMESTAMP(timestamp, lcl)) { \ | 
					
						
							|  |  |  | 	  (*_PREG) = FAILCODE; \ | 
					
						
							|  |  |  | 	} else { \ | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  | 	  LOCK(ap->StatisticsForPred->lock); \ | 
					
						
							|  |  |  | 	  ap->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  | 	  UNLOCK(ap->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  (*_PREG) = lcl->ClCode; \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \ | 
					
						
							|  |  |  | 	    B->cp_tr != B->cp_b->cp_tr) { \ | 
					
						
							|  |  |  | 	  cl->ClFlags &= ~InUseMask; \ | 
					
						
							|  |  |  | 	  --B->cp_tr; \ | 
					
						
							|  |  |  | 	    { \ | 
					
						
							|  |  |  | 	      TR = B->cp_tr; \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	  if (cl->ClFlags & (ErasedMask|DirtyMask)) { \ | 
					
						
							|  |  |  | 	    if ((*_PREG) != FAILCODE) { \ | 
					
						
							|  |  |  | 	      if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \ | 
					
						
							|  |  |  | 		lcl->ClFlags |= InUseMask; \ | 
					
						
							|  |  |  | 		TRAIL_CLREF(lcl); \ | 
					
						
							|  |  |  | 	      } \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    if (cl->ClFlags & ErasedMask) { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_ErLogUpdIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } else { \ | 
					
						
							|  |  |  | 	      saveregs(); \ | 
					
						
							|  |  |  | 	      Yap_CleanUpIndex(cl); \ | 
					
						
							|  |  |  | 	      setregs(); \ | 
					
						
							|  |  |  | 	    } \ | 
					
						
							|  |  |  | 	    save_pc(); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | 	  { \ | 
					
						
							|  |  |  | 	    pop_yaam_regs(); \ | 
					
						
							|  |  |  | 	    pop_args(ap->ArityOfPE); \ | 
					
						
							|  |  |  | 	    S_YREG--; \ | 
					
						
							|  |  |  | 	    set_cut(S_YREG, B); \ | 
					
						
							|  |  |  | 	  } \ | 
					
						
							|  |  |  | 	SET_BB(B_YREG); \ | 
					
						
							|  |  |  | 	ENDCACHE_Y(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #endif /* YAPOR */
 | 
					
						
							|  |  |  | #endif /* FROZEN_STACKS */
 | 
					
						
							|  |  |  | #endif /* MULTIPLE_STACKS */
 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | #define PROFILED_TRUST_LOGICAL_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)PROFILED_TRUST_LOGICAL_END; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       store_at_least_one_arg((*_PREG)->u.Otapl.s); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       store_yaam_regs(NEXTOP((*_PREG), Otapl), 0); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.Otapl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_CLAUSE_YAPOR \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_CLAUSE_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE2_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	register CELL x2 = ARG2; \ | 
					
						
							|  |  |  | 	register CELL x1 = ARG1; \ | 
					
						
							|  |  |  | 	store_yaam_regs(NEXTOP((*_PREG), l), 2); \ | 
					
						
							|  |  |  | 	B_YREG->cp_a1 = x1; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a2 = x2; \ | 
					
						
							|  |  |  |       } \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_CLAUSE2_YAPOR \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE2_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_CLAUSE2_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE3_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	store_yaam_regs(NEXTOP((*_PREG), l), 3); \ | 
					
						
							|  |  |  | 	B_YREG->cp_a1 = ARG1; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a2 = ARG2; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a3 = ARG3; \ | 
					
						
							|  |  |  |       } \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_CLAUSE3_YAPOR \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE3_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_CLAUSE3_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE4_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); \ | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	store_yaam_regs(NEXTOP((*_PREG), l), 4); \ | 
					
						
							|  |  |  | 	B_YREG->cp_a1 = ARG1; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a2 = ARG2; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a3 = ARG3; \ | 
					
						
							|  |  |  | 	B_YREG->cp_a4 = ARG4; \ | 
					
						
							|  |  |  |       } \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_CLAUSE4_YAPOR \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_CLAUSE4_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_CLAUSE4_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       restore_yaam_regs(NEXTOP((*_PREG), Otapl)); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       restore_at_least_one_arg((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)RETRY_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.Otapl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY2_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       restore_yaam_regs(NEXTOP((*_PREG), l)); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       ARG1 = B_YREG->cp_a1; \ | 
					
						
							|  |  |  |       ARG2 = B_YREG->cp_a2; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY2_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY2_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY2_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)RETRY2_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY3_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       restore_yaam_regs(NEXTOP((*_PREG), l)); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       ARG1 = B_YREG->cp_a1; \ | 
					
						
							|  |  |  |       ARG2 = B_YREG->cp_a2; \ | 
					
						
							|  |  |  |       ARG3 = B_YREG->cp_a3; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY3_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY3_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY3_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)RETRY3_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY4_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); \ | 
					
						
							|  |  |  |       restore_yaam_regs(NEXTOP((*_PREG), l)); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       ARG1 = B_YREG->cp_a1; \ | 
					
						
							|  |  |  |       ARG2 = B_YREG->cp_a2; \ | 
					
						
							|  |  |  |       ARG3 = B_YREG->cp_a3; \ | 
					
						
							|  |  |  |       ARG4 = B_YREG->cp_a4; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY4_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY4_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY4_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)RETRY4_END; \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRUST_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       CACHE_Y(B); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRUST_IFOK_INIT \
 | 
					
						
							|  |  |  |       if (SCH_top_shared_cp(B)) { \ | 
					
						
							|  |  |  | 	SCH_last_alternative((*_PREG), B_YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	restore_at_least_one_arg((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define TRUST_IFOK_FROZEN \
 | 
					
						
							|  |  |  |         S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #define TRUST_IFOK_END \
 | 
					
						
							|  |  |  | 	set_cut(S_YREG, B->cp_b); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRUST_NOIF_INIT \
 | 
					
						
							|  |  |  |       { \ | 
					
						
							|  |  |  | 	pop_yaam_regs(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	pop_at_least_one_arg((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	 | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define TRUST_NOIF_FROZEN \
 | 
					
						
							|  |  |  |         S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRUST_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRUST_END; \ | 
					
						
							|  |  |  | 	set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.Otapl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_IN_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       B->cp_ap = NEXTOP((*_PREG), l); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.l.l; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       JMPNext(); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #define TRY_IN_END \
 | 
					
						
							|  |  |  |       BLOCK = (CELL)TRY_IN_END; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SPY_OR_TRYMARK_INSTINIT \
 | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       PELOCK(5, ((PredEntry *)((*_PREG)->u.Otapl.p))); \ | 
					
						
							|  |  |  |       (*_PREG) = (yamop *)(&(((PredEntry *)((*_PREG)->u.Otapl.p))->OpcodeOfPred)); \ | 
					
						
							|  |  |  |       UNLOCKPE(11,(PredEntry *)((*_PREG)->u.Otapl.p)); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	  return external_labels[12]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_INSTINIT \
 | 
					
						
							|  |  |  |       BLOCKADDRESS = (CELL)(*_PREG); \ | 
					
						
							|  |  |  |       check_trail(TR); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(YAPOR) || defined(THREADS)
 | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_YAPOR_THREADS_YAPOR \
 | 
					
						
							|  |  |  |       CUT_wait_leftmost(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_YAPOR_THREADS_NOYAPOR_IF \
 | 
					
						
							|  |  |  |     BLOCK = (CELL)TRY_AND_MARK_YAPOR_THREADS_NOYAPOR_IF; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       if ((*_PREG)->u.Otapl.p->PredFlags & LogUpdatePredFlag) { \ | 
					
						
							|  |  |  | 	PELOCK(6,(*_PREG)->u.Otapl.p); \ | 
					
						
							|  |  |  | 	PP = (*_PREG)->u.Otapl.p; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       } \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       if ((*_PREG)->u.Otapl.p->CodeOfPred != (*_PREG)) { \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	PP = NULL; \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  | 	(*_PREG) = (*_PREG)->u.Otapl.p->CodeOfPred; \ | 
					
						
							|  |  |  | 	UNLOCKPE(12,(*_PREG)->u.Otapl.p); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	save_pc(); \ | 
					
						
							|  |  |  | 	JMPNext(); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_NOYAPOR_NOTHREADS \
 | 
					
						
							|  |  |  |       CACHE_Y(YREG); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.Otapl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       LOCK(DynamicLock((*_PREG))); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       UNLOCKPE(13,((PredEntry *)((*_PREG)->u.Otapl.p))); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       BEGD(d1); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       d1 = (*_PREG)->u.Otapl.s; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       store_args(d1); \ | 
					
						
							|  |  |  |       store_yaam_regs((*_PREG), 0); \ | 
					
						
							|  |  |  |       ENDD(d1); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B); \ | 
					
						
							|  |  |  |       B = B_YREG; | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_SET_LOAD \
 | 
					
						
							|  |  |  |       SCH_set_load(B_YREG); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_POST_SET_LOAD \
 | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #if MULTIPLE_STACKS
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_MULTIPLE_STACKS \
 | 
					
						
							|  |  |  |       INC_CLREF_COUNT(ClauseCodeToDynamicClause((*_PREG))); \ | 
					
						
							|  |  |  |       UNLOCK(DynamicLock((*_PREG))); \ | 
					
						
							|  |  |  |       TRAIL_CLREF(ClauseCodeToDynamicClause((*_PREG))); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_NOMULTIPLE_STACKS_IF \
 | 
					
						
							|  |  |  |       if (FlagOff(InUseMask, DynamicFlags((*_PREG)))) { \ | 
					
						
							|  |  |  | 	SetFlag(InUseMask, DynamicFlags((*_PREG))); \ | 
					
						
							|  |  |  | 	TRAIL_CLREF(ClauseCodeToDynamicClause((*_PREG))); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TRY_AND_MARK_END \
 | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG),Otapl); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define COUNT_RETRY_AND_MARK_INSTINIT \
 | 
					
						
							|  |  |  |     LOCAL_RetriesCounter--; \ | 
					
						
							|  |  |  |     if (LOCAL_RetriesCounter == 0) { \ | 
					
						
							|  |  |  | 	  saveregs(); \ | 
					
						
							|  |  |  | 	  Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \ | 
					
						
							|  |  |  | 	  setregs(); \ | 
					
						
							|  |  |  | 	  JMPNext(); \ | 
					
						
							|  |  |  |     } \ | 
					
						
							|  |  |  | 	else { \ | 
					
						
							|  |  |  |       LOCAL_PredEntriesCounter--; \ | 
					
						
							|  |  |  |       if (LOCAL_PredEntriesCounter == 0) { \ | 
					
						
							|  |  |  | 	    saveregs(); \ | 
					
						
							| 
									
										
										
										
											2015-09-25 10:57:26 +01:00
										 |  |  | 	    Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	    setregs(); \ | 
					
						
							|  |  |  | 	    JMPNext(); \ | 
					
						
							|  |  |  |       } \ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PROFILED_RETRY_AND_MARK_INSTINIT \
 | 
					
						
							| 
									
										
										
										
											2015-04-21 16:11:00 -06:00
										 |  |  |       LOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \ | 
					
						
							|  |  |  |       ((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->NOfRetries++; \ | 
					
						
							|  |  |  |       UNLOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_INSTINIT
 | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #ifdef YAPOR
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_YAPOR \
 | 
					
						
							|  |  |  |       CUT_wait_leftmost(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_POST_YAPOR \
 | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       PELOCK(7,(*_PREG)->u.Otapl.p); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       CACHE_Y(B); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       (*_PREG) = (*_PREG)->u.Otapl.d; \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       LOCK(DynamicLock((*_PREG))); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       UNLOCK((*_PREG)->u.Otapl.p->PELock); \ | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  |       restore_yaam_regs((*_PREG)); \ | 
					
						
							| 
									
										
										
										
											2015-01-18 01:32:13 +00:00
										 |  |  |       restore_args((*_PREG)->u.Otapl.s); | 
					
						
							| 
									
										
										
										
											2014-07-12 23:30:14 -05:00
										 |  |  | 	   | 
					
						
							|  |  |  | #ifdef FROZEN_STACKS
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_FROZEN \
 | 
					
						
							|  |  |  |       S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \ | 
					
						
							|  |  |  |       set_cut(S_YREG, B->cp_b); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_NOFROZEN \
 | 
					
						
							|  |  |  |       set_cut(S_YREG, B_YREG->cp_b); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_POST_FROZEN \
 | 
					
						
							|  |  |  |       SET_BB(B_YREG); \ | 
					
						
							|  |  |  |       ENDCACHE_Y(); | 
					
						
							|  |  |  | 	   | 
					
						
							|  |  |  | #if MULTIPLE_STACKS
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_MULTIPLE_STACKS \
 | 
					
						
							|  |  |  |       INC_CLREF_COUNT(ClauseCodeToDynamicClause((*_PREG))); \ | 
					
						
							|  |  |  |       TRAIL_CLREF(ClauseCodeToDynamicClause((*_PREG))); \ | 
					
						
							|  |  |  |       UNLOCK(DynamicLock((*_PREG))); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_NOMULTIPLE_STACKS_IF \
 | 
					
						
							|  |  |  |       if (FlagOff(InUseMask, DynamicFlags((*_PREG)))) { \ | 
					
						
							|  |  |  | 	SetFlag(InUseMask, DynamicFlags((*_PREG))); \ | 
					
						
							|  |  |  | 	TRAIL_CLREF(ClauseCodeToDynamicClause((*_PREG))); \ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define RETRY_AND_MARK_END \
 | 
					
						
							|  |  |  |       (*_PREG) = NEXTOP((*_PREG), Otapl); \ | 
					
						
							|  |  |  |       JMPNext(); | 
					
						
							|  |  |  | 
 |