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; } }
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); }
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; } }
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); }
iterator.writeByte(DUP_X2, pos + 1); iterator.writeByte(POP, pos + 2); ca.setMaxStack(ca.getMaxStack() + 2); iterator.writeByte(ACONST_NULL, pos); iterator.writeByte(SWAP, pos + 1); ca.setMaxStack(ca.getMaxStack() + 1);
iterator.writeByte(DUP_X2, pos + 1); iterator.writeByte(POP, pos + 2); ca.setMaxStack(ca.getMaxStack() + 2); iterator.writeByte(ACONST_NULL, pos); iterator.writeByte(SWAP, pos + 1); ca.setMaxStack(ca.getMaxStack() + 1);
codeAttr.setMaxLocals(context.maxLocals); codeAttr.setMaxStack(codeAttr.getMaxStack() + context.maxStack); try { if (edited)
codeAttr.setMaxStack(codeAttr.getMaxStack() + stack);
int maxstack = codeAttr.getMaxStack(); if (maxstack < stacksize) codeAttr.setMaxStack(stacksize);
jv.recordParams(getParameterTypes(), false); jv.compileStmnt(src); ca.setMaxStack(b.getMaxStack()); ca.setMaxLocals(b.getMaxLocals()); iterator.skipConstructor();
codeAttr.setMaxLocals(context.maxLocals); codeAttr.setMaxStack(codeAttr.getMaxStack() + context.maxStack); try { if (edited)
ca.setMaxStack(stack);
codeAttr.setMaxStack(codeAttr.getMaxStack() + stack);
int maxstack = codeAttr.getMaxStack(); if (maxstack < stacksize) codeAttr.setMaxStack(stacksize);
ca.setMaxStack(stack);
jv.recordParams(getParameterTypes(), false); jv.compileStmnt(src); ca.setMaxStack(b.getMaxStack()); ca.setMaxLocals(b.getMaxLocals()); iterator.skipConstructor();
ca.setMaxStack(stack);
ca.setMaxStack(stack);
ca.setMaxStack(stack);
ca.setMaxStack(b.getMaxStack()); ca.setMaxLocals(b.getMaxLocals()); methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2());