本文整理匯總了Java中jdk.vm.ci.meta.ResolvedJavaMethod.getDeclaringClass方法的典型用法代碼示例。如果您正苦於以下問題:Java ResolvedJavaMethod.getDeclaringClass方法的具體用法?Java ResolvedJavaMethod.getDeclaringClass怎麽用?Java ResolvedJavaMethod.getDeclaringClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jdk.vm.ci.meta.ResolvedJavaMethod
的用法示例。
在下文中一共展示了ResolvedJavaMethod.getDeclaringClass方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldCompileMethod
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
boolean shouldCompileMethod(ResolvedJavaMethod method) {
// NodeIntrinsics cannot be compiled.
if (hasExcludedAnnotation(method)) {
return false;
}
ResolvedJavaType declaringClass = method.getDeclaringClass();
// Check for special magical types in the signature, like Word or MetaspacePointer. Those
// are definitely snippets.
List<ResolvedJavaType> signatureTypes = Arrays.asList(method.toParameterTypes()).stream().map(p -> p.resolve(declaringClass)).collect(Collectors.toList());
signatureTypes.add(method.getSignature().getReturnType(null).resolve(declaringClass));
if (signatureTypes.stream().flatMap(t -> specialArgumentAndReturnTypes.stream().filter(s -> s.isAssignableFrom(t))).findAny().isPresent()) {
return false;
}
return true;
}
示例2: createParameterStamps
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
public static Stamp[] createParameterStamps(Assumptions assumptions, ResolvedJavaMethod method) {
Signature sig = method.getSignature();
Stamp[] result = new Stamp[sig.getParameterCount(!method.isStatic())];
int index = 0;
if (!method.isStatic()) {
result[index++] = StampFactory.objectNonNull(TypeReference.create(assumptions, method.getDeclaringClass()));
}
int max = sig.getParameterCount(false);
ResolvedJavaType accessingClass = method.getDeclaringClass();
for (int i = 0; i < max; i++) {
JavaType type = sig.getParameterType(i, accessingClass);
JavaKind kind = type.getJavaKind();
Stamp stamp;
if (kind == JavaKind.Object && type instanceof ResolvedJavaType) {
stamp = StampFactory.object(TypeReference.create(assumptions, (ResolvedJavaType) type));
} else {
stamp = StampFactory.forKind(kind);
}
result[index++] = stamp;
}
return result;
}
示例3: genInvokeStatic
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected void genInvokeStatic(JavaMethod target) {
if (callTargetIsResolved(target)) {
ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target;
ResolvedJavaType holder = resolvedTarget.getDeclaringClass();
if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue(options)) {
handleUnresolvedInvoke(target, InvokeKind.Static);
} else {
ValueNode classInit = null;
ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedTarget.getDeclaringClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInit = classInitializationPlugin.apply(this, resolvedTarget.getDeclaringClass(), stateBefore);
}
ValueNode[] args = frameState.popArguments(resolvedTarget.getSignature().getParameterCount(false));
Invoke invoke = appendInvoke(InvokeKind.Static, resolvedTarget, args);
if (invoke != null) {
invoke.setClassInit(classInit);
}
}
} else {
handleUnresolvedInvoke(target, InvokeKind.Static);
}
}
示例4: shouldApply
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Override
public boolean shouldApply(GraphBuilderContext builder, ResolvedJavaType type) {
if (!builder.parsingIntrinsic()) {
if (!type.isArray()) {
ResolvedJavaMethod method = builder.getGraph().method();
ResolvedJavaType methodHolder = method.getDeclaringClass();
// We can elide initialization nodes if type >=: methodHolder.
// The type is already initialized by either "new" or "invokestatic".
// Emit initialization node if type is an interface since:
// JLS 12.4: Before a class is initialized, its direct superclass must be
// initialized, but interfaces implemented by the class are not
// initialized and a class or interface type T will be initialized
// immediately before the first occurrence of accesses listed
// in JLS 12.4.1.
return !type.isAssignableFrom(methodHolder) || type.isInterface();
} else if (!type.getComponentType().isPrimitive()) {
// Always apply to object array types
return true;
}
}
return false;
}
示例5: getCallingConvention
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Create a calling convention from a {@link ResolvedJavaMethod}.
*/
public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, ValueKindFactory<?> valueKindFactory) {
Signature sig = method.getSignature();
JavaType retType = sig.getReturnType(null);
int sigCount = sig.getParameterCount(false);
JavaType[] argTypes;
int argIndex = 0;
if (!method.isStatic()) {
argTypes = new JavaType[sigCount + 1];
argTypes[argIndex++] = method.getDeclaringClass();
} else {
argTypes = new JavaType[sigCount];
}
for (int i = 0; i < sigCount; i++) {
argTypes[argIndex++] = sig.getParameterType(i, null);
}
RegisterConfig registerConfig = codeCache.getRegisterConfig();
return registerConfig.getCallingConvention(type, retType, argTypes, valueKindFactory);
}
示例6: signatureEquals
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
public boolean signatureEquals(ResolvedJavaMethod m) {
Signature s = m.getSignature();
ResolvedJavaType declaringClass = m.getDeclaringClass();
if (!s.getReturnType(declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(returnType))) {
return false;
}
if (s.getParameterCount(false) != parameterTypes.length) {
return false;
}
for (int i = 0; i < parameterTypes.length; i++) {
if (!s.getParameterType(i, declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(parameterTypes[i]))) {
return false;
}
}
return true;
}
示例7: getContextType
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Returns the {@linkplain ResolvedJavaType type} from which this invoke is executed. This is
* the declaring type of the caller method.
*
* @return the type from which this invoke is executed.
*/
default ResolvedJavaType getContextType() {
ResolvedJavaMethod contextMethod = getContextMethod();
if (contextMethod == null) {
return null;
}
return contextMethod.getDeclaringClass();
}
示例8: shouldVerifyEquals
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
private static boolean shouldVerifyEquals(ResolvedJavaMethod m) {
if (m.getName().equals("identityEquals")) {
ResolvedJavaType c = m.getDeclaringClass();
if (c.getName().equals("Ljdk/vm/ci/meta/AbstractValue;") || c.getName().equals("jdk/vm/ci/meta/Value")) {
return false;
}
}
return true;
}
示例9: callTargetIsResolved
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
/**
* Ensure that concrete classes are at least linked before generating an invoke. Interfaces may
* never be linked so simply return true for them.
*
* @param target
* @return true if the declared holder is an interface or is linked
*/
private static boolean callTargetIsResolved(JavaMethod target) {
if (target instanceof ResolvedJavaMethod) {
ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target;
ResolvedJavaType resolvedType = resolvedTarget.getDeclaringClass();
return resolvedType.isInterface() || resolvedType.isLinked();
}
return false;
}
示例10: verify
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
final ResolvedJavaType[] bailoutType = new ResolvedJavaType[FORBIDDEN_INSTANCE_OF_CHECKS.length];
for (int i = 0; i < FORBIDDEN_INSTANCE_OF_CHECKS.length; i++) {
bailoutType[i] = context.getMetaAccess().lookupJavaType(FORBIDDEN_INSTANCE_OF_CHECKS[i]);
}
ResolvedJavaMethod method = graph.method();
ResolvedJavaType declaringClass = method.getDeclaringClass();
if (!isTrustedInterface(declaringClass, context.getMetaAccess())) {
for (InstanceOfNode io : graph.getNodes().filter(InstanceOfNode.class)) {
ResolvedJavaType type = io.type().getType();
for (ResolvedJavaType forbiddenType : bailoutType) {
if (forbiddenType.equals(type)) {
String name = forbiddenType.getUnqualifiedName();
// strip outer class
ResolvedJavaType enclosingType = forbiddenType.getEnclosingType();
if (enclosingType != null) {
name = name.substring(enclosingType.getUnqualifiedName().length() + "$".length());
}
throw new VerificationError("Using `op instanceof %s` is not allowed. Use `%s.is%s(op)` instead. (in %s)", name, name, name, method.format("%H.%n(%p)"));
}
}
}
}
return true;
}
示例11: methodDeclaringClass
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Override
public Object methodDeclaringClass(ResolvedJavaMethod method) {
return method.getDeclaringClass();
}
示例12: get
import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
InvocationPlugin get(ResolvedJavaMethod method) {
if (resolvedRegistrations != null) {
return resolvedRegistrations.get(method);
} else {
if (!method.isBridge()) {
ResolvedJavaType declaringClass = method.getDeclaringClass();
flushDeferrables();
String internalName = declaringClass.getName();
ClassPlugins classPlugins = registrations.get(internalName);
InvocationPlugin res = null;
if (classPlugins != null) {
res = classPlugins.get(method);
}
if (res == null) {
LateClassPlugins lcp = findLateClassPlugins(internalName);
if (lcp != null) {
res = lcp.get(method);
}
}
if (res != null) {
if (canBeIntrinsified(declaringClass)) {
return res;
}
}
if (testExtensions != null) {
// Avoid the synchronization in the common case that there
// are no test extensions.
synchronized (this) {
if (testExtensions != null) {
List<Binding> bindings = testExtensions.get(internalName);
if (bindings != null) {
String name = method.getName();
String descriptor = method.getSignature().toMethodDescriptor();
for (Binding b : bindings) {
if (b.isStatic == method.isStatic() &&
b.name.equals(name) &&
descriptor.startsWith(b.argumentsDescriptor)) {
return b.plugin;
}
}
}
}
}
}
} else {
// Supporting plugins for bridge methods would require including
// the return type in the registered signature. Until needed,
// this extra complexity is best avoided.
}
}
return null;
}