Patent ID: 7035977

Claim:
A method for stack-caching method frames used with a stack-based processor using a frame size overflow (FSO) flag to control its execution mode, the method comprising the steps of: (A) storing at least one method frame in a memory stack or a stack cache for operating, invoking method, and returning and accessing local variables, wherein the stack cache has a capacity limit; (B) if the FSO flag is in a clear state and a size of a next method frame is larger than the capacity limit, changing the FSO flag into a set state and moving content in the stack cache to the memory stack so that the memory stack serves to store said method frame; (C) if the FSO flag is in the clear state and the size of next method frame is smaller than the capacity limit, storing the method frame in the stack cache; (D) if the FSO flag is in the set state and the size of the next method frame is smaller than the capacity limit, changing the FSO flag into the clear state and activating an auto spill and fill mechanism so that the stack cache serves to store the method frame for accessing data; and (E) if the FSO flag is in the set state and the size of the next method frame is larger than the capacity limit, storing the method frame in the memory stack.