Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/runtime/java.hpp
40951 views
1
/*
2
* Copyright (c) 1997, 2021, 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
#ifndef SHARE_RUNTIME_JAVA_HPP
26
#define SHARE_RUNTIME_JAVA_HPP
27
28
#include "runtime/os.hpp"
29
#include "utilities/globalDefinitions.hpp"
30
31
class Handle;
32
class JavaThread;
33
class Symbol;
34
35
// Execute code before all handles are released and thread is killed; prologue to vm_exit
36
extern void before_exit(JavaThread * thread);
37
38
// Forced VM exit (i.e, internal error or JVM_Exit)
39
extern void vm_exit(int code);
40
41
// Wrapper for ::exit()
42
extern void vm_direct_exit(int code);
43
extern void vm_direct_exit(int code, const char* message);
44
45
// Shutdown the VM but do not exit the process
46
extern void vm_shutdown();
47
// Shutdown the VM and abort the process
48
extern void vm_abort(bool dump_core=true);
49
50
// Trigger any necessary notification of the VM being shutdown
51
extern void notify_vm_shutdown();
52
53
// VM exit if error occurs during initialization of VM
54
extern void vm_exit_during_initialization();
55
extern void vm_exit_during_initialization(Handle exception);
56
extern void vm_exit_during_initialization(Symbol* exception_name, const char* message);
57
extern void vm_exit_during_initialization(const char* error, const char* message = NULL);
58
extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
59
60
extern void vm_exit_during_cds_dumping(const char* error, const char* message = NULL);
61
62
/**
63
* With the integration of the changes to handle the version string
64
* as defined by JEP-223, most of the code related to handle the version
65
* string prior to JDK 1.6 was removed (partial initialization)
66
*/
67
class JDK_Version {
68
friend class VMStructs;
69
friend class Universe;
70
friend void JDK_Version_init();
71
private:
72
73
static JDK_Version _current;
74
static const char* _java_version;
75
static const char* _runtime_name;
76
static const char* _runtime_version;
77
static const char* _runtime_vendor_version;
78
static const char* _runtime_vendor_vm_bug_url;
79
80
uint8_t _major;
81
uint8_t _minor;
82
uint8_t _security;
83
uint8_t _patch;
84
uint8_t _build;
85
86
bool is_valid() const {
87
return (_major != 0);
88
}
89
90
// initializes or partially initializes the _current static field
91
static void initialize();
92
93
public:
94
95
JDK_Version() :
96
_major(0), _minor(0), _security(0), _patch(0), _build(0)
97
{}
98
99
JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
100
uint8_t patch = 0, uint8_t build = 0) :
101
_major(major), _minor(minor), _security(security), _patch(patch), _build(build)
102
{}
103
104
// Returns the current running JDK version
105
static JDK_Version current() { return _current; }
106
107
// Factory methods for convenience
108
static JDK_Version jdk(uint8_t m) {
109
return JDK_Version(m);
110
}
111
112
static JDK_Version undefined() {
113
return JDK_Version(0);
114
}
115
116
bool is_undefined() const {
117
return _major == 0;
118
}
119
120
uint8_t major_version() const { return _major; }
121
uint8_t minor_version() const { return _minor; }
122
uint8_t security_version() const { return _security; }
123
uint8_t patch_version() const { return _patch; }
124
uint8_t build_number() const { return _build; }
125
126
// Performs a full ordering comparison using all fields (patch, build, etc.)
127
int compare(const JDK_Version& other) const;
128
129
/**
130
* Performs comparison using only the major version, returning negative
131
* if the major version of 'this' is less than the parameter, 0 if it is
132
* equal, and a positive value if it is greater.
133
*/
134
int compare_major(int version) const {
135
return major_version() - version;
136
}
137
138
void to_string(char* buffer, size_t buflen) const;
139
140
static const char* java_version() {
141
return _java_version;
142
}
143
static void set_java_version(const char* version) {
144
_java_version = os::strdup(version);
145
}
146
147
static const char* runtime_name() {
148
return _runtime_name;
149
}
150
static void set_runtime_name(const char* name) {
151
_runtime_name = os::strdup(name);
152
}
153
154
static const char* runtime_version() {
155
return _runtime_version;
156
}
157
static void set_runtime_version(const char* version) {
158
_runtime_version = os::strdup(version);
159
}
160
161
static const char* runtime_vendor_version() {
162
return _runtime_vendor_version;
163
}
164
static void set_runtime_vendor_version(const char* vendor_version) {
165
_runtime_vendor_version = os::strdup(vendor_version);
166
}
167
168
static const char* runtime_vendor_vm_bug_url() {
169
return _runtime_vendor_vm_bug_url;
170
}
171
static void set_runtime_vendor_vm_bug_url(const char* vendor_vm_bug_url) {
172
_runtime_vendor_vm_bug_url = os::strdup(vendor_vm_bug_url);
173
}
174
175
};
176
177
#endif // SHARE_RUNTIME_JAVA_HPP
178
179