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