Patent ID: 7725885

Claim:
A method for efficiently executing a program comprising source code, the method comprising: while a program is running: determining a selection of hot code traces from a plurality of code traces within a source code of said program based on an analysis of a frequency with which each code trace of said plurality of code traces is being executed during said running of said program and an execution pathway for said each code trace; upon said determining, initiating collecting of said selection of hot code traces; continuing said collecting of said selection of hot code traces until each hot code trace of said selection encounters termination criterion, whereby once encountering said termination criterion said each hot code trace becomes a complete hot code trace; adding each said complete hot code trace to a queue of complete hot code traces for subsequent compilation; compiling said queue of complete hot code traces, thereby enabling efficient compilation and execution of said program, wherein a balance of said source code is not yet compiled; wherein, during said running of said program, utilizing breakpoints instrumentation implemented with the hot code traces queue to control garbage collection and synchronize hot traces, the garbage collection control and traces synchronization comprising: utilizing safe points at break-points associated with said complete hot code traces within said queue to collect garbage according to a priority of said each of said complete hot code traces within said queue to be compiled, wherein said break-points provide a break within said running of said program; and after said garbage collection is complete, replacing each of said break-points with an original instruction and proceeding with said running of said program; and executing said balance of said source code via interpretation.