-
Notifications
You must be signed in to change notification settings - Fork 7
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
Move data recorded with yk_promote
into MTThread
.
#976
Conversation
let (thrdtrcr, promotions) = THREAD_MTTHREAD.with(|mtt| { | ||
( | ||
mtt.thread_tracer.take().unwrap(), | ||
mtt.promotions.take().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should say why the unwraps are safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing comment on line 296 explains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. I thought that was referring to something else because it's singular. Maybe wack and s
on the end?
(Top-notch pedantry right here!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ef0b3e1.
If I understand correctly, you move the promotions from a trace recorder (local to a thread by definition) into a thread local mtthread? At the risk of sounding like a dummy, what is the advantage of this? Just more convenient, or something more profound? |
I originally thought that all tracing backends could work out when |
OK |
I've slowly come to realise that calls to `yk_promote` could (but don't currently!) end up being in compiled in two different ways: 1. A literal call to `yk_promote_*`. 2. An inlined call to a side-band recording mechanism (e.g. `PTWRITE`). Because I hadn't teased these two apart in my mind, my previous attempt had kind-of tried to merge the two together in one API. It's now clear that was entirely misguided on my part. This commit can be seen as partly undoing my previous attempt: literal calls to `yk_promote_*` now record the data in `MTThread` which is a thread local. However, when tracing stops, the promotion data is now extracted from `MTThread` so it can safely be moved to another thread. That means we can now handle ykjit#1 above: but we don't yet have an API that can handle ykjit#2.
Please squash. |
ef0b3e1
to
7eff562
Compare
Squashed. |
I've slowly come to realise that calls to
yk_promote
could (but don't currently!) end up being in compiled in two different ways:yk_promote_*
.PTWRITE
).Because I hadn't teased these two apart in my mind, my previous attempt had kind-of tried to merge the two together in one API. It's now clear that was entirely misguided on my part.
This commit can be seen as partly undoing my previous attempt: literal calls to
yk_promote_*
now record the data inMTThread
which is a thread local. However, when tracing stops, the promotion data is now extracted fromMTThread
so it can safely be moved to another thread.That means we can now handle #1 above: but we don't yet have an API that can handle #2.