After we relocate counters, we no longer need to keep the original copy
around so we can return the memory back to the operating system.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/profile/InstrProfilingUtil.c | ||
---|---|---|
346 | See InstrProfilingPort.h "getpagesize", this looks like it can replace that. | |
compiler-rt/lib/profile/InstrProfilingUtil.h | ||
80 | Should these helpers assert that boundary is a power of two (not sure what the clearest way would be to check -- maybe assert(popcnt(b) == 1))? |
Factoring out the arithmetic from the OS-specific code and landing only the Fuchsia version of the OS-specific implementation LGTM.
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
557 | Unlikely. It may work on some systems other than Linux, but you'd have to check. Because of the uncertainty of the portable solution for other platforms, I'd recommend that we just land a change affecting only Fuchsia first. | |
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
199 | I agree it would be reasonable to consolidate this arithmetic into a call to an OS-specific function akin to sanitizer_common's ReleaseMemoryPagesToOS. That refactoring still fits well if you start out with only the Fuchsia implementation actually doing anything and leave the other ones as an empty TODO stub until the portability issues are worked out. | |
compiler-rt/lib/profile/InstrProfilingUtil.c | ||
346 | Agreed. There is also __llvm_profile_set_page_size, used only when a particular % magic sequence is found in an option setting (!). All that stuff should be cleaned up one way or another. | |
compiler-rt/lib/profile/InstrProfilingUtil.h | ||
80 | I don't think that's necessary. This kind of alignment rounding is common and always has the power-of-two constraint. |
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
557 | I forgot about Windows and it turned out that implementing MADV_DONTNEED is straightforward so I did that. |
Is this portable across all platforms?