当前位置: 首页>>代码示例>>Java>>正文


Java AssumptionResult.canRecordTo方法代码示例

本文整理汇总了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;
}
 
开发者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: 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


注:本文中的jdk.vm.ci.meta.Assumptions.AssumptionResult.canRecordTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。