@@ -93,8 +93,11 @@ void Universe::BasicInit() {
9393}
9494
9595void Universe::Shutdown () {
96- ErrorPrint (" Time spent in GC: [" +
97- to_string (Timer::GCTimer.GetTotalTime ()) + " ] msec\n " );
96+ if (gcVerbosity > 0 ) {
97+ ErrorPrint (" Time spent in GC: [" +
98+ to_string (Timer::GCTimer.GetTotalTime ()) + " ] msec\n " );
99+ }
100+
98101#ifdef GENERATE_INTEGER_HISTOGRAM
99102 std::string file_name_hist = std::string (bm_name);
100103 file_name_hist.append (" _integer_histogram.csv" );
@@ -138,6 +141,35 @@ void Universe::Shutdown() {
138141#endif
139142}
140143
144+ static void printVmConfig () {
145+ if (GC_TYPE == GENERATIONAL) {
146+ cout << " \t garbage collector: generational\n " ;
147+ } else if (GC_TYPE == COPYING) {
148+ cout << " \t garbage collector: copying\n " ;
149+ } else if (GC_TYPE == MARK_SWEEP) {
150+ cout << " \t garbage collector: mark-sweep\n " ;
151+ } else if (GC_TYPE == DEBUG_COPYING) {
152+ cout << " \t garbage collector: debug copying\n " ;
153+ } else {
154+ cout << " \t garbage collector: unknown\n " ;
155+ }
156+
157+ if (USE_TAGGING) {
158+ cout << " \t with tagged integers\n " ;
159+ } else {
160+ cout << " \t not tagging integers\n " ;
161+ }
162+
163+ if (CACHE_INTEGER) {
164+ cout << " \t caching integers from " << INT_CACHE_MIN_VALUE << " to "
165+ << INT_CACHE_MAX_VALUE << " \n " ;
166+ } else {
167+ cout << " \t not caching integers\n " ;
168+ }
169+
170+ cout << " --------------------------------------\n " ;
171+ }
172+
141173vector<std::string> Universe::handleArguments (int32_t argc, char ** argv) {
142174 vector<std::string> vmArgs = vector<std::string>();
143175 dumpBytecodes = 0 ;
@@ -151,6 +183,8 @@ vector<std::string> Universe::handleArguments(int32_t argc, char** argv) {
151183 setupClassPath (std::string (argv[++i]));
152184 } else if (strncmp (argv[i], " -d" , 2 ) == 0 ) {
153185 ++dumpBytecodes;
186+ } else if (strncmp (argv[i], " -cfg" , 4 ) == 0 ) {
187+ printVmConfig ();
154188 } else if (strncmp (argv[i], " -g" , 2 ) == 0 ) {
155189 ++gcVerbosity;
156190 } else if (strncmp (argv[i], " -H" , 2 ) == 0 ) {
@@ -235,14 +269,16 @@ void Universe::addClassPath(const std::string& cp) {
235269void Universe::printUsageAndExit (char * executable) {
236270 cout << " Usage: " << executable << " [-options] [args...]\n\n " ;
237271 cout << " where options include:\n " ;
238- cout << " -cp <directories separated by " << pathSeparator << " >\n " ;
239- cout << " set search path for application classes\n " ;
240- cout << " -d enable disassembling (twice for tracing)\n " ;
241- cout << " -g enable garbage collection details:\n "
242- << " 1x - print statistics when VM shuts down\n "
243- << " 2x - print statistics upon each collection\n "
244- << " 3x - print statistics and dump heap upon each \n "
245- << " collection\n " ;
272+ cout << " -cp <directories separated by " << pathSeparator << " >\n " ;
273+ cout << " set search path for application classes\n " ;
274+ cout << " -d enable disassembling (twice for tracing)\n " ;
275+ cout << " -cfg print VM configuration\n " ;
276+ cout
277+ << " -g enable garbage collection details:\n "
278+ << " 1x - print statistics when VM shuts down\n "
279+ << " 2x - print statistics upon each collection\n "
280+ << " 3x - print statistics and dump heap upon each collection\n "
281+ << " \n " ;
246282 cout << " -HxMB set the heap size to x MB (default: 1 MB)\n " ;
247283 cout << " -HxKB set the heap size to x KB (default: 1 MB)\n " ;
248284 cout << " -h show this help\n " ;
0 commit comments