See my comment on here for more context of my investigation:
https://bugzilla.mozilla.org/show_bug.cgi?id=1779257#c9
The saved context is invalid once the function that called `getcontext`
returns. We need to call the `getcontext` while the frame where we called it is
still on the stack. That's why this patch is moving the call to `getcontext` to
parent function by inlining the SyncPopulate content by using a macro instead.
This has to be a macro instead of a function because stack pointer address will
be invalid once the `Registers::SyncPopulate` returns. I tried to change this
method to inline but that didn't help either.
Differential Revision: https://phabricator.services.mozilla.com/D170133
Currently, `ReserveAndPutRaw` allocates a second span even if the data would be too big for the chunk.
Here a second conditional is added to check if the block of data is too big in this scenario and silently discard the data if so.
Differential Revision: https://phabricator.services.mozilla.com/D167167
This requires https://github.com/firefox-devtools/profiler/pull/4432 to be
landed and deployed. We bump the profile version in this patch.
Afaik we never used the optimizations field of the frame table in the profiler
frontend and this pfield was null for more than 3 years (since Bug 1614622).
We don't have any plans to make use of it any time soon. It's good to cleanup
this field so it doesn't clutter the profile data and we can reduce the profile
data size.
Differential Revision: https://phabricator.services.mozilla.com/D167290
We use profiler categories to separate out the profiler markers for major
components, such as DOM or Layout, to quickly understand what is happening in
each of them: this will also be helpful for accessibility. One might be
concerned that we're adding too many categories but I think it's fine: the
accessibility category shouldn't appear if accessibility services aren't in use.
Furthermore, if accessibility code is running when it's unexpected, having the
accessibility category appear will only highlight that fact.
Differential Revision: https://phabricator.services.mozilla.com/D160846
It is possible to specify full names for capabilities when using the clang
thread-safety analysis which will be used in error messages. We should use that
form of the attribute rather than the legacy lockable attribute.
Differential Revision: https://phabricator.services.mozilla.com/D160531
To avoid real or apparent races to the list of marker schema functions, some
bits of the atomic count are used to effectively implement a RWLock, so that
any number of threads can add their own new marker schema concurrently, while
the profile-capture reading of the whole list can only be done on its own.
Differential Revision: https://phabricator.services.mozilla.com/D157310
When something goes wrong, the most likely cause is running out of memory, so
we clear our data to try and free some memory ASAP, to hopefully reduce the
likelihood of a terminating OOM elsewhere.
Differential Revision: https://phabricator.services.mozilla.com/D155653
Instead of redundantly explaining each `static_cast` in different
SpliceableChunkedJSONWriter functions, safe accesses are now isolated to only
two functions, making the public function implementations simpler, including
changes in the following patch.
Differential Revision: https://phabricator.services.mozilla.com/D155650
Note that at this point, it's using the FailureLatchInfallibleSource singleton,
so operations are still effectively infallible, i.e. they will terminate the
program.
But users already handle future fallible outcomes.
Differential Revision: https://phabricator.services.mozilla.com/D155649
This removes some redundant initializers in constructors (present and future).
Also some [[nodiscard]]s were added where appropriate, and empty lines for
clarity.
Differential Revision: https://phabricator.services.mozilla.com/D155648
The FailureLatch interface, and some implementation helpers and classes, will
be used to record the first failure (if any) during some long process.
Differential Revision: https://phabricator.services.mozilla.com/D155647