本文整理汇总了Java中jdk.vm.ci.meta.Assumptions.AssumptionResult类的典型用法代码示例。如果您正苦于以下问题:Java AssumptionResult类的具体用法?Java AssumptionResult怎么用?Java AssumptionResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssumptionResult类属于jdk.vm.ci.meta.Assumptions包,在下文中一共展示了AssumptionResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: checkConcreteSubtype
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
void checkConcreteSubtype(ResolvedJavaType type, ResolvedJavaType expected) {
AssumptionResult<ResolvedJavaType> leafConcreteSubtype = type.findLeafConcreteSubtype();
if (leafConcreteSubtype == null) {
// findLeafConcreteSubtype() is conservative
} else {
if (expected == null) {
assertNull(leafConcreteSubtype);
} else {
assertTrue(leafConcreteSubtype.getResult().equals(expected));
}
assertTrue(!type.isLeaf() || leafConcreteSubtype.isAssumptionFree());
}
if (!type.isArray()) {
ResolvedJavaType arrayType = type.getArrayClass();
AssumptionResult<ResolvedJavaType> arraySubtype = arrayType.findLeafConcreteSubtype();
if (arraySubtype != null) {
assertEquals(arraySubtype.getResult(), arrayType);
} else {
// findLeafConcreteSubtype() method is conservative
}
}
}
示例5: checkConcreteSubtype
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
void checkConcreteSubtype(ResolvedJavaType type, ResolvedJavaType expected) {
AssumptionResult<ResolvedJavaType> leafConcreteSubtype = type.findLeafConcreteSubtype();
if (leafConcreteSubtype == null) {
// findLeafConcreteSubtype() is conservative
} else {
if (expected == null) {
assertNull(leafConcreteSubtype);
} else {
assertTrue(leafConcreteSubtype.getResult().equals(expected));
}
}
if (!type.isArray()) {
ResolvedJavaType arrayType = type.getArrayClass();
AssumptionResult<ResolvedJavaType> arraySubtype = arrayType.findLeafConcreteSubtype();
if (arraySubtype != null) {
assertEquals(arraySubtype.getResult(), arrayType);
} else {
// findLeafConcreteSubtype() method is conservative
}
}
}
示例6: getAssumptionInlineInfo
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
private InlineInfo getAssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, AssumptionResult<?> takenAssumption) {
assert concrete.isConcrete();
if (checkTargetConditions(invoke, concrete)) {
return new AssumptionInlineInfo(invoke, concrete, takenAssumption);
}
return null;
}
示例7: 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;
}
示例8: testFindUnique
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
/**
* HotSpot has an internal mismatch with CHA and default methods. The initial query says that
* it's a unique method but the verification code that ensures that a dependence of this kind
* would pass will fail an assert in debug mode.
*/
@Test
public void testFindUnique() {
ResolvedJavaType cType = getMetaAccess().lookupJavaType(Implementor1.class);
cType.initialize();
ResolvedJavaMethod v1Method = getMetaAccess().lookupJavaMethod(this.getMethod(Interface1.class, "v1"));
AssumptionResult<ResolvedJavaMethod> method = cType.findUniqueConcreteMethod(v1Method);
assertDeepEquals(null, method);
}
示例9: test
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
/**
* Executing {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)} for the
* method {@link Person#getName()} on the type {@link AbstractPerson} should return null as both
* {@link PersonImpl} and {@link TenantImpl} provide implementations (namely
* {@link PersonImpl#getName()} and {@link Tenant#getName()}).
*/
@Test
@Ignore("fix HotSpotResolvedObjectTypeImpl.findUniqueConcreteMethod")
public void test() throws NoSuchMethodException {
ResolvedJavaMethod ifaceMethod = getMetaAccess().lookupJavaMethod(Person.class.getDeclaredMethod("getName"));
PersonImpl person = new PersonImpl("maya");
TenantImpl tenant = new TenantImpl(0xdeadbeef);
// Ensure the relevant methods are linked
person.getName();
tenant.getName();
for (int i = 0; i < ITERATIONS; i++) {
getLabelLength(person);
getLabelLength(tenant);
}
// Until HotSpotResolvedObjectTypeImpl.findUniqueConcreteMethod is fixed,
// this causes a VM crash as getLabelLength() directly invokes PersonImpl.getName().
test("getLabelLength", tenant);
ResolvedJavaMethod expected = null;
AssumptionResult<ResolvedJavaMethod> actual = getMetaAccess().lookupJavaType(AbstractPerson.class).findUniqueConcreteMethod(ifaceMethod);
Assert.assertEquals(expected, actual.getResult());
}
示例10: concreteSubtype
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
private AssumptionResult<ResolvedJavaType> concreteSubtype(HotSpotResolvedObjectTypeImpl type) {
if (type.isLeaf()) {
return new AssumptionResult<>(type, new ConcreteSubtype(this, type));
} else {
return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type));
}
}
示例11: hasFinalizableSubclass
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
@Override
public AssumptionResult<Boolean> hasFinalizableSubclass() {
assert !isArray();
if (!compilerToVM().hasFinalizableSubclass(this)) {
return new AssumptionResult<>(false, new NoFinalizableSubclass(this));
}
return new AssumptionResult<>(true);
}
示例12: AssumptionInlineInfo
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
public AssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, AssumptionResult<?> takenAssumption) {
super(invoke, concrete);
this.takenAssumption = takenAssumption;
}
示例13: hasFinalizableSubclass
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
@Override
public AssumptionResult<Boolean> hasFinalizableSubclass() {
return new AssumptionResult<>(false);
}
示例14: findLeafConcreteSubtype
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
@Override
public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
return new AssumptionResult<>(this);
}
示例15: findUniqueConcreteMethod
import jdk.vm.ci.meta.Assumptions.AssumptionResult; //导入依赖的package包/类
@Override
public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
return null;
}