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

Audit mt.rs #165

Merged
merged 4 commits into from
Dec 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ykrt/src/mt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ impl MTThread {
Rc::get_mut(&mut self.inner).unwrap().tracer =
Some((start_tracing(self.inner.tracing_kind), loc_id));
return None;
} else {
// We raced with another thread that's also trying to trace this
// Location, so free the malloc'd block.
unsafe { Box::from_raw(loc_id) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should just eagerly allocate each thread an ID upon it's creation. Then the ID can be reused across many tracing sessions at zero additional cost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Once the current bug is fixed I'll look into that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by extension, is the address of the MTInner a better ID?

Copy link
Contributor Author

@ltratt ltratt Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That feature might be disappearing at some point. Not sure yet.

}
} else {
let new_pack = PHASE_COUNTING | ((count + 1) << PHASE_NUM_BITS);
Expand Down