Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalVMExits.cpp @ 2890:c23d45daff9b
Renamed cpp/hpp file directory.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 08 Jun 2011 13:40:25 +0200 |
parents | src/share/vm/c1x/graalVMExits.cpp@2fb867285938 |
children | 75a99b4f1c98 |
comparison
equal
deleted
inserted
replaced
2889:2fb867285938 | 2890:c23d45daff9b |
---|---|
1 /* | |
2 * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 | |
24 #include "precompiled.hpp" | |
25 #include "c1x/c1x_VMExits.hpp" | |
26 | |
27 // this is a *global* handle | |
28 jobject VMExits::_compilerPermObject; | |
29 jobject VMExits::_vmExitsPermObject; | |
30 jobject VMExits::_vmExitsPermKlass; | |
31 | |
32 KlassHandle VMExits::vmExitsKlass() { | |
33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) { | |
34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_VMExits(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
35 check_not_null(result, "Couldn't find class com.sun.hotspot.c1x.VMExits"); | |
36 _vmExitsPermKlass = JNIHandles::make_global(result); | |
37 } | |
38 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass)); | |
39 } | |
40 | |
41 Handle VMExits::compilerInstance() { | |
42 if (JNIHandles::resolve(_compilerPermObject) == NULL) { | |
43 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
44 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.c1x.CompilerImpl"); | |
45 | |
46 JavaValue result(T_OBJECT); | |
47 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::getInstance_name(), vmSymbols::getInstance_signature(), Thread::current()); | |
48 check_pending_exception("Couldn't get Compiler"); | |
49 _compilerPermObject = JNIHandles::make_global((oop) result.get_jobject()); | |
50 } | |
51 return Handle(JNIHandles::resolve_non_null(_compilerPermObject)); | |
52 } | |
53 | |
54 Handle VMExits::instance() { | |
55 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) { | |
56 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
57 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.Compiler"); | |
58 | |
59 JavaValue result(T_OBJECT); | |
60 JavaCallArguments args; | |
61 args.set_receiver(compilerInstance()); | |
62 JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current()); | |
63 check_pending_exception("Couldn't get VMExits"); | |
64 _vmExitsPermObject = JNIHandles::make_global((oop) result.get_jobject()); | |
65 } | |
66 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject)); | |
67 } | |
68 | |
69 void VMExits::initializeCompiler() { | |
70 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
71 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.c1x.CompilerImpl"); | |
72 | |
73 JavaValue result(T_VOID); | |
74 JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::initialize_name(), vmSymbols::void_method_signature(), Thread::current()); | |
75 check_pending_exception("Couldn't initialize compiler"); | |
76 } | |
77 | |
78 jboolean VMExits::setOption(Handle option) { | |
79 assert(!option.is_null(), ""); | |
80 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
81 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.HotSpotOptions"); | |
82 | |
83 Thread* THREAD = Thread::current(); | |
84 JavaValue result(T_BOOLEAN); | |
85 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setOption_name(), vmSymbols::setOption_signature(), option, THREAD); | |
86 check_pending_exception("Error while calling setOption"); | |
87 return result.get_jboolean(); | |
88 } | |
89 | |
90 void VMExits::setDefaultOptions() { | |
91 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_hotspot_c1x_HotSpotOptions(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
92 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.c1x.HotSpotOptions"); | |
93 | |
94 Thread* THREAD = Thread::current(); | |
95 JavaValue result(T_VOID); | |
96 JavaCalls::call_static(&result, compilerKlass, vmSymbols::setDefaultOptions_name(), vmSymbols::void_method_signature(), THREAD); | |
97 check_pending_exception("Error while calling setDefaultOptions"); | |
98 } | |
99 | |
100 void VMExits::compileMethod(jlong methodVmId, Handle name, int entry_bci) { | |
101 assert(!name.is_null(), "just checking"); | |
102 Thread* THREAD = Thread::current(); | |
103 JavaValue result(T_VOID); | |
104 JavaCallArguments args; | |
105 args.push_oop(instance()); | |
106 args.push_long(methodVmId); | |
107 args.push_oop(name); | |
108 args.push_int(entry_bci); | |
109 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD); | |
110 check_pending_exception("Error while calling compileMethod"); | |
111 } | |
112 | |
113 oop VMExits::createRiMethodResolved(jlong vmId, Handle name, TRAPS) { | |
114 assert(!name.is_null(), "just checking"); | |
115 JavaValue result(T_OBJECT); | |
116 JavaCallArguments args; | |
117 args.push_oop(instance()); | |
118 args.push_long(vmId); | |
119 args.push_oop(name); | |
120 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodResolved_name(), vmSymbols::createRiMethodResolved_signature(), &args, THREAD); | |
121 check_pending_exception("Error while calling createRiMethodResolved"); | |
122 return (oop) result.get_jobject(); | |
123 } | |
124 | |
125 oop VMExits::createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS) { | |
126 assert(!name.is_null(), "just checking"); | |
127 JavaValue result(T_OBJECT); | |
128 JavaCallArguments args; | |
129 args.push_oop(instance()); | |
130 args.push_oop(name); | |
131 args.push_oop(signature); | |
132 args.push_oop(holder); | |
133 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodUnresolved_name(), vmSymbols::createRiMethodUnresolved_signature(), &args, THREAD); | |
134 check_pending_exception("Error while calling createRiMethodUnresolved"); | |
135 return (oop) result.get_jobject(); | |
136 } | |
137 | |
138 oop VMExits::createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS) { | |
139 assert(!holder.is_null(), "just checking"); | |
140 assert(!name.is_null(), "just checking"); | |
141 assert(!type.is_null(), "just checking"); | |
142 JavaValue result(T_OBJECT); | |
143 JavaCallArguments args; | |
144 args.push_oop(instance()); | |
145 args.push_oop(holder); | |
146 args.push_oop(name); | |
147 args.push_oop(type); | |
148 args.push_int(index); | |
149 args.push_int(flags); | |
150 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiField_name(), vmSymbols::createRiField_signature(), &args, THREAD); | |
151 check_pending_exception("Error while calling createRiField"); | |
152 assert(result.get_type() == T_OBJECT, "just checking"); | |
153 return (oop) result.get_jobject(); | |
154 } | |
155 | |
156 oop VMExits::createRiType(jlong vmId, Handle name, TRAPS) { | |
157 assert(!name.is_null(), "just checking"); | |
158 JavaValue result(T_OBJECT); | |
159 JavaCallArguments args; | |
160 args.push_oop(instance()); | |
161 args.push_long(vmId); | |
162 args.push_oop(name); | |
163 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiType_name(), vmSymbols::createRiType_signature(), &args, THREAD); | |
164 check_pending_exception("Error while calling createRiType"); | |
165 return (oop) result.get_jobject(); | |
166 } | |
167 | |
168 oop VMExits::createRiTypePrimitive(int basic_type, TRAPS) { | |
169 JavaValue result(T_OBJECT); | |
170 JavaCallArguments args; | |
171 args.push_oop(instance()); | |
172 args.push_int(basic_type); | |
173 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypePrimitive_name(), vmSymbols::createRiTypePrimitive_signature(), &args, THREAD); | |
174 check_pending_exception("Error while calling createRiTypePrimitive"); | |
175 return (oop) result.get_jobject(); | |
176 } | |
177 | |
178 oop VMExits::createRiTypeUnresolved(Handle name, TRAPS) { | |
179 assert(!name.is_null(), "just checking"); | |
180 JavaValue result(T_OBJECT); | |
181 JavaCallArguments args; | |
182 args.push_oop(instance()); | |
183 args.push_oop(name); | |
184 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypeUnresolved_name(), vmSymbols::createRiTypeUnresolved_signature(), &args, THREAD); | |
185 check_pending_exception("Error while calling createRiTypeUnresolved"); | |
186 return (oop) result.get_jobject(); | |
187 } | |
188 | |
189 oop VMExits::createRiConstantPool(jlong vmId, TRAPS) { | |
190 JavaValue result(T_OBJECT); | |
191 JavaCallArguments args; | |
192 args.push_oop(instance()); | |
193 args.push_long(vmId); | |
194 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiConstantPool_name(), vmSymbols::createRiConstantPool_signature(), &args, THREAD); | |
195 check_pending_exception("Error while calling createRiConstantPool"); | |
196 return (oop) result.get_jobject(); | |
197 } | |
198 | |
199 oop VMExits::createRiSignature(Handle name, TRAPS) { | |
200 assert(!name.is_null(), "just checking"); | |
201 JavaValue result(T_OBJECT); | |
202 JavaCallArguments args; | |
203 args.push_oop(instance()); | |
204 args.push_oop(name); | |
205 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiSignature_name(), vmSymbols::createRiSignature_signature(), &args, THREAD); | |
206 check_pending_exception("Error while calling createRiSignature"); | |
207 return (oop) result.get_jobject(); | |
208 } | |
209 | |
210 oop VMExits::createCiConstant(Handle kind, jlong value, TRAPS) { | |
211 JavaValue result(T_OBJECT); | |
212 JavaCallArguments args; | |
213 args.push_oop(instance()); | |
214 args.push_oop(kind()); | |
215 args.push_long(value); | |
216 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstant_name(), vmSymbols::createCiConstant_signature(), &args, THREAD); | |
217 check_pending_exception("Error while calling createCiConstantFloat"); | |
218 return (oop) result.get_jobject(); | |
219 | |
220 } | |
221 | |
222 oop VMExits::createCiConstantFloat(jfloat value, TRAPS) { | |
223 JavaValue result(T_OBJECT); | |
224 JavaCallArguments args; | |
225 args.push_oop(instance()); | |
226 args.push_float(value); | |
227 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantFloat_name(), vmSymbols::createCiConstantFloat_signature(), &args, THREAD); | |
228 check_pending_exception("Error while calling createCiConstantFloat"); | |
229 return (oop) result.get_jobject(); | |
230 | |
231 } | |
232 | |
233 oop VMExits::createCiConstantDouble(jdouble value, TRAPS) { | |
234 JavaValue result(T_OBJECT); | |
235 JavaCallArguments args; | |
236 args.push_oop(instance()); | |
237 args.push_double(value); | |
238 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantDouble_name(), vmSymbols::createCiConstantDouble_signature(), &args, THREAD); | |
239 check_pending_exception("Error while calling createCiConstantDouble"); | |
240 return (oop) result.get_jobject(); | |
241 } | |
242 | |
243 oop VMExits::createCiConstantObject(Handle object, TRAPS) { | |
244 JavaValue result(T_OBJECT); | |
245 JavaCallArguments args; | |
246 /* | |
247 args.push_oop(instance()); | |
248 args.push_oop(object); | |
249 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantObject_name(), vmSymbols::createCiConstantObject_signature(), &args, THREAD); | |
250 check_pending_exception("Error while calling createCiConstantObject"); | |
251 */ | |
252 | |
253 | |
254 KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_sun_cri_ci_CiConstant(), SystemDictionary::java_system_loader(), NULL, Thread::current()); | |
255 JavaCalls::call_static(&result, klass(), vmSymbols::forObject_name(), vmSymbols::createCiConstantObject_signature(), object, THREAD); | |
256 check_pending_exception("Error while calling CiConstant.forObject"); | |
257 return (oop) result.get_jobject(); | |
258 } |