java.hpp revision 176
0N/A/*
0N/A * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A// Register function to be called by before_exit
0N/Aextern "C" { void register_on_exit_function(void (*func)(void)) ;}
0N/A
0N/A// Execute code before all handles are released and thread is killed; prologue to vm_exit
0N/Aextern void before_exit(JavaThread * thread);
0N/A
0N/A// Forced VM exit (i.e, internal error or JVM_Exit)
0N/Aextern void vm_exit(int code);
0N/A
0N/A// Wrapper for ::exit()
0N/Aextern void vm_direct_exit(int code);
0N/A
0N/A// Shutdown the VM but do not exit the process
0N/Aextern void vm_shutdown();
0N/A// Shutdown the VM and abort the process
0N/Aextern void vm_abort();
0N/A
0N/A// Trigger any necessary notification of the VM being shutdown
0N/Aextern void notify_vm_shutdown();
0N/A
0N/A// VM exit if error occurs during initialization of VM
0N/Aextern void vm_exit_during_initialization(Handle exception);
0N/Aextern void vm_exit_during_initialization(symbolHandle exception_name, const char* message);
0N/Aextern void vm_exit_during_initialization(const char* error, const char* message = NULL);
0N/Aextern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
0N/A
0N/Aclass JDK_Version : AllStatic {
0N/A friend class VMStructs;
0N/A private:
0N/A static jdk_version_info _version_info;
0N/A static bool _pre_jdk16_version;
0N/A static int _jdk_version; // JDK version number representing the release
0N/A // i.e. n in 1.n.x (= jdk_minor_version())
0N/A
0N/A public:
0N/A static void initialize();
0N/A static int jdk_major_version() { return JDK_VERSION_MAJOR(_version_info.jdk_version); }
0N/A static int jdk_minor_version() { return JDK_VERSION_MINOR(_version_info.jdk_version); }
0N/A static int jdk_micro_version() { return JDK_VERSION_MICRO(_version_info.jdk_version); }
0N/A static int jdk_build_number() { return JDK_VERSION_BUILD(_version_info.jdk_version); }
0N/A
0N/A static bool is_pre_jdk16_version() { return _pre_jdk16_version; }
0N/A static bool is_jdk12x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 2; }
0N/A static bool is_jdk13x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 3; }
0N/A static bool is_jdk14x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 4; }
0N/A static bool is_jdk15x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 5; }
0N/A
0N/A static bool is_jdk16x_version() {
0N/A if (is_jdk_version_initialized()) {
0N/A return _jdk_version == 6;
0N/A } else {
0N/A assert(is_pre_jdk16_version(), "must have been initialized");
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A static bool is_jdk17x_version() {
0N/A if (is_jdk_version_initialized()) {
0N/A return _jdk_version == 7;
0N/A } else {
0N/A assert(is_pre_jdk16_version(), "must have been initialized");
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A static bool supports_thread_park_blocker() { return _version_info.thread_park_blocker; }
0N/A
0N/A static bool is_gte_jdk14x_version() {
0N/A // Keep the semantics of this that the version number is >= 1.4
0N/A assert(is_jdk_version_initialized(), "Not initialized");
0N/A return _jdk_version >= 4;
0N/A }
0N/A static bool is_gte_jdk15x_version() {
0N/A // Keep the semantics of this that the version number is >= 1.5
0N/A assert(is_jdk_version_initialized(), "Not initialized");
0N/A return _jdk_version >= 5;
0N/A }
0N/A static bool is_gte_jdk16x_version() {
0N/A // Keep the semantics of this that the version number is >= 1.6
0N/A if (is_jdk_version_initialized()) {
0N/A return _jdk_version >= 6;
0N/A } else {
0N/A assert(is_pre_jdk16_version(), "Not initialized");
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A static bool is_gte_jdk17x_version() {
0N/A // Keep the semantics of this that the version number is >= 1.7
0N/A if (is_jdk_version_initialized()) {
0N/A return _jdk_version >= 7;
0N/A } else {
0N/A assert(is_pre_jdk16_version(), "Not initialized");
0N/A return false;
0N/A }
0N/A }
0N/A
0N/A static bool is_jdk_version_initialized() {
0N/A return _jdk_version > 0;
0N/A }
0N/A
0N/A // These methods are defined to deal with pre JDK 1.6 versions
static void set_jdk12x_version() {
assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize");
_jdk_version = 2;
_version_info.jdk_version = (1 << 24) | (2 << 16);
}
static void set_jdk13x_version() {
assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize");
_jdk_version = 3;
_version_info.jdk_version = (1 << 24) | (3 << 16);
}
static void set_jdk14x_version() {
assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize");
_jdk_version = 4;
_version_info.jdk_version = (1 << 24) | (4 << 16);
}
static void set_jdk15x_version() {
assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize");
_jdk_version = 5;
_version_info.jdk_version = (1 << 24) | (5 << 16);
}
};