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


Java HotSpotCompiledNmethod类代码示例

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


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

示例1: finish

import jdk.vm.ci.hotspot.HotSpotCompiledNmethod; //导入依赖的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

示例2: createCompiledCode

import jdk.vm.ci.hotspot.HotSpotCompiledNmethod; //导入依赖的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


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