Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/runtime/java.hpp
+++ new/src/share/vm/runtime/java.hpp
1 1 /*
2 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_VM_RUNTIME_JAVA_HPP
26 26 #define SHARE_VM_RUNTIME_JAVA_HPP
27 27
28 28 #include "runtime/os.hpp"
29 29
30 30 // Register function to be called by before_exit
31 31 extern "C" { void register_on_exit_function(void (*func)(void)) ;}
32 32
33 33 // Execute code before all handles are released and thread is killed; prologue to vm_exit
34 34 extern void before_exit(JavaThread * thread);
35 35
36 36 // Forced VM exit (i.e, internal error or JVM_Exit)
37 37 extern void vm_exit(int code);
38 38
39 39 // Wrapper for ::exit()
40 40 extern void vm_direct_exit(int code);
41 41
42 42 // Shutdown the VM but do not exit the process
43 43 extern void vm_shutdown();
44 44 // Shutdown the VM and abort the process
45 45 extern void vm_abort(bool dump_core=true);
46 46
47 47 // Trigger any necessary notification of the VM being shutdown
48 48 extern void notify_vm_shutdown();
49 49
50 50 // VM exit if error occurs during initialization of VM
51 51 extern void vm_exit_during_initialization(Handle exception);
52 52 extern void vm_exit_during_initialization(Symbol* exception_name, const char* message);
53 53 extern void vm_exit_during_initialization(const char* error, const char* message = NULL);
54 54 extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
55 55
56 56 /**
57 57 * Discovering the JDK_Version during initialization is tricky when the
58 58 * running JDK is less than JDK6. For JDK6 and greater, a "GetVersion"
59 59 * function exists in libjava.so and we simply call it during the
60 60 * 'initialize()' call to find the version. For JDKs with version < 6, no
61 61 * such call exists and we have to probe the JDK in order to determine
62 62 * the exact version. This probing cannot happen during late in
63 63 * the VM initialization process so there's a period of time during
64 64 * initialization when we don't know anything about the JDK version other than
65 65 * that it less than version 6. This is the "partially initialized" time,
66 66 * when we can answer only certain version queries (such as, is the JDK
67 67 * version greater than 5? Answer: no). Once the JDK probing occurs, we
68 68 * know the version and are considered fully initialized.
69 69 */
70 70 class JDK_Version VALUE_OBJ_CLASS_SPEC {
71 71 friend class VMStructs;
72 72 friend class Universe;
73 73 friend void JDK_Version_init();
74 74 private:
75 75
76 76 static JDK_Version _current;
77 77
78 78 // In this class, we promote the minor version of release to be the
79 79 // major version for releases >= 5 in anticipation of the JDK doing the
80 80 // same thing. For example, we represent "1.5.0" as major version 5 (we
81 81 // drop the leading 1 and use 5 as the 'major').
82 82
83 83 uint8_t _major;
84 84 uint8_t _minor;
↓ open down ↓ |
84 lines elided |
↑ open up ↑ |
85 85 uint8_t _micro;
86 86 uint8_t _update;
87 87 uint8_t _special;
88 88 uint8_t _build;
89 89
90 90 // If partially initialized, the above fields are invalid and we know
91 91 // that we're less than major version 6.
92 92 bool _partially_initialized;
93 93
94 94 bool _thread_park_blocker;
95 + bool _pending_list_uses_discovered_field;
95 96 bool _post_vm_init_hook_enabled;
96 97
97 98 bool is_valid() const {
98 99 return (_major != 0 || _partially_initialized);
99 100 }
100 101
101 102 // initializes or partially initializes the _current static field
102 103 static void initialize();
103 104
104 105 // Completes initialization for a pre-JDK6 version.
105 106 static void fully_initialize(uint8_t major, uint8_t minor = 0,
106 107 uint8_t micro = 0, uint8_t update = 0);
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
107 108
108 109 public:
109 110
110 111 // Returns true if the the current version has only been partially initialized
111 112 static bool is_partially_initialized() {
112 113 return _current._partially_initialized;
113 114 }
114 115
115 116 JDK_Version() : _major(0), _minor(0), _micro(0), _update(0),
116 117 _special(0), _build(0), _partially_initialized(false),
117 - _thread_park_blocker(false), _post_vm_init_hook_enabled(false) {}
118 + _thread_park_blocker(false), _post_vm_init_hook_enabled(false),
119 + _pending_list_uses_discovered_field(false) {}
118 120
119 121 JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t micro = 0,
120 122 uint8_t update = 0, uint8_t special = 0, uint8_t build = 0,
121 - bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) :
123 + bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false,
124 + bool pending_list_uses_discovered_field = false) :
122 125 _major(major), _minor(minor), _micro(micro), _update(update),
123 126 _special(special), _build(build), _partially_initialized(false),
124 127 _thread_park_blocker(thread_park_blocker),
125 - _post_vm_init_hook_enabled(post_vm_init_hook_enabled) {}
128 + _post_vm_init_hook_enabled(post_vm_init_hook_enabled),
129 + _pending_list_uses_discovered_field(pending_list_uses_discovered_field) {}
126 130
127 131 // Returns the current running JDK version
128 132 static JDK_Version current() { return _current; }
129 133
130 134 // Factory methods for convenience
131 135 static JDK_Version jdk(uint8_t m) {
132 136 return JDK_Version(m);
133 137 }
134 138
135 139 static JDK_Version jdk_update(uint8_t major, uint8_t update_number) {
136 140 return JDK_Version(major, 0, 0, update_number);
137 141 }
138 142
139 143 uint8_t major_version() const { return _major; }
140 144 uint8_t minor_version() const { return _minor; }
141 145 uint8_t micro_version() const { return _micro; }
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
142 146 uint8_t update_version() const { return _update; }
143 147 uint8_t special_update_version() const { return _special; }
144 148 uint8_t build_number() const { return _build; }
145 149
146 150 bool supports_thread_park_blocker() const {
147 151 return _thread_park_blocker;
148 152 }
149 153 bool post_vm_init_hook_enabled() const {
150 154 return _post_vm_init_hook_enabled;
151 155 }
156 + // For compatibility wrt pre-4965777 JDK's
157 + bool pending_list_uses_discovered_field() const {
158 + return _pending_list_uses_discovered_field;
159 + }
152 160
153 161 // Performs a full ordering comparison using all fields (update, build, etc.)
154 162 int compare(const JDK_Version& other) const;
155 163
156 164 /**
157 165 * Performs comparison using only the major version, returning negative
158 166 * if the major version of 'this' is less than the parameter, 0 if it is
159 167 * equal, and a positive value if it is greater.
160 168 */
161 169 int compare_major(int version) const {
162 170 if (_partially_initialized) {
163 171 if (version >= 6) {
164 172 return -1;
165 173 } else {
166 174 assert(false, "Can't make this comparison during init time");
167 175 return -1; // conservative
168 176 }
169 177 } else {
170 178 return major_version() - version;
171 179 }
172 180 }
173 181
174 182 void to_string(char* buffer, size_t buflen) const;
175 183
176 184 // Convenience methods for queries on the current major/minor version
177 185 static bool is_jdk12x_version() {
178 186 return current().compare_major(2) == 0;
179 187 }
180 188
181 189 static bool is_jdk13x_version() {
182 190 return current().compare_major(3) == 0;
183 191 }
184 192
185 193 static bool is_jdk14x_version() {
186 194 return current().compare_major(4) == 0;
187 195 }
188 196
189 197 static bool is_jdk15x_version() {
190 198 return current().compare_major(5) == 0;
191 199 }
192 200
193 201 static bool is_jdk16x_version() {
194 202 return current().compare_major(6) == 0;
195 203 }
196 204
197 205 static bool is_jdk17x_version() {
198 206 return current().compare_major(7) == 0;
199 207 }
200 208
201 209 static bool is_gte_jdk13x_version() {
202 210 return current().compare_major(3) >= 0;
203 211 }
204 212
205 213 static bool is_gte_jdk14x_version() {
206 214 return current().compare_major(4) >= 0;
207 215 }
208 216
209 217 static bool is_gte_jdk15x_version() {
210 218 return current().compare_major(5) >= 0;
211 219 }
212 220
213 221 static bool is_gte_jdk16x_version() {
214 222 return current().compare_major(6) >= 0;
215 223 }
216 224
217 225 static bool is_gte_jdk17x_version() {
218 226 return current().compare_major(7) >= 0;
219 227 }
220 228 };
221 229
222 230 #endif // SHARE_VM_RUNTIME_JAVA_HPP
↓ open down ↓ |
61 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX