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


Java ResolvedJavaMethod.getMaxLocals方法代碼示例

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


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

示例1: test

import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
@Test
public void test() {
    ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(getMethod("testNull"));

    int bci = 0;
    int numLocals = resolvedMethod.getMaxLocals();
    int numStack = 0;
    JavaValue[] values = new JavaValue[numLocals];
    JavaKind[] slotKinds = new JavaKind[numLocals];
    BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
    int size = hotspotCodeCache().interpreterFrameSize(frame);
    if (size <= 0) {
        Assert.fail("expected non-zero result");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:InterpreterFrameSizeTest.java

示例2: test

import jdk.vm.ci.meta.ResolvedJavaMethod; //導入方法依賴的package包/類
protected void test(DebugInfoCompiler compiler, Method method, int bci, Location[] objects, Location[] derivedBase, int[] sizeInBytes, JavaKind... slotKinds) {
    ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(method);

    int numLocals = resolvedMethod.getMaxLocals();
    int numStack = slotKinds.length - numLocals;
    JavaValue[] values = new JavaValue[slotKinds.length];
    test(asm -> {
        /*
         * Ensure that any objects mentioned in the VirtualObjects are also in the OopMap.
         */
        List<Location> newLocations = new ArrayList<Location>(Arrays.asList(objects));
        List<Location> newDerived = new ArrayList<Location>(Arrays.asList(derivedBase));
        int[] newSizeInBytes = sizeInBytes;
        VirtualObject[] vobjs = compiler.compile(asm, values);
        if (vobjs != null) {
            for (VirtualObject obj : vobjs) {
                JavaValue[] objValues = obj.getValues();
                for (int i = 0; i < objValues.length; i++) {
                        if (obj.getSlotKind(i) == JavaKind.Object) {
                                Location oopLocation = null;
                                int bytes = -1;
                                if (objValues[i] instanceof RegisterValue) {
                                        RegisterValue reg = (RegisterValue) objValues[i];
                                        oopLocation = Location.register(reg.getRegister());
                                        bytes = reg.getValueKind().getPlatformKind().getSizeInBytes();
                                } else if (objValues[i] instanceof StackSlot) {
                                        StackSlot slot = (StackSlot) objValues[i];
                                        oopLocation = Location.stack(asm.getOffset(slot));
                                        bytes = slot.getValueKind().getPlatformKind().getSizeInBytes();
                                }
                                if (oopLocation != null && !newLocations.contains(oopLocation)) {
                                        newLocations.add(oopLocation);
                                        newDerived.add(null);
                                        newSizeInBytes = Arrays.copyOf(newSizeInBytes, newSizeInBytes.length + 1);
                                    newSizeInBytes[newSizeInBytes.length - 1] = bytes;
                            }
                    }
                }
            }
        }

        BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
        DebugInfo info = new DebugInfo(frame, vobjs);
        info.setReferenceMap(new HotSpotReferenceMap(newLocations.toArray(new Location[0]), newDerived.toArray(new Location[0]), newSizeInBytes, 8));

        asm.emitTrap(info);
    }, method);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:49,代碼來源:DebugInfoTest.java


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