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


Java ResolvedJavaMethod类代码示例

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


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

示例1: tryInline

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
protected LoopScope tryInline(PEMethodScope methodScope, LoopScope loopScope, InvokeData invokeData, MethodCallTargetNode callTarget) {
    if (!callTarget.invokeKind().isDirect()) {
        return null;
    }

    ResolvedJavaMethod targetMethod = callTarget.targetMethod();
    if (targetMethod.hasNeverInlineDirective()) {
        return null;
    }

    ValueNode[] arguments = callTarget.arguments().toArray(new ValueNode[0]);
    GraphBuilderContext graphBuilderContext = new PENonAppendGraphBuilderContext(methodScope, invokeData.invoke);

    for (InlineInvokePlugin plugin : inlineInvokePlugins) {
        InlineInfo inlineInfo = plugin.shouldInlineInvoke(graphBuilderContext, targetMethod, arguments);
        if (inlineInfo != null) {
            if (inlineInfo.getMethodToInline() == null) {
                return null;
            } else {
                return doInline(methodScope, loopScope, invokeData, inlineInfo, arguments);
            }
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:PEGraphDecoder.java

示例2: profile

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
private ProfilingInfo profile(boolean resetProfile, int executions, String methodName, Object... args) {
    ResolvedJavaMethod javaMethod = getResolvedJavaMethod(methodName);
    Assert.assertTrue(javaMethod.isStatic());
    if (resetProfile) {
        javaMethod.reprofile();
    }

    for (int i = 0; i < executions; ++i) {
        try {
            invoke(javaMethod, null, args);
        } catch (Throwable e) {
            Assert.fail("method should not throw an exception: " + e.toString());
        }
    }

    ProfilingInfo info = javaMethod.getProfilingInfo();
    // The execution counts are low so force maturity
    info.setMature();
    return info;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:ProfilingInfoTest.java

示例3: testDebugUsageClass

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
@SuppressWarnings("try")
private static void testDebugUsageClass(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 VerifyDebugUsage().apply(graph, context);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:VerifyDebugUsageTest.java

示例4: assertEqualMethods

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
static void assertEqualMethods(ResolvedJavaMethod e, ResolvedJavaMethod a) {
    if (a != null) {
        if (!e.equals(a)) {
            if (!e.equals(a)) {
                if (!e.getDeclaringClass().equals(a.getDeclaringClass())) {

                    if (!typesAreRelated(e, a)) {
                        throw new AssertionError(String.format("%s and %s are unrelated", a.getDeclaringClass().toJavaName(), e.getDeclaringClass().toJavaName()));
                    }
                }
                Assert.assertEquals(e.getName(), a.getName());
                Assert.assertEquals(e.getSignature(), a.getSignature());
            } else {
                Assert.assertEquals(e, a);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ClassfileBytecodeProviderTest.java

示例5: findMethodTest

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
@Test
public void findMethodTest() {
    try {
        ResolvedJavaMethod findFoo = metaAccess.lookupJavaType(D.class).findMethod("foo", metaAccess.parseMethodDescriptor("()V"));
        ResolvedJavaMethod expectedFoo = metaAccess.lookupJavaMethod(D.class.getDeclaredMethod("foo"));
        assertEquals(expectedFoo, findFoo);

        ResolvedJavaMethod wrongReturnTypeFoo = metaAccess.lookupJavaType(D.class).findMethod("foo", metaAccess.parseMethodDescriptor("()I"));
        assertNull(wrongReturnTypeFoo);

        ResolvedJavaMethod wrongArgumentsFoo = metaAccess.lookupJavaType(D.class).findMethod("foo", metaAccess.parseMethodDescriptor("(I)V"));
        assertNull(wrongArgumentsFoo);

        ResolvedJavaMethod wrongNameFoo = metaAccess.lookupJavaType(D.class).findMethod("bar", metaAccess.parseMethodDescriptor("()V"));
        assertNull(wrongNameFoo);

        ResolvedJavaMethod wrongClassFoo = metaAccess.lookupJavaType(SubD.class).findMethod("foo", metaAccess.parseMethodDescriptor("()V"));
        assertNull(wrongClassFoo);
    } catch (NoSuchMethodException | SecurityException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:TestResolvedJavaType.java

示例6: checkForRequestedCrash

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
/**
 * Checks whether the {@link GraalCompilerOptions#CrashAt} option indicates that the compilation
 * of {@code graph} should result in an exception.
 *
 * @param graph a graph currently being compiled
 * @throws RuntimeException if the value of {@link GraalCompilerOptions#CrashAt} matches
 *             {@code graph.method()} or {@code graph.name}
 */
private static void checkForRequestedCrash(StructuredGraph graph) {
    String methodPattern = GraalCompilerOptions.CrashAt.getValue(graph.getOptions());
    if (methodPattern != null) {
        String crashLabel = null;
        if (graph.name != null && graph.name.contains(methodPattern)) {
            crashLabel = graph.name;
        }
        if (crashLabel == null) {
            ResolvedJavaMethod method = graph.method();
            MethodFilter[] filters = MethodFilter.parse(methodPattern);
            for (MethodFilter filter : filters) {
                if (filter.matches(method)) {
                    crashLabel = method.format("%H.%n(%p)");
                }
            }
        }
        if (crashLabel != null) {
            throw new RuntimeException("Forced crash after compiling " + crashLabel);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:GraalCompiler.java

示例7: getMethod

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
/**
 * Obtain a resolved Java method declared by a given type.
 *
 * @param type the declaring type
 * @param the method's name
 *
 * Currently, the lookup is based only on the method's name
 * but not on the method's signature (i.e., the first method
 * with a matching name declared on {@code type} is returned).
 */
private static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
    if (methodName.equals("<clinit>")) {
        return type.getClassInitializer();
    }

    if (methodName.equals("<init>")) {
        ResolvedJavaMethod[] initializers = type.getDeclaredConstructors();
        if (initializers.length >= 0) {
            return initializers[0];
        } else {
            throw new IllegalArgumentException();
        }
    }

    for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
        if (method.getName().equals(methodName)) {
            return method;
        }
    }

    throw new IllegalArgumentException();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:ConstantPoolTestsHelper.java

示例8: setMethods

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
/**
 * Sets the methods whose bytecodes were used as input to the compilation.
 *
 * @param rootMethod the root method of the compilation
 * @param inlinedMethods the methods inlined during compilation
 */
public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) {
    checkOpen();
    assert rootMethod != null;
    assert inlinedMethods != null;
    if (inlinedMethods.contains(rootMethod)) {
        methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]);
        for (int i = 0; i < methods.length; i++) {
            if (methods[i].equals(rootMethod)) {
                if (i != 0) {
                    ResolvedJavaMethod tmp = methods[0];
                    methods[0] = methods[i];
                    methods[i] = tmp;
                }
                break;
            }
        }
    } else {
        methods = new ResolvedJavaMethod[1 + inlinedMethods.size()];
        methods[0] = rootMethod;
        int i = 1;
        for (ResolvedJavaMethod m : inlinedMethods) {
            methods[i++] = m;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:CompilationResult.java

示例9: getBackedgeBCI

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
/**
 * Returns the target BCI of the first bytecode backedge. This is where HotSpot triggers
 * on-stack-replacement in case the backedge counter overflows.
 */
private static int getBackedgeBCI(DebugContext debug, ResolvedJavaMethod method) {
    Bytecode code = new ResolvedJavaMethodBytecode(method);
    BytecodeStream stream = new BytecodeStream(code.getCode());
    OptionValues options = debug.getOptions();
    BciBlockMapping bciBlockMapping = BciBlockMapping.create(stream, code, options, debug);

    for (BciBlock block : bciBlockMapping.getBlocks()) {
        if (block.startBci != -1) {
            int bci = block.startBci;
            for (BciBlock succ : block.getSuccessors()) {
                if (succ.startBci != -1) {
                    int succBci = succ.startBci;
                    if (succBci < bci) {
                        // back edge
                        return succBci;
                    }
                }
            }
        }
    }
    TTY.println("Cannot find loop back edge with bytecode loops at:%s", Arrays.toString(bciBlockMapping.getLoopHeaders()));
    TTY.println(new BytecodeDisassembler().disassemble(code));
    return -1;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:GraalOSRTestBase.java

示例10: registerThreadPlugins

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
private static void registerThreadPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, WordTypes wordTypes, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) {
    Registration r = new Registration(plugins, Thread.class, bytecodeProvider);
    r.register0("currentThread", new InvocationPlugin() {
        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            CurrentJavaThreadNode thread = b.add(new CurrentJavaThreadNode(wordTypes.getWordKind()));
            boolean compressible = false;
            ValueNode offset = b.add(ConstantNode.forLong(config.threadObjectOffset));
            AddressNode address = b.add(new OffsetAddressNode(thread, offset));
            ValueNode javaThread = WordOperationPlugin.readOp(b, JavaKind.Object, address, JAVA_THREAD_THREAD_OBJECT_LOCATION, BarrierType.NONE, compressible);
            boolean exactType = false;
            boolean nonNull = true;
            b.addPush(JavaKind.Object, new PiNode(javaThread, metaAccess.lookupJavaType(Thread.class), exactType, nonNull));
            return true;
        }
    });

    r.registerMethodSubstitution(ThreadSubstitutions.class, "isInterrupted", Receiver.class, boolean.class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:HotSpotGraphBuilderPlugins.java

示例11: verify

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
    final ResolvedJavaType graphType = context.getMetaAccess().lookupJavaType(Graph.class);
    final ResolvedJavaType virtualizableType = context.getMetaAccess().lookupJavaType(Virtualizable.class);
    final ResolvedJavaType constantNodeType = context.getMetaAccess().lookupJavaType(ConstantNode.class);
    if (virtualizableType.isAssignableFrom(graph.method().getDeclaringClass()) && graph.method().getName().equals("virtualize")) {
        for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
            int bci = t.invoke().bci();
            ResolvedJavaMethod callee = t.targetMethod();
            String calleeName = callee.getName();
            if (callee.getDeclaringClass().equals(graphType)) {
                if (calleeName.equals("add") || calleeName.equals("addWithoutUnique") || calleeName.equals("addOrUnique") || calleeName.equals("addWithoutUniqueWithInputs") ||
                                calleeName.equals("addOrUniqueWithInputs")) {
                    verifyVirtualizableEffectArguments(constantNodeType, graph.method(), callee, bci, t.arguments(), 1);
                }
            }
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:VerifyVirtualizableUsage.java

示例12: testStringEquals

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
private void testStringEquals(String s0, String s1) {
    ResolvedJavaMethod method = getResolvedJavaMethod("stringEquals");
    StructuredGraph graph = parseForCompile(method);

    graph.getParameter(0).replaceAndDelete(asConstant(graph, s0));
    graph.getParameter(1).replaceAndDelete(asConstant(graph, s1));

    compile(method, graph);

    FixedNode firstFixed = graph.start().next();
    Assert.assertThat(firstFixed, instanceOf(ReturnNode.class));

    ReturnNode ret = (ReturnNode) firstFixed;
    JavaConstant result = ret.result().asJavaConstant();
    if (result == null) {
        Assert.fail("result not constant: " + ret.result());
    } else {
        int expected = s0.equals(s1) ? 1 : 0;
        Assert.assertEquals("result", expected, result.asInt());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:StringEqualsConstantTest.java

示例13: createNonInlinedInvoke

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
protected Invoke createNonInlinedInvoke(boolean withExceptionEdge, int invokeBci, ValueNode[] invokeArgs, ResolvedJavaMethod targetMethod,
                InvokeKind invokeKind, JavaKind resultType, JavaType returnType, JavaTypeProfile profile) {

    StampPair returnStamp = graphBuilderConfig.getPlugins().getOverridingStamp(this, returnType, false);
    if (returnStamp == null) {
        returnStamp = StampFactory.forDeclaredType(graph.getAssumptions(), returnType, false);
    }

    MethodCallTargetNode callTarget = graph.add(createMethodCallTarget(invokeKind, targetMethod, invokeArgs, returnStamp, profile));
    Invoke invoke = createNonInlinedInvoke(withExceptionEdge, invokeBci, callTarget, resultType);

    for (InlineInvokePlugin plugin : graphBuilderConfig.getPlugins().getInlineInvokePlugins()) {
        plugin.notifyNotInlined(this, targetMethod, invoke);
    }

    return invoke;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:BytecodeParser.java

示例14: currentMap

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
private OptionValues currentMap(OptionValues initialValues, ResolvedJavaMethod method) {
    if (changes.isEmpty() && methodDumps.isEmpty()) {
        return initialValues;
    }
    OptionValues current = cachedOptions;
    if (current == null) {
        current = new OptionValues(initialValues, changes);
        cachedOptions = current;
    }
    if (method != null) {
        for (Dump request : methodDumps) {
            final String clazzName = method.getDeclaringClass().getName();
            if (method.getName().equals(request.method) && clazzName.equals(request.clazz)) {
                current = new OptionValues(current, DebugOptions.Dump, request.filter,
                                DebugOptions.PrintGraphHost, request.host,
                                DebugOptions.PrintBinaryGraphPort, request.port);
                break;
            }
        }
    }
    return current;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:HotSpotGraalMBean.java

示例15: createParameterStamps

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入依赖的package包/类
public static Stamp[] createParameterStamps(Assumptions assumptions, ResolvedJavaMethod method) {
    Signature sig = method.getSignature();
    Stamp[] result = new Stamp[sig.getParameterCount(!method.isStatic())];
    int index = 0;

    if (!method.isStatic()) {
        result[index++] = StampFactory.objectNonNull(TypeReference.create(assumptions, method.getDeclaringClass()));
    }

    int max = sig.getParameterCount(false);
    ResolvedJavaType accessingClass = method.getDeclaringClass();
    for (int i = 0; i < max; i++) {
        JavaType type = sig.getParameterType(i, accessingClass);
        JavaKind kind = type.getJavaKind();
        Stamp stamp;
        if (kind == JavaKind.Object && type instanceof ResolvedJavaType) {
            stamp = StampFactory.object(TypeReference.create(assumptions, (ResolvedJavaType) type));
        } else {
            stamp = StampFactory.forKind(kind);
        }
        result[index++] = stamp;
    }

    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:StampFactory.java


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