2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2015-04-23 11:26:32 -04:00
|
|
|
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#ifndef SHARE_VM_RUNTIME_JAVA_HPP
|
|
|
|
#define SHARE_VM_RUNTIME_JAVA_HPP
|
|
|
|
|
|
|
|
#include "runtime/os.hpp"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Execute code before all handles are released and thread is killed; prologue to vm_exit
|
|
|
|
extern void before_exit(JavaThread * thread);
|
|
|
|
|
|
|
|
// Forced VM exit (i.e, internal error or JVM_Exit)
|
|
|
|
extern void vm_exit(int code);
|
|
|
|
|
|
|
|
// Wrapper for ::exit()
|
|
|
|
extern void vm_direct_exit(int code);
|
|
|
|
|
|
|
|
// Shutdown the VM but do not exit the process
|
|
|
|
extern void vm_shutdown();
|
|
|
|
// Shutdown the VM and abort the process
|
2008-06-22 20:07:58 -07:00
|
|
|
extern void vm_abort(bool dump_core=true);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Trigger any necessary notification of the VM being shutdown
|
|
|
|
extern void notify_vm_shutdown();
|
|
|
|
|
|
|
|
// VM exit if error occurs during initialization of VM
|
|
|
|
extern void vm_exit_during_initialization(Handle exception);
|
2011-01-27 16:11:27 -08:00
|
|
|
extern void vm_exit_during_initialization(Symbol* exception_name, const char* message);
|
2007-12-01 00:00:00 +00:00
|
|
|
extern void vm_exit_during_initialization(const char* error, const char* message = NULL);
|
|
|
|
extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
|
|
|
|
|
2008-07-28 14:07:44 -04:00
|
|
|
/**
|
2015-06-19 10:34:38 -07:00
|
|
|
* With the integration of the changes to handle the version string
|
|
|
|
* as defined by JEP-223, most of the code related to handle the version
|
|
|
|
* string prior to JDK 1.6 was removed (partial initialization)
|
2008-07-28 14:07:44 -04:00
|
|
|
*/
|
|
|
|
class JDK_Version VALUE_OBJ_CLASS_SPEC {
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class VMStructs;
|
2008-07-28 14:07:44 -04:00
|
|
|
friend class Universe;
|
|
|
|
friend void JDK_Version_init();
|
2007-12-01 00:00:00 +00:00
|
|
|
private:
|
|
|
|
|
2008-07-28 14:07:44 -04:00
|
|
|
static JDK_Version _current;
|
2012-06-18 12:29:21 -07:00
|
|
|
static const char* _runtime_name;
|
2012-11-01 13:05:47 +01:00
|
|
|
static const char* _runtime_version;
|
2008-07-28 14:07:44 -04:00
|
|
|
|
|
|
|
uint8_t _major;
|
|
|
|
uint8_t _minor;
|
2015-06-12 08:31:01 +02:00
|
|
|
uint8_t _security;
|
2015-06-19 10:34:38 -07:00
|
|
|
uint8_t _patch;
|
2008-07-28 14:07:44 -04:00
|
|
|
uint8_t _build;
|
|
|
|
|
|
|
|
bool _thread_park_blocker;
|
2011-01-12 15:44:16 +00:00
|
|
|
bool _post_vm_init_hook_enabled;
|
2008-07-28 14:07:44 -04:00
|
|
|
|
|
|
|
bool is_valid() const {
|
2015-06-19 10:34:38 -07:00
|
|
|
return (_major != 0);
|
2008-07-28 14:07:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// initializes or partially initializes the _current static field
|
2007-12-01 00:00:00 +00:00
|
|
|
static void initialize();
|
|
|
|
|
2008-07-28 14:07:44 -04:00
|
|
|
public:
|
|
|
|
|
2015-06-19 10:34:38 -07:00
|
|
|
JDK_Version() : _major(0), _minor(0), _security(0), _patch(0), _build(0),
|
2015-04-23 11:26:32 -04:00
|
|
|
_thread_park_blocker(false), _post_vm_init_hook_enabled(false)
|
|
|
|
{}
|
2008-07-28 14:07:44 -04:00
|
|
|
|
2015-06-12 08:31:01 +02:00
|
|
|
JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
|
2015-06-19 10:34:38 -07:00
|
|
|
uint8_t patch = 0, uint8_t build = 0,
|
2015-04-23 11:26:32 -04:00
|
|
|
bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) :
|
2015-06-19 10:34:38 -07:00
|
|
|
_major(major), _minor(minor), _security(security), _patch(patch), _build(build),
|
2011-01-12 15:44:16 +00:00
|
|
|
_thread_park_blocker(thread_park_blocker),
|
2015-04-23 11:26:32 -04:00
|
|
|
_post_vm_init_hook_enabled(post_vm_init_hook_enabled)
|
|
|
|
{}
|
2008-07-28 14:07:44 -04:00
|
|
|
|
|
|
|
// Returns the current running JDK version
|
|
|
|
static JDK_Version current() { return _current; }
|
|
|
|
|
|
|
|
// Factory methods for convenience
|
|
|
|
static JDK_Version jdk(uint8_t m) {
|
|
|
|
return JDK_Version(m);
|
|
|
|
}
|
|
|
|
|
2015-09-11 15:31:03 -04:00
|
|
|
static JDK_Version undefined() {
|
|
|
|
return JDK_Version(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_undefined() const {
|
2015-10-25 19:38:20 -07:00
|
|
|
return _major == 0;
|
2015-09-11 15:31:03 -04:00
|
|
|
}
|
|
|
|
|
2008-07-28 14:07:44 -04:00
|
|
|
uint8_t major_version() const { return _major; }
|
|
|
|
uint8_t minor_version() const { return _minor; }
|
2015-06-19 10:34:38 -07:00
|
|
|
uint8_t security_version() const { return _security; }
|
|
|
|
uint8_t patch_version() const { return _patch; }
|
2008-07-28 14:07:44 -04:00
|
|
|
uint8_t build_number() const { return _build; }
|
|
|
|
|
|
|
|
bool supports_thread_park_blocker() const {
|
|
|
|
return _thread_park_blocker;
|
|
|
|
}
|
2011-01-12 15:44:16 +00:00
|
|
|
bool post_vm_init_hook_enabled() const {
|
|
|
|
return _post_vm_init_hook_enabled;
|
|
|
|
}
|
2008-07-28 14:07:44 -04:00
|
|
|
|
2015-06-19 10:34:38 -07:00
|
|
|
// Performs a full ordering comparison using all fields (patch, build, etc.)
|
2008-07-28 14:07:44 -04:00
|
|
|
int compare(const JDK_Version& other) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs comparison using only the major version, returning negative
|
|
|
|
* if the major version of 'this' is less than the parameter, 0 if it is
|
|
|
|
* equal, and a positive value if it is greater.
|
|
|
|
*/
|
|
|
|
int compare_major(int version) const {
|
|
|
|
return major_version() - version;
|
2008-05-22 13:03:52 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2008-07-28 14:07:44 -04:00
|
|
|
void to_string(char* buffer, size_t buflen) const;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-06-18 12:29:21 -07:00
|
|
|
static const char* runtime_name() {
|
|
|
|
return _runtime_name;
|
|
|
|
}
|
|
|
|
static void set_runtime_name(const char* name) {
|
|
|
|
_runtime_name = name;
|
|
|
|
}
|
|
|
|
|
2012-11-01 13:05:47 +01:00
|
|
|
static const char* runtime_version() {
|
|
|
|
return _runtime_version;
|
|
|
|
}
|
|
|
|
static void set_runtime_version(const char* version) {
|
|
|
|
_runtime_version = version;
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#endif // SHARE_VM_RUNTIME_JAVA_HPP
|