comparison src/share/vm/graal/graalVMToCompiler.cpp @ 5278:74dfa6f86879

removed last remaining references to vmEntries and vmExits
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 24 Apr 2012 13:04:43 +0200
parents af59b4dfc9e4
children 35753b8c098a
comparison
equal deleted inserted replaced
5277:1767613f8a4a 5278:74dfa6f86879
24 #include "precompiled.hpp" 24 #include "precompiled.hpp"
25 #include "graal/graalVMToCompiler.hpp" 25 #include "graal/graalVMToCompiler.hpp"
26 26
27 // this is a *global* handle 27 // this is a *global* handle
28 jobject VMToCompiler::_compilerPermObject = NULL; 28 jobject VMToCompiler::_compilerPermObject = NULL;
29 jobject VMToCompiler::_vmExitsPermObject = NULL; 29 jobject VMToCompiler::_vmToCompilerPermObject = NULL;
30 jobject VMToCompiler::_vmExitsPermKlass = NULL; 30 jobject VMToCompiler::_vmToCompilerPermKlass = NULL;
31 31
32 KlassHandle VMToCompiler::vmExitsKlass() { 32 KlassHandle VMToCompiler::vmToCompilerKlass() {
33 if (JNIHandles::resolve(_vmExitsPermKlass) == NULL) { 33 if (JNIHandles::resolve(_vmToCompilerPermKlass) == NULL) {
34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_bridge_VMToCompiler(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 34 klassOop result = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_bridge_VMToCompiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
35 check_not_null(result, "Couldn't find class com.oracle.graal.hotspot.bridge.VMToCompiler"); 35 check_not_null(result, "Couldn't find class com.oracle.graal.hotspot.bridge.VMToCompiler");
36 _vmExitsPermKlass = JNIHandles::make_global(result); 36 _vmToCompilerPermKlass = JNIHandles::make_global(result);
37 } 37 }
38 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmExitsPermKlass)); 38 return KlassHandle((klassOop)JNIHandles::resolve_non_null(_vmToCompilerPermKlass));
39 } 39 }
40 40
41 Handle VMToCompiler::compilerInstance() { 41 Handle VMToCompiler::compilerInstance() {
42 if (JNIHandles::resolve(_compilerPermObject) == NULL) { 42 if (JNIHandles::resolve(_compilerPermObject) == NULL) {
43 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 43 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current());
50 } 50 }
51 return Handle(JNIHandles::resolve_non_null(_compilerPermObject)); 51 return Handle(JNIHandles::resolve_non_null(_compilerPermObject));
52 } 52 }
53 53
54 Handle VMToCompiler::instance() { 54 Handle VMToCompiler::instance() {
55 if (JNIHandles::resolve(_vmExitsPermObject) == NULL) { 55 if (JNIHandles::resolve(_vmToCompilerPermObject) == NULL) {
56 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 56 KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_Compiler(), SystemDictionary::java_system_loader(), NULL, Thread::current());
57 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.Compiler"); 57 check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.Compiler");
58 58
59 JavaValue result(T_OBJECT); 59 JavaValue result(T_OBJECT);
60 JavaCallArguments args; 60 JavaCallArguments args;
61 args.set_receiver(compilerInstance()); 61 args.set_receiver(compilerInstance());
62 JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMExits_name(), vmSymbols::getVMExits_signature(), &args, Thread::current()); 62 JavaCalls::call_interface(&result, compilerKlass, vmSymbols::getVMToCompiler_name(), vmSymbols::getVMToCompiler_signature(), &args, Thread::current());
63 check_pending_exception("Couldn't get VMExits"); 63 check_pending_exception("Couldn't get VMToCompiler");
64 _vmExitsPermObject = JNIHandles::make_global((oop) result.get_jobject()); 64 _vmToCompilerPermObject = JNIHandles::make_global((oop) result.get_jobject());
65 } 65 }
66 return Handle(JNIHandles::resolve_non_null(_vmExitsPermObject)); 66 return Handle(JNIHandles::resolve_non_null(_vmToCompilerPermObject));
67 } 67 }
68 68
69 void VMToCompiler::initializeCompiler() { 69 void VMToCompiler::initializeCompiler() {
70 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); 70 KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current());
71 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.CompilerImpl"); 71 check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.CompilerImpl");
105 args.push_oop(instance()); 105 args.push_oop(instance());
106 args.push_oop(hotspot_method); 106 args.push_oop(hotspot_method);
107 args.push_int(entry_bci); 107 args.push_int(entry_bci);
108 args.push_int(blocking); 108 args.push_int(blocking);
109 args.push_int(priority); 109 args.push_int(priority);
110 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD); 110 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
111 check_pending_exception("Error while calling compileMethod"); 111 check_pending_exception("Error while calling compileMethod");
112 return result.get_jboolean(); 112 return result.get_jboolean();
113 } 113 }
114 114
115 void VMToCompiler::shutdownCompiler() { 115 void VMToCompiler::shutdownCompiler() {
117 HandleMark hm; 117 HandleMark hm;
118 JavaThread* THREAD = JavaThread::current(); 118 JavaThread* THREAD = JavaThread::current();
119 JavaValue result(T_VOID); 119 JavaValue result(T_VOID);
120 JavaCallArguments args; 120 JavaCallArguments args;
121 args.push_oop(instance()); 121 args.push_oop(instance());
122 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::shutdownCompiler_name(), vmSymbols::void_method_signature(), &args, THREAD); 122 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::shutdownCompiler_name(), vmSymbols::void_method_signature(), &args, THREAD);
123 check_pending_exception("Error while calling shutdownCompiler"); 123 check_pending_exception("Error while calling shutdownCompiler");
124 124
125 JNIHandles::destroy_global(_compilerPermObject); 125 JNIHandles::destroy_global(_compilerPermObject);
126 JNIHandles::destroy_global(_vmExitsPermObject); 126 JNIHandles::destroy_global(_vmToCompilerPermObject);
127 JNIHandles::destroy_global(_vmExitsPermKlass); 127 JNIHandles::destroy_global(_vmToCompilerPermKlass);
128 128
129 _compilerPermObject = NULL; 129 _compilerPermObject = NULL;
130 _vmExitsPermObject = NULL; 130 _vmToCompilerPermObject = NULL;
131 _vmExitsPermKlass = NULL; 131 _vmToCompilerPermKlass = NULL;
132 } 132 }
133 } 133 }
134 134
135 void VMToCompiler::startCompiler() { 135 void VMToCompiler::startCompiler() {
136 JavaThread* THREAD = JavaThread::current(); 136 JavaThread* THREAD = JavaThread::current();
137 JavaValue result(T_VOID); 137 JavaValue result(T_VOID);
138 JavaCallArguments args; 138 JavaCallArguments args;
139 args.push_oop(instance()); 139 args.push_oop(instance());
140 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::startCompiler_name(), vmSymbols::void_method_signature(), &args, THREAD); 140 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::startCompiler_name(), vmSymbols::void_method_signature(), &args, THREAD);
141 check_pending_exception("Error while calling startCompiler"); 141 check_pending_exception("Error while calling startCompiler");
142 } 142 }
143 143
144 void VMToCompiler::bootstrap() { 144 void VMToCompiler::bootstrap() {
145 JavaThread* THREAD = JavaThread::current(); 145 JavaThread* THREAD = JavaThread::current();
146 JavaValue result(T_VOID); 146 JavaValue result(T_VOID);
147 JavaCallArguments args; 147 JavaCallArguments args;
148 args.push_oop(instance()); 148 args.push_oop(instance());
149 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::bootstrap_name(), vmSymbols::void_method_signature(), &args, THREAD); 149 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::bootstrap_name(), vmSymbols::void_method_signature(), &args, THREAD);
150 check_pending_exception("Error while calling boostrap"); 150 check_pending_exception("Error while calling boostrap");
151 } 151 }
152 152
153 oop VMToCompiler::createRiMethodResolved(jlong vmId, Handle name, TRAPS) { 153 oop VMToCompiler::createRiMethodResolved(jlong vmId, Handle name, TRAPS) {
154 assert(!name.is_null(), "just checking"); 154 assert(!name.is_null(), "just checking");
155 JavaValue result(T_OBJECT); 155 JavaValue result(T_OBJECT);
156 JavaCallArguments args; 156 JavaCallArguments args;
157 args.push_oop(instance()); 157 args.push_oop(instance());
158 args.push_long(vmId); 158 args.push_long(vmId);
159 args.push_oop(name); 159 args.push_oop(name);
160 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodResolved_name(), vmSymbols::createRiMethodResolved_signature(), &args, THREAD); 160 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiMethodResolved_name(), vmSymbols::createRiMethodResolved_signature(), &args, THREAD);
161 check_pending_exception("Error while calling createRiMethodResolved"); 161 check_pending_exception("Error while calling createRiMethodResolved");
162 return (oop) result.get_jobject(); 162 return (oop) result.get_jobject();
163 } 163 }
164 164
165 oop VMToCompiler::createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS) { 165 oop VMToCompiler::createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS) {
168 JavaCallArguments args; 168 JavaCallArguments args;
169 args.push_oop(instance()); 169 args.push_oop(instance());
170 args.push_oop(name); 170 args.push_oop(name);
171 args.push_oop(signature); 171 args.push_oop(signature);
172 args.push_oop(holder); 172 args.push_oop(holder);
173 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiMethodUnresolved_name(), vmSymbols::createRiMethodUnresolved_signature(), &args, THREAD); 173 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiMethodUnresolved_name(), vmSymbols::createRiMethodUnresolved_signature(), &args, THREAD);
174 check_pending_exception("Error while calling createRiMethodUnresolved"); 174 check_pending_exception("Error while calling createRiMethodUnresolved");
175 return (oop) result.get_jobject(); 175 return (oop) result.get_jobject();
176 } 176 }
177 177
178 oop VMToCompiler::createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS) { 178 oop VMToCompiler::createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS) {
185 args.push_oop(holder); 185 args.push_oop(holder);
186 args.push_oop(name); 186 args.push_oop(name);
187 args.push_oop(type); 187 args.push_oop(type);
188 args.push_int(index); 188 args.push_int(index);
189 args.push_int(flags); 189 args.push_int(flags);
190 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiField_name(), vmSymbols::createRiField_signature(), &args, THREAD); 190 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiField_name(), vmSymbols::createRiField_signature(), &args, THREAD);
191 check_pending_exception("Error while calling createRiField"); 191 check_pending_exception("Error while calling createRiField");
192 assert(result.get_type() == T_OBJECT, "just checking"); 192 assert(result.get_type() == T_OBJECT, "just checking");
193 return (oop) result.get_jobject(); 193 return (oop) result.get_jobject();
194 } 194 }
195 195
198 JavaValue result(T_OBJECT); 198 JavaValue result(T_OBJECT);
199 JavaCallArguments args; 199 JavaCallArguments args;
200 args.push_oop(instance()); 200 args.push_oop(instance());
201 args.push_long(vmId); 201 args.push_long(vmId);
202 args.push_oop(name); 202 args.push_oop(name);
203 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiType_name(), vmSymbols::createRiType_signature(), &args, THREAD); 203 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiType_name(), vmSymbols::createRiType_signature(), &args, THREAD);
204 check_pending_exception("Error while calling createRiType"); 204 check_pending_exception("Error while calling createRiType");
205 return (oop) result.get_jobject(); 205 return (oop) result.get_jobject();
206 } 206 }
207 207
208 oop VMToCompiler::createRiTypePrimitive(int basic_type, TRAPS) { 208 oop VMToCompiler::createRiTypePrimitive(int basic_type, TRAPS) {
209 JavaValue result(T_OBJECT); 209 JavaValue result(T_OBJECT);
210 JavaCallArguments args; 210 JavaCallArguments args;
211 args.push_oop(instance()); 211 args.push_oop(instance());
212 args.push_int(basic_type); 212 args.push_int(basic_type);
213 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypePrimitive_name(), vmSymbols::createRiTypePrimitive_signature(), &args, THREAD); 213 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiTypePrimitive_name(), vmSymbols::createRiTypePrimitive_signature(), &args, THREAD);
214 check_pending_exception("Error while calling createRiTypePrimitive"); 214 check_pending_exception("Error while calling createRiTypePrimitive");
215 return (oop) result.get_jobject(); 215 return (oop) result.get_jobject();
216 } 216 }
217 217
218 oop VMToCompiler::createRiTypeUnresolved(Handle name, TRAPS) { 218 oop VMToCompiler::createRiTypeUnresolved(Handle name, TRAPS) {
219 assert(!name.is_null(), "just checking"); 219 assert(!name.is_null(), "just checking");
220 JavaValue result(T_OBJECT); 220 JavaValue result(T_OBJECT);
221 JavaCallArguments args; 221 JavaCallArguments args;
222 args.push_oop(instance()); 222 args.push_oop(instance());
223 args.push_oop(name); 223 args.push_oop(name);
224 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiTypeUnresolved_name(), vmSymbols::createRiTypeUnresolved_signature(), &args, THREAD); 224 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiTypeUnresolved_name(), vmSymbols::createRiTypeUnresolved_signature(), &args, THREAD);
225 check_pending_exception("Error while calling createRiTypeUnresolved"); 225 check_pending_exception("Error while calling createRiTypeUnresolved");
226 return (oop) result.get_jobject(); 226 return (oop) result.get_jobject();
227 } 227 }
228 228
229 oop VMToCompiler::createRiSignature(Handle name, TRAPS) { 229 oop VMToCompiler::createRiSignature(Handle name, TRAPS) {
230 assert(!name.is_null(), "just checking"); 230 assert(!name.is_null(), "just checking");
231 JavaValue result(T_OBJECT); 231 JavaValue result(T_OBJECT);
232 JavaCallArguments args; 232 JavaCallArguments args;
233 args.push_oop(instance()); 233 args.push_oop(instance());
234 args.push_oop(name); 234 args.push_oop(name);
235 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createRiSignature_name(), vmSymbols::createRiSignature_signature(), &args, THREAD); 235 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiSignature_name(), vmSymbols::createRiSignature_signature(), &args, THREAD);
236 check_pending_exception("Error while calling createRiSignature"); 236 check_pending_exception("Error while calling createRiSignature");
237 return (oop) result.get_jobject(); 237 return (oop) result.get_jobject();
238 } 238 }
239 239
240 oop VMToCompiler::createCiConstant(Handle kind, jlong value, TRAPS) { 240 oop VMToCompiler::createCiConstant(Handle kind, jlong value, TRAPS) {
241 JavaValue result(T_OBJECT); 241 JavaValue result(T_OBJECT);
242 JavaCallArguments args; 242 JavaCallArguments args;
243 args.push_oop(instance()); 243 args.push_oop(instance());
244 args.push_oop(kind()); 244 args.push_oop(kind());
245 args.push_long(value); 245 args.push_long(value);
246 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstant_name(), vmSymbols::createCiConstant_signature(), &args, THREAD); 246 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstant_name(), vmSymbols::createCiConstant_signature(), &args, THREAD);
247 check_pending_exception("Error while calling createCiConstantFloat"); 247 check_pending_exception("Error while calling createCiConstantFloat");
248 return (oop) result.get_jobject(); 248 return (oop) result.get_jobject();
249 249
250 } 250 }
251 251
252 oop VMToCompiler::createCiConstantFloat(jfloat value, TRAPS) { 252 oop VMToCompiler::createCiConstantFloat(jfloat value, TRAPS) {
253 JavaValue result(T_OBJECT); 253 JavaValue result(T_OBJECT);
254 JavaCallArguments args; 254 JavaCallArguments args;
255 args.push_oop(instance()); 255 args.push_oop(instance());
256 args.push_float(value); 256 args.push_float(value);
257 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantFloat_name(), vmSymbols::createCiConstantFloat_signature(), &args, THREAD); 257 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstantFloat_name(), vmSymbols::createCiConstantFloat_signature(), &args, THREAD);
258 check_pending_exception("Error while calling createCiConstantFloat"); 258 check_pending_exception("Error while calling createCiConstantFloat");
259 return (oop) result.get_jobject(); 259 return (oop) result.get_jobject();
260 260
261 } 261 }
262 262
263 oop VMToCompiler::createCiConstantDouble(jdouble value, TRAPS) { 263 oop VMToCompiler::createCiConstantDouble(jdouble value, TRAPS) {
264 JavaValue result(T_OBJECT); 264 JavaValue result(T_OBJECT);
265 JavaCallArguments args; 265 JavaCallArguments args;
266 args.push_oop(instance()); 266 args.push_oop(instance());
267 args.push_double(value); 267 args.push_double(value);
268 JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::createCiConstantDouble_name(), vmSymbols::createCiConstantDouble_signature(), &args, THREAD); 268 JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstantDouble_name(), vmSymbols::createCiConstantDouble_signature(), &args, THREAD);
269 check_pending_exception("Error while calling createCiConstantDouble"); 269 check_pending_exception("Error while calling createCiConstantDouble");
270 return (oop) result.get_jobject(); 270 return (oop) result.get_jobject();
271 } 271 }
272 272
273 oop VMToCompiler::createCiConstantObject(Handle object, TRAPS) { 273 oop VMToCompiler::createCiConstantObject(Handle object, TRAPS) {