/** * Check to ensure that this context is not the result of recursion. */ public void checkForRecursion() throws CFGBuilderException { Context callerContext = caller; while (callerContext != null) { if (callerContext.subroutine == this.subroutine) { throw new CFGBuilderException("JSR recursion detected!"); } callerContext = callerContext.caller; } } }
/** * Add an instruction to the subroutine. We keep track of which * instructions are part of which subroutines. No instruction may be * part of more than one subroutine. * * @param handle * the instruction to be added to the subroutine */ public void addInstruction(InstructionHandle handle) throws CFGBuilderException { int position = handle.getPosition(); if (usedInstructionSet.get(position)) { throw new CFGBuilderException("Instruction " + handle + " visited in multiple subroutines"); } instructionSet.set(position); usedInstructionSet.set(position); }
InstructionHandle next = handle.getNext(); if (next == null) { throw new CFGBuilderException("Control falls off end of method: " + handle);
throw new CFGBuilderException("Invalid stack at "+prev+" when checking "+handle);
throw new CFGBuilderException("Unknown caller for escape target " + targetInstruction + " referenced by " + context.getSubroutine().getStartInstruction());
/** * Check to ensure that this context is not the result of recursion. */ public void checkForRecursion() throws CFGBuilderException { Context callerContext = caller; while (callerContext != null) { if (callerContext.subroutine == this.subroutine) { throw new CFGBuilderException("JSR recursion detected!"); } callerContext = callerContext.caller; } } }
/** * Add an instruction to the subroutine. We keep track of which * instructions are part of which subroutines. No instruction may be * part of more than one subroutine. * * @param handle * the instruction to be added to the subroutine */ public void addInstruction(InstructionHandle handle) throws CFGBuilderException { int position = handle.getPosition(); if (usedInstructionSet.get(position)) { throw new CFGBuilderException("Instruction " + handle + " visited in multiple subroutines"); } instructionSet.set(position); usedInstructionSet.set(position); }
InstructionHandle next = handle.getNext(); if (next == null) { throw new CFGBuilderException("Control falls off end of method: " + handle);
throw new CFGBuilderException("Invalid stack at "+prev+" when checking "+handle);
throw new CFGBuilderException("Unknown caller for escape target " + targetInstruction + " referenced by " + context.getSubroutine().getStartInstruction());