X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsFlags.c;h=cf8d2c5bdb49b1127751d01bfe28a9a150077567;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=b4ce185aaa3a601f3a02b7ec68f99481dac5385c;hpb=e918a7f155648fc83ed78c8fca85e6e56b77d9ff;p=ghc-hetmet.git diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index b4ce185..cf8d2c5 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsFlags.c,v 1.67 2003/03/25 17:26:08 sof Exp $ + * $Id: RtsFlags.c,v 1.75 2004/08/13 13:10:29 simonmar Exp $ * * (c) The AQUA Project, Glasgow University, 1994-1997 * (c) The GHC Team, 1998-1999 @@ -36,13 +36,15 @@ #include #include -extern struct RTS_FLAGS RtsFlags; +// Flag Structure +RTS_FLAGS RtsFlags; /* * Split argument lists */ -int prog_argc = 0; /* an "int" so as to match normal "argc" */ +int prog_argc = 0; /* an "int" so as to match normal "argc" */ char **prog_argv = NULL; +char *prog_name = NULL; /* 'basename' of prog_argv[0] */ int rts_argc = 0; /* ditto */ char *rts_argv[MAX_RTS_ARGS]; @@ -55,25 +57,9 @@ char *rts_argv[MAX_RTS_ARGS]; #define RTS 1 #define PGM 0 -char *debug_opts_prefix[] = { - "_-", /* scheduler */ - "_.", /* interpreter */ - "_,", /* codegen */ - "_;", /* weak */ - "_~", /* gccafs */ - "_@", /* gc */ - "_#", /* block */ - "_&", /* sanity */ - "_:", /* stable */ - "_!", /* prof */ - "_=", /* gran */ - "_=" /* par */ - "_*" /* linker */ -}; - #if defined(GRAN) -char *gran_debug_opts_strs[] = { +static char *gran_debug_opts_strs[] = { "DEBUG (-bDe, -bD1): event_trace; printing event trace.\n", "DEBUG (-bDE, -bD2): event_stats; printing event statistics.\n", "DEBUG (-bDb, -bD4): bq; check blocking queues\n", @@ -92,32 +78,13 @@ char *gran_debug_opts_strs[] = { }; /* one character codes for the available debug options */ -char gran_debug_opts_flags[] = { +static char gran_debug_opts_flags[] = { 'e', 'E', 'b', 'G', 'q', 'f', 'r', 'F', 'u', 'S', ':', 'o', 'z', 'P', 't' }; -/* prefix strings printed with the debug messages of the corresponding type */ -char *gran_debug_opts_prefix[] = { - "", /* event_trace */ - "", /* event_stats */ - "##", /* bq */ - "**", /* pack */ - "^^", /* checkSparkQ */ - "==", /* thunkStealing */ - "^^", /* randomSteal */ - "+-", /* findWork */ - "", /* unused */ - "++", /* pri */ - "::", /* checkLight */ - "##", /* sortedQ */ - "", /* blockOnFetch */ - "", /* packBuffer */ - "" /* blockOnFetch_sanity */ -}; - #elif defined(PAR) -char *par_debug_opts_strs[] = { +static char *par_debug_opts_strs[] = { "DEBUG (-qDv, -qD1): verbose; be generally verbose with parallel related stuff.\n", "DEBUG (-qDq, -qD2): bq; print blocking queues.\n", "DEBUG (-qDs, -qD4): schedule; scheduling of parallel threads.\n", @@ -135,27 +102,10 @@ char *par_debug_opts_strs[] = { }; /* one character codes for the available debug options */ -char par_debug_opts_flags[] = { +static char par_debug_opts_flags[] = { 'v', 'q', 's', 'e', 'r', 'w', 'F', 'f', 'l', 'o', 'p', 'z' }; -/* prefix strings printed with the debug messages of the corresponding type */ -char *par_debug_opts_prefix[] = { - " ", /* verbose */ - "##", /* bq */ - "--", /* schedule */ - "!!", /* free */ - "[]", /* resume */ - ";;", /* weight */ - "%%", /* fetch */ - //",,", /* ack */ - "$$", /* fish */ - "", /* tables */ - "**", /* packet */ - "**" /* pack */ - ":(" /* paranoia */ -}; - #endif /* PAR */ //@node Static function decls, Command-line option parsing routines, Constants @@ -198,7 +148,7 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.statsFile = NULL; RtsFlags.GcFlags.giveStats = NO_GC_STATS; - RtsFlags.GcFlags.maxStkSize = (1024 * 1024) / sizeof(W_); + RtsFlags.GcFlags.maxStkSize = (8 * 1024 * 1024) / sizeof(W_); RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_); RtsFlags.GcFlags.minAllocAreaSize = (256 * 1024) / BLOCK_SIZE; @@ -296,7 +246,7 @@ void initRtsFlagsDefaults(void) #if defined(GRAN) /* ToDo: check defaults for GranSim and GUM */ - RtsFlags.GcFlags.maxStkSize = (1024 * 1024) / sizeof(W_); + RtsFlags.GcFlags.maxStkSize = (8 * 1024 * 1024) / sizeof(W_); RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_); RtsFlags.GranFlags.maxThreads = 65536; // refers to mandatory threads @@ -382,8 +332,8 @@ usage_text[] = { "", " -? Prints this message and exits; the program is not executed", "", -" -K Sets the maximum stack size (default 1M) Egs: -K32k -K512k", -" -k Sets the initial thread stack size (default 1k) Egs: -K4k -K2m", +" -K Sets the maximum stack size (default 8M) Egs: -K32k -K512k", +" -k Sets the initial thread stack size (default 1k) Egs: -k4k -k2m", "", " -A Sets the minimum allocation area size (default 256k) Egs: -A1m -A10k", " -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", @@ -508,7 +458,7 @@ usage_text[] = { 0 }; -static __inline__ rtsBool +STATIC_INLINE rtsBool strequal(const char *a, const char * b) { return(strcmp(a, b) == 0); @@ -549,9 +499,17 @@ setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]) char *last_slash; /* Remove directory from argv[0] -- default files in current directory */ - - if ((last_slash = (char *) strrchr(argv[0], '/')) != NULL) - strcpy(argv[0], last_slash+1); + if ((last_slash = (char *) strrchr(argv[0], +#if !defined(mingw32_TARGET_OS) + '/') +#else + '\\') +#endif + ) != NULL) { + prog_name = last_slash+1; + } else { + prog_name = argv[0]; + } total_arg = *argc; arg = 1; @@ -637,7 +595,7 @@ setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]) # define TICKY_BUILD_ONLY(x) x #else # define TICKY_BUILD_ONLY(x) \ -prog_belch("GHC not built for: ticky-ticky stats"); \ +prog_belch("not built for: ticky-ticky stats"); \ error = rtsTrue; #endif @@ -645,7 +603,7 @@ error = rtsTrue; # define COST_CENTRE_USING_BUILD_ONLY(x) x #else # define COST_CENTRE_USING_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -prof or -parallel"); \ +prog_belch("not built for: -prof or -parallel"); \ error = rtsTrue; #endif @@ -653,7 +611,7 @@ error = rtsTrue; # define PROFILING_BUILD_ONLY(x) x #else # define PROFILING_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -prof"); \ +prog_belch("not built for: -prof"); \ error = rtsTrue; #endif @@ -661,7 +619,7 @@ error = rtsTrue; # define SMP_BUILD_ONLY(x) x #else # define SMP_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -smp"); \ +prog_belch("not built for: -smp"); \ error = rtsTrue; #endif @@ -669,7 +627,7 @@ error = rtsTrue; # define PAR_BUILD_ONLY(x) x #else # define PAR_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -parallel"); \ +prog_belch("not built for: -parallel"); \ error = rtsTrue; #endif @@ -677,7 +635,7 @@ error = rtsTrue; # define PAR_OR_SMP_BUILD_ONLY(x) x #else # define PAR_OR_SMP_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -parallel or -smp"); \ +prog_belch("not built for: -parallel or -smp"); \ error = rtsTrue; #endif @@ -685,7 +643,7 @@ error = rtsTrue; # define GRAN_BUILD_ONLY(x) x #else # define GRAN_BUILD_ONLY(x) \ -prog_belch("GHC not built for: -gransim"); \ +prog_belch("not built for: -gransim"); \ error = rtsTrue; #endif