Combining write-barriers within an inner loop with fixed step
First Claim
1. For employing a computer to compile source code that specifies operation of a mutator, which includes a loop including at least one reference-modifying instruction that modifies a reference stored in an array of references, into object code for execution by a computer system, which includes a memory of which at least a portion is logically partitioned into cards, together with a garbage collector that relies on the mutator'"'"'s execution of write-barrier code to keep track of at least some reference modifications, a method comprising:
- (A) determining whether execution of the loop included in the mutator would result in modifications, by the least one reference-modifying instruction included in the loop, of at least one reference stored in the array of references within each card spanned by the array of references;
(B) deferring, in response to determining that execution of the loop would result in at least one reference stored in the array of references being modified within each card spanned by the array of references, emission of write-barrier code corresponding to the reference modifications made to the references contained in the array of references;
(C) emitting write-barrier code that executes subsequent to the execution of the object code implementing the loop, the write-barrier code executing a write barrier corresponding to each card spanned by the array of references; and
(D) providing, in response to determining that execution of the loop would result in at least one reference stored in the array of references being modified within each card spanned by the array of references, a data structure containing an indication of a location that stores the memory address of the array of references, the data structure being accessible to the collector.
2 Assignments
0 Petitions
Accused Products
Abstract
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.
57 Citations
7 Claims
-
1. For employing a computer to compile source code that specifies operation of a mutator, which includes a loop including at least one reference-modifying instruction that modifies a reference stored in an array of references, into object code for execution by a computer system, which includes a memory of which at least a portion is logically partitioned into cards, together with a garbage collector that relies on the mutator'"'"'s execution of write-barrier code to keep track of at least some reference modifications, a method comprising:
-
(A) determining whether execution of the loop included in the mutator would result in modifications, by the least one reference-modifying instruction included in the loop, of at least one reference stored in the array of references within each card spanned by the array of references;
(B) deferring, in response to determining that execution of the loop would result in at least one reference stored in the array of references being modified within each card spanned by the array of references, emission of write-barrier code corresponding to the reference modifications made to the references contained in the array of references;
(C) emitting write-barrier code that executes subsequent to the execution of the object code implementing the loop, the write-barrier code executing a write barrier corresponding to each card spanned by the array of references; and
(D) providing, in response to determining that execution of the loop would result in at least one reference stored in the array of references being modified within each card spanned by the array of references, a data structure containing an indication of a location that stores the memory address of the array of references, the data structure being accessible to the collector. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
Specification