-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR revamps the reference processor, and schedules reference processing work. This PR is one step towards #544: it gets the old reference processor working again. There is some more work needed for weak reference processing. So `no_reference_types` is `true` and by default, we do not process weak references. Changes * Rework on `ReferenceProcessor`: * retain soft references properly, depending on whether the collection is an emergency collection or not. * add a separate reference enqueue step. For references that need to be enqueue'd (by Java semantics), the reference processor will store them in a buffer, and call to the binding at the end of a GC to enqueue the references. This makes sure the references are valid during the GC. * reference table is now an `HashSet` rather than `Vec`. We used to assume weak references are added to MMTk once they are created, so for one reference, it will be added once. Now we allow adding weak references during GC, and a weak reference may be traced multiple times in a GC, and added multiple times to MMTk. Using `HashSet` can deduplicate the references. * Remove unnecessary use of `UnsafeCell` for `ReferenceProcessorSync`. * Remove unnecessary `unforwarded_references`: I suspect it was intended to deal with meta-circularity in JikesRVM/Java MMTk (https://github.com/JikesRVM/JikesRVM/blob/5072f19761115d987b6ee162f49a03522d36c697/MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ReferenceProcessor.java#L96), and is no longer needed for MMTk core. For MMTk core, any Rust struct and field is 'untraced' unless we specifically 'trace' it. * Add a `allow_new_candidate` field to avoid adding new candidates after we finish processing references. See the comments for the field for details. * `process_reference()` is moved from `ReferenceGlue` (in VMBinding traits) to `ReferenceProcessor`. * `enqueue_references()` is added to `ReferenceGlue`. * Add a few work packets for weak reference processing. They are simply wrapping the reference processor's methods, and are single threaded. * Add a few more work buckets for weak reference processing: `SoftRefClosure`, `WeakRefClosure`, `PhantomRefClosure`, `FinalRefClosure`, `FinalizableForwarding`. * Schedule the weak reference processing work properly. * Rename `ProcessWeakRef` (which call `VMBinding::VMCollection::process_weak_refs()`) to `VMProcessWeakRef`. * `add_soft/weak/phantom_candidate()` now no longer needs a `referent` argument.
- Loading branch information
Showing
15 changed files
with
573 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.