-
Notifications
You must be signed in to change notification settings - Fork 85
Concurrent Immix #1355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Concurrent Immix #1355
Changes from 3 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
fb12863
WIP
tianleq 9ac22bd
minor
tianleq 04fee38
Merge branch 'master' of github.com:tianleq/mmtk-core into concurrent…
tianleq 100c049
minor
tianleq 2bbb200
Add ref/finalizer packets for final pause. Use log instead of println.
qinsoon 90f4518
schedule_concurrent_packets before resuming mutators
qinsoon 521adea
eBPF tracing tools for concurrent Immix
wks 4f14b2f
Wake up workers immediately for concurrent work
wks 865e24c
Fix clippy warnings and formatting
wks 7b13272
Move concurrent_marking_active to the plan. Add a flag allocate_as_live
qinsoon 1db4743
Rename load_reference to load_weak_reference
wks 5c38704
Replace `swap` with `replace` and `take`
wks a95e94a
Remove schedule_concurrent_collection
qinsoon eacc959
Rename gc_pause_start. Merge gc_pause_end with end_of_gc
qinsoon 028bd0e
Merge branch 'master' into concurrent-immix
qinsoon fe29529
Disallow new weak reference before ref enqueue
qinsoon 26c2a54
Introduce ConcurrentPlan. Make ConcurrentTraceObjects trace objects in
qinsoon 80024dd
Merge branch 'master' into concurrent-immix
qinsoon 7487c1b
Fix rayon-core version for MSRV
qinsoon 6bb03c0
More assertions and minor fix.
qinsoon ad41d7e
Wrong assertions
qinsoon a938110
Fix style check
qinsoon 321c6e2
Refactor log bits
qinsoon c9315b9
Merge branch 'master' into concurrent-immix
qinsoon 12112d2
Fix style check
qinsoon 77330fe
Use Concurrent bucket for concurrent work
qinsoon 74572eb
Merge branch 'master' into concurrent-immix
qinsoon bdcf723
Re-enable weak ref buckets. Calculate allocated pages using used pages.
qinsoon 1368ac5
Remove NUM_CONCURRENT_TRACING_PACKETS. Fix issues about enabling
qinsoon f906db3
Dont use TRACE_KIND_FAST in ConcurrentTraceObjects
qinsoon 4e5c772
Fix docs
qinsoon 47708b7
Allow defrag for STW full heap collection
qinsoon 35cf25a
Put generated concurrent work to the concurrent bucket. Don't need pr…
qinsoon 2653716
Properly call post_scan_object in ConcurrentTraceObject
qinsoon 9cdcb7a
Remove the use of Pause in StopMutators
qinsoon d43c9e5
Use normal StopMutators for initial marking
qinsoon e3163d8
Remove Collection::set_concurrent_marking_state. Introduce active for
qinsoon 4966131
Remove the GCCause type
qinsoon c70c03f
Cleanup
qinsoon c79fe8e
Fix style check
qinsoon a23bfbb
Fix style check
qinsoon 3e076a9
Fix style check
qinsoon 553227a
Remove object_reference_clone_pre
wks 8ad9ed8
Remove the gc_cause field.
wks acea83a
Postpone full GC after FinalMark
wks c442dcd
Merge branch 'master' into review/concurrent-immix
wks 70ef1db
Change active to SATBBarrier-specific
wks 6dfde0a
Label SlotIterator for refactoring
wks a33ba5a
Fix some comments
wks d7ae8e2
No longer expose concrete barriers to the VM binding.
wks 8acb5af
Comments and formatting
wks 2731449
Remove dead code.
wks ab75860
Extract method `eager_mark_lines`
wks d96d2e5
Minor change
wks 4e1db41
Record pause kind in eBPF trace
wks c9d4971
Move FIXME out of doc comment
wks ad0d88e
Remove duplicate clear/set_side_log_bits from policies
qinsoon be33efe
Set and clear side unlog bits in parallel.
wks 34be825
Merge remote-tracking branch 'tianleq/concurrent-immix' into review/c…
wks 2ee86af
Remove visualization of unused work packet
wks 0c3d9f6
Remove unnecessary unlog bit clearing
wks f76e954
Move `eager_mark_lines` to `Line`.
wks b7b79e4
Just use bset_metadata
wks 26f74c1
Code style and comments
wks 5b5552b
Extract bulk_set_line_mark_states
wks 815cc17
Make the `-e` option of `capture.py` work for ConcurrentImmix
wks 446ec36
Merge branch 'master' into review/concurrent-immix
wks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| use std::sync::atomic::Ordering; | ||
|
|
||
| use crate::{ | ||
| plan::{barriers::BarrierSemantics, concurrent::immix::global::ConcurrentImmix, VectorQueue}, | ||
| scheduler::WorkBucketStage, | ||
| util::ObjectReference, | ||
| vm::{ | ||
| slot::{MemorySlice, Slot}, | ||
| VMBinding, | ||
| }, | ||
| MMTK, | ||
| }; | ||
|
|
||
| use super::{concurrent_marking_work::ProcessModBufSATB, Pause}; | ||
|
|
||
| pub struct SATBBarrierSemantics<VM: VMBinding> { | ||
| mmtk: &'static MMTK<VM>, | ||
| satb: VectorQueue<ObjectReference>, | ||
| refs: VectorQueue<ObjectReference>, | ||
| immix: &'static ConcurrentImmix<VM>, | ||
|
qinsoon marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| impl<VM: VMBinding> SATBBarrierSemantics<VM> { | ||
| pub fn new(mmtk: &'static MMTK<VM>) -> Self { | ||
| Self { | ||
| mmtk, | ||
| satb: VectorQueue::default(), | ||
| refs: VectorQueue::default(), | ||
| immix: mmtk | ||
| .get_plan() | ||
| .downcast_ref::<ConcurrentImmix<VM>>() | ||
| .unwrap(), | ||
| } | ||
| } | ||
|
|
||
| fn slow(&mut self, _src: Option<ObjectReference>, _slot: VM::VMSlot, old: ObjectReference) { | ||
| self.satb.push(old); | ||
| if self.satb.is_full() { | ||
| self.flush_satb(); | ||
| } | ||
| } | ||
|
|
||
| fn enqueue_node( | ||
| &mut self, | ||
| src: Option<ObjectReference>, | ||
| slot: VM::VMSlot, | ||
| _new: Option<ObjectReference>, | ||
| ) -> bool { | ||
| if let Some(old) = slot.load() { | ||
| self.slow(src, slot, old); | ||
| } | ||
| true | ||
| } | ||
|
|
||
| /// Attempt to atomically log an object. | ||
| /// Returns true if the object is not logged previously. | ||
| fn log_object(&self, object: ObjectReference) -> bool { | ||
| Self::UNLOG_BIT_SPEC.store_atomic::<VM, u8>(object, 0, None, Ordering::SeqCst); | ||
| true | ||
| } | ||
|
|
||
| fn flush_satb(&mut self) { | ||
| if !self.satb.is_empty() { | ||
| if self.should_create_satb_packets() { | ||
| let satb = self.satb.take(); | ||
| if let Some(pause) = self.immix.current_pause() { | ||
| debug_assert_ne!(pause, Pause::InitialMark); | ||
| self.mmtk.scheduler.work_buckets[WorkBucketStage::Closure] | ||
| .add(ProcessModBufSATB::new(satb)); | ||
| } else { | ||
| self.mmtk.scheduler.work_buckets[WorkBucketStage::Unconstrained] | ||
| .add(ProcessModBufSATB::new(satb)); | ||
| } | ||
| } else { | ||
| let _ = self.satb.take(); | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| #[cold] | ||
| fn flush_weak_refs(&mut self) { | ||
| if !self.refs.is_empty() { | ||
| // debug_assert!(self.should_create_satb_packets()); | ||
| let nodes = self.refs.take(); | ||
| if let Some(pause) = self.immix.current_pause() { | ||
| debug_assert_ne!(pause, Pause::InitialMark); | ||
| self.mmtk.scheduler.work_buckets[WorkBucketStage::Closure] | ||
| .add(ProcessModBufSATB::new(nodes)); | ||
| } else { | ||
| self.mmtk.scheduler.work_buckets[WorkBucketStage::Unconstrained] | ||
| .add(ProcessModBufSATB::new(nodes)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn should_create_satb_packets(&self) -> bool { | ||
| self.immix.concurrent_marking_in_progress() | ||
| || self.immix.current_pause() == Some(Pause::FinalMark) | ||
| } | ||
| } | ||
|
|
||
| impl<VM: VMBinding> BarrierSemantics for SATBBarrierSemantics<VM> { | ||
| type VM = VM; | ||
|
|
||
| #[cold] | ||
| fn flush(&mut self) { | ||
| self.flush_satb(); | ||
| self.flush_weak_refs(); | ||
| } | ||
|
|
||
| fn object_reference_write_slow( | ||
| &mut self, | ||
| src: ObjectReference, | ||
| _slot: <Self::VM as VMBinding>::VMSlot, | ||
| _target: Option<ObjectReference>, | ||
| ) { | ||
| self.object_probable_write_slow(src); | ||
| self.log_object(src); | ||
| } | ||
|
|
||
| fn memory_region_copy_slow( | ||
| &mut self, | ||
| _src: <Self::VM as VMBinding>::VMMemorySlice, | ||
| dst: <Self::VM as VMBinding>::VMMemorySlice, | ||
| ) { | ||
| for s in dst.iter_slots() { | ||
| self.enqueue_node(None, s, None); | ||
| } | ||
| } | ||
|
|
||
| fn load_reference(&mut self, o: ObjectReference) { | ||
| if !self.immix.concurrent_marking_in_progress() { | ||
| return; | ||
| } | ||
| self.refs.push(o); | ||
| if self.refs.is_full() { | ||
| self.flush_weak_refs(); | ||
| } | ||
| } | ||
|
|
||
| fn object_probable_write_slow(&mut self, obj: ObjectReference) { | ||
| obj.iterate_fields::<VM, _>(|s| { | ||
| self.enqueue_node(Some(obj), s, None); | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.