Merge two versions of initializeProfileForContinuousMode function into one.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks!
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
531 | Why not keep the 'Grow the profile ...' comment? | |
555–556 | These checks are useful for debugging, and should be safe to keep in the useBiasVar == 0 path. Any reason to delete them? | |
555–556 | The new "CountersOffset" cannot be used when useBiasVar == 0, so I suggest renaming it (maybe "CountersOffsetInBiasMode") and sinking it closer to its use. | |
556 | Will these defines be needed in your follow-up patches? If so, it might be worth moving them to the global namespace now. If not, 'static' can be dropped. | |
557 | The difference in fileOpenMode ('a+b' vs. 'w+b') is probably worth a TODO or FIXME. But it makes sense to keep this patch NFC. | |
568–569 | I guess warnIfNonZero can also be deleted. | |
650–651 | Why not keep the 'so long as there is at least one counter' comment? |
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
531 | Added. | |
555–556 | Those checks failed when running profile tests on Linux. | |
556 | Yes, those checks will still be needed in the follow-up patches. | |
557 | What would the TODO/FIXME about? Are we going to change it in the future? |
Thanks, lgtm.
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
555–556 | Thanks, moving the checks to the useBiasVar == 0 path is the right thing to do, since that's the path where we require certain profile sections to be page aligned. | |
557 | If I've understood correctly, fileOpenMode is used in the !doMerging() case, and the append behavior ("a+b") is the correct one. Consider the case where you have two instrumented DSOs, both using continuous mode with !doMerging(): then as the runtime initializer in the second DSO does initializeProfileForContinuousMode(), it will truncate + clobber the profile written by the initializer in the first DSO. |
Capitalize first letter of global variables.
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
557 |
I don't understand that. If the file is opened with "a+b", it will just append new profile to the end of existing profile file. |
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
557 | Right, but if the file is opened with "w+b", then the second DSO's initializer will truncate the profile, erasing the data written by the first DSO. |
Add a TODO.
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
557 | Oh, I see. You are saying the non-apple platform. It is problematic in that case. Added a TODO. |
Why not keep the 'Grow the profile ...' comment?