diff options
-rw-r--r-- | backendC/CleanCompilerSources/sa.c | 15 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/settings.c | 2 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/settings.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/backendC/CleanCompilerSources/sa.c b/backendC/CleanCompilerSources/sa.c index 1be3039..cf74d4a 100644 --- a/backendC/CleanCompilerSources/sa.c +++ b/backendC/CleanCompilerSources/sa.c @@ -55,6 +55,13 @@ #define for_l(v,l,n) for(v=(l);v!=NULL;v=v->n) +#define NR_BLOCKS 200 +#define NR_BLOCKS_FOR_ANALYSIS 100 + +#define BLOCK_SIZE (unsigned long) (16 * KBYTE) + +unsigned long StrictMemUse = NR_BLOCKS * BLOCK_SIZE; + #ifdef CHECK_STACK_OVERFLOW char *min_stack; int stack_source = 0; @@ -243,8 +250,8 @@ static char *ffree = Null; /* the freezed free position */ static void NewBlock (void) { if (usedblocks < n_allocated_blocks) - usedblocks ++; - else if (n_allocated_blocks < NR_BLOCKS && (BLOCK_SIZE * (n_allocated_blocks+1)) < StrictMemUse){ + ++usedblocks; + else if (n_allocated_blocks<NR_BLOCKS && (fblocks==0 || n_allocated_blocks<fblocks+NR_BLOCKS_FOR_ANALYSIS) && BLOCK_SIZE*(n_allocated_blocks+1)<StrictMemUse){ if (! (free_pos = (char *) Alloc (BLOCK_SIZE, SizeOf (char)))) return; @@ -253,7 +260,7 @@ static void NewBlock (void) n_allocated_blocks++; usedblocks++; } else { - free_pos = (char *) Null; + free_pos = NULL; return; } @@ -356,7 +363,7 @@ static void FreeBlocks (void) } } - n_allocated_blocks = usedblocks = fblocks = 0; + n_allocated_blocks = usedblocks = fblocks = 0; free_pos = ffree = Null; } diff --git a/backendC/CleanCompilerSources/settings.c b/backendC/CleanCompilerSources/settings.c index b46894a..e98fb81 100644 --- a/backendC/CleanCompilerSources/settings.c +++ b/backendC/CleanCompilerSources/settings.c @@ -44,8 +44,6 @@ Bool StrictDoEager = True; Bool StrictDoVerbose = False; Bool StrictDoAnnots = True; -unsigned long StrictMemUse = NR_BLOCKS * BLOCK_SIZE; - Bool FunctionMayFailIsError = False; Bool NotUsedIsError = False; Bool FunctionNotUsedIsError = False; diff --git a/backendC/CleanCompilerSources/settings.h b/backendC/CleanCompilerSources/settings.h index ee1048f..bf70cbc 100644 --- a/backendC/CleanCompilerSources/settings.h +++ b/backendC/CleanCompilerSources/settings.h @@ -31,8 +31,6 @@ extern Bool OptimizeLazyTupleRecursion; extern Bool OptimizeTailCallModuloCons; extern Bool WriteModificationTimes; -#define NR_BLOCKS 100 -#define BLOCK_SIZE (unsigned long) (16 * KBYTE) #define StrictDoRelated False extern unsigned StrictDepth; |