Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java @ 23741:6542cd8da2da
include VarHandle in signature polymorphic method test (JDK-8164214)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 23 Aug 2016 22:58:50 +0200 |
parents | ae27c683c128 |
children | d6bd0b9cd0b6 |
comparison
equal
deleted
inserted
replaced
23740:724fbad94ee3 | 23741:6542cd8da2da |
---|---|
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package jdk.vm.ci.meta; | 23 package jdk.vm.ci.meta; |
24 | 24 |
25 import java.lang.annotation.Annotation; | 25 import java.lang.annotation.Annotation; |
26 import java.lang.invoke.MethodHandle; | |
27 import java.lang.reflect.AnnotatedElement; | 26 import java.lang.reflect.AnnotatedElement; |
28 import java.lang.reflect.Array; | 27 import java.lang.reflect.Array; |
29 import java.lang.reflect.Method; | 28 import java.lang.reflect.Method; |
30 import java.lang.reflect.Modifier; | 29 import java.lang.reflect.Modifier; |
31 import java.lang.reflect.Type; | 30 import java.lang.reflect.Type; |
328 default boolean isJavaLangObjectInit() { | 327 default boolean isJavaLangObjectInit() { |
329 return getDeclaringClass().isJavaLangObject() && getName().equals("<init>"); | 328 return getDeclaringClass().isJavaLangObject() && getName().equals("<init>"); |
330 } | 329 } |
331 | 330 |
332 SpeculationLog getSpeculationLog(); | 331 SpeculationLog getSpeculationLog(); |
333 | |
334 /** | |
335 * Determines if the method identified by its holder and name is a | |
336 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature | |
337 * polymorphic</a> method. | |
338 */ | |
339 static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) { | |
340 if (!holder.getName().equals("Ljava/lang/invoke/MethodHandle;")) { | |
341 return false; | |
342 } | |
343 ResolvedJavaType methodHandleType = metaAccess.lookupJavaType(MethodHandle.class); | |
344 Signature signature = metaAccess.parseMethodDescriptor("([Ljava/lang/Object;)Ljava/lang/Object;"); | |
345 ResolvedJavaMethod method = methodHandleType.findMethod(name, signature); | |
346 if (method == null) { | |
347 return false; | |
348 } | |
349 return method.isNative() && method.isVarArgs(); | |
350 } | |
351 } | 332 } |