[compiler-rt] 2fe8498 - mmapForContinuousMode: Redo #95702: Align Linux's impl to __APPLE__'s a little.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 20 17:38:51 PDT 2024
Author: NAKAMURA Takumi
Date: 2024-06-21T09:38:25+09:00
New Revision: 2fe8498654fe5db68c585fc9fa4cd84d634e53df
URL: https://github.com/llvm/llvm-project/commit/2fe8498654fe5db68c585fc9fa4cd84d634e53df
DIFF: https://github.com/llvm/llvm-project/commit/2fe8498654fe5db68c585fc9fa4cd84d634e53df.diff
LOG: mmapForContinuousMode: Redo #95702: Align Linux's impl to __APPLE__'s a little.
I've made this small cosmetic changes,
`s/CountersOffsetInBiasMode/FileOffsetToCounters/`
Added:
Modified:
compiler-rt/lib/profile/InstrProfilingFile.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index b88e0b4b0b2ab..54ee59c30722f 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -243,18 +243,20 @@ static int mmapForContinuousMode(uint64_t CurrentFileOffset, FILE *File) {
if (getProfileFileSizeForMerging(File, &FileSize))
return 1;
+ int Fileno = fileno(File);
+ uint64_t FileOffsetToCounters =
+ sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) + DataSize;
+
/* Map the profile. */
char *Profile = (char *)mmap(NULL, FileSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, fileno(File), 0);
+ MAP_SHARED, Fileno, 0);
if (Profile == MAP_FAILED) {
PROF_ERR("Unable to mmap profile: %s\n", strerror(errno));
return 1;
}
- const uint64_t CountersOffsetInBiasMode =
- sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) + DataSize;
/* Update the profile fields based on the current mapping. */
INSTR_PROF_PROFILE_COUNTER_BIAS_VAR =
- (intptr_t)Profile - (uintptr_t)CountersBegin + CountersOffsetInBiasMode;
+ (intptr_t)Profile - (uintptr_t)CountersBegin + FileOffsetToCounters;
/* Return the memory allocated for counters to OS. */
lprofReleaseMemoryPagesToOS((uintptr_t)CountersBegin, (uintptr_t)CountersEnd);
More information about the llvm-commits
mailing list