@@ -28,7 +28,7 @@ different properties.
28
28
one weak reference.
29
29
30
30
The garbage collector may reclaim weakly reachable objects, clear weak references to weakly
31
- reachable objects, and/or performing associated clean-up operations.
31
+ reachable objects, and/or perform associated clean-up operations.
32
32
33
33
[ object graph ] : ../../glossary.md#object-graph
34
34
@@ -195,7 +195,7 @@ already moved.
195
195
## Supporting weak references
196
196
197
197
The general way to handle weak references is, after computing the transitive closure, iterate
198
- through all fields that contain weak references to objects . For each field,
198
+ through all fields that contain weak references. For each field,
199
199
200
200
- if the referent has already been reached, write the new address of the object to the field (or
201
201
do nothing if the object is not moved);
@@ -285,7 +285,7 @@ Take Java as an example, we may run `process_weak_refs` four times.
285
285
- clear the referent field,
286
286
- remove the ` SoftReference ` from the list of soft references, and
287
287
- optionally enqueue it to the associated ` ReferenceQueue ` if it has one.
288
- - (This step may expand the transitive closure in emergency GCs if any referents are
288
+ - (This step may expand the transitive closure in non- emergency GCs if any referents are
289
289
retained.)
290
290
2 . Visit all ` WeakReference ` .
291
291
- If the referent has been reached, then
@@ -371,8 +371,8 @@ To support ephemerons, the VM binding needs to identify ephemerons. This includ
371
371
individual objects, objects that contain ephemerons, and, equivalently, objects that contain
372
372
key/value fields that have semantics similar to ephemerons.
373
373
374
- The following is the algorithm for processing ephemerons. It gradually discovers ephemerons as we
375
- do the tracing. We maintain a queue of ephemerons which is empty before the ` Closure ` stage.
374
+ The following is an algorithm for processing ephemerons. It gradually discovers ephemerons as we do
375
+ the tracing. We maintain a queue of ephemerons which is empty before the ` Closure ` stage.
376
376
377
377
1 . In ` Scanning::scan_object ` and ` Scanning::scan_object_and_trace_edges ` , we enqueue ephemerons
378
378
(into the queue of ephemerons we created before) as we scan them, but do not trace either the
@@ -389,7 +389,7 @@ do the tracing. We maintain a queue of ephemerons which is empty before the `Cl
389
389
This algorithm can be modified if we have a list of all ephemerons before GC starts. We no longer
390
390
need to maintain the queue.
391
391
392
- - In Step 1, we don't need to enqueue ephemerons.
392
+ - In Step 1, we don't need to enqueue ephemerons or trace their key or value fields .
393
393
- In Step 2, we iterate through all ephemerons. We retain the value if both the ephemeron itself
394
394
and the key have been reached, and the value has not been reached, yet. We don't need to remove
395
395
any ephemeron from the list.
0 commit comments