The present invention provides a technique for reducing the number of
write barriers without compromising garbage collector performance or
correctness. To that end, a compiler defers emitting write barriers until
it reaches a subsequent instruction in the mutator code. At this point,
the compiler may elide repeated or unnecessary write-barrier code so as
to emit only those write barriers that provide useful information to the
garbage collector. By eliminating write-barrier code in this manner, the
amount of write-barrier overhead in the mutator can be minimized,
consequently enabling the mutator to execute faster and more efficiently.
Further, collocating write barriers after the predetermined instruction
also enables the compiler to generate object code having better cache
performance and more efficient use of guard code than is possible using
conventional write-barrier implementations.