@@ -1586,29 +1586,25 @@ extern "C" void __bolt_instr_indirect_tailcall();
1586
1586
1587
1587
// / Initialization code
1588
1588
extern " C" void __attribute ((force_align_arg_pointer)) __bolt_instr_setup() {
1589
- __bolt_ind_call_counter_func_pointer = __bolt_instr_indirect_call;
1590
- __bolt_ind_tailcall_counter_func_pointer = __bolt_instr_indirect_tailcall;
1591
-
1592
1589
const uint64_t CountersStart =
1593
1590
reinterpret_cast <uint64_t >(&__bolt_instr_locations[0 ]);
1594
1591
const uint64_t CountersEnd = alignTo (
1595
1592
reinterpret_cast <uint64_t >(&__bolt_instr_locations[__bolt_num_counters]),
1596
1593
0x1000 );
1597
1594
DEBUG (reportNumber (" replace mmap start: " , CountersStart, 16 ));
1598
1595
DEBUG (reportNumber (" replace mmap stop: " , CountersEnd, 16 ));
1599
- assert (CountersEnd > CountersStart, " no counters" );
1600
-
1601
- const bool Shared = !__bolt_instr_use_pid;
1602
- const uint64_t MapPrivateOrShared = Shared ? MAP_SHARED : MAP_PRIVATE;
1603
-
1596
+ assert (CountersEnd > CountersStart, " no counters" );
1597
+ // Maps our counters to be shared instead of private, so we keep counting for
1598
+ // forked processes
1604
1599
void *Ret =
1605
1600
__mmap (CountersStart, CountersEnd - CountersStart, PROT_READ | PROT_WRITE,
1606
- MAP_ANONYMOUS | MapPrivateOrShared | MAP_FIXED, -1 , 0 );
1601
+ MAP_ANONYMOUS | MAP_SHARED | MAP_FIXED, -1 , 0 );
1607
1602
assert (Ret != MAP_FAILED, " __bolt_instr_setup: Failed to mmap counters!" );
1608
-
1603
+ __bolt_ind_call_counter_func_pointer = __bolt_instr_indirect_call;
1604
+ __bolt_ind_tailcall_counter_func_pointer = __bolt_instr_indirect_tailcall;
1609
1605
// Conservatively reserve 100MiB shared pages
1610
1606
GlobalAlloc.setMaxSize (0x6400000 );
1611
- GlobalAlloc.setShared (Shared );
1607
+ GlobalAlloc.setShared (true );
1612
1608
GlobalWriteProfileMutex = new (GlobalAlloc, 0 ) Mutex ();
1613
1609
if (__bolt_instr_num_ind_calls > 0 )
1614
1610
GlobalIndCallCounters =
0 commit comments