A computer system includes a processor; and a memory coupled to the
processor, configured to provide the processor with a plurality of
instructions including a garbage collection barrier instruction and a
subsequent instruction that immediately follows the garbage collection
barrier instruction; wherein the processor is configured to execute the
garbage collection barrier instruction, including by: evaluating a memory
reference to determine a condition associated with the garbage collection
barrier instruction; and in the event that the condition is met, while
maintaining the same privilege level, saving information that is based at
least in part on the current value of a program counter, and setting the
program counter to correspond to a target location that is other than the
location of the subsequent instruction.