This is an archive of the discontinued LLVM Phabricator instance.

[XRay] fix and clarify comments in the log file decoder [NFC]
ClosedPublic

Authored by pelikan on Jun 19 2017, 12:06 AM.

Details

Summary

For readers unfamiliar with the XRay code base, explain our little-endian views more clearly. For code clarity either get rid of obvious comments or explain their intentions, fix typos, correct coding style according to LLVM's standards and manually CSE long expressions to point out it is the same expression.

Diff Detail

Repository
rL LLVM

Event Timeline

pelikan created this revision.Jun 19 2017, 12:06 AM
dberris accepted this revision.Jun 19 2017, 12:10 AM

Some nits.

lib/XRay/Trace.cpp
62 ↗(On Diff #102990)

The error was already correct -- there's not enough data for an XRay log.

225 ↗(On Diff #102990)

see -> set

327 ↗(On Diff #102990)

unsigned integer?

441–442 ↗(On Diff #102990)

Empty line between non-comment line and first comment line?

This revision is now accepted and ready to land.Jun 19 2017, 12:10 AM
dberris requested changes to this revision.Jun 19 2017, 12:11 AM

Actually, also change the description to be more prose and contain [NFC] somewhere?

This revision now requires changes to proceed.Jun 19 2017, 12:11 AM
pelikan updated this revision to Diff 102995.Jun 19 2017, 1:23 AM
pelikan edited edge metadata.
pelikan marked 4 inline comments as done.

address code review comments

pelikan retitled this revision from [XRay] fix and clarify comments in the log file decoder to [XRay] fix and clarify comments in the log file decoder [NFC].Jun 19 2017, 1:25 AM
pelikan edited the summary of this revision. (Show Details)
pelikan added inline comments.
lib/XRay/Trace.cpp
62 ↗(On Diff #102990)

I'd appreciate for it to be more specific but at least now we can keep it NFC.

327 ↗(On Diff #102990)

You are technically correct. I've made the comment even smaller as this (for me) is a common enough thing to do.

dberris added inline comments.Jun 19 2017, 2:31 AM
lib/XRay/Trace.cpp
10–11 ↗(On Diff #102995)

This technically isn't strictly true. While there is an implementation of the naive and FDR mode logging, those may not be written by the implementation in compiler-rt. Making it sound like there's an actual dependency (as opposed to a coincidental dependency) may be misleading.

For instance, it's possible to write logs in this format without using the compiler-rt implementation.

Working on documenting the log details/format as opposed to referring to the compiler-rt implementation would be a strictly better approach. I'd rather change this comment to say the explicit versions of the log we're supporting and not mentioning anything in compiler-rt.

pelikan updated this revision to Diff 103135.Jun 19 2017, 6:39 PM

explain the complicated mess of a situation between LLVM and compiler-rt even
more clearly, to avoid any reader being confused

lib/XRay/Trace.cpp
10–11 ↗(On Diff #102995)

May not be. But currently (and for the forseeable future) will be. Currently, a person will see two separate and *very* different implementations, and not know if they're supposed to be related or not just because the data format appears to coincide.

The point of this is obviously not documenting the format. It is supposed to tell the reader where an example of the counterpart can be found. I've updated it so it reflects the fact this doesn't have to be a hard dependency.

When/if there is a formal spec to the format, I'll be happy to reword this. (IIUC this isn't a priority for anyone yet, because there are only these two instances so far.)

dberris added inline comments.Jun 21 2017, 12:07 AM
lib/XRay/Trace.cpp
10–11 ↗(On Diff #102995)

Or we can just remove this comment, and not need to refer to compiler-rt nor any other implementations at this point.

pelikan updated this revision to Diff 103527.Jun 21 2017, 11:03 PM
pelikan marked an inline comment as done.

remove comment per request

pelikan added inline comments.Jun 21 2017, 11:04 PM
lib/XRay/Trace.cpp
10–11 ↗(On Diff #102995)

...and leave this confusing forever.

dberris accepted this revision.Jun 21 2017, 11:09 PM
dberris added inline comments.
lib/XRay/Trace.cpp
10–11 ↗(On Diff #102995)

No, not "forever".

If we're going to make this clearer, it shouldn't involve referring to the details of an implementation. The proper disambiguation to this would be, that we say what version of the log we're supporting, and a pointer to the documentation of the log format.

The feedback I gave you was: "Working on documenting the log details/format as opposed to referring to the compiler-rt implementation would be a strictly better approach. I'd rather change this comment to say the explicit versions of the log we're supporting and not mentioning anything in compiler-rt."

Nowhere did I imply that this should be intentionally confusing forever.

This revision is now accepted and ready to land.Jun 21 2017, 11:09 PM
pelikan updated this revision to Diff 115335.Sep 14 2017, 6:44 PM

Rebase to HEAD.

pelikan edited the summary of this revision. (Show Details)Sep 14 2017, 6:48 PM
This revision was automatically updated to reflect the committed changes.