Re: switch -M ambiguous to ghc

1999-06-25 Thread Michael Weber

On Thu, Jun 24, 1999 at 16:55:29 +0200, Michael Weber wrote:
> When I set too big heapsize values...
[blah removed]

Sorry for that, guys, -optCrts-M seems to be the switch of choice...
 
 
my apologies,
Michael
-- 
No sig is good sig...



switch -M ambiguous to ghc

1999-06-24 Thread Michael Weber

Hi!

When I set too big heapsize values with option '-H', hsc complains about
something like "-H bigger than -M". Since ghc won't compile (*)
with lower -H values (yes, -dcore-lint also applied), I added "-M" to
the command line... AND: it doesn't work!

  (*) this happened when compiling ghc-cvs with ghc-4.02 on Linux/x86.

ghc complains about not knowing this switch and "ghc --help" says, "-M" does
something different...

In fact, there is IMHO no way to hand over "-M" to hsc...

I patched ghc.lprl, which now has a parameter "-MM", yielding an
additional "-M" to hsc...

patch is attached...


Cheers,
Michael
-- 
No sig is good sig...


--- ghc/driver/ghc.lprl.origThu Jun 17 11:03:18 1999
+++ ghc/driver/ghc.lprl Thu Jun 24 15:32:55 1999
@@ -212,6 +212,7 @@
 #   terrible things to cache behavior.
 #
 $Specific_heap_size = 6 * 1000 * 1000;
+$Specific_mem_size  = 70 * 1000 * 1000;
 $Specific_stk_size  = 1000 * 1000;
 $Scale_sizes_by = 1.0;
 
@@ -1198,6 +1199,8 @@
 sub setupHeapStackSize {
$Specific_heap_size = $Specific_heap_size * $Scale_sizes_by;
push(@HsC_rts_flags, '-H'.$Specific_heap_size);
+   $Specific_mem_size = $Specific_mem_size * $Scale_sizes_by;
+   push(@HsC_rts_flags, "-M$Specific_mem_size");
$Specific_stk_size = $Specific_stk_size * $Scale_sizes_by;
push(@HsC_rts_flags, "-K$Specific_stk_size");
 }
@@ -3205,6 +3208,27 @@
$Specific_heap_size = $heap_size;
} else {
print STDERR "$Pgm: ignoring heap-size-setting option ($_)...not the 
largest seen\n";
+   }
+   next arg; };
+
+/^(-MM|-Rmax-memsize)(.*)/ && do {
+   local($mem_size) = &grab_arg_arg(*Args,$1, $2);
+   if ($mem_size =~ /(\d+)[Kk]$/) {
+   $mem_size = $1 * 1000;
+   } elsif ($mem_size =~ /(\d+)[Mm]$/) {
+   $mem_size = $1 * 1000 * 1000;
+   } elsif ($mem_size =~ /(\d+)[Gg]$/) {
+   $mem_size = $1 * 1000 * 1000 * 1000;
+   }
+   if ($mem_size <= 0) {
+   print STDERR "$Pgm: resetting mem-size to zero!!! $mem_size\n";
+   $Specific_mem_size = 0;
+   
+   # if several heap sizes given, take the largest...
+   } elsif ($mem_size >= $Specific_mem_size) {
+   $Specific_mem_size = $mem_size;
+   } else {
+   print STDERR "$Pgm: ignoring mem-size-setting option ($_)...not the 
+largest seen\n";
}
next arg; };