@@ -28,33 +28,38 @@ use std::marker::PhantomData;
28
28
29
29
use downcast_rs:: Downcast ;
30
30
31
- /**
32
- * Space Function Table (SFT).
33
- *
34
- * This trait captures functions that reflect _space-specific per-object
35
- * semantics_. These functions are implemented for each object via a special
36
- * space-based dynamic dispatch mechanism where the semantics are _not_
37
- * determined by the object's _type_, but rather, are determined by the _space_
38
- * that the object is in.
39
- *
40
- * The underlying mechanism exploits the fact that spaces use the address space
41
- * at an MMTk chunk granularity with the consequence that each chunk maps to
42
- * exactluy one space, so knowing the chunk for an object reveals its space.
43
- * The dispatch then works by performing simple address arithmetic on the object
44
- * reference to find a chunk index which is used to index a table which returns
45
- * the space. The relevant function is then dispatched against that space
46
- * object.
47
- *
48
- * We use the SFT trait to simplify typing for Rust, so our table is a
49
- * table of SFT rather than Space.
50
- */
31
+ /// Space Function Table (SFT).
32
+ ///
33
+ /// This trait captures functions that reflect _space-specific per-object
34
+ /// semantics_. These functions are implemented for each object via a special
35
+ /// space-based dynamic dispatch mechanism where the semantics are _not_
36
+ /// determined by the object's _type_, but rather, are determined by the _space_
37
+ /// that the object is in.
38
+ ///
39
+ /// The underlying mechanism exploits the fact that spaces use the address space
40
+ /// at an MMTk chunk granularity with the consequence that each chunk maps to
41
+ /// exactluy one space, so knowing the chunk for an object reveals its space.
42
+ /// The dispatch then works by performing simple address arithmetic on the object
43
+ /// reference to find a chunk index which is used to index a table which returns
44
+ /// the space. The relevant function is then dispatched against that space
45
+ /// object.
46
+ ///
47
+ /// We use the SFT trait to simplify typing for Rust, so our table is a
48
+ /// table of SFT rather than Space.
51
49
pub trait SFT {
50
+ /// The space name
52
51
fn name ( & self ) -> & str ;
52
+ /// Is the object live, determined by the policy?
53
53
fn is_live ( & self , object : ObjectReference ) -> bool ;
54
+ /// Is the object movable, determined by the policy? E.g. the policy is non-moving,
55
+ /// or the object is pinned.
54
56
fn is_movable ( & self ) -> bool ;
57
+ /// Is the object sane? A policy should return false if there is any abnormality about
58
+ /// object - the sanity checker will fail if an object is not sane.
55
59
#[ cfg( feature = "sanity" ) ]
56
60
fn is_sane ( & self ) -> bool ;
57
- fn initialize_header ( & self , object : ObjectReference , alloc : bool ) ;
61
+ /// Initialize object metadata (in the header, or in the side metadata).
62
+ fn initialize_object_metadata ( & self , object : ObjectReference , alloc : bool ) ;
58
63
}
59
64
60
65
/// Print debug info for SFT. Should be false when committed.
@@ -91,9 +96,9 @@ impl SFT for EmptySpaceSFT {
91
96
false
92
97
}
93
98
94
- fn initialize_header ( & self , object : ObjectReference , _alloc : bool ) {
99
+ fn initialize_object_metadata ( & self , object : ObjectReference , _alloc : bool ) {
95
100
panic ! (
96
- "Called initialize_header () on {:x}, which maps to an empty space" ,
101
+ "Called initialize_object_metadata () on {:x}, which maps to an empty space" ,
97
102
object
98
103
)
99
104
}
0 commit comments