fix overflow fixes for p_execute in absmi.c
execute_last was not decreasing depth (thanks to Camacho for finding out). git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@299 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		
							
								
								
									
										33
									
								
								C/absmi.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								C/absmi.c
									
									
									
									
									
								
							@@ -1777,7 +1777,6 @@ absmi(int inp)
 | 
				
			|||||||
    NoStackCall:
 | 
					    NoStackCall:
 | 
				
			||||||
      /* on X86 machines S will not actually be holding the pointer to pred */
 | 
					      /* on X86 machines S will not actually be holding the pointer to pred */
 | 
				
			||||||
      SREG = (CELL *) PREG->u.sla.p;
 | 
					      SREG = (CELL *) PREG->u.sla.p;
 | 
				
			||||||
    NoStackCallGotS:
 | 
					 | 
				
			||||||
#ifdef YAPOR
 | 
					#ifdef YAPOR
 | 
				
			||||||
      /* abort_optyap("NoStackCall in function absmi"); */
 | 
					      /* abort_optyap("NoStackCall in function absmi"); */
 | 
				
			||||||
      if (HeapTop > GlobalBase - MinHeapGap)
 | 
					      if (HeapTop > GlobalBase - MinHeapGap)
 | 
				
			||||||
@@ -11168,7 +11167,7 @@ absmi(int inp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	CACHE_Y_AS_ENV(Y);
 | 
						CACHE_Y_AS_ENV(Y);
 | 
				
			||||||
#ifndef NO_CHECKING
 | 
					#ifndef NO_CHECKING
 | 
				
			||||||
	check_stack(NoStackPExec, H);
 | 
						check_stack(NoStackCall, H);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BEGD(d0);
 | 
						BEGD(d0);
 | 
				
			||||||
	d0 = ARG1;
 | 
						d0 = ARG1;
 | 
				
			||||||
@@ -11274,11 +11273,6 @@ absmi(int inp)
 | 
				
			|||||||
	ENDD(d0);
 | 
						ENDD(d0);
 | 
				
			||||||
	ENDCACHE_Y_AS_ENV();
 | 
						ENDCACHE_Y_AS_ENV();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NoStackPExec:
 | 
					 | 
				
			||||||
      /* on X86 machines S will not actually be holding the pointer to pred */
 | 
					 | 
				
			||||||
      SREG = (CELL *) pen;
 | 
					 | 
				
			||||||
      goto NoStackCallGotS;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      ENDBOp();
 | 
					      ENDBOp();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11291,7 +11285,7 @@ absmi(int inp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	CACHE_Y_AS_ENV(Y);
 | 
						CACHE_Y_AS_ENV(Y);
 | 
				
			||||||
#ifndef NO_CHECKING
 | 
					#ifndef NO_CHECKING
 | 
				
			||||||
	check_stack(NoStackPWExec, H);
 | 
						check_stack(NoStackCall, H);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BEGD(d0);
 | 
						BEGD(d0);
 | 
				
			||||||
	d0 = ARG1;
 | 
						d0 = ARG1;
 | 
				
			||||||
@@ -11423,12 +11417,6 @@ absmi(int inp)
 | 
				
			|||||||
	ENDP(pt1);
 | 
						ENDP(pt1);
 | 
				
			||||||
	ENDD(d0);
 | 
						ENDD(d0);
 | 
				
			||||||
	ENDCACHE_Y_AS_ENV();
 | 
						ENDCACHE_Y_AS_ENV();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    NoStackPWExec:
 | 
					 | 
				
			||||||
	/* on X86 machines S will not actually be holding the pointer to pred */
 | 
					 | 
				
			||||||
	SREG = (CELL *) pen;
 | 
					 | 
				
			||||||
	goto NoStackCallGotS;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      ENDBOp();
 | 
					      ENDBOp();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11439,7 +11427,7 @@ absmi(int inp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	CACHE_Y_AS_ENV(Y);
 | 
						CACHE_Y_AS_ENV(Y);
 | 
				
			||||||
#ifndef NO_CHECKING
 | 
					#ifndef NO_CHECKING
 | 
				
			||||||
	check_stack(NoStackPWLExec, H);
 | 
						check_stack(NoStackCall, H);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BEGD(d0);
 | 
						BEGD(d0);
 | 
				
			||||||
	d0 = ARG1;
 | 
						d0 = ARG1;
 | 
				
			||||||
@@ -11522,6 +11510,16 @@ absmi(int inp)
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
	  d0 = (CELL)B;
 | 
						  d0 = (CELL)B;
 | 
				
			||||||
	PREG = (yamop *) pen->CodeOfPred;
 | 
						PREG = (yamop *) pen->CodeOfPred;
 | 
				
			||||||
 | 
					#ifdef DEPTH_LIMIT
 | 
				
			||||||
 | 
						if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
 | 
				
			||||||
 | 
						  if (pen->ModuleOfPred) {
 | 
				
			||||||
 | 
						    if (DEPTH == MkIntTerm(0))
 | 
				
			||||||
 | 
						      FAIL();
 | 
				
			||||||
 | 
						    else DEPTH = RESET_DEPTH();
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						} else if (pen->ModuleOfPred)
 | 
				
			||||||
 | 
						  DEPTH -= MkIntConstant(2);
 | 
				
			||||||
 | 
					#endif	/* DEPTH_LIMIT */
 | 
				
			||||||
	/* do deallocate */
 | 
						/* do deallocate */
 | 
				
			||||||
	CPREG = (yamop *) E_Y[E_CP];
 | 
						CPREG = (yamop *) E_Y[E_CP];
 | 
				
			||||||
	E_Y = ENV = (CELL *) E_Y[E_E];
 | 
						E_Y = ENV = (CELL *) E_Y[E_E];
 | 
				
			||||||
@@ -11559,11 +11557,6 @@ absmi(int inp)
 | 
				
			|||||||
	ENDD(d0);
 | 
						ENDD(d0);
 | 
				
			||||||
	ENDCACHE_Y_AS_ENV();
 | 
						ENDCACHE_Y_AS_ENV();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NoStackPWLExec:
 | 
					 | 
				
			||||||
	/* on X86 machines S will not actually be holding the pointer to pred */
 | 
					 | 
				
			||||||
	SREG = (CELL *) pen;
 | 
					 | 
				
			||||||
	goto NoStackCallGotS;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      ENDBOp();
 | 
					      ENDBOp();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,10 +122,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
 | 
				
			|||||||
  /* if (vsc_count > 500000) exit(0); */
 | 
					  /* if (vsc_count > 500000) exit(0); */
 | 
				
			||||||
  /* if (gc_calls < 1) return;*/
 | 
					  /* if (gc_calls < 1) return;*/
 | 
				
			||||||
#if defined(__GNUC__)
 | 
					#if defined(__GNUC__)
 | 
				
			||||||
  {
 | 
					  YP_fprintf(YP_stderr,"%llu (%d) ", vsc_count, IntegerOfTerm(DEPTH));
 | 
				
			||||||
    choiceptr myB=B;
 | 
					 | 
				
			||||||
    YP_fprintf(YP_stderr,"%llu (%p, %p, %p) ", vsc_count, TR, ENV, myB);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  /* check_trail_consistency(); */
 | 
					  /* check_trail_consistency(); */
 | 
				
			||||||
  if (pred == NULL) {
 | 
					  if (pred == NULL) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user