< prev index next >

src/hotspot/share/runtime/abstract_vm_version.hpp

Print this page

 25 #ifndef SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP
 26 #define SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP
 27 
 28 #include "memory/allStatic.hpp"  // For declaration of class AllStatic
 29 #include "utilities/globalDefinitions.hpp"
 30 
 31 typedef enum {
 32   NoDetectedVirtualization,
 33   XenHVM,
 34   XenPVHVM, // mix-mode on Linux aarch64
 35   KVM,
 36   VMWare,
 37   HyperV,
 38   HyperVRole,
 39   PowerVM, // on AIX or Linux ppc64(le)
 40   PowerFullPartitionMode, // on Linux ppc64(le)
 41   PowerKVM
 42 } VirtualizationType;
 43 
 44 class outputStream;

 45 enum class vmIntrinsicID;
 46 
 47 // Abstract_VM_Version provides information about the VM.
 48 
 49 class Abstract_VM_Version: AllStatic {
 50   friend class VMStructs;
 51   friend class JVMCIVMStructs;
 52 
 53  protected:
 54   static const char*  _s_vm_release;
 55   static const char*  _s_internal_vm_info_string;
 56 
 57   // CPU feature flags, can be affected by VM settings.
 58   static uint64_t _features;
 59 
 60   static const char* _features_string;
 61 
 62   static const char* _cpu_info_string;
 63 
 64   // Original CPU feature flags, not affected by VM settings.

115   static const char* vm_platform_string();
116   static const char* vm_variant();
117 
118   static int vm_major_version()               { return _vm_major_version; }
119   static int vm_minor_version()               { return _vm_minor_version; }
120   static int vm_security_version()            { return _vm_security_version; }
121   static int vm_patch_version()               { return _vm_patch_version; }
122   static int vm_build_number()                { return _vm_build_number; }
123 
124   // Gets the jvm_version_info.jvm_version
125   static unsigned int jvm_version();
126 
127   // Internal version providing additional build information
128   static const char* internal_vm_info_string();
129   static const char* jdk_debug_level();
130   static const char* printable_jdk_debug_level();
131 
132   static const char* features_string() { return _features_string; }
133 
134   static const char* cpu_info_string() { return _cpu_info_string; }
135   static const char* extract_features_string(const char* cpu_info_string,
136                                              size_t cpu_info_string_len,
137                                              size_t features_offset);
138 
139   static VirtualizationType get_detected_virtualization() {
140     return _detected_virtualization;
141   }
142 
143   // platforms that need to specialize this
144   // define VM_Version::print_platform_virtualization_info()
145   static void print_platform_virtualization_info(outputStream*) { }
146 
147   // does HW support an 8-byte compare-exchange operation?
148   // Required to be true but still dynamically checked at runtime
149   // for platforms that don't set SUPPORTS_NATIVE_CX8
150   static bool supports_cx8()  {
151 #ifdef SUPPORTS_NATIVE_CX8
152     return true;
153 #else
154     return _supports_cx8;
155 #endif
156   }
157   // does HW support atomic get-and-set or atomic get-and-add?  Used

212 
213  protected:
214   // VM_Version statics
215   static const size_t      CPU_TYPE_DESC_BUF_SIZE = 256;
216   static const size_t      CPU_DETAILED_DESC_BUF_SIZE = 4096;
217 
218   static int   _no_of_threads;
219   static int   _no_of_cores;
220   static int   _no_of_sockets;
221   static bool  _initialized;
222   static char  _cpu_name[CPU_TYPE_DESC_BUF_SIZE];
223   static char  _cpu_desc[CPU_DETAILED_DESC_BUF_SIZE];
224 
225  public:
226   static int number_of_threads(void);
227   static int number_of_cores(void);
228   static int number_of_sockets(void);
229 
230   static const char* cpu_name(void);
231   static const char* cpu_description(void);













232 };
233 
234 #endif // SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP

 25 #ifndef SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP
 26 #define SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP
 27 
 28 #include "memory/allStatic.hpp"  // For declaration of class AllStatic
 29 #include "utilities/globalDefinitions.hpp"
 30 
 31 typedef enum {
 32   NoDetectedVirtualization,
 33   XenHVM,
 34   XenPVHVM, // mix-mode on Linux aarch64
 35   KVM,
 36   VMWare,
 37   HyperV,
 38   HyperVRole,
 39   PowerVM, // on AIX or Linux ppc64(le)
 40   PowerFullPartitionMode, // on Linux ppc64(le)
 41   PowerKVM
 42 } VirtualizationType;
 43 
 44 class outputStream;
 45 class stringStream;
 46 enum class vmIntrinsicID;
 47 
 48 // Abstract_VM_Version provides information about the VM.
 49 
 50 class Abstract_VM_Version: AllStatic {
 51   friend class VMStructs;
 52   friend class JVMCIVMStructs;
 53 
 54  protected:
 55   static const char*  _s_vm_release;
 56   static const char*  _s_internal_vm_info_string;
 57 
 58   // CPU feature flags, can be affected by VM settings.
 59   static uint64_t _features;
 60 
 61   static const char* _features_string;
 62 
 63   static const char* _cpu_info_string;
 64 
 65   // Original CPU feature flags, not affected by VM settings.

116   static const char* vm_platform_string();
117   static const char* vm_variant();
118 
119   static int vm_major_version()               { return _vm_major_version; }
120   static int vm_minor_version()               { return _vm_minor_version; }
121   static int vm_security_version()            { return _vm_security_version; }
122   static int vm_patch_version()               { return _vm_patch_version; }
123   static int vm_build_number()                { return _vm_build_number; }
124 
125   // Gets the jvm_version_info.jvm_version
126   static unsigned int jvm_version();
127 
128   // Internal version providing additional build information
129   static const char* internal_vm_info_string();
130   static const char* jdk_debug_level();
131   static const char* printable_jdk_debug_level();
132 
133   static const char* features_string() { return _features_string; }
134 
135   static const char* cpu_info_string() { return _cpu_info_string; }



136 
137   static VirtualizationType get_detected_virtualization() {
138     return _detected_virtualization;
139   }
140 
141   // platforms that need to specialize this
142   // define VM_Version::print_platform_virtualization_info()
143   static void print_platform_virtualization_info(outputStream*) { }
144 
145   // does HW support an 8-byte compare-exchange operation?
146   // Required to be true but still dynamically checked at runtime
147   // for platforms that don't set SUPPORTS_NATIVE_CX8
148   static bool supports_cx8()  {
149 #ifdef SUPPORTS_NATIVE_CX8
150     return true;
151 #else
152     return _supports_cx8;
153 #endif
154   }
155   // does HW support atomic get-and-set or atomic get-and-add?  Used

210 
211  protected:
212   // VM_Version statics
213   static const size_t      CPU_TYPE_DESC_BUF_SIZE = 256;
214   static const size_t      CPU_DETAILED_DESC_BUF_SIZE = 4096;
215 
216   static int   _no_of_threads;
217   static int   _no_of_cores;
218   static int   _no_of_sockets;
219   static bool  _initialized;
220   static char  _cpu_name[CPU_TYPE_DESC_BUF_SIZE];
221   static char  _cpu_desc[CPU_DETAILED_DESC_BUF_SIZE];
222 
223  public:
224   static int number_of_threads(void);
225   static int number_of_cores(void);
226   static int number_of_sockets(void);
227 
228   static const char* cpu_name(void);
229   static const char* cpu_description(void);
230 
231   static void get_cpu_features_name(void* features_buffer, stringStream& ss) { return; }
232   static void get_missing_features_name(void* features_buffer, stringStream& ss) { return; }
233 
234   // Returns number of bytes required to store cpu features representation
235   static int cpu_features_size() { return 0; }
236 
237   // Stores arch dependent cpu features representation in the provided buffer.
238   // Size of the buffer must be same as returned by cpu_features_size()
239   static void store_cpu_features(void* buf) { return; }
240 
241   // features_to_test is an opaque object that stores arch specific representation of cpu features
242   static bool supports_features(void* features_to_test) { return false; };
243 };
244 
245 #endif // SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP
< prev index next >