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


Java MetaAccessProvider.lookupJavaMethod方法代碼示例

本文整理匯總了Java中jdk.vm.ci.meta.MetaAccessProvider.lookupJavaMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java MetaAccessProvider.lookupJavaMethod方法的具體用法?Java MetaAccessProvider.lookupJavaMethod怎麽用?Java MetaAccessProvider.lookupJavaMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jdk.vm.ci.meta.MetaAccessProvider的用法示例。


在下文中一共展示了MetaAccessProvider.lookupJavaMethod方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: testVirtualizableEffects

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的package包/類
@SuppressWarnings("try")
private static void testVirtualizableEffects(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 VerifyVirtualizableUsage().apply(graph, context);
            }
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:VerifyVirtualizableTest.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: 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

示例5: testDebugUsageClass

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的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

示例6: checkMethod

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的package包/類
private static void checkMethod(ClassfileBytecodeProvider cbp, MetaAccessProvider metaAccess, Executable executable) {
    ResolvedJavaMethod method = metaAccess.lookupJavaMethod(executable);
    if (method.hasBytecodes()) {
        ResolvedJavaMethodBytecode expected = new ResolvedJavaMethodBytecode(method);
        Bytecode actual = getBytecode(cbp, method);
        new BytecodeComparer(expected, actual).compare();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:ClassfileBytecodeProviderTest.java

示例7: getSubstitute

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的package包/類
/**
 * Gets the substitute method, resolving it first if necessary.
 */
public ResolvedJavaMethod getSubstitute(MetaAccessProvider metaAccess) {
    if (cachedSubstitute == null) {
        cachedSubstitute = metaAccess.lookupJavaMethod(getJavaSubstitute());
    }
    return cachedSubstitute;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:MethodSubstitutionPlugin.java

示例8: resolveIntrinsic

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的package包/類
public static ResolvedJavaMethod resolveIntrinsic(MetaAccessProvider metaAccess, VMIntrinsicMethod intrinsic) throws ClassNotFoundException {
    Class<?> c;
    try {
        c = Class.forName(intrinsic.declaringClass.replace('/', '.'), false, CheckGraalIntrinsics.class.getClassLoader());
    } catch (ClassNotFoundException ex) {
        try {
            Class.forName("javax.naming.Reference");
        } catch (ClassNotFoundException coreNamingMissing) {
            // if core JDK classes aren't found, we are probably running in a
            // JDK9 java.base environment and then missing class is OK
            return null;
        }
        throw ex;
    }
    for (Method javaMethod : c.getDeclaredMethods()) {
        if (javaMethod.getName().equals(intrinsic.name)) {
            ResolvedJavaMethod method = metaAccess.lookupJavaMethod(javaMethod);
            if (intrinsic.descriptor.equals("*")) {
                // Signature polymorphic method - name match is enough
                return method;
            } else {
                if (method.getSignature().toMethodDescriptor().equals(intrinsic.descriptor)) {
                    return method;
                }
            }
        }
    }
    return null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:30,代碼來源:CheckGraalIntrinsics.java

示例9: dumpOperation

import jdk.vm.ci.meta.MetaAccessProvider; //導入方法依賴的package包/類
@Test
public void dumpOperation() throws Exception {
    Field field = null;
    try {
        field = stopMBeanServer();
    } catch (Exception ex) {
        if (ex.getClass().getName().equals("java.lang.reflect.InaccessibleObjectException")) {
            // skip on JDK9
            return;
        }
    }
    assertNull("The platformMBeanServer isn't initialized now", field.get(null));

    ObjectName name;

    assertNotNull("Server is started", ManagementFactory.getPlatformMBeanServer());

    HotSpotGraalMBean realBean = HotSpotGraalMBean.create(null);

    assertNotNull("Bean is registered", name = realBean.ensureRegistered(false));
    final MBeanServer server = ManagementFactory.getPlatformMBeanServer();

    ObjectInstance bean = server.getObjectInstance(name);
    assertNotNull("Bean is registered", bean);

    MBeanInfo info = server.getMBeanInfo(name);
    assertNotNull("Info is found", info);

    final MBeanOperationInfo[] arr = info.getOperations();
    assertEquals("Currently three overloads", 3, arr.length);
    MBeanOperationInfo dumpOp = null;
    for (int i = 0; i < arr.length; i++) {
        assertEquals("dumpMethod", arr[i].getName());
        if (arr[i].getSignature().length == 3) {
            dumpOp = arr[i];
        }
    }
    assertNotNull("three args variant found", dumpOp);

    server.invoke(name, "dumpMethod", new Object[]{
                    "java.util.Arrays", "asList", ":3"
    }, null);

    MBeanAttributeInfo dump = (MBeanAttributeInfo) findAttributeInfo("Dump", info);
    Attribute dumpTo1 = new Attribute(dump.getName(), "");
    server.setAttribute(name, dumpTo1);
    Object after = server.getAttribute(name, dump.getName());
    assertEquals("", after);

    OptionValues empty = new OptionValues(EconomicMap.create());
    OptionValues unsetDump = realBean.optionsFor(empty, null);
    final MetaAccessProvider metaAccess = jdk.vm.ci.runtime.JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
    ResolvedJavaMethod method = metaAccess.lookupJavaMethod(Arrays.class.getMethod("asList", Object[].class));
    final OptionValues forMethod = realBean.optionsFor(unsetDump, method);
    assertNotSame(unsetDump, forMethod);
    Object nothing = unsetDump.getMap().get(DebugOptions.Dump);
    assertEquals("Empty string", "", nothing);

    Object specialValue = forMethod.getMap().get(DebugOptions.Dump);
    assertEquals(":3", specialValue);

    OptionValues normalMethod = realBean.optionsFor(unsetDump, null);
    Object noSpecialValue = normalMethod.getMap().get(DebugOptions.Dump);
    assertEquals("Empty string", "", noSpecialValue);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:66,代碼來源:HotSpotGraalMBeanTest.java


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