author | dholmes |
Sat, 23 Jun 2018 01:32:41 -0400 | |
changeset 50735 | 2f2af62dfac7 |
parent 49364 | 601146c66cad |
child 52300 | 9e29d8388514 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49364
601146c66cad
8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
950
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
950
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
950
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_RUNTIME_JAVA_HPP |
26 |
#define SHARE_VM_RUNTIME_JAVA_HPP |
|
27 |
||
28 |
#include "runtime/os.hpp" |
|
29 |
||
1 | 30 |
// Execute code before all handles are released and thread is killed; prologue to vm_exit |
31 |
extern void before_exit(JavaThread * thread); |
|
32 |
||
33 |
// Forced VM exit (i.e, internal error or JVM_Exit) |
|
34 |
extern void vm_exit(int code); |
|
35 |
||
36 |
// Wrapper for ::exit() |
|
37 |
extern void vm_direct_exit(int code); |
|
38 |
||
39 |
// Shutdown the VM but do not exit the process |
|
40 |
extern void vm_shutdown(); |
|
41 |
// Shutdown the VM and abort the process |
|
773
01daf7c809b1
6694099: Hotspot vm_exit_out_of_memory should dump core
poonam
parents:
602
diff
changeset
|
42 |
extern void vm_abort(bool dump_core=true); |
1 | 43 |
|
44 |
// Trigger any necessary notification of the VM being shutdown |
|
45 |
extern void notify_vm_shutdown(); |
|
46 |
||
47 |
// VM exit if error occurs during initialization of VM |
|
44326
6c59cca7ff07
8174823: Module system implementation refresh (3/2017)
alanb
parents:
33975
diff
changeset
|
48 |
extern void vm_exit_during_initialization(); |
1 | 49 |
extern void vm_exit_during_initialization(Handle exception); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7900
diff
changeset
|
50 |
extern void vm_exit_during_initialization(Symbol* exception_name, const char* message); |
1 | 51 |
extern void vm_exit_during_initialization(const char* error, const char* message = NULL); |
52 |
extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL); |
|
53 |
||
950 | 54 |
/** |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
55 |
* With the integration of the changes to handle the version string |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
56 |
* as defined by JEP-223, most of the code related to handle the version |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
57 |
* string prior to JDK 1.6 was removed (partial initialization) |
950 | 58 |
*/ |
49364
601146c66cad
8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents:
47216
diff
changeset
|
59 |
class JDK_Version { |
1 | 60 |
friend class VMStructs; |
950 | 61 |
friend class Universe; |
62 |
friend void JDK_Version_init(); |
|
1 | 63 |
private: |
950 | 64 |
|
65 |
static JDK_Version _current; |
|
13106 | 66 |
static const char* _runtime_name; |
14289
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
67 |
static const char* _runtime_version; |
950 | 68 |
|
69 |
uint8_t _major; |
|
70 |
uint8_t _minor; |
|
33957
39113ae98993
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
30558
diff
changeset
|
71 |
uint8_t _security; |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
72 |
uint8_t _patch; |
950 | 73 |
uint8_t _build; |
74 |
||
75 |
bool _thread_park_blocker; |
|
7900
4c7fc6332f7e
6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents:
7397
diff
changeset
|
76 |
bool _post_vm_init_hook_enabled; |
950 | 77 |
|
78 |
bool is_valid() const { |
|
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
79 |
return (_major != 0); |
950 | 80 |
} |
81 |
||
82 |
// initializes or partially initializes the _current static field |
|
83 |
static void initialize(); |
|
84 |
||
1 | 85 |
public: |
950 | 86 |
|
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
87 |
JDK_Version() : _major(0), _minor(0), _security(0), _patch(0), _build(0), |
30558
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
27157
diff
changeset
|
88 |
_thread_park_blocker(false), _post_vm_init_hook_enabled(false) |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
27157
diff
changeset
|
89 |
{} |
1 | 90 |
|
33957
39113ae98993
8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents:
30558
diff
changeset
|
91 |
JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0, |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
92 |
uint8_t patch = 0, uint8_t build = 0, |
30558
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
27157
diff
changeset
|
93 |
bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) : |
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
94 |
_major(major), _minor(minor), _security(security), _patch(patch), _build(build), |
7900
4c7fc6332f7e
6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents:
7397
diff
changeset
|
95 |
_thread_park_blocker(thread_park_blocker), |
30558
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
27157
diff
changeset
|
96 |
_post_vm_init_hook_enabled(post_vm_init_hook_enabled) |
baec90a2699f
8031401: Remove unused code in the reference processor
kbarrett
parents:
27157
diff
changeset
|
97 |
{} |
602
92e03692ddd6
6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents:
1
diff
changeset
|
98 |
|
950 | 99 |
// Returns the current running JDK version |
100 |
static JDK_Version current() { return _current; } |
|
101 |
||
102 |
// Factory methods for convenience |
|
103 |
static JDK_Version jdk(uint8_t m) { |
|
104 |
return JDK_Version(m); |
|
105 |
} |
|
106 |
||
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
107 |
static JDK_Version undefined() { |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
108 |
return JDK_Version(0); |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
109 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
110 |
|
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
111 |
bool is_undefined() const { |
33975 | 112 |
return _major == 0; |
32823
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
113 |
} |
ca8fef4cd57b
8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents:
30558
diff
changeset
|
114 |
|
950 | 115 |
uint8_t major_version() const { return _major; } |
116 |
uint8_t minor_version() const { return _minor; } |
|
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
117 |
uint8_t security_version() const { return _security; } |
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
118 |
uint8_t patch_version() const { return _patch; } |
950 | 119 |
uint8_t build_number() const { return _build; } |
120 |
||
121 |
bool supports_thread_park_blocker() const { |
|
122 |
return _thread_park_blocker; |
|
123 |
} |
|
7900
4c7fc6332f7e
6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents:
7397
diff
changeset
|
124 |
bool post_vm_init_hook_enabled() const { |
4c7fc6332f7e
6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents:
7397
diff
changeset
|
125 |
return _post_vm_init_hook_enabled; |
4c7fc6332f7e
6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents:
7397
diff
changeset
|
126 |
} |
950 | 127 |
|
33959
36f534ca18c0
8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents:
33957
diff
changeset
|
128 |
// Performs a full ordering comparison using all fields (patch, build, etc.) |
950 | 129 |
int compare(const JDK_Version& other) const; |
130 |
||
131 |
/** |
|
132 |
* Performs comparison using only the major version, returning negative |
|
133 |
* if the major version of 'this' is less than the parameter, 0 if it is |
|
134 |
* equal, and a positive value if it is greater. |
|
135 |
*/ |
|
136 |
int compare_major(int version) const { |
|
137 |
return major_version() - version; |
|
602
92e03692ddd6
6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents:
1
diff
changeset
|
138 |
} |
1 | 139 |
|
950 | 140 |
void to_string(char* buffer, size_t buflen) const; |
141 |
||
13106 | 142 |
static const char* runtime_name() { |
143 |
return _runtime_name; |
|
144 |
} |
|
145 |
static void set_runtime_name(const char* name) { |
|
146 |
_runtime_name = name; |
|
147 |
} |
|
148 |
||
14289
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
149 |
static const char* runtime_version() { |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
150 |
return _runtime_version; |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
151 |
} |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
152 |
static void set_runtime_version(const char* version) { |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
153 |
_runtime_version = version; |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
154 |
} |
aec758622b4b
8002078: hs_err_pid file should report full JDK version string
sla
parents:
13963
diff
changeset
|
155 |
|
1 | 156 |
}; |
7397 | 157 |
|
158 |
#endif // SHARE_VM_RUNTIME_JAVA_HPP |