This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Add a BlockVerifier visitor for FDR Records
ClosedPublic

Authored by dberris on Sep 6 2018, 1:31 AM.

Details

Summary

This patch implements a BlockVerifier type which enforces the
invariants of the log structure of FDR mode logs on a per-block basis.
This ensures that the data we encounter from an FDR mode log
semantically correct (i.e. that records follow the documented "grammar"
for FDR mode log records).

This is another part of the refactoring of D50441.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Sep 6 2018, 1:31 AM
dberris updated this revision to Diff 164165.Sep 6 2018, 1:42 AM

Move mask and number functions out of class definition and into the implementation as detail functions instead.

LGTM

As discussed, I find the transition comments unnecessary because the code is self explaining. So I'd prefer to have them removed, but up to you.

eizan added inline comments.Sep 6 2018, 5:46 PM
llvm/lib/XRay/BlockVerifier.cpp
62 ↗(On Diff #164165)

I presume State::WallClockTime has an underlying value of 3, so won't 3<<1 also pass (1 | 2)<<1 ?

dberris marked an inline comment as done.Sep 6 2018, 6:26 PM
dberris added inline comments.
llvm/lib/XRay/BlockVerifier.cpp
62 ↗(On Diff #164165)

We're turning 0001 into 1000 when we call mask(State::WallclockTime). Note that the operation in mask(...) is 1uLL << N where N is the underlying value for the enum.

dberris updated this revision to Diff 164345.Sep 6 2018, 7:25 PM
dberris marked an inline comment as done.

Rebase, remove unnecessary comments, reformat.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 6 2018, 7:26 PM
This revision was automatically updated to reflect the committed changes.
dberris reopened this revision.Sep 6 2018, 8:41 PM

Reverted in rL341631.

Broke GCC builds.

dberris updated this revision to Diff 164360.Sep 7 2018, 12:07 AM

Use a struct instead of a std::tuple<...> in the function-local static constexpr array.

eizan accepted this revision.Sep 9 2018, 6:19 PM
This revision is now accepted and ready to land.Sep 9 2018, 6:19 PM
This revision was automatically updated to reflect the committed changes.