hotspot/src/share/vm/runtime/vm_version.cpp
changeset 33979 06bd9fb1f813
parent 33977 a27f0d8a7861
child 35075 ca79cbf3f106
equal deleted inserted replaced
33575:c8f114cd0ebc 33979:06bd9fb1f813
    38 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
    38 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
    39 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
    39 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
    40 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
    40 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
    41 int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
    41 int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
    42 
    42 
    43 #ifndef HOTSPOT_RELEASE_VERSION
    43 #ifndef HOTSPOT_VERSION_STRING
    44   #error HOTSPOT_RELEASE_VERSION must be defined
    44   #error HOTSPOT_VERSION_STRING must be defined
    45 #endif
    45 #endif
    46 
    46 
    47 #ifndef JDK_MAJOR_VERSION
    47 #ifndef VERSION_MAJOR
    48   #error JDK_MAJOR_VERSION must be defined
    48   #error VERSION_MAJOR must be defined
    49 #endif
    49 #endif
    50 #ifndef JDK_MINOR_VERSION
    50 #ifndef VERSION_MINOR
    51   #error JDK_MINOR_VERSION must be defined
    51   #error VERSION_MINOR must be defined
    52 #endif
    52 #endif
    53 #ifndef JDK_MICRO_VERSION
    53 #ifndef VERSION_SECURITY
    54   #error JDK_MICRO_VERSION must be defined
    54   #error VERSION_SECURITY must be defined
    55 #endif
    55 #endif
    56 #ifndef JDK_BUILD_NUMBER
    56 #ifndef VERSION_PATCH
    57   #error JDK_BUILD_NUMBER must be defined
    57   #error VERSION_PATCH must be defined
    58 #endif
    58 #endif
    59 
    59 #ifndef VERSION_BUILD
    60 #ifndef JRE_RELEASE_VERSION
    60   #error VERSION_BUILD must be defined
    61   #error JRE_RELEASE_VERSION must be defined
    61 #endif
       
    62 
       
    63 #ifndef VERSION_STRING
       
    64   #error VERSION_STRING must be defined
       
    65 #endif
       
    66 
       
    67 #ifndef DEBUG_LEVEL
       
    68   #error DEBUG_LEVEL must be defined
    62 #endif
    69 #endif
    63 
    70 
    64 // NOTE: Builds within Visual Studio do not define the build target in
    71 // NOTE: Builds within Visual Studio do not define the build target in
    65 //       HOTSPOT_RELEASE_VERSION, so it must be done here
    72 //       HOTSPOT_VERSION_STRING, so it must be done here
    66 #if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
    73 #if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
    67   #ifndef HOTSPOT_BUILD_TARGET
    74   #ifndef HOTSPOT_BUILD_TARGET
    68     #error HOTSPOT_BUILD_TARGET must be defined
    75     #error HOTSPOT_BUILD_TARGET must be defined
    69   #endif
    76   #endif
    70   #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
    77   #define VM_RELEASE HOTSPOT_VERSION_STRING "-" HOTSPOT_BUILD_TARGET
    71 #else
    78 #else
    72   #define VM_RELEASE HOTSPOT_RELEASE_VERSION
    79   #define VM_RELEASE HOTSPOT_VERSION_STRING
    73 #endif
    80 #endif
    74 
    81 
    75 // HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
    82 // HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
    76 // <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
    83 // in a standalone build).
    77 int Abstract_VM_Version::_vm_major_version = 0;
    84 int Abstract_VM_Version::_vm_major_version = VERSION_MAJOR;
    78 int Abstract_VM_Version::_vm_minor_version = 0;
    85 int Abstract_VM_Version::_vm_minor_version = VERSION_MINOR;
    79 int Abstract_VM_Version::_vm_micro_version = 0;
    86 int Abstract_VM_Version::_vm_security_version = VERSION_SECURITY;
    80 int Abstract_VM_Version::_vm_build_number = 0;
    87 int Abstract_VM_Version::_vm_patch_version = VERSION_PATCH;
    81 bool Abstract_VM_Version::_initialized = false;
    88 int Abstract_VM_Version::_vm_build_number = VERSION_BUILD;
    82 unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;
    89 unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;
    83 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
    90 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
    84 
       
    85 #ifdef ASSERT
       
    86 static void assert_digits(const char * s, const char * message) {
       
    87   for (int i = 0; s[i] != '\0'; i++) {
       
    88     assert(isdigit(s[i]), "%s", message);
       
    89   }
       
    90 }
       
    91 #endif
       
    92 
       
    93 static void set_version_field(int * version_field, const char * version_str,
       
    94                               const char * const assert_msg) {
       
    95   if (version_str != NULL && *version_str != '\0') {
       
    96     DEBUG_ONLY(assert_digits(version_str, assert_msg));
       
    97     *version_field = atoi(version_str);
       
    98   }
       
    99 }
       
   100 
       
   101 void Abstract_VM_Version::initialize() {
       
   102   if (_initialized) {
       
   103     return;
       
   104   }
       
   105 
       
   106   set_version_field(&_vm_major_version, JDK_MAJOR_VERSION, "bad major version");
       
   107   set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
       
   108   set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
       
   109   int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
       
   110   set_version_field(&_vm_build_number, &JDK_BUILD_NUMBER[offset],
       
   111                     "bad build number");
       
   112 
       
   113   _initialized = true;
       
   114 }
       
   115 
    91 
   116 #if defined(_LP64)
    92 #if defined(_LP64)
   117   #define VMLP "64-Bit "
    93   #define VMLP "64-Bit "
   118 #else
    94 #else
   119   #define VMLP ""
    95   #define VMLP ""
   152 #else
   128 #else
   153   return "Oracle Corporation";
   129   return "Oracle Corporation";
   154 #endif
   130 #endif
   155 }
   131 }
   156 
   132 
       
   133 
   157 const char* Abstract_VM_Version::vm_info_string() {
   134 const char* Abstract_VM_Version::vm_info_string() {
   158   if (CodeCacheExtensions::use_pregenerated_interpreter()) {
   135   if (CodeCacheExtensions::use_pregenerated_interpreter()) {
   159     return "interpreted mode, pregenerated";
   136     return "interpreted mode, pregenerated";
   160   }
   137   }
   161   switch (Arguments::mode()) {
   138   switch (Arguments::mode()) {
   179 
   156 
   180 // NOTE: do *not* use stringStream. this function is called by
   157 // NOTE: do *not* use stringStream. this function is called by
   181 //       fatal error handlers. if the crash is in native thread,
   158 //       fatal error handlers. if the crash is in native thread,
   182 //       stringStream cannot get resource allocated and will SEGV.
   159 //       stringStream cannot get resource allocated and will SEGV.
   183 const char* Abstract_VM_Version::jre_release_version() {
   160 const char* Abstract_VM_Version::jre_release_version() {
   184   return JRE_RELEASE_VERSION;
   161   return VERSION_STRING;
   185 }
   162 }
   186 
   163 
   187 #define OS       LINUX_ONLY("linux")             \
   164 #define OS       LINUX_ONLY("linux")             \
   188                  WINDOWS_ONLY("windows")         \
   165                  WINDOWS_ONLY("windows")         \
   189                  SOLARIS_ONLY("solaris")         \
   166                  SOLARIS_ONLY("solaris")         \
   260   #else
   237   #else
   261     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   238     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   262   #endif
   239   #endif
   263 
   240 
   264   return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
   241   return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
   265          " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
   242          " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__
   266          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
   243          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
   267 }
   244 }
   268 
   245 
   269 const char *Abstract_VM_Version::vm_build_user() {
   246 const char *Abstract_VM_Version::vm_build_user() {
   270   return HOTSPOT_BUILD_USER;
   247   return HOTSPOT_BUILD_USER;
       
   248 }
       
   249 
       
   250 const char *Abstract_VM_Version::jdk_debug_level() {
       
   251   return DEBUG_LEVEL;
   271 }
   252 }
   272 
   253 
   273 unsigned int Abstract_VM_Version::jvm_version() {
   254 unsigned int Abstract_VM_Version::jvm_version() {
   274   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
   255   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
   275          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   256          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   276          ((Abstract_VM_Version::vm_micro_version() & 0xFF) << 8) |
   257          ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
   277          (Abstract_VM_Version::vm_build_number() & 0xFF);
   258          (Abstract_VM_Version::vm_build_number() & 0xFF);
   278 }
   259 }
   279 
   260 
   280 
   261 
   281 void VM_Version_init() {
   262 void VM_Version_init() {