The present invention provides a technique for reducing the number of
write barriers executed in mutator code without compromising garbage
collector performance. To that end, when mutator instructions located
within an inner-most nested loop ("inner loop") modify references stored
in one or more arrays, a compiler defers emitting write barriers
corresponding to the reference modifications until after the inner loop
is emitted. By deferring emission of write barriers, the mutator may
execute a write barrier for each card spanned by the array instead of
executing a typically larger number of write barriers corresponding to
each reference modification made in an array. Thus, the invention enables
the compiler to reduce the amount of write-barrier overhead performed by
the mutator, consequently enabling the mutator to execute faster and more
efficiently.