本文整理汇总了Java中javassist.bytecode.CodeAttribute.setMaxStack方法的典型用法代码示例。如果您正苦于以下问题:Java CodeAttribute.setMaxStack方法的具体用法?Java CodeAttribute.setMaxStack怎么用?Java CodeAttribute.setMaxStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javassist.bytecode.CodeAttribute
的用法示例。
在下文中一共展示了CodeAttribute.setMaxStack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertAuxInitializer
import javassist.bytecode.CodeAttribute; //导入方法依赖的package包/类
private static void insertAuxInitializer(CodeAttribute codeAttr,
Bytecode initializer,
int stacksize)
throws BadBytecode
{
CodeIterator it = codeAttr.iterator();
int index = it.skipSuperConstructor();
if (index < 0) {
index = it.skipThisConstructor();
if (index >= 0)
return; // this() is called.
// Neither this() or super() is called.
}
int pos = it.insertEx(initializer.get());
it.insert(initializer.getExceptionTable(), pos);
int maxstack = codeAttr.getMaxStack();
if (maxstack < stacksize)
codeAttr.setMaxStack(stacksize);
}
示例2: runEditor
import javassist.bytecode.CodeAttribute; //导入方法依赖的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;
}