Revert "[BOLT][Instrumentation] Don't share counters when using append-pid"
This reverts commit 02c3724d43840339fdc91d21747e96b5f7405bb0. This change breaks instrumented Clang: https://lab.llvm.org/buildbot/#/builders/252/builds/2700
This commit is contained in:
parent
4314f4ceb5
commit
c15e9b6814
@ -1586,9 +1586,6 @@ extern "C" void __bolt_instr_indirect_tailcall();
|
|||||||
|
|
||||||
/// Initialization code
|
/// Initialization code
|
||||||
extern "C" void __attribute((force_align_arg_pointer)) __bolt_instr_setup() {
|
extern "C" void __attribute((force_align_arg_pointer)) __bolt_instr_setup() {
|
||||||
__bolt_ind_call_counter_func_pointer = __bolt_instr_indirect_call;
|
|
||||||
__bolt_ind_tailcall_counter_func_pointer = __bolt_instr_indirect_tailcall;
|
|
||||||
|
|
||||||
const uint64_t CountersStart =
|
const uint64_t CountersStart =
|
||||||
reinterpret_cast<uint64_t>(&__bolt_instr_locations[0]);
|
reinterpret_cast<uint64_t>(&__bolt_instr_locations[0]);
|
||||||
const uint64_t CountersEnd = alignTo(
|
const uint64_t CountersEnd = alignTo(
|
||||||
@ -1597,18 +1594,17 @@ extern "C" void __attribute((force_align_arg_pointer)) __bolt_instr_setup() {
|
|||||||
DEBUG(reportNumber("replace mmap start: ", CountersStart, 16));
|
DEBUG(reportNumber("replace mmap start: ", CountersStart, 16));
|
||||||
DEBUG(reportNumber("replace mmap stop: ", CountersEnd, 16));
|
DEBUG(reportNumber("replace mmap stop: ", CountersEnd, 16));
|
||||||
assert (CountersEnd > CountersStart, "no counters");
|
assert (CountersEnd > CountersStart, "no counters");
|
||||||
|
// Maps our counters to be shared instead of private, so we keep counting for
|
||||||
const bool Shared = !__bolt_instr_use_pid;
|
// forked processes
|
||||||
const uint64_t MapPrivateOrShared = Shared ? MAP_SHARED : MAP_PRIVATE;
|
|
||||||
|
|
||||||
void *Ret =
|
void *Ret =
|
||||||
__mmap(CountersStart, CountersEnd - CountersStart, PROT_READ | PROT_WRITE,
|
__mmap(CountersStart, CountersEnd - CountersStart, PROT_READ | PROT_WRITE,
|
||||||
MAP_ANONYMOUS | MapPrivateOrShared | MAP_FIXED, -1, 0);
|
MAP_ANONYMOUS | MAP_SHARED | MAP_FIXED, -1, 0);
|
||||||
assert(Ret != MAP_FAILED, "__bolt_instr_setup: Failed to mmap counters!");
|
assert(Ret != MAP_FAILED, "__bolt_instr_setup: Failed to mmap counters!");
|
||||||
|
__bolt_ind_call_counter_func_pointer = __bolt_instr_indirect_call;
|
||||||
|
__bolt_ind_tailcall_counter_func_pointer = __bolt_instr_indirect_tailcall;
|
||||||
// Conservatively reserve 100MiB shared pages
|
// Conservatively reserve 100MiB shared pages
|
||||||
GlobalAlloc.setMaxSize(0x6400000);
|
GlobalAlloc.setMaxSize(0x6400000);
|
||||||
GlobalAlloc.setShared(Shared);
|
GlobalAlloc.setShared(true);
|
||||||
GlobalWriteProfileMutex = new (GlobalAlloc, 0) Mutex();
|
GlobalWriteProfileMutex = new (GlobalAlloc, 0) Mutex();
|
||||||
if (__bolt_instr_num_ind_calls > 0)
|
if (__bolt_instr_num_ind_calls > 0)
|
||||||
GlobalIndCallCounters =
|
GlobalIndCallCounters =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user