Patent ID: 7519944

Claim:
A method for executing postprocessing logic to a subject computer program routine, comprising the steps of: (a) as a function of exit type, modifying byte-codes of the subject computer program routine including for different exit-types inserting different instructions into the subject computer program routine resulting in modifying exit handling steps in the subject computer program routine, different exit types having respective different sets of exit handling steps, exit types including exception exit and ordinary exit; wherein said modifying byte codes of the subject computer program routine for ordinary exit includes: inserting a subroutine call instruction before each original RETURN instruction in the subject computer program routine; providing in the called subroutine an instruction to return to one of the original RETURN instructions; and replacing an original RETURN instruction in the subject computer program routine with a BRANCH instruction that enables (i) execution of the postprocessing logic and (ii) thereafter a return similar to the original RETURN instruction; and wherein said modifying byte codes of the subject computer program routine for exception exit includes inserting a working exception handling region in an exception handling table, the working exception handling region calling a handler that (i) executes the postprocessing logic, and (ii) subsequently rethrows an exception; (b) in each set of exit handling steps, executing desired postprocessing logic, there being different postprocessing logic for ordinary exit than for exception exit; and (c) resuming the subject computer program routine at an exit point wherein steps (a), (b) and (c) are performed in a manner free of wrapping code of the subject computer program routine inside another routine.