hotspot/src/share/vm/runtime/vm_version.cpp
changeset 33957 39113ae98993
parent 30585 12f312d694cd
child 33959 36f534ca18c0
equal deleted inserted replaced
30850:56166ce66037 33957:39113ae98993
    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_BUILD
    56   #error JDK_BUILD_NUMBER must be defined
    56   #error VERSION_BUILD must be defined
    57 #endif
    57 #endif
    58 
    58 
    59 #ifndef JRE_RELEASE_VERSION
    59 #ifndef VERSION_STRING
    60   #error JRE_RELEASE_VERSION must be defined
    60   #error VERSION_STRING must be defined
    61 #endif
    61 #endif
    62 
    62 
    63 // NOTE: Builds within Visual Studio do not define the build target in
    63 // NOTE: Builds within Visual Studio do not define the build target in
    64 //       HOTSPOT_RELEASE_VERSION, so it must be done here
    64 //       HOTSPOT_VERSION_STRING, so it must be done here
    65 #if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
    65 #if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
    66   #ifndef HOTSPOT_BUILD_TARGET
    66   #ifndef HOTSPOT_BUILD_TARGET
    67     #error HOTSPOT_BUILD_TARGET must be defined
    67     #error HOTSPOT_BUILD_TARGET must be defined
    68   #endif
    68   #endif
    69   #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
    69   #define VM_RELEASE HOTSPOT_VERSION_STRING "-" HOTSPOT_BUILD_TARGET
    70 #else
    70 #else
    71   #define VM_RELEASE HOTSPOT_RELEASE_VERSION
    71   #define VM_RELEASE HOTSPOT_VERSION_STRING
    72 #endif
    72 #endif
    73 
    73 
    74 // HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
    74 // HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
    75 // <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
    75 // in a standalone build).
    76 int Abstract_VM_Version::_vm_major_version = 0;
    76 int Abstract_VM_Version::_vm_major_version = VERSION_MAJOR;
    77 int Abstract_VM_Version::_vm_minor_version = 0;
    77 int Abstract_VM_Version::_vm_minor_version = VERSION_MINOR;
    78 int Abstract_VM_Version::_vm_micro_version = 0;
    78 int Abstract_VM_Version::_vm_security_version = VERSION_SECURITY;
    79 int Abstract_VM_Version::_vm_build_number = 0;
    79 int Abstract_VM_Version::_vm_build_number = VERSION_BUILD;
    80 bool Abstract_VM_Version::_initialized = false;
    80 bool Abstract_VM_Version::_initialized = false;
    81 unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;
    81 unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;
    82 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
    82 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
    83 
    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() {
    84 void Abstract_VM_Version::initialize() {
       
    85   // FIXME: Initialization can probably be removed now.
   101   if (_initialized) {
    86   if (_initialized) {
   102     return;
    87     return;
   103   }
    88   }
   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 
    89 
   112   _initialized = true;
    90   _initialized = true;
   113 }
    91 }
   114 
    92 
   115 #if defined(_LP64)
    93 #if defined(_LP64)
   176 
   154 
   177 // NOTE: do *not* use stringStream. this function is called by
   155 // NOTE: do *not* use stringStream. this function is called by
   178 //       fatal error handlers. if the crash is in native thread,
   156 //       fatal error handlers. if the crash is in native thread,
   179 //       stringStream cannot get resource allocated and will SEGV.
   157 //       stringStream cannot get resource allocated and will SEGV.
   180 const char* Abstract_VM_Version::jre_release_version() {
   158 const char* Abstract_VM_Version::jre_release_version() {
   181   return JRE_RELEASE_VERSION;
   159   return VERSION_STRING;
   182 }
   160 }
   183 
   161 
   184 #define OS       LINUX_ONLY("linux")             \
   162 #define OS       LINUX_ONLY("linux")             \
   185                  WINDOWS_ONLY("windows")         \
   163                  WINDOWS_ONLY("windows")         \
   186                  SOLARIS_ONLY("solaris")         \
   164                  SOLARIS_ONLY("solaris")         \
   257   #else
   235   #else
   258     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   236     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   259   #endif
   237   #endif
   260 
   238 
   261   return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
   239   return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
   262          " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
   240          " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__
   263          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
   241          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
   264 }
   242 }
   265 
   243 
   266 const char *Abstract_VM_Version::vm_build_user() {
   244 const char *Abstract_VM_Version::vm_build_user() {
   267   return HOTSPOT_BUILD_USER;
   245   return HOTSPOT_BUILD_USER;
   268 }
   246 }
   269 
   247 
   270 unsigned int Abstract_VM_Version::jvm_version() {
   248 unsigned int Abstract_VM_Version::jvm_version() {
   271   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
   249   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
   272          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   250          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   273          ((Abstract_VM_Version::vm_micro_version() & 0xFF) << 8) |
   251          ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
   274          (Abstract_VM_Version::vm_build_number() & 0xFF);
   252          (Abstract_VM_Version::vm_build_number() & 0xFF);
   275 }
   253 }
   276 
   254 
   277 
   255 
   278 void VM_Version_init() {
   256 void VM_Version_init() {