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


Java HotSpotCompiledCode类代码示例

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


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

示例1: test

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void test(TestCompiler compiler, Method method, Object... args) {
    try {
        HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
        TestAssembler asm = createAssembler();

        asm.emitPrologue();
        compiler.compile(asm);
        asm.emitEpilogue();

        HotSpotCompiledCode code = asm.finish(resolvedMethod);
        InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);

        Object expected = method.invoke(null, args);
        Object actual = installed.executeVarargs(args);
        Assert.assertEquals(expected, actual);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail(e.toString());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:CodeInstallationTest.java

示例2: test

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void test(TestCompiler compiler, Method method, Object... args) {
    HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
    TestAssembler asm = createAssembler();

    asm.emitPrologue();
    compiler.compile(asm);
    asm.emitEpilogue();

    HotSpotCompiledCode code = asm.finish(resolvedMethod);
    InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);

    try {
        Object expected = method.invoke(null, args);
        Object actual = installed.executeVarargs(args);
        Assert.assertEquals(expected, actual);
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail(e.toString());
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:21,代码来源:CodeInstallationTest.java

示例3: installNativeFunctionStub

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
/**
 * Creates and installs a stub for calling a native function.
 */
@SuppressWarnings("try")
void installNativeFunctionStub(HotSpotNativeFunctionHandle function) {
    Plugins plugins = new Plugins(providers.getGraphBuilderPlugins());
    plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(new Object[]{function, null}, providers.getMetaAccess(), providers.getSnippetReflection()));

    PhaseSuite<HighTierContext> graphBuilder = new PhaseSuite<>();
    graphBuilder.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getDefault(plugins)));

    Suites suites = providers.getSuites().getDefaultSuites(options);
    LIRSuites lirSuites = providers.getSuites().getDefaultLIRSuites(options);

    StructuredGraph g = new StructuredGraph.Builder(options).method(callStubMethod).compilationId(backend.getCompilationIdentifier(callStubMethod)).build();
    CompilationResult compResult = GraalCompiler.compileGraph(g, callStubMethod, providers, backend, graphBuilder, OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites,
                    lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default);

    HotSpotCodeCacheProvider codeCache = providers.getCodeCache();
    try (Scope s = Debug.scope("CodeInstall", codeCache, g.method(), compResult)) {
        HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, g.method(), null, compResult);
        function.code = codeCache.addCode(g.method(), compiledCode, null, null);
    } catch (Throwable e) {
        throw Debug.handle(e);
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:27,代码来源:NativeCallStubGraphBuilder.java

示例4: finish

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
    int id = method.allocateCompileId(0);
    byte[] finishedCode = code.finish();
    Site[] finishedSites = sites.toArray(new Site[0]);
    byte[] finishedData = data.finish();
    DataPatch[] finishedDataPatches = dataPatches.toArray(new DataPatch[0]);
    return new HotSpotCompiledNmethod(method.getName(), finishedCode, finishedCode.length, finishedSites, new Assumption[0], new ResolvedJavaMethod[]{method}, new Comment[0], finishedData, 16,
                    finishedDataPatches, false, frameSize, deoptRescue, method, 0, id, 0L, false);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:TestAssembler.java

示例5: installMethod

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
@SuppressWarnings("try")
private void installMethod(final CompilationResult compResult) {
    final CodeCacheProvider codeCache = jvmciRuntime.getHostJVMCIBackend().getCodeCache();
    installedCode = null;
    Object[] context = {new DebugDumpScope(getIdString(), true), codeCache, getMethod(), compResult};
    try (Scope s = Debug.scope("CodeInstall", context)) {
        HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, getRequest().getMethod(), getRequest(), compResult);
        installedCode = (HotSpotInstalledCode) codeCache.installCode(getRequest().getMethod(), compiledCode, null, getRequest().getMethod().getSpeculationLog(), installAsDefault);
    } catch (Throwable e) {
        throw Debug.handle(e);
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:13,代码来源:CompilationTask.java

示例6: compiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode compiledCode(CompilationResult result) {
    return HotSpotCompiledCodeBuilder.createCompiledCode(backend.getCodeCache(), null, null, result);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:AOTStub.java

示例7: compiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
HotSpotCompiledCode compiledCode() {
    if (code == null) {
        code = methodInfo.compiledCode(compilationResult);
    }
    return code;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:CompiledMethodInfo.java

示例8: compiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public HotSpotCompiledCode compiledCode(CompilationResult result) {
    return HotSpotCompiledCodeBuilder.createCompiledCode(backend.getCodeCache(), method, null, result);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:AOTHotSpotResolvedJavaMethod.java

示例9: createCompiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
public static HotSpotCompiledCode createCompiledCode(CodeCacheProvider codeCache, ResolvedJavaMethod method, HotSpotCompilationRequest compRequest, CompilationResult compResult) {
    String name = compResult.getName();

    byte[] targetCode = compResult.getTargetCode();
    int targetCodeSize = compResult.getTargetCodeSize();

    Site[] sites = getSortedSites(codeCache, compResult);

    Assumption[] assumptions = compResult.getAssumptions();

    ResolvedJavaMethod[] methods = compResult.getMethods();

    List<CodeAnnotation> annotations = compResult.getAnnotations();
    Comment[] comments = new Comment[annotations.size()];
    if (!annotations.isEmpty()) {
        for (int i = 0; i < comments.length; i++) {
            CodeAnnotation annotation = annotations.get(i);
            String text;
            if (annotation instanceof CodeComment) {
                CodeComment codeComment = (CodeComment) annotation;
                text = codeComment.value;
            } else if (annotation instanceof JumpTable) {
                JumpTable jumpTable = (JumpTable) annotation;
                text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]";
            } else {
                text = annotation.toString();
            }
            comments[i] = new Comment(annotation.position, text);
        }
    }

    DataSection data = compResult.getDataSection();
    byte[] dataSection = new byte[data.getSectionSize()];

    ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
    Builder<DataPatch> patchBuilder = Stream.builder();
    data.buildDataSection(buffer, vmConstant -> {
        patchBuilder.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
    });

    int dataSectionAlignment = data.getSectionAlignment();
    DataPatch[] dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);

    int totalFrameSize = compResult.getTotalFrameSize();
    StackSlot customStackArea = compResult.getCustomStackArea();
    boolean isImmutablePIC = compResult.isImmutablePIC();

    if (method instanceof HotSpotResolvedJavaMethod) {
        HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
        int entryBCI = compResult.getEntryBCI();
        boolean hasUnsafeAccess = compResult.hasUnsafeAccess();

        int id;
        long jvmciEnv;
        if (compRequest != null) {
            id = compRequest.getId();
            jvmciEnv = compRequest.getJvmciEnv();
        } else {
            id = hsMethod.allocateCompileId(entryBCI);
            jvmciEnv = 0L;
        }
        return new HotSpotCompiledNmethod(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
                        totalFrameSize, customStackArea, hsMethod, entryBCI, id, jvmciEnv, hasUnsafeAccess);
    } else {
        return new HotSpotCompiledCode(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
                        totalFrameSize, customStackArea);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:69,代码来源:HotSpotCompiledCodeBuilder.java

示例10: installEmptyCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
protected void installEmptyCode(Site[] sites, Assumption[] assumptions, Comment[] comments, int dataSectionAlignment, DataPatch[] dataSectionPatches, StackSlot deoptRescueSlot) {
    HotSpotCompiledCode code = new HotSpotCompiledCode("dummyMethod", new byte[0], 0, sites, assumptions, new ResolvedJavaMethod[]{dummyMethod}, comments, new byte[8], dataSectionAlignment,
                    dataSectionPatches, false, 0, deoptRescueSlot);
    codeCache.addCode(dummyMethod, code, null, null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:CodeInstallerTest.java

示例11: finish

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
@Override
public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
    frameSize += SPARC.REGISTER_SAFE_AREA_SIZE;
    return super.finish(method);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:SPARCTestAssembler.java

示例12: compiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledCode; //导入依赖的package包/类
HotSpotCompiledCode compiledCode(CompilationResult result); 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:2,代码来源:JavaMethodInfo.java


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