Patent ID: 8713548

Claim:
A method, in a data processing system, for rewriting branch instructions in a portion of code, comprising: receiving, in a processor of the data processing system, a portion of source code having an original branch instruction; generating, by a compiler executing on the processor, a branch stub for the original branch instruction, wherein the branch stub stores information about the original branch instruction including an original target address of the original branch instruction and a link to an instruction cache manager that manages loading of instructions from a backing store to an instruction cache of a computing device; rewriting, by the compiler, the original branch instruction so that a target of the rewritten branch instruction references the branch stub; and outputting, by the compiler, compiled code including the rewritten branch instruction and the branch stub, for execution by the computing device, wherein the branch stub is utilized by the computing device at runtime to determine if execution of the rewritten branch instruction can be redirected directly to a target instruction corresponding to the original target address in an instruction cache of the computing device without intervention by an instruction cache runtime system.