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


Java Site類代碼示例

本文整理匯總了Java中jdk.vm.ci.code.site.Site的典型用法代碼示例。如果您正苦於以下問題:Java Site類的具體用法?Java Site怎麽用?Java Site使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Site類屬於jdk.vm.ci.code.site包,在下文中一共展示了Site類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: HotSpotCompiledCode

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `sites`, `targetCode`, `comments`, `methods`, `dataSection`, `dataSectionPatches` and `assumptions`")
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
                int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
    this.name = name;
    this.targetCode = targetCode;
    this.targetCodeSize = targetCodeSize;
    this.sites = sites;
    this.assumptions = assumptions;
    this.methods = methods;

    this.comments = comments;
    this.dataSection = dataSection;
    this.dataSectionAlignment = dataSectionAlignment;
    this.dataSectionPatches = dataSectionPatches;
    this.isImmutablePIC = isImmutablePIC;
    this.totalFrameSize = totalFrameSize;
    this.deoptRescueSlot = deoptRescueSlot;

    assert validateFrames();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:HotSpotCompiledCode.java

示例2: HotSpotCompiledCode

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
                int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
    this.name = name;
    this.targetCode = targetCode;
    this.targetCodeSize = targetCodeSize;
    this.sites = sites;
    this.assumptions = assumptions;
    this.methods = methods;

    this.comments = comments;
    this.dataSection = dataSection;
    this.dataSectionAlignment = dataSectionAlignment;
    this.dataSectionPatches = dataSectionPatches;
    this.isImmutablePIC = isImmutablePIC;
    this.totalFrameSize = totalFrameSize;
    this.deoptRescueSlot = deoptRescueSlot;

    assert validateFrames();
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:20,代碼來源:HotSpotCompiledCode.java

