24 |
24 |
25 #ifndef SHARE_VM_CI_CIUTILITIES_HPP |
25 #ifndef SHARE_VM_CI_CIUTILITIES_HPP |
26 #define SHARE_VM_CI_CIUTILITIES_HPP |
26 #define SHARE_VM_CI_CIUTILITIES_HPP |
27 |
27 |
28 #include "ci/ciEnv.hpp" |
28 #include "ci/ciEnv.hpp" |
29 #include "runtime/interfaceSupport.hpp" |
|
30 #include "utilities/globalDefinitions.hpp" |
29 #include "utilities/globalDefinitions.hpp" |
31 |
30 |
32 // The following routines and definitions are used internally in the |
31 // The following routines and definitions are used internally in the |
33 // compiler interface. |
32 // compiler interface. |
34 |
|
35 |
|
36 // Add a ci native entry wrapper? |
|
37 |
|
38 // Bring the compilation thread into the VM state. |
|
39 #define VM_ENTRY_MARK \ |
|
40 CompilerThread* thread=CompilerThread::current(); \ |
|
41 ThreadInVMfromNative __tiv(thread); \ |
|
42 ResetNoHandleMark rnhm; \ |
|
43 HandleMarkCleaner __hm(thread); \ |
|
44 Thread* THREAD = thread; \ |
|
45 debug_only(VMNativeEntryWrapper __vew;) |
|
46 |
|
47 |
|
48 |
|
49 // Bring the compilation thread into the VM state. No handle mark. |
|
50 #define VM_QUICK_ENTRY_MARK \ |
|
51 CompilerThread* thread=CompilerThread::current(); \ |
|
52 ThreadInVMfromNative __tiv(thread); \ |
|
53 /* \ |
|
54 * [TODO] The NoHandleMark line does nothing but declare a function prototype \ |
|
55 * The NoHandkeMark constructor is NOT executed. If the ()'s are \ |
|
56 * removed, causes the NoHandleMark assert to trigger. \ |
|
57 * debug_only(NoHandleMark __hm();) \ |
|
58 */ \ |
|
59 Thread* THREAD = thread; \ |
|
60 debug_only(VMNativeEntryWrapper __vew;) |
|
61 |
|
62 |
|
63 #define EXCEPTION_CONTEXT \ |
|
64 CompilerThread* thread=CompilerThread::current(); \ |
|
65 Thread* THREAD = thread; |
|
66 |
|
67 |
33 |
68 #define CURRENT_ENV \ |
34 #define CURRENT_ENV \ |
69 ciEnv::current() |
35 ciEnv::current() |
70 |
36 |
71 // where current thread is THREAD |
37 // where current thread is THREAD |
76 ciEnv::is_in_vm() |
42 ciEnv::is_in_vm() |
77 |
43 |
78 #define ASSERT_IN_VM \ |
44 #define ASSERT_IN_VM \ |
79 assert(IS_IN_VM, "must be in vm state"); |
45 assert(IS_IN_VM, "must be in vm state"); |
80 |
46 |
81 #define GUARDED_VM_ENTRY(action) \ |
|
82 {if (IS_IN_VM) { action } else { VM_ENTRY_MARK; { action }}} |
|
83 |
|
84 #define GUARDED_VM_QUICK_ENTRY(action) \ |
|
85 {if (IS_IN_VM) { action } else { VM_QUICK_ENTRY_MARK; { action }}} |
|
86 |
|
87 // Redefine this later. |
|
88 #define KILL_COMPILE_ON_FATAL_(result) \ |
|
89 THREAD); \ |
|
90 if (HAS_PENDING_EXCEPTION) { \ |
|
91 if (PENDING_EXCEPTION->klass() == \ |
|
92 SystemDictionary::ThreadDeath_klass()) { \ |
|
93 /* Kill the compilation. */ \ |
|
94 fatal("unhandled ci exception"); \ |
|
95 return (result); \ |
|
96 } \ |
|
97 CLEAR_PENDING_EXCEPTION; \ |
|
98 return (result); \ |
|
99 } \ |
|
100 (void)(0 |
|
101 |
|
102 #define KILL_COMPILE_ON_ANY \ |
|
103 THREAD); \ |
|
104 if (HAS_PENDING_EXCEPTION) { \ |
|
105 fatal("unhandled ci exception"); \ |
|
106 CLEAR_PENDING_EXCEPTION; \ |
|
107 } \ |
|
108 (void)(0 |
|
109 |
|
110 |
|
111 inline const char* bool_to_str(bool b) { |
47 inline const char* bool_to_str(bool b) { |
112 return ((b) ? "true" : "false"); |
48 return ((b) ? "true" : "false"); |
113 } |
49 } |
114 |
50 |
115 const char* basictype_to_str(BasicType t); |
51 const char* basictype_to_str(BasicType t); |