本文整理匯總了Java中jdk.vm.ci.meta.Assumptions.AssumptionResult.canRecordTo方法的典型用法代碼示例。如果您正苦於以下問題:Java AssumptionResult.canRecordTo方法的具體用法?Java AssumptionResult.canRecordTo怎麽用?Java AssumptionResult.canRecordTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jdk.vm.ci.meta.Assumptions.AssumptionResult
的用法示例。
在下文中一共展示了AssumptionResult.canRecordTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: devirtualizeCall
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入方法依賴的package包/類
public static ResolvedJavaMethod devirtualizeCall(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ResolvedJavaType contextType, Assumptions assumptions, Stamp receiverStamp) {
TypeReference type = StampTool.typeReferenceOrNull(receiverStamp);
if (type == null && invokeKind == InvokeKind.Virtual) {
// For virtual calls, we are guaranteed to receive a correct receiver type.
type = TypeReference.createTrusted(assumptions, targetMethod.getDeclaringClass());
}
if (type != null) {
/*
* either the holder class is exact, or the receiver object has an exact type, or it's
* an array type
*/
ResolvedJavaMethod resolvedMethod = type.getType().resolveConcreteMethod(targetMethod, contextType);
if (resolvedMethod != null && (resolvedMethod.canBeStaticallyBound() || type.isExact() || type.getType().isArray())) {
return resolvedMethod;
}
AssumptionResult<ResolvedJavaMethod> uniqueConcreteMethod = type.getType().findUniqueConcreteMethod(targetMethod);
if (uniqueConcreteMethod != null && uniqueConcreteMethod.canRecordTo(assumptions)) {
uniqueConcreteMethod.recordTo(assumptions);
return uniqueConcreteMethod.getResult();
}
}
return null;
}
示例2: canonical
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入方法依賴的package包/類
@Override
public Node canonical(CanonicalizerTool tool) {
if (hub instanceof LoadHubNode) {
ValueNode object = ((LoadHubNode) hub).getValue();
TypeReference type = StampTool.typeReferenceOrNull(object);
if (type != null) {
if (type.isExact()) {
return resolveExactMethod(tool, type.getType());
}
Assumptions assumptions = graph().getAssumptions();
AssumptionResult<ResolvedJavaMethod> resolvedMethod = type.getType().findUniqueConcreteMethod(method);
if (resolvedMethod != null && resolvedMethod.canRecordTo(assumptions) && !type.getType().isInterface() && method.getDeclaringClass().isAssignableFrom(type.getType())) {
resolvedMethod.recordTo(assumptions);
return ConstantNode.forConstant(stamp(), resolvedMethod.getResult().getEncoding(), tool.getMetaAccess());
}
}
}
if (hub.isConstant()) {
return resolveExactMethod(tool, tool.getConstantReflection().asJavaType(hub.asConstant()));
}
return this;
}
示例3: canonicalizeRead
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入方法依賴的package包/類
@Override
public ValueNode canonicalizeRead(ValueNode read, AddressNode location, ValueNode object, CanonicalizerTool tool) {
ValueNode javaObject = findReadHub(object);
if (javaObject != null) {
ResolvedJavaType type = StampTool.typeOrNull(javaObject);
if (type != null && type.isArray()) {
ResolvedJavaType element = type.getComponentType();
if (element != null && !element.isPrimitive() && !element.getElementalType().isInterface()) {
Assumptions assumptions = object.graph().getAssumptions();
AssumptionResult<ResolvedJavaType> leafType = element.findLeafConcreteSubtype();
if (leafType != null && leafType.canRecordTo(assumptions)) {
leafType.recordTo(assumptions);
return ConstantNode.forConstant(read.stamp(), tool.getConstantReflection().asObjectHub(leafType.getResult()), tool.getMetaAccess());
}
}
}
}
return read;
}
示例4: mayHaveFinalizer
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入方法依賴的package包/類
/**
* Determines if the compiler should emit code to test whether a given object has a finalizer
* that must be registered with the runtime upon object initialization.
*/
public static boolean mayHaveFinalizer(ValueNode object, Assumptions assumptions) {
ObjectStamp objectStamp = (ObjectStamp) object.stamp();
if (objectStamp.isExactType()) {
return objectStamp.type().hasFinalizer();
} else if (objectStamp.type() != null) {
AssumptionResult<Boolean> result = objectStamp.type().hasFinalizableSubclass();
if (result.canRecordTo(assumptions)) {
result.recordTo(assumptions);
return result.getResult();
}
}
return true;
}