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


Java CodeIterator.move方法代码示例

本文整理汇总了Java中javassist.bytecode.CodeIterator.move方法的典型用法代码示例。如果您正苦于以下问题:Java CodeIterator.move方法的具体用法?Java CodeIterator.move怎么用?Java CodeIterator.move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javassist.bytecode.CodeIterator的用法示例。


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

示例1: scan

import javassist.bytecode.CodeIterator; //导入方法依赖的package包/类
private void scan(int pos, CodeIterator iter, Subroutine sub) throws BadBytecode {
    // Skip already processed blocks
    if (done.contains(Integer.valueOf(pos)))
        return;

    done.add(Integer.valueOf(pos));

    int old = iter.lookAhead();
    iter.move(pos);

    boolean next;
    do {
        pos = iter.next();
        next = scanOp(pos, iter, sub) && iter.hasNext();
    } while (next);

    iter.move(old);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:SubroutineScanner.java

示例2: runEditor

import javassist.bytecode.CodeIterator; //导入方法依赖的package包/类
protected void runEditor(ExprEditor ed, CodeIterator oldIterator)
    throws CannotCompileException
{
    CodeAttribute codeAttr = oldIterator.get();
    int orgLocals = codeAttr.getMaxLocals();
    int orgStack = codeAttr.getMaxStack();
    int newLocals = locals();
    codeAttr.setMaxStack(stack());
    codeAttr.setMaxLocals(newLocals);
    ExprEditor.LoopContext context
        = new ExprEditor.LoopContext(newLocals);
    int size = oldIterator.getCodeLength();
    int endPos = oldIterator.lookAhead();
    oldIterator.move(currentPos);
    if (ed.doit(thisClass, thisMethod, context, oldIterator, endPos))
        edited = true;

    oldIterator.move(endPos + oldIterator.getCodeLength() - size);
    codeAttr.setMaxLocals(orgLocals);
    codeAttr.setMaxStack(orgStack);
    maxLocals = context.maxLocals;
    maxStack += context.maxStack;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:Expr.java

示例3: scan

import javassist.bytecode.CodeIterator; //导入方法依赖的package包/类
private void scan(int pos, CodeIterator iter, Subroutine sub) throws BadBytecode {
    // Skip already processed blocks
    if (done.contains(new Integer(pos)))
        return;

    done.add(new Integer(pos));

    int old = iter.lookAhead();
    iter.move(pos);

    boolean next;
    do {
        pos = iter.next();
        next = scanOp(pos, iter, sub) && iter.hasNext();
    } while (next);

    iter.move(old);
}
 
开发者ID:MeRPG2,项目名称:EndHQ-Libraries,代码行数:19,代码来源:SubroutineScanner.java

示例4: analyzeNextEntry

import javassist.bytecode.CodeIterator; //导入方法依赖的package包/类
private void analyzeNextEntry(MethodInfo method, CodeIterator iter,
        IntQueue queue, Executor executor) throws BadBytecode {
    int pos = queue.take();
    iter.move(pos);
    iter.next();

    Frame frame = frames[pos].copy();
    Subroutine subroutine = subroutines[pos];

    try {
        executor.execute(method, pos, iter, frame, subroutine);
    } catch (RuntimeException e) {
        throw new BadBytecode(e.getMessage() + "[pos = " + pos + "]", e);
    }

    int opcode = iter.byteAt(pos);

    if (opcode == TABLESWITCH) {
        mergeTableSwitch(queue, pos, iter, frame);
    } else if (opcode == LOOKUPSWITCH) {
        mergeLookupSwitch(queue, pos, iter, frame);
    } else if (opcode == RET) {
        mergeRet(queue, iter, pos, frame, subroutine);
    } else if (Util.isJumpInstruction(opcode)) {
        int target = Util.getJumpTarget(pos, iter);

        if (Util.isJsr(opcode)) {
            // Merge the state before the jsr into the next instruction
            mergeJsr(queue, frames[pos], subroutines[target], pos, lookAhead(iter, pos));
        } else if (! Util.isGoto(opcode)) {
            merge(queue, frame, lookAhead(iter, pos));
        }

        merge(queue, frame, target);
    } else if (opcode != ATHROW && ! Util.isReturn(opcode)) {
        // Can advance to next instruction
        merge(queue, frame, lookAhead(iter, pos));
    }

    // Merge all exceptions that are reachable from this instruction.
    // The redundancy is intentional, since the state must be based
    // on the current instruction frame.
    mergeExceptionHandlers(queue, method, pos, frame);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:45,代码来源:Analyzer.java


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