當前位置: 首頁>>代碼示例>>Java>>正文


Java AssumptionResult類代碼示例

本文整理匯總了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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:MethodCallTargetNode.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:LoadMethodNode.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:HotSpotReplacementsUtil.java

示例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
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:TestResolvedJavaType.java

示例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
        }
    }
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:23,代碼來源:TestResolvedJavaType.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:InliningData.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:RegisterFinalizerNode.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:FindUniqueDefaultMethodTest.java

示例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());

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:33,代碼來源:FindUniqueConcreteMethodBugTest.java

示例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));
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:HotSpotResolvedObjectTypeImpl.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:HotSpotResolvedObjectTypeImpl.java

示例12: AssumptionInlineInfo

import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入依賴的package包/類
public AssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, AssumptionResult<?> takenAssumption) {
    super(invoke, concrete);
    this.takenAssumption = takenAssumption;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:AssumptionInlineInfo.java

示例13: hasFinalizableSubclass

import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入依賴的package包/類
@Override
public AssumptionResult<Boolean> hasFinalizableSubclass() {
    return new AssumptionResult<>(false);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:HotSpotResolvedPrimitiveType.java

示例14: findLeafConcreteSubtype

import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入依賴的package包/類
@Override
public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
    return new AssumptionResult<>(this);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:HotSpotResolvedPrimitiveType.java

示例15: findUniqueConcreteMethod

import jdk.vm.ci.meta.Assumptions.AssumptionResult; //導入依賴的package包/類
@Override
public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
    return null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:HotSpotResolvedPrimitiveType.java


注:本文中的jdk.vm.ci.meta.Assumptions.AssumptionResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。