Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 7225:31c4d9f9e922
adder better CHA support
added more test cases for inlining and intrinsification
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Fri, 14 Dec 2012 12:05:35 +0100 |
parents | 720925633b3a |
children | 8a3efb8c831d |
comparison
equal
deleted
inserted
replaced
7224:fb16d8681ddc | 7225:31c4d9f9e922 |
---|---|
222 } | 222 } |
223 | 223 |
224 C2V_VMENTRY(jlong, getUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method, jobject resultHolder)) | 224 C2V_VMENTRY(jlong, getUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method, jobject resultHolder)) |
225 methodHandle method = asMethod(metaspace_method); | 225 methodHandle method = asMethod(metaspace_method); |
226 KlassHandle holder = method->method_holder(); | 226 KlassHandle holder = method->method_holder(); |
227 if (holder->is_interface()) { | 227 // TODO (chaeubl): check if the following is necessary |
228 // Cannot trust interfaces. Because of: | 228 //if (holder->is_interface()) { |
229 // interface I { void foo(); } | 229 // // Cannot trust interfaces. Because of: |
230 // class A { public void foo() {} } | 230 // // interface I { void foo(); } |
231 // class B extends A implements I { } | 231 // // class A { public void foo() {} } |
232 // class C extends B { public void foo() { } } | 232 // // class B extends A implements I { } |
233 // class D extends B { } | 233 // // class C extends B { public void foo() { } } |
234 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). | 234 // // class D extends B { } |
235 return 0L; | 235 // // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). |
236 } | 236 // return 0L; |
237 //} | |
237 methodHandle ucm; | 238 methodHandle ucm; |
238 { | 239 { |
239 ResourceMark rm; | 240 ResourceMark rm; |
240 MutexLocker locker(Compile_lock); | 241 MutexLocker locker(Compile_lock); |
241 ucm = Dependencies::find_unique_concrete_method(holder(), method()); | 242 ucm = Dependencies::find_unique_concrete_method(holder(), method()); |
246 } | 247 } |
247 | 248 |
248 Handle type = GraalCompiler::createHotSpotResolvedObjectType(ucm(), CHECK_0); | 249 Handle type = GraalCompiler::createHotSpotResolvedObjectType(ucm(), CHECK_0); |
249 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type()); | 250 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type()); |
250 return (jlong) (address) ucm(); | 251 return (jlong) (address) ucm(); |
252 C2V_END | |
253 | |
254 C2V_VMENTRY(jobject, getUniqueImplementor, (JNIEnv *, jobject, jobject interface_type)) | |
255 InstanceKlass* klass = (InstanceKlass*) asKlass(HotSpotResolvedObjectType::metaspaceKlass(interface_type)); | |
256 assert(klass->is_interface(), "must be"); | |
257 if (klass->nof_implementors() == 1) { | |
258 InstanceKlass* implementor = (InstanceKlass*) klass->implementor(); | |
259 if (!implementor->is_abstract() && !implementor->is_interface() && implementor->is_leaf_class()) { | |
260 Handle type = GraalCompiler::get_JavaType(implementor, CHECK_NULL); | |
261 return JNIHandles::make_local(THREAD, type()); | |
262 } | |
263 } | |
264 return NULL; | |
251 C2V_END | 265 C2V_END |
252 | 266 |
253 C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jlong metaspace_method)) | 267 C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jlong metaspace_method)) |
254 Method* method = asMethod(metaspace_method); | 268 Method* method = asMethod(metaspace_method); |
255 return method->invocation_count(); | 269 return method->invocation_count(); |
945 {CC"initializeBytecode", CC"("METASPACE_METHOD"[B)[B", FN_PTR(initializeBytecode)}, | 959 {CC"initializeBytecode", CC"("METASPACE_METHOD"[B)[B", FN_PTR(initializeBytecode)}, |
946 {CC"getSignature", CC"("METASPACE_METHOD")"STRING, FN_PTR(getSignature)}, | 960 {CC"getSignature", CC"("METASPACE_METHOD")"STRING, FN_PTR(getSignature)}, |
947 {CC"initializeExceptionHandlers", CC"("METASPACE_METHOD EXCEPTION_HANDLERS")"EXCEPTION_HANDLERS, FN_PTR(initializeExceptionHandlers)}, | 961 {CC"initializeExceptionHandlers", CC"("METASPACE_METHOD EXCEPTION_HANDLERS")"EXCEPTION_HANDLERS, FN_PTR(initializeExceptionHandlers)}, |
948 {CC"hasBalancedMonitors", CC"("METASPACE_METHOD")Z", FN_PTR(hasBalancedMonitors)}, | 962 {CC"hasBalancedMonitors", CC"("METASPACE_METHOD")Z", FN_PTR(hasBalancedMonitors)}, |
949 {CC"getUniqueConcreteMethod", CC"("METASPACE_METHOD"["HS_RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getUniqueConcreteMethod)}, | 963 {CC"getUniqueConcreteMethod", CC"("METASPACE_METHOD"["HS_RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getUniqueConcreteMethod)}, |
964 {CC"getUniqueImplementor", CC"("HS_RESOLVED_TYPE")"RESOLVED_TYPE, FN_PTR(getUniqueImplementor)}, | |
950 {CC"getStackTraceElement", CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, | 965 {CC"getStackTraceElement", CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, |
951 {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, | 966 {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, |
952 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, | 967 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, |
953 {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, | 968 {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, |
954 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)}, | 969 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)}, |