本文整理汇总了Java中jdk.vm.ci.meta.Assumptions.AssumptionResult.recordTo方法的典型用法代码示例。如果您正苦于以下问题:Java AssumptionResult.recordTo方法的具体用法?Java AssumptionResult.recordTo怎么用?Java AssumptionResult.recordTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.Assumptions.AssumptionResult
的用法示例。
在下文中一共展示了AssumptionResult.recordTo方法的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;
}