src/share/vm/ci/ciUtilities.hpp

Wed, 12 Oct 2011 21:00:13 -0700

author
twisti
date
Wed, 12 Oct 2011 21:00:13 -0700
changeset 3197
5eb9169b1a14
parent 2314
f95d63e2154a
child 4267
bd7a7ce2e264
permissions
-rw-r--r--

7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
Reviewed-by: jrose, never

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CI_CIUTILITIES_HPP
stefank@2314 26 #define SHARE_VM_CI_CIUTILITIES_HPP
stefank@2314 27
stefank@2314 28 #include "ci/ciEnv.hpp"
stefank@2314 29 #include "runtime/interfaceSupport.hpp"
stefank@2314 30
duke@435 31 // The following routines and definitions are used internally in the
duke@435 32 // compiler interface.
duke@435 33
duke@435 34
duke@435 35 // Add a ci native entry wrapper?
duke@435 36
duke@435 37 // Bring the compilation thread into the VM state.
duke@435 38 #define VM_ENTRY_MARK \
duke@435 39 CompilerThread* thread=CompilerThread::current(); \
duke@435 40 ThreadInVMfromNative __tiv(thread); \
duke@435 41 ResetNoHandleMark rnhm; \
duke@435 42 HandleMarkCleaner __hm(thread); \
duke@435 43 Thread* THREAD = thread; \
duke@435 44 debug_only(VMNativeEntryWrapper __vew;)
duke@435 45
duke@435 46
duke@435 47
duke@435 48 // Bring the compilation thread into the VM state. No handle mark.
duke@435 49 #define VM_QUICK_ENTRY_MARK \
duke@435 50 CompilerThread* thread=CompilerThread::current(); \
duke@435 51 ThreadInVMfromNative __tiv(thread); \
duke@435 52 /* \
duke@435 53 * [TODO] The NoHandleMark line does nothing but declare a function prototype \
duke@435 54 * The NoHandkeMark constructor is NOT executed. If the ()'s are \
duke@435 55 * removed, causes the NoHandleMark assert to trigger. \
duke@435 56 * debug_only(NoHandleMark __hm();) \
duke@435 57 */ \
duke@435 58 Thread* THREAD = thread; \
duke@435 59 debug_only(VMNativeEntryWrapper __vew;)
duke@435 60
duke@435 61
duke@435 62 #define EXCEPTION_CONTEXT \
duke@435 63 CompilerThread* thread=CompilerThread::current(); \
duke@435 64 Thread* THREAD = thread;
duke@435 65
duke@435 66
duke@435 67 #define CURRENT_ENV \
duke@435 68 ciEnv::current()
duke@435 69
duke@435 70 // where current thread is THREAD
duke@435 71 #define CURRENT_THREAD_ENV \
duke@435 72 ciEnv::current(thread)
duke@435 73
duke@435 74 #define IS_IN_VM \
duke@435 75 ciEnv::is_in_vm()
duke@435 76
duke@435 77 #define ASSERT_IN_VM \
duke@435 78 assert(IS_IN_VM, "must be in vm state");
duke@435 79
duke@435 80 #define GUARDED_VM_ENTRY(action) \
duke@435 81 {if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}}
duke@435 82
duke@435 83 // Redefine this later.
duke@435 84 #define KILL_COMPILE_ON_FATAL_(result) \
duke@435 85 THREAD); \
duke@435 86 if (HAS_PENDING_EXCEPTION) { \
duke@435 87 if (PENDING_EXCEPTION->klass() == \
never@1577 88 SystemDictionary::ThreadDeath_klass()) { \
duke@435 89 /* Kill the compilation. */ \
duke@435 90 fatal("unhandled ci exception"); \
duke@435 91 return (result); \
duke@435 92 } \
duke@435 93 CLEAR_PENDING_EXCEPTION; \
duke@435 94 return (result); \
duke@435 95 } \
duke@435 96 (0
duke@435 97
duke@435 98 #define KILL_COMPILE_ON_ANY \
duke@435 99 THREAD); \
duke@435 100 if (HAS_PENDING_EXCEPTION) { \
duke@435 101 fatal("unhandled ci exception"); \
duke@435 102 CLEAR_PENDING_EXCEPTION; \
duke@435 103 } \
duke@435 104 (0
duke@435 105
duke@435 106
duke@435 107 inline const char* bool_to_str(bool b) {
duke@435 108 return ((b) ? "true" : "false");
duke@435 109 }
duke@435 110
duke@435 111 const char* basictype_to_str(BasicType t);
duke@435 112 const char basictype_to_char(BasicType t);
stefank@2314 113
stefank@2314 114 #endif // SHARE_VM_CI_CIUTILITIES_HPP

mercurial