File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed
policy/marksweepspace/native_ms Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ use crate::util::heap::chunk_map::*;
29
29
use crate :: util:: linear_scan:: Region ;
30
30
use crate :: util:: VMThread ;
31
31
use crate :: vm:: ObjectModel ;
32
+ use crate :: vm:: Scanning ;
32
33
use std:: sync:: Mutex ;
33
34
34
35
/// The result for `MarkSweepSpace.acquire_block()`. `MarkSweepSpace` will attempt
@@ -374,7 +375,7 @@ impl<VM: VMBinding> MarkSweepSpace<VM> {
374
375
/// Mark an object. Return `true` if the object is newly marked. Return `false` if the object
375
376
/// was already marked.
376
377
fn attempt_mark ( & self , object : ObjectReference ) -> bool {
377
- if VM :: UNIQUE_OBJECT_ENQUEUING {
378
+ if VM :: VMScanning :: UNIQUE_OBJECT_ENQUEUING {
378
379
self . attempt_mark_atomic ( object)
379
380
} else {
380
381
self . attempt_mark_non_atomic ( object)
Original file line number Diff line number Diff line change 79
79
/// Note that MMTk does not attempt to do anything to align the cursor to this value, but
80
80
/// it merely asserts with this constant.
81
81
const ALLOC_END_ALIGNMENT : usize = 1 ;
82
-
83
- /// When set to `true`, all plans will guarantee that during each GC, each live object is
84
- /// enqueued at most once, and therefore scanned (by either [`Scanning::scan_object`] or
85
- /// [`Scanning::scan_object_and_trace_edges`]) at most once.
86
- ///
87
- /// When set to `false`, MMTk may enqueue an object multiple times due to optimizations, such as
88
- /// using non-atomic operatios to mark objects. Consequently, an object may be scanned multiple
89
- /// times during a GC.
90
- ///
91
- /// The default value is `false` because duplicated object-enqueuing is benign for most VMs, and
92
- /// related optimizations, such as non-atomic marking, can improve GC speed. VM bindings can
93
- /// override this if they need. For example, some VMs piggyback on object-scanning to visit
94
- /// objects during a GC, but may have data race if multiple GC workers visit the same object at
95
- /// the same time. Such VMs can set this constant to `true` to workaround this problem.
96
- const UNIQUE_OBJECT_ENQUEUING : bool = false ;
97
82
}
Original file line number Diff line number Diff line change @@ -140,6 +140,21 @@ pub trait RootsWorkFactory<SL: Slot>: Clone + Send + 'static {
140
140
141
141
/// VM-specific methods for scanning roots/objects.
142
142
pub trait Scanning < VM : VMBinding > {
143
+ /// When set to `true`, all plans will guarantee that during each GC, each live object is
144
+ /// enqueued at most once, and therefore scanned (by either [`Scanning::scan_object`] or
145
+ /// [`Scanning::scan_object_and_trace_edges`]) at most once.
146
+ ///
147
+ /// When set to `false`, MMTk may enqueue an object multiple times due to optimizations, such as
148
+ /// using non-atomic operatios to mark objects. Consequently, an object may be scanned multiple
149
+ /// times during a GC.
150
+ ///
151
+ /// The default value is `false` because duplicated object-enqueuing is benign for most VMs, and
152
+ /// related optimizations, such as non-atomic marking, can improve GC speed. VM bindings can
153
+ /// override this if they need. For example, some VMs piggyback on object-scanning to visit
154
+ /// objects during a GC, but may have data race if multiple GC workers visit the same object at
155
+ /// the same time. Such VMs can set this constant to `true` to workaround this problem.
156
+ const UNIQUE_OBJECT_ENQUEUING : bool = false ;
157
+
143
158
/// Return true if the given object supports slot enqueuing.
144
159
///
145
160
/// - If this returns true, MMTk core will call `scan_object` on the object.
You can’t perform that action at this time.
0 commit comments