interfaceSupport.hpp revision 2062
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * This code is free software; you can redistribute it and/or modify it
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * under the terms of the GNU General Public License version 2 only, as
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * published by the Free Software Foundation.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * This code is distributed in the hope that it will be useful, but WITHOUT
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * version 2 for more details (a copy is included in the LICENSE file that
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * accompanied this code).
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * You should have received a copy of the GNU General Public License version
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * 2 along with this work; if not, write to the Free Software Foundation,
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * or visit www.oracle.com if you need additional information or have any
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott#ifndef SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott#define SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings// Wrapper for all entry points to the virtual machine.
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings// The HandleMarkCleaner is a faster version of HandleMark.
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings// It relies on the fact that there is a HandleMark further
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell// down the stack (in JavaCalls::call_helper), and just resets
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell// to the saved values in that HandleMark.
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings _thread->last_handle_mark()->pop_and_restore();
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell inline void* operator new(size_t size, void* ptr) {
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings// InterfaceSupport provides functionality used by the __LEAF and __ENTRY
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell// macros. These macros are used to guard entry points into the VM and
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell// perform checks upon leave of the VM.
3cb6a584a87fa8fec140b0bb20dd91731d13e751Diego Colantoni static void trace(const char* result_type, const char* header);
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott // Helper methods used to implement +ScavengeALot and +FullGCALot
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott static void check_gc_alot() { if (ScavengeALot || FullGCALot) gc_alot(); }
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott static void gc_alot();
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott static void walk_stack_from(vframe* start_vf);
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell static void zombieAll();
3cb6a584a87fa8fec140b0bb20dd91731d13e751Diego Colantoni // OS dependent stuff
# include "interfaceSupport_windows.hpp"
if (UseMembar) {
static inline void transition_and_fence(JavaThread *thread, JavaThreadState from, JavaThreadState to) {
if (UseMembar) {
if (UseMembar) {
void trans_and_fence(JavaThreadState from, JavaThreadState to) { transition_and_fence(_thread, from, to); }
~ThreadInVMfromJava() {
if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition();
class ThreadInVMfromUnknown {
if (t->is_Java_thread()) {
if (_thread) {
~ThreadInVMfromNative() {
if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition(false);
~ThreadToNativeFromVM() {
~ThreadBlockInVM() {
#ifdef ASSERT
class VMEntryWrapper {
VMEntryWrapper() {
if (VerifyLastFrame) {
~VMEntryWrapper() {
if (WalkStackALot) {
#ifdef ENABLE_ZAP_DEAD_LOCALS
if (ZapDeadLocalsOld) {
#ifdef COMPILER2
if (StressDerivedPointers) {
if (ZombieALot) {
if (UnlinkSymbolsALot) {
if (VerifyStack) {
class VMNativeEntryWrapper {
~VMNativeEntryWrapper() {
#ifdef ASSERT
if (TraceRuntimeCalls) \
if (CountRuntimeCalls) { \
#define IRT_END }
#define JRT_BLOCK \
#define JRT_BLOCK_END }
#define JRT_END }
assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \
#define JNI_END } }
#define JVM_END } }