public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo) { if (DEBUG) { System.out.println("Exception:"); } // The stack size when entering the exception handler is always 1. stackSize = 1; // Evaluate the instruction block starting at the entry point of the // exception handler. evaluateInstructionBlock(clazz, method, codeAttribute, exceptionInfo.u2handlerPC); }
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo) { if (DEBUG) { System.out.println("Exception:"); } // The stack size when entering the exception handler is always 1. stackSize = 1; // Evaluate the instruction block starting at the entry point of the // exception handler. evaluateInstructionBlock(clazz, method, codeAttribute, exceptionInfo.u2handlerPC); }
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo) { if (DEBUG) { System.out.println("Exception:"); } // The stack size when entering the exception handler is always 1. stackSize = 1; // Evaluate the instruction block starting at the entry point of the // exception handler. evaluateInstructionBlock(clazz, method, codeAttribute, exceptionInfo.u2handlerPC); }
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo) { if (DEBUG) { System.out.println("Exception:"); } // The stack size when entering the exception handler is always 1. stackSize = 1; // Evaluate the instruction block starting at the entry point of the // exception handler. evaluateInstructionBlock(clazz, method, codeAttribute, exceptionInfo.u2handlerPC); }
public void visitAnySwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SwitchInstruction switchInstruction) { // Evaluate the target instruction blocks. // Loop over all jump offsets. int[] jumpOffsets = switchInstruction.jumpOffsets; for (int index = 0; index < jumpOffsets.length; index++) { // Evaluate the jump instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + jumpOffsets[index]); } // Also evaluate the default instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + switchInstruction.defaultOffset); // The switch instruction always ends the current instruction block. exitInstructionBlock = true; }
public void visitAnySwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SwitchInstruction switchInstruction) { // Evaluate the target instruction blocks. // Loop over all jump offsets. int[] jumpOffsets = switchInstruction.jumpOffsets; for (int index = 0; index < jumpOffsets.length; index++) { // Evaluate the jump instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + jumpOffsets[index]); } // Also evaluate the default instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + switchInstruction.defaultOffset); // The switch instruction always ends the current instruction block. exitInstructionBlock = true; }
public void visitAnySwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SwitchInstruction switchInstruction) { // Evaluate the target instruction blocks. // Loop over all jump offsets. int[] jumpOffsets = switchInstruction.jumpOffsets; for (int index = 0; index < jumpOffsets.length; index++) { // Evaluate the jump instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + jumpOffsets[index]); } // Also evaluate the default instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + switchInstruction.defaultOffset); // The switch instruction always ends the current instruction block. exitInstructionBlock = true; }
public void visitAnySwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SwitchInstruction switchInstruction) { // Evaluate the target instruction blocks. // Loop over all jump offsets. int[] jumpOffsets = switchInstruction.jumpOffsets; for (int index = 0; index < jumpOffsets.length; index++) { // Evaluate the jump instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + jumpOffsets[index]); } // Also evaluate the default instruction block. evaluateInstructionBlock(clazz, method, codeAttribute, offset + switchInstruction.defaultOffset); // The switch instruction always ends the current instruction block. exitInstructionBlock = true; }
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction) { byte opcode = branchInstruction.opcode; // Evaluate the target instruction blocks. evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.branchOffset); // Evaluate the instructions after a subroutine branch. if (opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W) { // We assume subroutine calls (jsr and jsr_w instructions) don't // change the stack, other than popping the return value. stackSize -= 1; evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.length(offset)); } // Some branch instructions always end the current instruction block. exitInstructionBlock = opcode == InstructionConstants.OP_GOTO || opcode == InstructionConstants.OP_GOTO_W || opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W; }
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction) { byte opcode = branchInstruction.opcode; // Evaluate the target instruction blocks. evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.branchOffset); // Evaluate the instructions after a subroutine branch. if (opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W) { // We assume subroutine calls (jsr and jsr_w instructions) don't // change the stack, other than popping the return value. stackSize -= 1; evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.length(offset)); } // Some branch instructions always end the current instruction block. exitInstructionBlock = opcode == InstructionConstants.OP_GOTO || opcode == InstructionConstants.OP_GOTO_W || opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W; }
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction) { byte opcode = branchInstruction.opcode; // Evaluate the target instruction blocks. evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.branchOffset); // Evaluate the instructions after a subroutine branch. if (opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W) { // We assume subroutine calls (jsr and jsr_w instructions) don't // change the stack, other than popping the return value. stackSize -= 1; evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.length(offset)); } // Some branch instructions always end the current instruction block. exitInstructionBlock = opcode == InstructionConstants.OP_GOTO || opcode == InstructionConstants.OP_GOTO_W || opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W; }
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction) { byte opcode = branchInstruction.opcode; // Evaluate the target instruction blocks. evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.branchOffset); // Evaluate the instructions after a subroutine branch. if (opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W) { // We assume subroutine calls (jsr and jsr_w instructions) don't // change the stack, other than popping the return value. stackSize -= 1; evaluateInstructionBlock(clazz, method, codeAttribute, offset + branchInstruction.length(offset)); } // Some branch instructions always end the current instruction block. exitInstructionBlock = opcode == InstructionConstants.OP_GOTO || opcode == InstructionConstants.OP_GOTO_W || opcode == InstructionConstants.OP_JSR || opcode == InstructionConstants.OP_JSR_W; }
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute) { if (DEBUG) { System.out.println("StackSizeComputer: "+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)); } // Try to reuse the previous array. int codeLength = codeAttribute.u4codeLength; if (evaluated.length < codeLength) { evaluated = new boolean[codeLength]; stackSizes = new int[codeLength]; } else { for (int index = 0; index < codeLength; index++) { evaluated[index] = false; } } // The initial stack is always empty. stackSize = 0; maxStackSize = 0; // Evaluate the instruction block starting at the entry point of the method. evaluateInstructionBlock(clazz, method, codeAttribute, 0); // Evaluate the exception handlers. codeAttribute.exceptionsAccept(clazz, method, this); }
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute) { if (DEBUG) { System.out.println("StackSizeComputer: "+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)); } int codeLength = codeAttribute.u4codeLength; // Make sure the global arrays are sufficiently large. evaluated = ArrayUtil.ensureArraySize(evaluated, codeLength, false); stackSizesBefore = ArrayUtil.ensureArraySize(stackSizesBefore, codeLength, 0); stackSizesAfter = ArrayUtil.ensureArraySize(stackSizesAfter, codeLength, 0); // The initial stack is always empty. stackSize = 0; maxStackSize = 0; // Evaluate the instruction block starting at the entry point of the method. evaluateInstructionBlock(clazz, method, codeAttribute, 0); // Evaluate the exception handlers. codeAttribute.exceptionsAccept(clazz, method, this); }
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute) { if (DEBUG) { System.out.println("StackSizeComputer: "+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)); } int codeLength = codeAttribute.u4codeLength; // Make sure the global arrays are sufficiently large. evaluated = ArrayUtil.ensureArraySize(evaluated, codeLength, false); stackSizesBefore = ArrayUtil.ensureArraySize(stackSizesBefore, codeLength, 0); stackSizesAfter = ArrayUtil.ensureArraySize(stackSizesAfter, codeLength, 0); // The initial stack is always empty. stackSize = 0; maxStackSize = 0; // Evaluate the instruction block starting at the entry point of the method. evaluateInstructionBlock(clazz, method, codeAttribute, 0); // Evaluate the exception handlers. codeAttribute.exceptionsAccept(clazz, method, this); }
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute) { if (DEBUG) { System.out.println("StackSizeComputer: "+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)); } int codeLength = codeAttribute.u4codeLength; // Make sure the global arrays are sufficiently large. evaluated = ArrayUtil.ensureArraySize(evaluated, codeLength, false); stackSizesBefore = ArrayUtil.ensureArraySize(stackSizesBefore, codeLength, 0); stackSizesAfter = ArrayUtil.ensureArraySize(stackSizesAfter, codeLength, 0); // The initial stack is always empty. stackSize = 0; maxStackSize = 0; // Evaluate the instruction block starting at the entry point of the method. evaluateInstructionBlock(clazz, method, codeAttribute, 0); // Evaluate the exception handlers. codeAttribute.exceptionsAccept(clazz, method, this); }