rev 47445 : 8171853: Remove Shark compiler

   1 /*
   2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "logging/log.hpp"
  27 #include "logging/logStream.hpp"
  28 #include "memory/universe.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/arguments.hpp"
  31 #include "runtime/vm_version.hpp"
  32 
  33 const char* Abstract_VM_Version::_s_vm_release = Abstract_VM_Version::vm_release();
  34 const char* Abstract_VM_Version::_s_internal_vm_info_string = Abstract_VM_Version::internal_vm_info_string();
  35 
  36 uint64_t Abstract_VM_Version::_features = 0;
  37 const char* Abstract_VM_Version::_features_string = "";
  38 
  39 bool Abstract_VM_Version::_supports_cx8 = false;
  40 bool Abstract_VM_Version::_supports_atomic_getset4 = false;
  41 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
  42 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
  43 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
  44 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
  45 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
  46 
  47 #ifndef HOTSPOT_VERSION_STRING
  48   #error HOTSPOT_VERSION_STRING must be defined
  49 #endif
  50 
  51 #ifndef VERSION_MAJOR
  52   #error VERSION_MAJOR must be defined
  53 #endif
  54 #ifndef VERSION_MINOR
  55   #error VERSION_MINOR must be defined
  56 #endif
  57 #ifndef VERSION_SECURITY
  58   #error VERSION_SECURITY must be defined
  59 #endif
  60 #ifndef VERSION_PATCH
  61   #error VERSION_PATCH must be defined
  62 #endif
  63 #ifndef VERSION_BUILD
  64   #error VERSION_BUILD must be defined
  65 #endif
  66 
  67 #ifndef VERSION_STRING
  68   #error VERSION_STRING must be defined
  69 #endif
  70 
  71 #ifndef DEBUG_LEVEL
  72   #error DEBUG_LEVEL must be defined
  73 #endif
  74 
  75 #define VM_RELEASE HOTSPOT_VERSION_STRING
  76 
  77 // HOTSPOT_VERSION_STRING equals the JDK VERSION_STRING (unless overridden
  78 // in a standalone build).
  79 int Abstract_VM_Version::_vm_major_version = VERSION_MAJOR;
  80 int Abstract_VM_Version::_vm_minor_version = VERSION_MINOR;
  81 int Abstract_VM_Version::_vm_security_version = VERSION_SECURITY;
  82 int Abstract_VM_Version::_vm_patch_version = VERSION_PATCH;
  83 int Abstract_VM_Version::_vm_build_number = VERSION_BUILD;
  84 unsigned int Abstract_VM_Version::_parallel_worker_threads = 0;
  85 bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
  86 
  87 #if defined(_LP64)
  88   #define VMLP "64-Bit "
  89 #else
  90   #define VMLP ""
  91 #endif
  92 
  93 #ifndef VMTYPE
  94   #ifdef TIERED
  95     #define VMTYPE "Server"
  96   #else // TIERED
  97   #ifdef ZERO
  98   #ifdef SHARK
  99     #define VMTYPE "Shark"
 100   #else // SHARK
 101     #define VMTYPE "Zero"
 102   #endif // SHARK
 103   #else // ZERO
 104      #define VMTYPE COMPILER1_PRESENT("Client")   \
 105                     COMPILER2_PRESENT("Server")
 106   #endif // ZERO
 107   #endif // TIERED
 108 #endif
 109 
 110 #ifndef HOTSPOT_VM_DISTRO
 111   #error HOTSPOT_VM_DISTRO must be defined
 112 #endif
 113 #define VMNAME HOTSPOT_VM_DISTRO " " VMLP VMTYPE " VM"
 114 
 115 const char* Abstract_VM_Version::vm_name() {
 116   return VMNAME;
 117 }
 118 
 119 
 120 const char* Abstract_VM_Version::vm_vendor() {
 121 #ifdef VENDOR
 122   return XSTR(VENDOR);
 123 #else
 124   return "Oracle Corporation";
 125 #endif
 126 }
 127 
 128 
 129 const char* Abstract_VM_Version::vm_info_string() {
 130   switch (Arguments::mode()) {
 131     case Arguments::_int:
 132       return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
 133     case Arguments::_mixed:
 134       if (UseSharedSpaces) {
 135         if (UseAOT) {
 136           return "mixed mode, aot, sharing";
 137 #ifdef TIERED
 138         } else if(is_client_compilation_mode_vm()) {
 139           return "mixed mode, emulated-client, sharing";
 140 #endif
 141         } else {
 142           return "mixed mode, sharing";
 143          }
 144       } else {
 145         if (UseAOT) {
 146           return "mixed mode, aot";
 147 #ifdef TIERED
 148         } else if(is_client_compilation_mode_vm()) {
 149           return "mixed mode, emulated-client";
 150 #endif
 151         } else {
 152           return "mixed mode";
 153         }
 154       }
 155     case Arguments::_comp:
 156 #ifdef TIERED
 157       if (is_client_compilation_mode_vm()) {
 158          return UseSharedSpaces ? "compiled mode, emulated-client, sharing" : "compiled mode, emulated-client";
 159       }
 160 #endif
 161       return UseSharedSpaces ? "compiled mode, sharing"    : "compiled mode";
 162   };
 163   ShouldNotReachHere();
 164   return "";
 165 }
 166 
 167 // NOTE: do *not* use stringStream. this function is called by
 168 //       fatal error handler. if the crash is in native thread,
 169 //       stringStream cannot get resource allocated and will SEGV.
 170 const char* Abstract_VM_Version::vm_release() {
 171   return VM_RELEASE;
 172 }
 173 
 174 // NOTE: do *not* use stringStream. this function is called by
 175 //       fatal error handlers. if the crash is in native thread,
 176 //       stringStream cannot get resource allocated and will SEGV.
 177 const char* Abstract_VM_Version::jre_release_version() {
 178   return VERSION_STRING;
 179 }
 180 
 181 #define OS       LINUX_ONLY("linux")             \
 182                  WINDOWS_ONLY("windows")         \
 183                  SOLARIS_ONLY("solaris")         \
 184                  AIX_ONLY("aix")                 \
 185                  BSD_ONLY("bsd")
 186 
 187 #ifndef CPU
 188 #ifdef ZERO
 189 #define CPU      ZERO_LIBARCH
 190 #elif defined(PPC64)
 191 #if defined(VM_LITTLE_ENDIAN)
 192 #define CPU      "ppc64le"
 193 #else
 194 #define CPU      "ppc64"
 195 #endif // PPC64
 196 #else
 197 #define CPU      AARCH64_ONLY("aarch64")         \
 198                  AMD64_ONLY("amd64")             \
 199                  IA32_ONLY("x86")                \
 200                  IA64_ONLY("ia64")               \
 201                  S390_ONLY("s390")               \
 202                  SPARC_ONLY("sparc")
 203 #endif // !ZERO
 204 #endif // !CPU
 205 
 206 const char *Abstract_VM_Version::vm_platform_string() {
 207   return OS "-" CPU;
 208 }
 209 
 210 const char* Abstract_VM_Version::internal_vm_info_string() {
 211   #ifndef HOTSPOT_BUILD_USER
 212     #define HOTSPOT_BUILD_USER unknown
 213   #endif
 214 
 215   #ifndef HOTSPOT_BUILD_COMPILER
 216     #ifdef _MSC_VER
 217       #if _MSC_VER == 1600
 218         #define HOTSPOT_BUILD_COMPILER "MS VC++ 10.0 (VS2010)"
 219       #elif _MSC_VER == 1700
 220         #define HOTSPOT_BUILD_COMPILER "MS VC++ 11.0 (VS2012)"
 221       #elif _MSC_VER == 1800
 222         #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)"
 223       #else
 224         #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
 225       #endif
 226     #elif defined(__SUNPRO_CC)
 227       #if   __SUNPRO_CC == 0x420
 228         #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
 229       #elif __SUNPRO_CC == 0x500
 230         #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
 231       #elif __SUNPRO_CC == 0x520
 232         #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
 233       #elif __SUNPRO_CC == 0x580
 234         #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
 235       #elif __SUNPRO_CC == 0x590
 236         #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
 237       #elif __SUNPRO_CC == 0x5100
 238         #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u1"
 239       #elif __SUNPRO_CC == 0x5120
 240         #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u3"
 241       #elif __SUNPRO_CC == 0x5130
 242         #define HOTSPOT_BUILD_COMPILER "Sun Studio 12u4"
 243       #else
 244         #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
 245       #endif
 246     #elif defined(__GNUC__)
 247         #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
 248     #elif defined(__IBMCPP__)
 249         #define HOTSPOT_BUILD_COMPILER "xlC " XSTR(__IBMCPP__)
 250 
 251     #else
 252       #define HOTSPOT_BUILD_COMPILER "unknown compiler"
 253     #endif
 254   #endif
 255 
 256   #ifndef FLOAT_ARCH
 257     #if defined(__SOFTFP__)
 258       #define FLOAT_ARCH_STR "-sflt"
 259     #else
 260       #define FLOAT_ARCH_STR ""
 261     #endif
 262   #else
 263     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
 264   #endif
 265 
 266   #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
 267          " for " OS "-" CPU FLOAT_ARCH_STR \
 268          " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
 269          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
 270 
 271   return strcmp(DEBUG_LEVEL, "release") == 0
 272       ? VMNAME " (" INTERNAL_VERSION_SUFFIX
 273       : VMNAME " (" DEBUG_LEVEL " " INTERNAL_VERSION_SUFFIX;
 274 }
 275 
 276 const char *Abstract_VM_Version::vm_build_user() {
 277   return HOTSPOT_BUILD_USER;
 278 }
 279 
 280 const char *Abstract_VM_Version::jdk_debug_level() {
 281   return DEBUG_LEVEL;
 282 }
 283 
 284 const char *Abstract_VM_Version::printable_jdk_debug_level() {
 285   // Debug level is not printed for "release" builds
 286   return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
 287 }
 288 
 289 unsigned int Abstract_VM_Version::jvm_version() {
 290   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
 291          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
 292          ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
 293          (Abstract_VM_Version::vm_build_number() & 0xFF);
 294 }
 295 
 296 
 297 void VM_Version_init() {
 298   VM_Version::initialize();
 299 
 300   if (log_is_enabled(Info, os, cpu)) {
 301     char buf[1024];
 302     ResourceMark rm;
 303     LogStream ls(Log(os, cpu)::info());
 304     os::print_cpu_info(&ls, buf, sizeof(buf));
 305   }
 306 }
 307 
 308 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
 309                                                       unsigned int num,
 310                                                       unsigned int den,
 311                                                       unsigned int switch_pt) {
 312   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
 313     assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
 314     unsigned int threads;
 315     // For very large machines, there are diminishing returns
 316     // for large numbers of worker threads.  Instead of
 317     // hogging the whole system, use a fraction of the workers for every
 318     // processor after the first 8.  For example, on a 72 cpu machine
 319     // and a chosen fraction of 5/8
 320     // use 8 + (72 - 8) * (5/8) == 48 worker threads.
 321     unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
 322     threads = (ncpus <= switch_pt) ?
 323              ncpus :
 324              (switch_pt + ((ncpus - switch_pt) * num) / den);
 325 #ifndef _LP64
 326     // On 32-bit binaries the virtual address space available to the JVM
 327     // is usually limited to 2-3 GB (depends on the platform).
 328     // Do not use up address space with too many threads (stacks and per-thread
 329     // data). Note that x86 apps running on Win64 have 2 stacks per thread.
 330     // GC may more generally scale down threads by max heap size (etc), but the
 331     // consequences of over-provisioning threads are higher on 32-bit JVMS,
 332     // so add hard limit here:
 333     threads = MIN2(threads, (2*switch_pt));
 334 #endif
 335     return threads;
 336   } else {
 337     return ParallelGCThreads;
 338   }
 339 }
 340 
 341 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
 342   return nof_parallel_worker_threads(5, 8, 8);
 343 }
 344 
 345 
 346 // Does not set the _initialized flag since it is
 347 // a global flag.
 348 unsigned int Abstract_VM_Version::parallel_worker_threads() {
 349   if (!_parallel_worker_threads_initialized) {
 350     if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
 351       _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
 352     } else {
 353       _parallel_worker_threads = ParallelGCThreads;
 354     }
 355     _parallel_worker_threads_initialized = true;
 356   }
 357   return _parallel_worker_threads;
 358 }
--- EOF ---