One embodiment of the present invention provides a system for type tagging
values in a compiled activation frame in a lazy manner to facilitate
garbage collection. This system operates in a mixed-mode environment that
supports both interpretation of byte codes and execution of compiled
native code. Upon receiving an invocation of a method, the system creates
an activation frame for the method on the execution stack. If the method
is executing in interpreted mode, the interpreter maintains a tag for
each value in the activation frame during execution. The tag indicates
whether the value is a reference type or a primitive type. However, if
the method is executing in compiled mode, the system allocates space for
tags for each value in the activation frame, but does not fill in the
tags during execution. This allows the tags to be filled in at a future
time when needed.