[Haskell-cafe] GHC ignores RTS options
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Wed Nov 16 12:39:42 EST 2005
"Simon Marlow" <simonmar at microsoft.com> writes:
> Sure, it shouldn't be too hard. You need to generate a .c file
> containing the ghc_rts_opts setting, and then compile & link it into the
> final binary. It's just a matter of plumbing the various bits together
> in GHC's front end.
If it helps, here is a little C program used by nhc98 to generate
much the same type of hook.
Regards,
Malcolm
-------------- next part --------------
main(int argc, char **argv)
{
int prefix = 1;
int i = 0;
char *s;
if (argc==1) {
i = DefaultHeap;
} else if ((argc==2) && (*argv[1]=='T')) {
i = 5 * DefaultHeap;
} else {
s = argv[argc-1];
while(isdigit(*s)) {
i = i*10 + *s++ - '0';
}
switch(*s) {
case 'k':
case 'K': prefix *= 1000; s++; break;
case 'm':
case 'M': prefix *= 1000000; s++; break;
}
switch(*s) {
case 'b': case 'B': s++; i = i*prefix/sizeof(unsigned); break;
case 'w': case 'W': s++; i = i*prefix; break;
default: i = i*prefix/sizeof(unsigned); break;
}
}
printf("int hpSize = %d;\n",i);
exit(0);
}
More information about the Glasgow-haskell-users
mailing list