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