US 6453411 B1 The inventive mechanism has a run-time
optimization system (RTOS) embedded in hardware. When the code
is first moved into Icache, a threshold value is set into a
counter associated with the instruction or instruction bundle of
the particular cache line of the Icache. Each time the
instruction or instruction bundle is executed and retired, the
counter is decremented by one. When the counter reaches zero, a
trap is generated to inform that the code is hot. A trace
selector will form a trace starting from the hot instruction (or
instruction bundle) from the Icache line. The Icache maintains
branch history information for the instructions in each cache
line which is used to determine whether a branch should be
predicted as taken or fall through. After the trace is formed,
it is optimized and stored into a trace memory portion of the
physical memory. The mapping between the original code of the
trace and the optimized trace in the trace memory is maintained
in a mapping table. The processor consults