Skip to content

Commit 8dcfcc3

Browse files
authored
Fix typos and vague statements in weakref doc (#1329)
We fix some mistakes and vague statements in the Finalizer and Weak Reference chapter in the Porting Guide.
1 parent 3d89bb5 commit 8dcfcc3

File tree

1 file changed

+6
-6
lines changed
  • docs/userguide/src/portingguide/concerns

1 file changed

+6
-6
lines changed

docs/userguide/src/portingguide/concerns/weakref.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ different properties.
2828
one weak reference.
2929

3030
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.
3232

3333
[object graph]: ../../glossary.md#object-graph
3434

@@ -195,7 +195,7 @@ already moved.
195195
## Supporting weak references
196196

197197
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,
199199

200200
- if the referent has already been reached, write the new address of the object to the field (or
201201
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.
285285
- clear the referent field,
286286
- remove the `SoftReference` from the list of soft references, and
287287
- 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
289289
retained.)
290290
2. Visit all `WeakReference`.
291291
- If the referent has been reached, then
@@ -371,8 +371,8 @@ To support ephemerons, the VM binding needs to identify ephemerons. This includ
371371
individual objects, objects that contain ephemerons, and, equivalently, objects that contain
372372
key/value fields that have semantics similar to ephemerons.
373373

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.
376376

377377
1. In `Scanning::scan_object` and `Scanning::scan_object_and_trace_edges`, we enqueue ephemerons
378378
(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
389389
This algorithm can be modified if we have a list of all ephemerons before GC starts. We no longer
390390
need to maintain the queue.
391391

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.
393393
- In Step 2, we iterate through all ephemerons. We retain the value if both the ephemeron itself
394394
and the key have been reached, and the value has not been reached, yet. We don't need to remove
395395
any ephemeron from the list.

0 commit comments

Comments
 (0)