hotspot/src/share/vm/runtime/globals.cpp
changeset 11441 a89f443814cd
parent 11254 e2dd3c32a7cb
child 12157 439a7166bf0f
equal deleted inserted replaced
11422:fcd6a1948f57 11441:a89f443814cd
   486   static int compare_flags(const void* void_a, const void* void_b) {
   486   static int compare_flags(const void* void_a, const void* void_b) {
   487     return strcmp((*((Flag**) void_a))->name, (*((Flag**) void_b))->name);
   487     return strcmp((*((Flag**) void_a))->name, (*((Flag**) void_b))->name);
   488   }
   488   }
   489 }
   489 }
   490 
   490 
   491 void CommandLineFlags::printSetFlags() {
   491 void CommandLineFlags::printSetFlags(outputStream* out) {
   492   // Print which flags were set on the command line
   492   // Print which flags were set on the command line
   493   // note: this method is called before the thread structure is in place
   493   // note: this method is called before the thread structure is in place
   494   //       which means resource allocation cannot be used.
   494   //       which means resource allocation cannot be used.
   495 
   495 
   496   // Compute size
   496   // Compute size
   505   qsort(array, length, sizeof(Flag*), compare_flags);
   505   qsort(array, length, sizeof(Flag*), compare_flags);
   506 
   506 
   507   // Print
   507   // Print
   508   for (int i = 0; i < length; i++) {
   508   for (int i = 0; i < length; i++) {
   509     if (array[i]->origin /* naked field! */) {
   509     if (array[i]->origin /* naked field! */) {
   510       array[i]->print_as_flag(tty);
   510       array[i]->print_as_flag(out);
   511       tty->print(" ");
   511       out->print(" ");
   512     }
   512     }
   513   }
   513   }
   514   tty->cr();
   514   out->cr();
   515   FREE_C_HEAP_ARRAY(Flag*, array);
   515   FREE_C_HEAP_ARRAY(Flag*, array);
   516 }
   516 }
   517 
   517 
   518 #ifndef PRODUCT
   518 #ifndef PRODUCT
   519 
   519 
   522   assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict");
   522   assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict");
   523 }
   523 }
   524 
   524 
   525 #endif // PRODUCT
   525 #endif // PRODUCT
   526 
   526 
   527 void CommandLineFlags::printFlags(bool withComments) {
   527 void CommandLineFlags::printFlags(outputStream* out, bool withComments) {
   528   // Print the flags sorted by name
   528   // Print the flags sorted by name
   529   // note: this method is called before the thread structure is in place
   529   // note: this method is called before the thread structure is in place
   530   //       which means resource allocation cannot be used.
   530   //       which means resource allocation cannot be used.
   531 
   531 
   532   // Compute size
   532   // Compute size
   539     array[index] = &flagTable[index];
   539     array[index] = &flagTable[index];
   540   }
   540   }
   541   qsort(array, length, sizeof(Flag*), compare_flags);
   541   qsort(array, length, sizeof(Flag*), compare_flags);
   542 
   542 
   543   // Print
   543   // Print
   544   tty->print_cr("[Global flags]");
   544   out->print_cr("[Global flags]");
   545   for (int i = 0; i < length; i++) {
   545   for (int i = 0; i < length; i++) {
   546     if (array[i]->is_unlocked()) {
   546     if (array[i]->is_unlocked()) {
   547       array[i]->print_on(tty, withComments);
   547       array[i]->print_on(out, withComments);
   548     }
   548     }
   549   }
   549   }
   550   FREE_C_HEAP_ARRAY(Flag*, array);
   550   FREE_C_HEAP_ARRAY(Flag*, array);
   551 }
   551 }