示例3: hasMark

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
boolean hasMark(Site call, MarkId id) {
    for (Mark m : compilationResult.getMarks()) {
        // TODO: X64-specific code.
        // Call instructions are aligned to 8
        // bytes - 1 on x86 to patch address atomically,
        int adjOffset = (m.pcOffset & (-8)) + 7;
        // Mark points before aligning nops.
        if ((call.pcOffset == adjOffset) && MarkId.getEnum((int) m.id) == id) {
            return true;
        }
    }
    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:CompiledMethodInfo.java

示例4: compare

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Override
public int compare(Site s1, Site s2) {
    if (s1.pcOffset == s2.pcOffset) {
        // Marks must come first since patching a call site
        // may need to know the mark denoting the call type
        // (see uses of CodeInstaller::_next_call_type).
        boolean s1IsMark = s1 instanceof Mark;
        boolean s2IsMark = s2 instanceof Mark;
        if (s1IsMark != s2IsMark) {
            return s1IsMark ? -1 : 1;
        }

        // Infopoints must group together so put them after
        // other Site types.
        boolean s1IsInfopoint = s1 instanceof Infopoint;
        boolean s2IsInfopoint = s2 instanceof Infopoint;
        if (s1IsInfopoint != s2IsInfopoint) {
            return s1IsInfopoint ? 1 : -1;
        }

        if (s1IsInfopoint) {
            sawCollidingInfopoints = true;
            return checkCollision((Infopoint) s1, (Infopoint) s2);
        }
    }
    return s1.pcOffset - s2.pcOffset;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:28,代碼來源:HotSpotCompiledCodeBuilder.java

示例5: HotSpotCompiledNmethod

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
                int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot, HotSpotResolvedJavaMethod method, int entryBCI,
                int id, long jvmciEnv, boolean hasUnsafeAccess) {
    super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, deoptRescueSlot);
    this.method = method;
    this.entryBCI = entryBCI;
    this.id = id;
    this.jvmciEnv = jvmciEnv;
    this.hasUnsafeAccess = hasUnsafeAccess;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:HotSpotCompiledNmethod.java

示例6: finish

import jdk.vm.ci.code.site.Site; //導入依賴的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

示例7: compareSites

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
public static int compareSites(Site s1, Site s2) {
    if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) {
        return s1 instanceof Mark ? -1 : 1;
    }
    return s1.pcOffset - s2.pcOffset;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:InstanceOfTest.java

示例8: createCompiledCode

import jdk.vm.ci.code.site.Site; //導入依賴的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

示例9: getSortedSites

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
/**
 * HotSpot expects sites to be presented in ascending order of PC (see
 * {@code DebugInformationRecorder::add_new_pc_offset}). In addition, it expects
 * {@link Infopoint} PCs to be unique.
 */
private static Site[] getSortedSites(CodeCacheProvider codeCache, CompilationResult target) {
    List<Site> sites = new ArrayList<>(
                    target.getExceptionHandlers().size() + target.getInfopoints().size() + target.getDataPatches().size() + target.getMarks().size() + target.getSourceMappings().size());
    sites.addAll(target.getExceptionHandlers());
    sites.addAll(target.getInfopoints());
    sites.addAll(target.getDataPatches());
    sites.addAll(target.getMarks());

    /*
     * Translate the source mapping into appropriate info points. In HotSpot only one position
     * can really be represented and recording the end PC seems to give the best results and
     * corresponds with what C1 and C2 do.
     */
    if (codeCache.shouldDebugNonSafepoints()) {
        for (SourceMapping source : target.getSourceMappings()) {
            sites.add(new Infopoint(source.getEndOffset(), new DebugInfo(source.getSourcePosition()), InfopointReason.BYTECODE_POSITION));
            assert verifySourcePositionReceivers(source.getSourcePosition());
        }
    }

    SiteComparator c = new SiteComparator();
    Collections.sort(sites, c);
    if (c.sawCollidingInfopoints) {
        Infopoint lastInfopoint = null;
        List<Site> copy = new ArrayList<>(sites.size());
        for (Site site : sites) {
            if (site instanceof Infopoint) {
                Infopoint info = (Infopoint) site;
                if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) {
                    lastInfopoint = info;
                    copy.add(info);
                } else {
                    // Omit this colliding infopoint
                    assert lastInfopoint.reason.compareTo(info.reason) <= 0;
                }
            } else {
                copy.add(site);
            }
        }
        sites = copy;
    }
    return sites.toArray(new Site[sites.size()]);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:49,代碼來源:HotSpotCompiledCodeBuilder.java

示例10: testInvalidAssumption

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = JVMCIError.class)
public void testInvalidAssumption() {
    installEmptyCode(new Site[0], new Assumption[]{new InvalidAssumption()}, new Comment[0], 16, new DataPatch[0], null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:TestInvalidCompilationResult.java

示例11: testInvalidAlignment

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = JVMCIError.class)
public void testInvalidAlignment() {
    installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 7, new DataPatch[0], null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:TestInvalidCompilationResult.java

示例12: testNullDataPatchInDataSection

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = NullPointerException.class)
public void testNullDataPatchInDataSection() {
    installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{null}, null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:TestInvalidCompilationResult.java

示例13: testNullReferenceInDataSection

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = NullPointerException.class)
public void testNullReferenceInDataSection() {
    installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, null)}, null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:TestInvalidCompilationResult.java

示例14: testInvalidDataSectionReference

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = JVMCIError.class)
public void testInvalidDataSectionReference() {
    DataSectionReference ref = new DataSectionReference();
    ref.setOffset(0);
    installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:TestInvalidCompilationResult.java

示例15: testInvalidNarrowMethodInDataSection

import jdk.vm.ci.code.site.Site; //導入依賴的package包/類
@Test(expected = JVMCIError.class)
public void testInvalidNarrowMethodInDataSection() {
    HotSpotConstant c = (HotSpotConstant) dummyMethod.getEncoding();
    ConstantReference ref = new ConstantReference((VMConstant) c.compress());
    installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:TestInvalidCompilationResult.java


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