Mon, 26 Apr 2010 23:59:45 -0700
6943485: JVMTI always on capabilities change code generation too much
Reviewed-by: twisti, dcubed
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 1999-2007 Sun Microsystems, Inc. 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 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // The following routines and definitions are used internally in the |
duke@435 | 26 | // compiler interface. |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | // Add a ci native entry wrapper? |
duke@435 | 30 | |
duke@435 | 31 | // Bring the compilation thread into the VM state. |
duke@435 | 32 | #define VM_ENTRY_MARK \ |
duke@435 | 33 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 34 | ThreadInVMfromNative __tiv(thread); \ |
duke@435 | 35 | ResetNoHandleMark rnhm; \ |
duke@435 | 36 | HandleMarkCleaner __hm(thread); \ |
duke@435 | 37 | Thread* THREAD = thread; \ |
duke@435 | 38 | debug_only(VMNativeEntryWrapper __vew;) |
duke@435 | 39 | |
duke@435 | 40 | |
duke@435 | 41 | |
duke@435 | 42 | // Bring the compilation thread into the VM state. No handle mark. |
duke@435 | 43 | #define VM_QUICK_ENTRY_MARK \ |
duke@435 | 44 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 45 | ThreadInVMfromNative __tiv(thread); \ |
duke@435 | 46 | /* \ |
duke@435 | 47 | * [TODO] The NoHandleMark line does nothing but declare a function prototype \ |
duke@435 | 48 | * The NoHandkeMark constructor is NOT executed. If the ()'s are \ |
duke@435 | 49 | * removed, causes the NoHandleMark assert to trigger. \ |
duke@435 | 50 | * debug_only(NoHandleMark __hm();) \ |
duke@435 | 51 | */ \ |
duke@435 | 52 | Thread* THREAD = thread; \ |
duke@435 | 53 | debug_only(VMNativeEntryWrapper __vew;) |
duke@435 | 54 | |
duke@435 | 55 | |
duke@435 | 56 | #define EXCEPTION_CONTEXT \ |
duke@435 | 57 | CompilerThread* thread=CompilerThread::current(); \ |
duke@435 | 58 | Thread* THREAD = thread; |
duke@435 | 59 | |
duke@435 | 60 | |
duke@435 | 61 | #define CURRENT_ENV \ |
duke@435 | 62 | ciEnv::current() |
duke@435 | 63 | |
duke@435 | 64 | // where current thread is THREAD |
duke@435 | 65 | #define CURRENT_THREAD_ENV \ |
duke@435 | 66 | ciEnv::current(thread) |
duke@435 | 67 | |
duke@435 | 68 | #define IS_IN_VM \ |
duke@435 | 69 | ciEnv::is_in_vm() |
duke@435 | 70 | |
duke@435 | 71 | #define ASSERT_IN_VM \ |
duke@435 | 72 | assert(IS_IN_VM, "must be in vm state"); |
duke@435 | 73 | |
duke@435 | 74 | #define GUARDED_VM_ENTRY(action) \ |
duke@435 | 75 | {if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}} |
duke@435 | 76 | |
duke@435 | 77 | // Redefine this later. |
duke@435 | 78 | #define KILL_COMPILE_ON_FATAL_(result) \ |
duke@435 | 79 | THREAD); \ |
duke@435 | 80 | if (HAS_PENDING_EXCEPTION) { \ |
duke@435 | 81 | if (PENDING_EXCEPTION->klass() == \ |
never@1577 | 82 | SystemDictionary::ThreadDeath_klass()) { \ |
duke@435 | 83 | /* Kill the compilation. */ \ |
duke@435 | 84 | fatal("unhandled ci exception"); \ |
duke@435 | 85 | return (result); \ |
duke@435 | 86 | } \ |
duke@435 | 87 | CLEAR_PENDING_EXCEPTION; \ |
duke@435 | 88 | return (result); \ |
duke@435 | 89 | } \ |
duke@435 | 90 | (0 |
duke@435 | 91 | |
duke@435 | 92 | #define KILL_COMPILE_ON_ANY \ |
duke@435 | 93 | THREAD); \ |
duke@435 | 94 | if (HAS_PENDING_EXCEPTION) { \ |
duke@435 | 95 | fatal("unhandled ci exception"); \ |
duke@435 | 96 | CLEAR_PENDING_EXCEPTION; \ |
duke@435 | 97 | } \ |
duke@435 | 98 | (0 |
duke@435 | 99 | |
duke@435 | 100 | |
duke@435 | 101 | inline const char* bool_to_str(bool b) { |
duke@435 | 102 | return ((b) ? "true" : "false"); |
duke@435 | 103 | } |
duke@435 | 104 | |
duke@435 | 105 | const char* basictype_to_str(BasicType t); |
duke@435 | 106 | const char basictype_to_char(BasicType t); |