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


Java MetaAccessProvider类代码示例

本文整理汇总了Java中jdk.vm.ci.meta.MetaAccessProvider的典型用法代码示例。如果您正苦于以下问题:Java MetaAccessProvider类的具体用法?Java MetaAccessProvider怎么用?Java MetaAccessProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetaAccessProvider类属于jdk.vm.ci.meta包,在下文中一共展示了MetaAccessProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eagerlyParseMethod

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
@SuppressWarnings("try")
private void eagerlyParseMethod(Class<C> clazz, String methodName) {
    RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
    Providers providers = rt.getHostBackend().getProviders();
    MetaAccessProvider metaAccess = providers.getMetaAccess();

    PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
    Plugins plugins = new Plugins(new InvocationPlugins());
    GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
    graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
    HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);

    Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());

    final Method m = getMethod(clazz, methodName);
    ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
    OptionValues options = getInitialOptions();
    DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
    StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
    try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("GraphBuilding", graph, method)) {
        graphBuilderSuite.apply(graph, context);
    } catch (Throwable e) {
        throw debug.handle(e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:StaticInterfaceFieldTest.java

示例2: checkInjectedArgument

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
protected boolean checkInjectedArgument(GraphBuilderContext b, ValueNode arg, ResolvedJavaMethod foldAnnotatedMethod) {
    if (arg.isNullConstant()) {
        return true;
    }

    MetaAccessProvider metaAccess = b.getMetaAccess();
    ResolvedJavaMethod executeMethod = metaAccess.lookupJavaMethod(getExecuteMethod());
    ResolvedJavaType thisClass = metaAccess.lookupJavaType(getClass());
    ResolvedJavaMethod thisExecuteMethod = thisClass.resolveConcreteMethod(executeMethod, thisClass);
    if (b.getMethod().equals(thisExecuteMethod)) {
        // The "execute" method of this plugin is itself being compiled. In (only) this context,
        // the injected argument of the call to the @Fold annotated method will be non-null.
        return true;
    }
    throw new AssertionError("must pass null to injected argument of " + foldAnnotatedMethod.format("%H.%n(%p)") + ", not " + arg);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:GeneratedInvocationPlugin.java

示例3: testBailoutUsage

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
@SuppressWarnings("try")
private static void testBailoutUsage(Class<?> c) {
    RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
    Providers providers = rt.getHostBackend().getProviders();
    MetaAccessProvider metaAccess = providers.getMetaAccess();
    PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
    Plugins plugins = new Plugins(new InvocationPlugins());
    GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
    graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
    HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
    OptionValues options = getInitialOptions();
    DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
    for (Method m : c.getDeclaredMethods()) {
        if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
            ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
            StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
            graphBuilderSuite.apply(graph, context);
            try (DebugCloseable s = debug.disableIntercept()) {
                new VerifyBailoutUsage().apply(graph, context);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:VerifyBailoutUsageTest.java

示例4: tryConstantFold

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
private static ValueNode tryConstantFold(ValueNode array, ValueNode index, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
    if (array.isConstant() && !array.isNullConstant() && index.isConstant()) {
        JavaConstant arrayConstant = array.asJavaConstant();
        if (arrayConstant != null) {
            int stableDimension = ((ConstantNode) array).getStableDimension();
            if (stableDimension > 0) {
                JavaConstant constant = constantReflection.readArrayElement(arrayConstant, index.asJavaConstant().asInt());
                boolean isDefaultStable = ((ConstantNode) array).isDefaultStable();
                if (constant != null && (isDefaultStable || !constant.isDefaultForKind())) {
                    return ConstantNode.forConstant(constant, stableDimension - 1, isDefaultStable, metaAccess);
                }
            }
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:LoadIndexedNode.java

示例5: create

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
public static ValueNode create(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ValueNode value, JavaKind boxingKind) {
    ValueNode synonym = findSynonym(metaAccess, constantReflection, value, boxingKind);
    if (synonym != null) {
        return synonym;
    }
    return new UnboxNode(value, boxingKind);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:UnboxNode.java

示例6: createHints

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
static Hints createHints(TypeCheckHints hints, MetaAccessProvider metaAccess, boolean positiveOnly, StructuredGraph graph) {
    ConstantNode[] hubs = new ConstantNode[hints.hints.length];
    boolean[] isPositive = new boolean[hints.hints.length];
    int index = 0;
    for (int i = 0; i < hubs.length; i++) {
        if (!positiveOnly || hints.hints[i].positive) {
            hubs[index] = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), ((HotSpotResolvedObjectType) hints.hints[i].type).klass(), metaAccess, graph);
            isPositive[index] = hints.hints[i].positive;
            index++;
        }
    }
    if (positiveOnly && index != hubs.length) {
        assert index < hubs.length;
        hubs = Arrays.copyOf(hubs, index);
        isPositive = Arrays.copyOf(isPositive, index);
    }
    return new Hints(hubs, isPositive);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:TypeCheckSnippetUtils.java

示例7: getSpecialClasses

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
private static List<ResolvedJavaType> getSpecialClasses(MetaAccessProvider meta) {
    // @formatter:off
    return Arrays.asList(meta.lookupJavaType(Snippets.class),
        meta.lookupJavaType(HotSpotClassSubstitutions.class),
        meta.lookupJavaType(GraalDirectives.class),
        meta.lookupJavaType(ClassSubstitution.class));
    // @formatter:on
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:GraalFilters.java

示例8: isIllegalUsage

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
/**
 * Checks whether the type of {@code x} is assignable to the restricted type and that {@code y}
 * is not a null constant.
 */
private boolean isIllegalUsage(ResolvedJavaMethod method, ValueNode x, ValueNode y, MetaAccessProvider metaAccess) {
    if (isAssignableToRestrictedType(x, metaAccess) && !isNullConstant(y)) {
        if (isEqualsMethod(method) && isThisParameter(x) || isThisParameter(y)) {
            return false;
        }
        return true;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:VerifyUsageWithEquals.java

示例9: create

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
public static LogicNode create(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
                ValueNode x, ValueNode y) {
    LogicNode value = OP.canonical(constantReflection, metaAccess, options, smallestCompareWidth, OP.getCondition(), false, x, y);
    if (value != null) {
        return value;
    }
    return create(x, y);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:IntegerLessThanNode.java

示例10: canonicalizeBoxing

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
public static FloatingNode canonicalizeBoxing(BoxNode box, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
    ValueNode value = box.getValue();
    if (value.isConstant()) {
        JavaConstant sourceConstant = value.asJavaConstant();
        if (sourceConstant.getJavaKind() != box.getBoxingKind() && sourceConstant.getJavaKind().isNumericInteger()) {
            switch (box.getBoxingKind()) {
                case Boolean:
                    sourceConstant = JavaConstant.forBoolean(sourceConstant.asLong() != 0L);
                    break;
                case Byte:
                    sourceConstant = JavaConstant.forByte((byte) sourceConstant.asLong());
                    break;
                case Char:
                    sourceConstant = JavaConstant.forChar((char) sourceConstant.asLong());
                    break;
                case Short:
                    sourceConstant = JavaConstant.forShort((short) sourceConstant.asLong());
                    break;
            }
        }
        JavaConstant boxedConstant = constantReflection.boxPrimitive(sourceConstant);
        if (boxedConstant != null && sourceConstant.getJavaKind() == box.getBoxingKind()) {
            return ConstantNode.forConstant(boxedConstant, metaAccess, box.graph());
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:BoxingSnippets.java

示例11: checkConstantArgument

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
private static boolean checkConstantArgument(MetaAccessProvider metaAccess, final ResolvedJavaMethod method, Signature signature, int i, String name, Object arg, JavaKind kind) {
    ResolvedJavaType type = signature.getParameterType(i, method.getDeclaringClass()).resolve(method.getDeclaringClass());
    if (metaAccess.lookupJavaType(WordBase.class).isAssignableFrom(type)) {
        assert arg instanceof JavaConstant : method + ": word constant parameters must be passed boxed in a Constant value: " + arg;
        return true;
    }
    if (kind != JavaKind.Object) {
        assert arg != null && kind.toBoxedJavaClass() == arg.getClass() : method + ": wrong value kind for " + name + ": expected " + kind + ", got " +
                        (arg == null ? "null" : arg.getClass().getSimpleName());
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:SnippetTemplate.java

示例12: checkVarargs

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
private static boolean checkVarargs(MetaAccessProvider metaAccess, final ResolvedJavaMethod method, Signature signature, int i, String name, Varargs varargs) {
    ResolvedJavaType type = (ResolvedJavaType) signature.getParameterType(i, method.getDeclaringClass());
    assert type.isArray() : "varargs parameter must be an array type";
    assert type.getComponentType().isAssignableFrom(metaAccess.lookupJavaType(varargs.componentType)) : "componentType for " + name + " not matching " + type.toJavaName() + " instance: " +
                    varargs.componentType;
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:SnippetTemplate.java

示例13: forConstant

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
public static ConstantNode forConstant(JavaConstant constant, int stableDimension, boolean isDefaultStable, MetaAccessProvider metaAccess) {
    if (constant.getJavaKind().getStackKind() == JavaKind.Int && constant.getJavaKind() != JavaKind.Int) {
        return forInt(constant.asInt());
    }
    if (constant.getJavaKind() == JavaKind.Object) {
        return new ConstantNode(constant, StampFactory.forConstant(constant, metaAccess), stableDimension, isDefaultStable);
    } else {
        assert stableDimension == 0;
        return createPrimitive(constant);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:ConstantNode.java

示例14: constant

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
@Override
public Stamp constant(Constant c, MetaAccessProvider meta) {
    if (JavaConstant.NULL_POINTER.equals(c)) {
        return METHOD_ALWAYS_NULL;
    } else {
        assert c instanceof HotSpotMetaspaceConstant;
        return METHOD_NON_NULL;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:MethodPointerStamp.java

示例15: buildInitialGraph

import jdk.vm.ci.meta.MetaAccessProvider; //导入依赖的package包/类
/**
 * Builds the initial graph for a replacement.
 */
@SuppressWarnings("try")
protected StructuredGraph buildInitialGraph(DebugContext debug, BytecodeProvider bytecodeProvider, final ResolvedJavaMethod methodToParse, Object[] args) {
    // Replacements cannot have optimistic assumptions since they have
    // to be valid for the entire run of the VM.
    final StructuredGraph graph = new StructuredGraph.Builder(replacements.options, debug).method(methodToParse).build();

    // Replacements are not user code so they do not participate in unsafe access
    // tracking
    graph.disableUnsafeAccessTracking();

    try (DebugContext.Scope s = debug.scope("buildInitialGraph", graph)) {
        MetaAccessProvider metaAccess = replacements.providers.getMetaAccess();

        Plugins plugins = new Plugins(replacements.graphBuilderPlugins);
        GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins);
        if (args != null) {
            plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(args, metaAccess, replacements.snippetReflection));
        }

        IntrinsicContext initialIntrinsicContext = null;
        if (method.getAnnotation(Snippet.class) == null) {
            // Post-parse inlined intrinsic
            initialIntrinsicContext = new IntrinsicContext(substitutedMethod, method, bytecodeProvider, INLINE_AFTER_PARSING);
        } else {
            // Snippet
            ResolvedJavaMethod original = substitutedMethod != null ? substitutedMethod : method;
            initialIntrinsicContext = new IntrinsicContext(original, method, bytecodeProvider, INLINE_AFTER_PARSING);
        }

        createGraphBuilder(metaAccess, replacements.providers.getStampProvider(), replacements.providers.getConstantReflection(), replacements.providers.getConstantFieldProvider(), config,
                        OptimisticOptimizations.NONE, initialIntrinsicContext).apply(graph);

        new CanonicalizerPhase().apply(graph, new PhaseContext(replacements.providers));
    } catch (Throwable e) {
        throw debug.handle(e);
    }
    return graph;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:ReplacementsImpl.java


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