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


Java Opcodes.F_NEW屬性代碼示例

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


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

示例1: visitFrame

@Override
public void visitFrame(final int type, final int nLocal,
        final Object[] local, final int nStack, final Object[] stack) {
    if (type != Opcodes.F_NEW) { // uncompressed frame
        throw new IllegalStateException(
                "ClassReader.accept() should be called with EXPAND_FRAMES flag");
    }

    if (mv != null) {
        mv.visitFrame(type, nLocal, local, nStack, stack);
    }

    if (this.locals != null) {
        this.locals.clear();
        this.stack.clear();
    } else {
        this.locals = new ArrayList<Object>();
        this.stack = new ArrayList<Object>();
    }
    visitFrameTypes(nLocal, local, this.locals);
    visitFrameTypes(nStack, stack, this.stack);
    maxStack = Math.max(maxStack, this.stack.size());
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:23,代碼來源:AnalyzerAdapter.java

示例2: accept

/**
 * Makes the given visitor visit this stack map frame.
 * 
 * @param mv
 *            a method visitor.
 */
@Override
public void accept(final MethodVisitor mv) {
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        mv.visitFrame(type, local.size(), asArray(local), stack.size(),
                asArray(stack));
        break;
    case Opcodes.F_APPEND:
        mv.visitFrame(type, local.size(), asArray(local), 0, null);
        break;
    case Opcodes.F_CHOP:
        mv.visitFrame(type, local.size(), null, 0, null);
        break;
    case Opcodes.F_SAME:
        mv.visitFrame(type, 0, null, 0, null);
        break;
    case Opcodes.F_SAME1:
        mv.visitFrame(type, 0, null, 1, asArray(stack));
        break;
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:28,代碼來源:FrameNode.java

示例3: visitFrame

@Override
public void visitFrame(final int type, final int nLocal,
        final Object[] local, final int nStack, final Object[] stack) {
    AttributesImpl attrs = new AttributesImpl();
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        if (type == Opcodes.F_NEW) {
            attrs.addAttribute("", "type", "type", "", "NEW");
        } else {
            attrs.addAttribute("", "type", "type", "", "FULL");
        }
        sa.addStart("frame", attrs);
        appendFrameTypes(true, nLocal, local);
        appendFrameTypes(false, nStack, stack);
        break;
    case Opcodes.F_APPEND:
        attrs.addAttribute("", "type", "type", "", "APPEND");
        sa.addStart("frame", attrs);
        appendFrameTypes(true, nLocal, local);
        break;
    case Opcodes.F_CHOP:
        attrs.addAttribute("", "type", "type", "", "CHOP");
        attrs.addAttribute("", "count", "count", "",
                Integer.toString(nLocal));
        sa.addStart("frame", attrs);
        break;
    case Opcodes.F_SAME:
        attrs.addAttribute("", "type", "type", "", "SAME");
        sa.addStart("frame", attrs);
        break;
    case Opcodes.F_SAME1:
        attrs.addAttribute("", "type", "type", "", "SAME1");
        sa.addStart("frame", attrs);
        appendFrameTypes(false, 1, stack);
        break;
    }
    sa.addEnd("frame");
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:39,代碼來源:SAXCodeAdapter.java

示例4: visitFrame

@Override
public void visitFrame(final int type, final int nLocal,
        final Object[] local, final int nStack, final Object[] stack) {
    buf.setLength(0);
    buf.append(ltab);
    buf.append("FRAME ");
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        buf.append("FULL [");
        appendFrameTypes(nLocal, local);
        buf.append("] [");
        appendFrameTypes(nStack, stack);
        buf.append(']');
        break;
    case Opcodes.F_APPEND:
        buf.append("APPEND [");
        appendFrameTypes(nLocal, local);
        buf.append(']');
        break;
    case Opcodes.F_CHOP:
        buf.append("CHOP ").append(nLocal);
        break;
    case Opcodes.F_SAME:
        buf.append("SAME");
        break;
    case Opcodes.F_SAME1:
        buf.append("SAME1 ");
        appendFrameTypes(1, stack);
        break;
    }
    buf.append('\n');
    text.add(buf.toString());
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:34,代碼來源:Textifier.java

示例5: visitFrame

@Override
public void visitFrame(final int type, final int nLocal,
        final Object[] local, final int nStack, final Object[] stack) {
    buf.setLength(0);
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        declareFrameTypes(nLocal, local);
        declareFrameTypes(nStack, stack);
        if (type == Opcodes.F_NEW) {
            buf.append(name).append(".visitFrame(Opcodes.F_NEW, ");
        } else {
            buf.append(name).append(".visitFrame(Opcodes.F_FULL, ");
        }
        buf.append(nLocal).append(", new Object[] {");
        appendFrameTypes(nLocal, local);
        buf.append("}, ").append(nStack).append(", new Object[] {");
        appendFrameTypes(nStack, stack);
        buf.append('}');
        break;
    case Opcodes.F_APPEND:
        declareFrameTypes(nLocal, local);
        buf.append(name).append(".visitFrame(Opcodes.F_APPEND,")
                .append(nLocal).append(", new Object[] {");
        appendFrameTypes(nLocal, local);
        buf.append("}, 0, null");
        break;
    case Opcodes.F_CHOP:
        buf.append(name).append(".visitFrame(Opcodes.F_CHOP,")
                .append(nLocal).append(", null, 0, null");
        break;
    case Opcodes.F_SAME:
        buf.append(name).append(
                ".visitFrame(Opcodes.F_SAME, 0, null, 0, null");
        break;
    case Opcodes.F_SAME1:
        declareFrameTypes(1, stack);
        buf.append(name).append(
                ".visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {");
        appendFrameTypes(1, stack);
        buf.append('}');
        break;
    }
    buf.append(");\n");
    text.add(buf.toString());
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:46,代碼來源:ASMifier.java

示例6: visitFrame

@Override
public void visitFrame(final int type, final int nLocal,
        final Object[] local, final int nStack, final Object[] stack) {
    if (insnCount == lastFrame) {
        throw new IllegalStateException(
                "At most one frame can be visited at a given code location.");
    }
    lastFrame = insnCount;
    int mLocal;
    int mStack;
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        mLocal = Integer.MAX_VALUE;
        mStack = Integer.MAX_VALUE;
        break;

    case Opcodes.F_SAME:
        mLocal = 0;
        mStack = 0;
        break;

    case Opcodes.F_SAME1:
        mLocal = 0;
        mStack = 1;
        break;

    case Opcodes.F_APPEND:
    case Opcodes.F_CHOP:
        mLocal = 3;
        mStack = 0;
        break;

    default:
        throw new IllegalArgumentException("Invalid frame type " + type);
    }

    if (nLocal > mLocal) {
        throw new IllegalArgumentException("Invalid nLocal=" + nLocal
                + " for frame type " + type);
    }
    if (nStack > mStack) {
        throw new IllegalArgumentException("Invalid nStack=" + nStack
                + " for frame type " + type);
    }

    if (type != Opcodes.F_CHOP) {
        if (nLocal > 0 && (local == null || local.length < nLocal)) {
            throw new IllegalArgumentException(
                    "Array local[] is shorter than nLocal");
        }
        for (int i = 0; i < nLocal; ++i) {
            checkFrameValue(local[i]);
        }
    }
    if (nStack > 0 && (stack == null || stack.length < nStack)) {
        throw new IllegalArgumentException(
                "Array stack[] is shorter than nStack");
    }
    for (int i = 0; i < nStack; ++i) {
        checkFrameValue(stack[i]);
    }
    if (type == Opcodes.F_NEW) {
        ++expandedFrames;
    } else {
        ++compressedFrames;
    }
    if (expandedFrames > 0 && compressedFrames > 0) {
        throw new RuntimeException(
                "Expanded and compressed frames must not be mixed.");
    }
    super.visitFrame(type, nLocal, local, nStack, stack);
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:73,代碼來源:CheckMethodAdapter.java

示例7: FrameNode

/**
 * Constructs a new {@link FrameNode}.
 * 
 * @param type
 *            the type of this frame. Must be {@link Opcodes#F_NEW} for
 *            expanded frames, or {@link Opcodes#F_FULL},
 *            {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP},
 *            {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND},
 *            {@link Opcodes#F_SAME1} for compressed frames.
 * @param nLocal
 *            number of local variables of this stack map frame.
 * @param local
 *            the types of the local variables of this stack map frame.
 *            Elements of this list can be Integer, String or LabelNode
 *            objects (for primitive, reference and uninitialized types
 *            respectively - see {@link MethodVisitor}).
 * @param nStack
 *            number of operand stack elements of this stack map frame.
 * @param stack
 *            the types of the operand stack elements of this stack map
 *            frame. Elements of this list can be Integer, String or
 *            LabelNode objects (for primitive, reference and uninitialized
 *            types respectively - see {@link MethodVisitor}).
 */
public FrameNode(final int type, final int nLocal, final Object[] local,
        final int nStack, final Object[] stack) {
    super(-1);
    this.type = type;
    switch (type) {
    case Opcodes.F_NEW:
    case Opcodes.F_FULL:
        this.local = asList(nLocal, local);
        this.stack = asList(nStack, stack);
        break;
    case Opcodes.F_APPEND:
        this.local = asList(nLocal, local);
        break;
    case Opcodes.F_CHOP:
        this.local = Arrays.asList(new Object[nLocal]);
        break;
    case Opcodes.F_SAME:
        break;
    case Opcodes.F_SAME1:
        this.stack = asList(1, stack);
        break;
    }
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Nonce-ID-Finder,代碼行數:47,代碼來源:FrameNode.java


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