1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/runtime/java.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,123 @@ 1.4 +/* 1.5 + * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// Register function to be called by before_exit 1.29 +extern "C" { void register_on_exit_function(void (*func)(void)) ;} 1.30 + 1.31 +// Execute code before all handles are released and thread is killed; prologue to vm_exit 1.32 +extern void before_exit(JavaThread * thread); 1.33 + 1.34 +// Forced VM exit (i.e, internal error or JVM_Exit) 1.35 +extern void vm_exit(int code); 1.36 + 1.37 +// Wrapper for ::exit() 1.38 +extern void vm_direct_exit(int code); 1.39 + 1.40 +// Shutdown the VM but do not exit the process 1.41 +extern void vm_shutdown(); 1.42 +// Shutdown the VM and abort the process 1.43 +extern void vm_abort(); 1.44 + 1.45 +// Trigger any necessary notification of the VM being shutdown 1.46 +extern void notify_vm_shutdown(); 1.47 + 1.48 +// VM exit if error occurs during initialization of VM 1.49 +extern void vm_exit_during_initialization(Handle exception); 1.50 +extern void vm_exit_during_initialization(symbolHandle exception_name, const char* message); 1.51 +extern void vm_exit_during_initialization(const char* error, const char* message = NULL); 1.52 +extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL); 1.53 + 1.54 +class JDK_Version : AllStatic { 1.55 + friend class VMStructs; 1.56 + private: 1.57 + static jdk_version_info _version_info; 1.58 + static bool _pre_jdk16_version; 1.59 + static int _jdk_version; // JDK version number representing the release 1.60 + // i.e. n in 1.n.x (= jdk_minor_version()) 1.61 + 1.62 + public: 1.63 + static void initialize(); 1.64 + static int jdk_major_version() { return JDK_VERSION_MAJOR(_version_info.jdk_version); } 1.65 + static int jdk_minor_version() { return JDK_VERSION_MINOR(_version_info.jdk_version); } 1.66 + static int jdk_micro_version() { return JDK_VERSION_MICRO(_version_info.jdk_version); } 1.67 + static int jdk_build_number() { return JDK_VERSION_BUILD(_version_info.jdk_version); } 1.68 + 1.69 + static bool is_pre_jdk16_version() { return _pre_jdk16_version; } 1.70 + static bool is_jdk12x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 2; } 1.71 + static bool is_jdk13x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 3; } 1.72 + static bool is_jdk14x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 4; } 1.73 + static bool is_jdk15x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 5; } 1.74 + static bool is_jdk16x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 6; } 1.75 + static bool is_jdk17x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 7; } 1.76 + 1.77 + static bool supports_thread_park_blocker() { return _version_info.thread_park_blocker; } 1.78 + 1.79 + static bool is_gte_jdk14x_version() { 1.80 + // Keep the semantics of this that the version number is >= 1.4 1.81 + assert(is_jdk_version_initialized(), "Not initialized"); 1.82 + return _jdk_version >= 4; 1.83 + } 1.84 + static bool is_gte_jdk15x_version() { 1.85 + // Keep the semantics of this that the version number is >= 1.5 1.86 + assert(is_jdk_version_initialized(), "Not initialized"); 1.87 + return _jdk_version >= 5; 1.88 + } 1.89 + static bool is_gte_jdk16x_version() { 1.90 + // Keep the semantics of this that the version number is >= 1.6 1.91 + assert(is_jdk_version_initialized(), "Not initialized"); 1.92 + return _jdk_version >= 6; 1.93 + } 1.94 + 1.95 + static bool is_gte_jdk17x_version() { 1.96 + // Keep the semantics of this that the version number is >= 1.7 1.97 + assert(is_jdk_version_initialized(), "Not initialized"); 1.98 + return _jdk_version >= 7; 1.99 + } 1.100 + 1.101 + static bool is_jdk_version_initialized() { 1.102 + return _jdk_version > 0; 1.103 + } 1.104 + 1.105 + // These methods are defined to deal with pre JDK 1.6 versions 1.106 + static void set_jdk12x_version() { 1.107 + assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize"); 1.108 + _jdk_version = 2; 1.109 + _version_info.jdk_version = (1 << 24) | (2 << 16); 1.110 + } 1.111 + static void set_jdk13x_version() { 1.112 + assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize"); 1.113 + _jdk_version = 3; 1.114 + _version_info.jdk_version = (1 << 24) | (3 << 16); 1.115 + } 1.116 + static void set_jdk14x_version() { 1.117 + assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize"); 1.118 + _jdk_version = 4; 1.119 + _version_info.jdk_version = (1 << 24) | (4 << 16); 1.120 + } 1.121 + static void set_jdk15x_version() { 1.122 + assert(_pre_jdk16_version && !is_jdk_version_initialized(), "must not initialize"); 1.123 + _jdk_version = 5; 1.124 + _version_info.jdk_version = (1 << 24) | (5 << 16); 1.125 + } 1.126 +};