File tree 4 files changed +22
-12
lines changed
4 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -71,15 +71,17 @@ impl<VM: VMBinding> GCWorkerShared<VM> {
71
71
let bytes = VM :: VMObjectModel :: get_current_size ( object) ;
72
72
// Get the space index from descriptor
73
73
let space_descriptor = VM_MAP . get_descriptor_for_address ( object. to_raw_address ( ) ) ;
74
- let space_index = space_descriptor. get_index ( ) ;
75
- debug_assert ! (
76
- space_index < MAX_SPACES ,
77
- "Space index {} is not in the range of [0, {})" ,
78
- space_index,
79
- MAX_SPACES
80
- ) ;
81
- // Accumulate the live bytes for the index
82
- live_bytes_per_space[ space_index] += bytes;
74
+ if space_descriptor != crate :: util:: heap:: space_descriptor:: SpaceDescriptor :: UNINITIALIZED {
75
+ let space_index = space_descriptor. get_index ( ) ;
76
+ debug_assert ! (
77
+ space_index < MAX_SPACES ,
78
+ "Space index {} is not in the range of [0, {})" ,
79
+ space_index,
80
+ MAX_SPACES
81
+ ) ;
82
+ // Accumulate the live bytes for the index
83
+ live_bytes_per_space[ space_index] += bytes;
84
+ }
83
85
}
84
86
}
85
87
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ pub trait VMMap: Sync {
81
81
82
82
fn is_finalized ( & self ) -> bool ;
83
83
84
+ /// Get the space descriptor for the given address. Return SpaceDescriptor::UNINITIALIZED if the
85
+ /// address is not within the MMTk heap range, or not within MMTk spaces.
84
86
fn get_descriptor_for_address ( & self , address : Address ) -> SpaceDescriptor ;
85
87
86
88
fn add_to_cumulative_committed_pages ( & self , pages : usize ) ;
Original file line number Diff line number Diff line change @@ -255,7 +255,10 @@ impl VMMap for Map32 {
255
255
256
256
fn get_descriptor_for_address ( & self , address : Address ) -> SpaceDescriptor {
257
257
let index = address. chunk_index ( ) ;
258
- self . descriptor_map [ index]
258
+ self . descriptor_map
259
+ . get ( index)
260
+ . copied ( )
261
+ . unwrap_or ( SpaceDescriptor :: UNINITIALIZED )
259
262
}
260
263
261
264
fn add_to_cumulative_committed_pages ( & self , pages : usize ) {
Original file line number Diff line number Diff line change @@ -206,8 +206,11 @@ impl VMMap for Map64 {
206
206
}
207
207
208
208
fn get_descriptor_for_address ( & self , address : Address ) -> SpaceDescriptor {
209
- let index = Self :: space_index ( address) . unwrap ( ) ;
210
- self . inner ( ) . descriptor_map [ index]
209
+ if let Some ( index) = Self :: space_index ( address) {
210
+ self . inner ( ) . descriptor_map [ index]
211
+ } else {
212
+ SpaceDescriptor :: UNINITIALIZED
213
+ }
211
214
}
212
215
213
216
fn add_to_cumulative_committed_pages ( & self , pages : usize ) {
You can’t perform that action at this time.
0 commit comments