X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsFlags.c;h=4c1f739e894615e8f62948ece354397c18cd31ef;hb=1bd1fb932375bc4b065cc8de23f0d251e8075395;hp=0ab13992ce9479b1bd6ae8d42e58cdcc3486a16f;hpb=73637ad66b7f88e57dcd0e0ea93b3d7bf8fb0d78;p=ghc-hetmet.git diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 0ab1399..4c1f739 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -28,6 +28,8 @@ RTS_FLAGS RtsFlags; */ int prog_argc = 0; /* an "int" so as to match normal "argc" */ char **prog_argv = NULL; +int full_prog_argc = 0; /* an "int" so as to match normal "argc" */ +char **full_prog_argv = NULL; char *prog_name = NULL; /* 'basename' of prog_argv[0] */ int rts_argc = 0; /* ditto */ char *rts_argv[MAX_RTS_ARGS]; @@ -201,8 +203,8 @@ void initRtsFlagsDefaults(void) RtsFlags.ProfFlags.bioSelector = NULL; #endif - RtsFlags.MiscFlags.tickInterval = 50; /* In milliseconds */ - RtsFlags.ConcFlags.ctxtSwitchTime = 50; /* In milliseconds */ + RtsFlags.MiscFlags.tickInterval = 20; /* In milliseconds */ + RtsFlags.ConcFlags.ctxtSwitchTime = 20; /* In milliseconds */ RtsFlags.MiscFlags.install_signal_handlers = rtsTrue; @@ -680,6 +682,22 @@ error = rtsTrue; &rts_argv[arg][2])) { RtsFlags.MiscFlags.install_signal_handlers = rtsFalse; } + else if (strequal("info", + &rts_argv[arg][2])) { + char *s; + printf("RTS info:\n"); + printf("RTS from GHC " ProjectVersion "\n"); + printf("RTS way " RtsWay "\n"); + printf("Host platform " HostPlatform "\n"); + printf("Build platform " BuildPlatform "\n"); + printf("Target platform " TargetPlatform "\n"); + s = strcmp(GhcUnregisterised, "YES") == 0 ? "un" : ""; + printf("Compiler is %sregisterised\n", s); + s = strcmp(GhcEnableTablesNextToCode, "YES") == 0 + ? "" : "not "; + printf("Tables are %snext to code\n", s); + exit(0); + } else { errorBelch("unknown RTS option: %s",rts_argv[arg]); error = rtsTrue; @@ -1244,13 +1262,20 @@ error = rtsTrue; } } - // Determine what tick interval we should use for the RTS timer - // by taking the shortest of the various intervals that we need to - // monitor. - if (RtsFlags.MiscFlags.tickInterval <= 0) { + if (RtsFlags.MiscFlags.tickInterval < 0) { RtsFlags.MiscFlags.tickInterval = 50; } + // If the master timer is disabled, turn off the other timers. + if (RtsFlags.MiscFlags.tickInterval == 0) { + RtsFlags.ConcFlags.ctxtSwitchTime = 0; + RtsFlags.GcFlags.idleGCDelayTime = 0; + RtsFlags.ProfFlags.profileInterval = 0; + } + + // Determine what tick interval we should use for the RTS timer + // by taking the shortest of the various intervals that we need to + // monitor. if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) { RtsFlags.MiscFlags.tickInterval = stg_min(RtsFlags.ConcFlags.ctxtSwitchTime, @@ -1277,8 +1302,13 @@ error = rtsTrue; RtsFlags.ConcFlags.ctxtSwitchTicks = 0; } - RtsFlags.ProfFlags.profileIntervalTicks = - RtsFlags.ProfFlags.profileInterval / RtsFlags.MiscFlags.tickInterval; + if (RtsFlags.ProfFlags.profileInterval > 0) { + RtsFlags.ProfFlags.profileIntervalTicks = + RtsFlags.ProfFlags.profileInterval / + RtsFlags.MiscFlags.tickInterval; + } else { + RtsFlags.ProfFlags.profileIntervalTicks = 0; + } if (error) { const char **p; @@ -2399,3 +2429,29 @@ setProgArgv(int argc, char *argv[]) prog_argv = argv; setProgName(prog_argv); } + +/* These functions record and recall the full arguments, including the + +RTS ... -RTS options. The reason for adding them was so that the + ghc-inplace program can pass /all/ the arguments on to the real ghc. */ +void +getFullProgArgv(int *argc, char **argv[]) +{ + if (argc) { *argc = full_prog_argc; } + if (argv) { *argv = full_prog_argv; } +} + +void +setFullProgArgv(int argc, char *argv[]) +{ + int i; + full_prog_argc = argc; + full_prog_argv = stgCallocBytes(argc + 1, sizeof (char *), + "setFullProgArgv 1"); + for (i = 0; i < argc; i++) { + full_prog_argv[i] = stgMallocBytes(strlen(argv[i]) + 1, + "setFullProgArgv 2"); + strcpy(full_prog_argv[i], argv[i]); + } + full_prog_argv[argc] = NULL; +} +