/** * Calculate and set the maximum stack depth needed for * the instructions used. * * @see #setMaxStack */ public void calculateMaxStack() { int stack = 0; int max = 0; ExceptionHandler[] handlers = getExceptionHandlers(); Instruction ins; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { ins = (Instruction) entry; stack += ins.getStackChange(); // if this is the start of a try, the exception will be placed // on the stack for (int j = 0; j < handlers.length; j++) if (handlers[j].getTryStart() == ins) stack++; if (stack > max) max = stack; } setMaxStack(max); }
/** * Calculate and set the maximum stack depth needed for * the instructions used. * * @see #setMaxStack */ public void calculateMaxStack() { int stack = 0; int max = 0; ExceptionHandler[] handlers = getExceptionHandlers(); Instruction ins; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { ins = (Instruction) entry; stack += ins.getStackChange(); // if this is the start of a try, the exception will be placed // on the stack for (int j = 0; j < handlers.length; j++) if (handlers[j].getTryStart() == ins) stack++; if (stack > max) max = stack; } setMaxStack(max); }