Skip to content

Commit

Permalink
Use extreme assertion for metadata mapped assert (#812)
Browse files Browse the repository at this point in the history
The `assert_metadata_mapped` method uses the `mmap` system call and
expects a failure. This is too costly even for debug builds. We disable
it unless the "extreme_assertions" feature is enabled.
  • Loading branch information
wks authored May 10, 2023
1 parent da6e64b commit 6d93af7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/policy/marksweepspace/malloc_ms/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub(super) unsafe fn unset_chunk_mark_unsafe(chunk_start: Address) {
pub(super) unsafe fn load128(metadata_spec: &SideMetadataSpec, data_addr: Address) -> u128 {
let meta_addr = side_metadata::address_to_meta_address(metadata_spec, data_addr);

#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, feature = "extreme_assertions"))]
metadata_spec.assert_metadata_mapped(data_addr);

meta_addr.load::<u128>()
Expand Down
1 change: 1 addition & 0 deletions src/util/metadata/side_metadata/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ impl SideMetadataSpec {
#[cfg(debug_assertions)]
{
self.assert_value_type::<T>(input);
#[cfg(feature = "extreme_assertions")]
self.assert_metadata_mapped(data_addr);
}

Expand Down

0 comments on commit 6d93af7

Please sign in to comment.