src/share/vm/runtime/globals.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6619271 Sdiff src/share/vm/runtime

src/share/vm/runtime/globals.cpp

Print this page




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

  71     const char* eol;
  72     while ((eol = strchr(cp, '\n')) != NULL) {
  73       char format_buffer[FORMAT_BUFFER_LEN];
  74       size_t llen = pointer_delta(eol, cp, sizeof(char));
  75       jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
  76                    "%%." SIZE_FORMAT "s", llen);
  77       st->print(format_buffer, cp);
  78       st->cr();
  79       cp = eol+1;
  80       st->print("%5s %-35s += ", "", name);
  81     }
  82     st->print("%-16s", cp);
  83   }

  84   st->print(" %s", kind);
  85   st->cr();
  86 }
  87 
  88 void Flag::print_as_flag(outputStream* st) {
  89   if (is_bool()) {
  90     st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
  91   } else if (is_intx()) {
  92     st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
  93   } else if (is_uintx()) {
  94     st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
  95   } else if (is_ccstr()) {
  96     st->print("-XX:%s=", name);


  97     // Need to turn embedded '\n's back into separate arguments
  98     // Not so efficient to print one character at a time,
  99     // but the choice is to do the transformation to a buffer
 100     // and print that.  And this need not be efficient.
 101     for (const char* cp = get_ccstr(); *cp != '\0'; cp += 1) {
 102       switch (*cp) {
 103       default:
 104         st->print("%c", *cp);
 105         break;
 106       case '\n':
 107         st->print(" -XX:%s=", name);
 108         break;
 109       }
 110     }

 111   } else {
 112     ShouldNotReachHere();
 113   }
 114 }
 115 
 116 // 4991491 do not "optimize out" the was_set false values: omitting them
 117 // tickles a Microsoft compiler bug causing flagTable to be malformed
 118 
 119 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product}", DEFAULT },
 120 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{pd product}", DEFAULT },
 121 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{diagnostic}", DEFAULT },
 122 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{manageable}", DEFAULT },
 123 #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product rw}", DEFAULT },
 124 
 125 #ifdef PRODUCT
 126   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 127   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 128   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 129 #else
 130   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "", DEFAULT },




  51   return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0);
  52 }
  53 
  54 // All flags except "manageable" are assumed internal flags.
  55 // Long term, we need to define a mechanism to specify which flags
  56 // are external/stable and change this function accordingly.
  57 bool Flag::is_external() const {
  58   return (strcmp(kind, "{manageable}") == 0);
  59 }
  60 
  61 // Length of format string (e.g. "%.1234s") for printing ccstr below
  62 #define FORMAT_BUFFER_LEN 16
  63 
  64 void Flag::print_on(outputStream* st) {
  65   st->print("%5s %-35s %c= ", type, name, (origin != DEFAULT ? ':' : ' '));
  66   if (is_bool())  st->print("%-16s", get_bool() ? "true" : "false");
  67   if (is_intx())  st->print("%-16ld", get_intx());
  68   if (is_uintx()) st->print("%-16lu", get_uintx());
  69   if (is_ccstr()) {
  70     const char* cp = get_ccstr();
  71     if (cp != NULL) {
  72       const char* eol;
  73       while ((eol = strchr(cp, '\n')) != NULL) {
  74         char format_buffer[FORMAT_BUFFER_LEN];
  75         size_t llen = pointer_delta(eol, cp, sizeof(char));
  76         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
  77                      "%%." SIZE_FORMAT "s", llen);
  78         st->print(format_buffer, cp);
  79         st->cr();
  80         cp = eol+1;
  81         st->print("%5s %-35s += ", "", name);
  82       }
  83       st->print("%-16s", cp);
  84     }
  85   }
  86   st->print(" %s", kind);
  87   st->cr();
  88 }
  89 
  90 void Flag::print_as_flag(outputStream* st) {
  91   if (is_bool()) {
  92     st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
  93   } else if (is_intx()) {
  94     st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
  95   } else if (is_uintx()) {
  96     st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
  97   } else if (is_ccstr()) {
  98     st->print("-XX:%s=", name);
  99     const char* cp = get_ccstr();
 100     if (cp != NULL) {
 101       // Need to turn embedded '\n's back into separate arguments
 102       // Not so efficient to print one character at a time,
 103       // but the choice is to do the transformation to a buffer
 104       // and print that.  And this need not be efficient.
 105       for (; *cp != '\0'; cp += 1) {
 106         switch (*cp) {
 107           default:
 108             st->print("%c", *cp);
 109             break;
 110           case '\n':
 111             st->print(" -XX:%s=", name);
 112             break;
 113         }
 114       }
 115     }
 116   } else {
 117     ShouldNotReachHere();
 118   }
 119 }
 120 
 121 // 4991491 do not "optimize out" the was_set false values: omitting them
 122 // tickles a Microsoft compiler bug causing flagTable to be malformed
 123 
 124 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product}", DEFAULT },
 125 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{pd product}", DEFAULT },
 126 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{diagnostic}", DEFAULT },
 127 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{manageable}", DEFAULT },
 128 #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product rw}", DEFAULT },
 129 
 130 #ifdef PRODUCT
 131   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 132   #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
 133   #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
 134 #else
 135   #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "", DEFAULT },


src/share/vm/runtime/globals.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File