[memprof] Simplify initialized flags.
authorSnehasish Kumar <snehasishk@google.com>
Tue, 7 Mar 2023 23:38:51 +0000 (23:38 +0000)
committerSnehasish Kumar <snehasishk@google.com>
Wed, 8 Mar 2023 18:02:23 +0000 (18:02 +0000)
commit79ebb6385b3afe2b78a6923b3bbddadb791b7840
tree630b30577a180bc099bce5e8a92f0f42ab50c1b6
parent4d94a0080e1490513bde3da4302c7cb729246ddb
[memprof] Simplify initialized flags.

As discussed in D145428, the memprof_init_is_running check can be moved
to the end of the initialization routine to avoid intercepting
allocations during initialization. Also, the memprof_init_done flag can
be removed and replaced with memprof_inited. Finally, memprof_inited can
also be moved to the end of the method.

Tested on the existing check-memprof tests; memprof profile collection
succeeded on a large internal workload.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D145528
compiler-rt/lib/memprof/memprof_allocator.cpp
compiler-rt/lib/memprof/memprof_internal.h
compiler-rt/lib/memprof/memprof_rtl.cpp