Remove the unpleasant <VM as VMBinding>::Foo::bar code #652
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A VM binding has many aspects, and we represent them as several different traits:
ObjectModel,Scanning,Collection,ActivePlanandReferenceGlue.Currently, we combine them into one
VMBindingby making them member types of theVMBindingtrait, namely:This has some drawbacks.
One obvious drawback is that sometimes we have write
<VM as VMBinding>::SomeType::some_function. This is ugly, because the Rust complier is sometimes not smart enough to figure outVMimplementsVMBinding, andSomeTypeis a member ofVMBinding.To solve this problem, we make those traits "trait bounds" of the
VMBindingtrait. Namely:By doing this, A binding instance (such as
OpenJDK) directly implementsObjectModel,Scanning,Collection, ..., instead of aggregating them into member types. So instead of<VM as VMBinding>::Foo::bar, we only need to writeVM::bar.VM::VMObjectModel::copy, we writeVM::copy<VM as VMBinding>::VMCollection::resume_mutators, we writeVM::resume_mutators<E::VM as VMBinding>::VMScanning::scan_thread_roots, we writeE::VM::scan_thread_roots<<E as ProcessEdgesWork>::VM as VMBinding>::VMCollection::schedule_finalization, we writeE::VM::schedule_finalization.