An improved method for compiler support of garbage collection. Live
reference data to support a garbage collection process are stored in null
operation instructions (NOPs) of an instruction set within the native
code. This allows the live reference information to be encoded near the
call instruction and thus the information can be retrieved in constant
time. This may decease the amount of processing resources required for
garbage collection.The compiler determines which references are live at
each call. The compiler may also determine the number of bits that may be
used to store those references. In one embodiment the number of NOPs is
sufficient to store the information. In an alternative embodiment, NOPs
are artificially inserted to store the information. Because a sufficient
number of NOPs are typically present anyway, the method of one embodiment
of the present invention does not significantly increase the size of the
code.