diff options
author | Bowgo Tsai <bowgotsai@google.com> | 2020-08-24 15:19:52 +0800 |
---|---|---|
committer | Bowgo Tsai <bowgotsai@google.com> | 2020-08-25 02:26:30 +0000 |
commit | 1e1c7845aab0542306f61d8e8c880aca096ea336 (patch) | |
tree | 52b7a55510ae7546065f536023a9bd29bde112cd /libc/malloc_hooks/malloc_hooks.cpp | |
parent | 1e0d28b9c27ee5ea5dda08b6a2048dbce8ccd8cf (diff) |
bionic_systrace: moving global static variables
Some global static variables are only used within a single function,
so moving them inside the function which requires them. This also
ensures those static variables of class types are initialized before
they are being used.
For example, this is needed for CachedProperty(), as some of the
member method, e.g., CachedProperty().Get(), might be invoked,
e.g., in __libc_preinit(), before the constructor is invoked.
This happens after we added property trace points in commit
Id2b93acb2ce02b308c0e4889f836159151af3b46.
For g_lock, we don't move them because it can be initialized by setting
its memory to 0. And it's used in two functions.
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/private/bionic_lock.h
Bug: 147275573
Test: atest CtsBionicTestCases
Test: adb shell perfetto -o /data/misc/perfetto-traces/test_trace -t 10s bionic sysprop
Change-Id: I99565ce2442d34f33830778915c737eed834f8b3
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
0 files changed, 0 insertions, 0 deletions