src/share/vm/runtime/globals.cpp

Print this page




  51     return UnlockExperimentalVMOptions;
  52   } else {
  53     return true;
  54   }
  55 }
  56 
  57 bool Flag::is_writeable() const {
  58   return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0);
  59 }
  60 
  61 // All flags except "manageable" are assumed internal flags.
  62 // Long term, we need to define a mechanism to specify which flags
  63 // are external/stable and change this function accordingly.
  64 bool Flag::is_external() const {
  65   return (strcmp(kind, "{manageable}") == 0);
  66 }
  67 
  68 // Length of format string (e.g. "%.1234s") for printing ccstr below
  69 #define FORMAT_BUFFER_LEN 16
  70 
  71 void Flag::print_on(outputStream* st) {
  72   st->print("%5s %-35s %c= ", type, name, (origin != DEFAULT ? ':' : ' '));
  73   if (is_bool())     st->print("%-16s", get_bool() ? "true" : "false");
  74   if (is_intx())     st->print("%-16ld", get_intx());
  75   if (is_uintx())    st->print("%-16lu", get_uintx());
  76   if (is_uint64_t()) st->print("%-16lu", get_uint64_t());


  77   if (is_ccstr()) {
  78     const char* cp = get_ccstr();
  79     if (cp != NULL) {
  80       const char* eol;
  81       while ((eol = strchr(cp, '\n')) != NULL) {
  82         char format_buffer[FORMAT_BUFFER_LEN];
  83         size_t llen = pointer_delta(eol, cp, sizeof(char));
  84         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
  85                      "%%." SIZE_FORMAT "s", llen);
  86         st->print(format_buffer, cp);
  87         st->cr();
  88         cp = eol+1;
  89         st->print("%5s %-35s += ", "", name);
  90       }
  91       st->print("%-16s", cp);
  92     }

  93   }
  94   st->print(" %s", kind);





  95   st->cr();
  96 }
  97 
  98 void Flag::print_as_flag(outputStream* st) {
  99   if (is_bool()) {
 100     st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
 101   } else if (is_intx()) {
 102     st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
 103   } else if (is_uintx()) {
 104     st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
 105   } else if (is_uint64_t()) {
 106     st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
 107   } else if (is_ccstr()) {
 108     st->print("-XX:%s=", name);
 109     const char* cp = get_ccstr();
 110     if (cp != NULL) {
 111       // Need to turn embedded '\n's back into separate arguments
 112       // Not so efficient to print one character at a time,
 113       // but the choice is to do the transformation to a buffer
 114       // and print that.  And this need not be efficient.
 115       for (; *cp != '\0'; cp += 1) {
 116         switch (*cp) {
 117           default:
 118             st->print("%c", *cp);
 119             break;
 120           case '\n':
 121             st->print(" -XX:%s=", name);
 122             break;
 123         }
 124       }
 125     }
 126   } else {
 127     ShouldNotReachHere();
 128   }
 129 }
 130 
 131 // 4991491 do not "optimize out" the was_set false values: omitting them
 132 // tickles a Microsoft compiler bug causing flagTable to be malformed
 133 
 134 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product}", DEFAULT },
 135 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{pd product}", DEFAULT },
 136 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{diagnostic}", DEFAULT },
 137 #define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{experimental}", DEFAULT },
 138 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{manageable}", DEFAULT },
 139 #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product rw}", DEFAULT },
 140 
 141 #ifdef PRODUCT
 142   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 143   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 144   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 145 #else
 146   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "", DEFAULT },
 147   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{pd}", DEFAULT },
 148   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{notproduct}", DEFAULT },
 149 #endif
 150 
 151 #ifdef _LP64
 152   #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{lp64_product}", DEFAULT },
 153 #else
 154   #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 155 #endif // _LP64
 156 
 157 #define C1_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C1 product}", DEFAULT },
 158 #define C1_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{C1 pd product}", DEFAULT },
 159 #ifdef PRODUCT
 160   #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 161   #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 162   #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 163 #else
 164   #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C1}", DEFAULT },
 165   #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{C1 pd}", DEFAULT },
 166   #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C1 notproduct}", DEFAULT },
 167 #endif
 168 
 169 
 170 #define C2_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 product}", DEFAULT },
 171 #define C2_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{C2 pd product}", DEFAULT },
 172 #define C2_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 diagnostic}", DEFAULT },
 173 #define C2_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 experimental}", DEFAULT },
 174 #ifdef PRODUCT
 175   #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 176   #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 177   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 178 #else
 179   #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2}", DEFAULT },
 180   #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{C2 pd}", DEFAULT },
 181   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 notproduct}", DEFAULT },
 182 #endif
 183 
 184 #define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark product}", DEFAULT },
 185 #define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd product}", DEFAULT },
 186 #define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark diagnostic}", DEFAULT },
 187 #ifdef PRODUCT
 188   #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 189   #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 190   #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 191 #else
 192   #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark}", DEFAULT },
 193   #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd}", DEFAULT },
 194   #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark notproduct}", DEFAULT },
 195 #endif
 196 
 197 static Flag flagTable[] = {
 198  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
 199  RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT)
 200 #ifndef SERIALGC
 201  G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT)
 202 #endif // SERIALGC
 203 #ifdef COMPILER1
 204  C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT)
 205 #endif
 206 #ifdef COMPILER2
 207  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_EXPERIMENTAL_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
 208 #endif
 209 #ifdef SHARK
 210  SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
 211 #endif
 212  {0, NULL, NULL}
 213 };
 214 


 468   // Print
 469   for (int i = 0; i < length; i++) {
 470     if (array[i]->origin /* naked field! */) {
 471       array[i]->print_as_flag(tty);
 472       tty->print(" ");
 473     }
 474   }
 475   tty->cr();
 476   FREE_C_HEAP_ARRAY(Flag*, array);
 477 }
 478 
 479 #ifndef PRODUCT
 480 
 481 
 482 void CommandLineFlags::verify() {
 483   assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict");
 484 }
 485 
 486 #endif // PRODUCT
 487 
 488 void CommandLineFlags::printFlags() {
 489   // Print the flags sorted by name
 490   // note: this method is called before the thread structure is in place
 491   //       which means resource allocation cannot be used.
 492 
 493   // Compute size
 494   int length= 0;
 495   while (flagTable[length].name != NULL) length++;
 496 
 497   // Sort
 498   Flag** array = NEW_C_HEAP_ARRAY(Flag*, length);
 499   for (int index = 0; index < length; index++) {
 500     array[index] = &flagTable[index];
 501   }
 502   qsort(array, length, sizeof(Flag*), compare_flags);
 503 
 504   // Print
 505   tty->print_cr("[Global flags]");
 506   for (int i = 0; i < length; i++) {
 507     if (array[i]->is_unlocked()) {
 508       array[i]->print_on(tty);
 509     }
 510   }
 511   FREE_C_HEAP_ARRAY(Flag*, array);
 512 }


  51     return UnlockExperimentalVMOptions;
  52   } else {
  53     return true;
  54   }
  55 }
  56 
  57 bool Flag::is_writeable() const {
  58   return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0);
  59 }
  60 
  61 // All flags except "manageable" are assumed internal flags.
  62 // Long term, we need to define a mechanism to specify which flags
  63 // are external/stable and change this function accordingly.
  64 bool Flag::is_external() const {
  65   return (strcmp(kind, "{manageable}") == 0);
  66 }
  67 
  68 // Length of format string (e.g. "%.1234s") for printing ccstr below
  69 #define FORMAT_BUFFER_LEN 16
  70 
  71 void Flag::print_on(outputStream* st, bool withComments) {
  72   st->print("%9s %-40s %c= ", type, name, (origin != DEFAULT ? ':' : ' '));
  73   if (is_bool())     st->print("%-16s", get_bool() ? "true" : "false");
  74   if (is_intx())     st->print("%-16ld", get_intx());
  75   if (is_uintx())    st->print("%-16lu", get_uintx());
  76   if (is_uint64_t()) st->print("%-16lu", get_uint64_t());
  77   if (is_double())   st->print("%-16f", get_double());
  78 
  79   if (is_ccstr()) {
  80      const char* cp = get_ccstr();
  81      if (cp != NULL) {
  82        const char* eol;
  83        while ((eol = strchr(cp, '\n')) != NULL) {
  84          char format_buffer[FORMAT_BUFFER_LEN];
  85          size_t llen = pointer_delta(eol, cp, sizeof(char));
  86          jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
  87                      "%%." SIZE_FORMAT "s", llen);
  88          st->print(format_buffer, cp);
  89          st->cr();
  90          cp = eol+1;
  91          st->print("%5s %-35s += ", "", name);
  92        }
  93        st->print("%-16s", cp);
  94      }
  95      else st->print("%-16s", "");
  96   }
  97   st->print("%-20s", kind);
  98   if (withComments) {
  99 #ifndef PRODUCT
 100     st->print("%s", doc );
 101 #endif
 102   }
 103   st->cr();
 104 }
 105 
 106 void Flag::print_as_flag(outputStream* st) {
 107   if (is_bool()) {
 108     st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
 109   } else if (is_intx()) {
 110     st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
 111   } else if (is_uintx()) {
 112     st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
 113   } else if (is_uint64_t()) {
 114     st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
 115   } else if (is_ccstr()) {
 116     st->print("-XX:%s=", name);
 117     const char* cp = get_ccstr();
 118     if (cp != NULL) {
 119       // Need to turn embedded '\n's back into separate arguments
 120       // Not so efficient to print one character at a time,
 121       // but the choice is to do the transformation to a buffer
 122       // and print that.  And this need not be efficient.
 123       for (; *cp != '\0'; cp += 1) {
 124         switch (*cp) {
 125           default:
 126             st->print("%c", *cp);
 127             break;
 128           case '\n':
 129             st->print(" -XX:%s=", name);
 130             break;
 131         }
 132       }
 133     }
 134   } else {
 135     ShouldNotReachHere();
 136   }
 137 }
 138 
 139 // 4991491 do not "optimize out" the was_set false values: omitting them
 140 // tickles a Microsoft compiler bug causing flagTable to be malformed
 141 
 142 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product}", DEFAULT },
 143 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{pd product}", DEFAULT },
 144 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{diagnostic}", DEFAULT },
 145 #define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{experimental}", DEFAULT },
 146 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{manageable}", DEFAULT },
 147 #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product rw}", DEFAULT },
 148 
 149 #ifdef PRODUCT
 150   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 151   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 152   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 153 #else
 154   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "", DEFAULT },
 155   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{pd}", DEFAULT },
 156   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{notproduct}", DEFAULT },
 157 #endif
 158 
 159 #ifdef _LP64
 160   #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{lp64_product}", DEFAULT },
 161 #else
 162   #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 163 #endif // _LP64
 164 
 165 #define C1_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 product}", DEFAULT },
 166 #define C1_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 pd product}", DEFAULT },
 167 #ifdef PRODUCT
 168   #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 169   #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 170   #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 171 #else
 172   #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1}", DEFAULT },
 173   #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{C1 pd}", DEFAULT },
 174   #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1 notproduct}", DEFAULT },
 175 #endif
 176 
 177 
 178 #define C2_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 product}", DEFAULT },
 179 #define C2_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 pd product}", DEFAULT },
 180 #define C2_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 diagnostic}", DEFAULT },
 181 #define C2_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 experimental}", DEFAULT },
 182 #ifdef PRODUCT
 183   #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 184   #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 185   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 186 #else
 187   #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2}", DEFAULT },
 188   #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{C2 pd}", DEFAULT },
 189   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2 notproduct}", DEFAULT },
 190 #endif
 191 
 192 #define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark product}", DEFAULT },
 193 #define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark pd product}", DEFAULT },
 194 #define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark diagnostic}", DEFAULT },
 195 #ifdef PRODUCT
 196   #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 197   #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 198   #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 199 #else
 200   #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark}", DEFAULT },
 201   #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{Shark pd}", DEFAULT },
 202   #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark notproduct}", DEFAULT },
 203 #endif
 204 
 205 static Flag flagTable[] = {
 206  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
 207  RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT)
 208 #ifndef SERIALGC
 209  G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT)
 210 #endif // SERIALGC
 211 #ifdef COMPILER1
 212  C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT)
 213 #endif
 214 #ifdef COMPILER2
 215  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_EXPERIMENTAL_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
 216 #endif
 217 #ifdef SHARK
 218  SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
 219 #endif
 220  {0, NULL, NULL}
 221 };
 222 


 476   // Print
 477   for (int i = 0; i < length; i++) {
 478     if (array[i]->origin /* naked field! */) {
 479       array[i]->print_as_flag(tty);
 480       tty->print(" ");
 481     }
 482   }
 483   tty->cr();
 484   FREE_C_HEAP_ARRAY(Flag*, array);
 485 }
 486 
 487 #ifndef PRODUCT
 488 
 489 
 490 void CommandLineFlags::verify() {
 491   assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict");
 492 }
 493 
 494 #endif // PRODUCT
 495 
 496 void CommandLineFlags::printFlags(bool withComments) {
 497   // Print the flags sorted by name
 498   // note: this method is called before the thread structure is in place
 499   //       which means resource allocation cannot be used.
 500 
 501   // Compute size
 502   int length= 0;
 503   while (flagTable[length].name != NULL) length++;
 504 
 505   // Sort
 506   Flag** array = NEW_C_HEAP_ARRAY(Flag*, length);
 507   for (int index = 0; index < length; index++) {
 508     array[index] = &flagTable[index];
 509   }
 510   qsort(array, length, sizeof(Flag*), compare_flags);
 511 
 512   // Print
 513   tty->print_cr("[Global flags]");
 514   for (int i = 0; i < length; i++) {
 515     if (array[i]->is_unlocked()) {
 516       array[i]->print_on(tty, withComments);
 517     }
 518   }
 519   FREE_C_HEAP_ARRAY(Flag*, array);
 520 }