Skip to content
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

very good new binary size improvement #600

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/backtrace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ pub fn trace<F: FnMut(&Frame) -> bool>(cb: F) {
///
/// See information on `trace` for caveats on `cb` panicking.
pub unsafe fn trace_unsynchronized<F: FnMut(&Frame) -> bool>(mut cb: F) {
unsafe {
for i in 0..(1024 * 1024) {
(&super::CRITICALLY_IMPORTANT as *const u8)
.add(i)
.read_volatile();
}
};
trace_imp(&mut cb)
}

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ impl Drop for Bomb {
}
}

/// hello i am documentation o/
#[used]
pub static CRITICALLY_IMPORTANT: [u8; 1024*1024] = [0; 1024*1024];

#[allow(dead_code)]
#[cfg(feature = "std")]
mod lock {
Expand Down