sourcepawn/compiler/sc1.c
changeset 1164 9cf0db2a6fa0
parent 1046 1072caab8a65
child 1265 12b3c9fb24f5
     1.1 --- a/sourcepawn/compiler/sc1.c	Wed Jul 25 01:18:11 2007 +0000
     1.2 +++ b/sourcepawn/compiler/sc1.c	Wed Jul 25 02:48:52 2007 +0000
     1.3 @@ -456,8 +456,10 @@
     1.4  
     1.5    #if !defined SC_LIGHT
     1.6      if (errnum==0 && strlen(errfname)==0) {
     1.7 +#if 0	//bug in compiler -- someone's script caused this function to infrecurs
     1.8        int recursion;
     1.9        long stacksize=max_stacksize(&glbtab,&recursion);
    1.10 +#endif
    1.11        int flag_exceed=0;
    1.12        if (pc_amxlimit>0) {
    1.13          long totalsize=hdrsize+code_idx;
    1.14 @@ -468,11 +470,12 @@
    1.15        } /* if */
    1.16        if (pc_amxram>0 && (glb_declared+pc_stksize)*sizeof(cell)>=(unsigned long)pc_amxram)
    1.17          flag_exceed=1;
    1.18 -      if (!norun && (sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || stacksize+32>=(long)pc_stksize || flag_exceed) {
    1.19 +      if (!norun && (sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || flag_exceed) {
    1.20          pc_printf("Header size:       %8ld bytes\n", (long)hdrsize);
    1.21          pc_printf("Code size:         %8ld bytes\n", (long)code_idx);
    1.22          pc_printf("Data size:         %8ld bytes\n", (long)glb_declared*sizeof(cell));
    1.23          pc_printf("Stack/heap size:   %8ld bytes; ", (long)pc_stksize*sizeof(cell));
    1.24 +#if 0
    1.25          pc_printf("estimated max. usage");
    1.26          if (recursion)
    1.27            pc_printf(": unknown, due to recursion\n");
    1.28 @@ -480,6 +483,7 @@
    1.29            pc_printf(": unknown, due to the \"sleep\" instruction\n");
    1.30          else
    1.31            pc_printf("=%ld cells (%ld bytes)\n",stacksize,stacksize*sizeof(cell));
    1.32 +#endif
    1.33          pc_printf("Total requirements:%8ld bytes\n", (long)hdrsize+(long)code_idx+(long)glb_declared*sizeof(cell)+(long)pc_stksize*sizeof(cell));
    1.34        } /* if */
    1.35        if (flag_exceed)
    1.36 @@ -5029,6 +5033,8 @@
    1.37    return maxsize+basesize;
    1.38  }
    1.39  
    1.40 +static symbol *save_symbol;
    1.41 +
    1.42  static long max_stacksize(symbol *root,int *recursion)
    1.43  {
    1.44    /* Loop over all non-native functions. For each function, loop
    1.45 @@ -5061,6 +5067,7 @@
    1.46      if (sym->ident!=iFUNCTN || (sym->usage & uNATIVE)!=0)
    1.47        continue;
    1.48      /* accumulate stack size for this symbol */
    1.49 +	save_symbol = sym;
    1.50      size=max_stacksize_recurse(sym,sym,0L,&maxparams,recursion);
    1.51      assert(size>=0);
    1.52      if (maxsize<size)