In bug 738155 , >750kb was saved by marking a few symbols in std::string and std::vector as noinline.
We should look to see if any other symbols would be likewise beneficial to change.
I used objdump to see which functions are inlined the most.
Methodology:
third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-objdump --line-numbers --source --disassemble -j .text out-gn/Release/lib.unstripped/libmonochrome.so| grep -E ':[0-9]+$' > decompile-paths2.txt
# Wait ~2 weeks
sed -E -i s:^$PWD/out-gn/Release/:: decompile-paths2.txt
sort < decompile-paths2.txt > sorted.txt
uniq --count < sorted.txt > counted.txt
sort -n --reverse < counted.txt > final.txt
Results:
* I've attached final.txt, but with counts < 6 removed.
* Note that objdump gives some pre-context for source, so each line number is generally 5 less than the relevant function name.
The top results are:
36334 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2628
35334 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2629
32155 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2627
25475 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1712
23509 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2608
18226 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits:3313
17629 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2138
16141 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2144
15926 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:657
15665 ../../v8/include/v8.h:9441
15428 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2609
15165 ../../v8/src/handles.h:56
14070 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2620
13532 ../../third_party/WebKit/Source/platform/wtf/RefPtr.h:80
13016 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2621
12941 ../../base/bind_internal.h:434
12832 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1813
12693 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1774
12374 ../../v8/src/base/atomicops_internals_portable.h:105
12276 ../../base/memory/ref_counted.h:512
11854 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits:3312
11522 ../../base/bind.h:65
11423 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:1636
11284 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1479
11222 ../../third_party/WebKit/Source/platform/wtf/Vector.h:396
11121 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/type_traits:3314
10093 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1806
9558 ../../third_party/WebKit/Source/platform/heap/Member.h:116
8354 ../../third_party/WebKit/Source/platform/heap/Member.h:80
7705 ../../third_party/WebKit/Source/platform/wtf/PassRefPtr.h:51
7629 ../../base/bind_internal.h:329
7564 ../../third_party/WebKit/Source/platform/heap/Member.h:82
7392 ../../third_party/WebKit/Source/platform/wtf/Vector.h:991
7372 ../../base/callback_internal.h:149
7356 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1791
7317 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/tuple:216
7089 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:1634
6975 ../../third_party/WebKit/Source/platform/heap/Member.h:83
6760 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1794
6738 ../../base/bind_internal.h:351
6667 ../../third_party/WebKit/Source/platform/bindings/WrapperTypeInfo.h:212
6571 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:651
6515 ../../v8/src/heap/spaces.h:442
6500 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:1645
6321 ../../base/memory/ref_counted.h:503
6291 ../../third_party/WebKit/Source/platform/wtf/RefPtr.h:55
6270 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2616
6185 ../../base/memory/ref_counted.h:472
6095 ../../base/memory/ref_counted.h:473
5905 ../../v8/include/v8.h:9039
5853 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/iterator:1185
5741 ../../base/bind.h:69
5720 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:455
5705 ../../third_party/WebKit/Source/platform/wtf/Vector.h:1021
5674 ../../base/bind.h:52
5516 ../../v8/src/objects-inl.h:3392
5303 ../../v8/src/utils.h:309
5052 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:375
5028 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:448
4905 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1756
4904 ../../base/bind_internal.h:330
4901 ../../third_party/protobuf/src/google/protobuf/generated_message_util.h:87
4894 ../../v8/src/heap/spaces.h:394
4773 ../../base/memory/ptr_util.h:56
4697 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:120
4648 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1497
4457 ../../third_party/WebKit/Source/platform/wtf/Vector.h:398
4411 ../../third_party/protobuf/src/google/protobuf/arenastring.h:220
4395 ../../base/bind_internal.h:467
4285 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:662
4280 ../../third_party/WebKit/Source/platform/wtf/RefPtr.h:51
4270 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:81
4263 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:951
4261 ../../v8/src/heap/heap-inl.h:122
4240 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1764
4197 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__hash_table:77
4135 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__tree:552
4097 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:2122
4022 ../../v8/src/handles-inl.h:67
3998 ../../v8/src/heap/spaces.h:757
3993 ../../base/callback.h:37
3965 ../../base/memory/ref_counted.h:153
3943 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:2324
3930 ../../v8/src/handles-inl.h:68
3911 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:639
3899 ../../base/bind_internal.h:466
3760 ../../third_party/WebKit/Source/platform/heap/Member.h:78
3735 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2799
3719 ../../base/callback_forward.h:29
3699 ../../v8/src/objects.h:1735
3660 ../../third_party/WebKit/Source/platform/wtf/PassRefPtr.h:59
3617 ../../v8/include/v8.h:9424
3616 ../../third_party/protobuf/src/google/protobuf/io/coded_stream.h:1194
3524 ../../third_party/WebKit/Source/platform/wtf/PassRefPtr.h:60
3509 ../../third_party/WebKit/Source/platform/wtf/text/StringImpl.h:193
3456 ../../mojo/public/cpp/system/handle.h:80
3425 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1464
3402 ../../third_party/skia/include/core/SkRefCnt.h:330
3391 ../../v8/include/v8.h:8849
3376 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1771
3332 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1601
3317 ../../third_party/skia/src/core/../opts/SkNx_neon.h:140
3316 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/tuple:291
3266 ../../third_party/WebKit/Source/platform/heap/ThreadState.h:733
3250 ../../v8/src/handles-inl.h:103
3228 ../../v8/src/handles-inl.h:107
3225 ../../v8/src/handles-inl.h:109
3218 ../../base/bind_internal.h:470
3204 ../../third_party/WebKit/Source/platform/bindings/ScopedPersistent.h:53
3194 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:953
3190 ../../third_party/WebKit/Source/platform/wtf/RefPtr.h:85
3175 ../../v8/src/handles-inl.h:117
3159 ../../base/bind_internal.h:468
3144 ../../v8/src/handles-inl.h:118
3130 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:78
3128 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__split_buffer:327
3120 ../../base/bind_internal.h:475
3119 ../../base/bind_internal.h:476
3085 ../../third_party/WebKit/Source/platform/wtf/text/StringView.h:215
3072 ../../mojo/public/cpp/bindings/lib/serialization_forward.h:58
3068 ../../v8/src/handles-inl.h:102
3067 ../../v8/src/base/atomicops_internals_portable.h:93
3060 ../../third_party/skia/include/core/SkRefCnt.h:192
3021 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/atomic:922
2988 ../../third_party/WebKit/Source/platform/wtf/text/StringImpl.h:264
2962 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:700
2958 ../../v8/include/v8.h:9046
2951 ../../v8/src/counters.h:981
2927 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2607
2889 ../../third_party/WebKit/Source/platform/wtf/RefPtr.h:87
2880 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1607
2865 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:80
2834 ../../v8/src/handles-inl.h:70
2809 ../../v8/src/handles-inl.h:32
2798 ../../v8/src/heap/heap-inl.h:650
2797 ../../base/memory/ref_counted.h:466
2790 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__split_buffer:326
2777 ../../base/trace_event/trace_event.h:1042
2766 ../../base/memory/ref_counted.h:488
2765 ../../v8/src/utils.h:496
2751 ../../v8/include/v8.h:9404
2733 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1472
2718 ../../base/memory/ref_counted.h:467
2709 ../../third_party/WebKit/Source/platform/wtf/ConditionalDestructor.h:20
2703 ../../base/trace_event/trace_event.h:1045
2702 ../../base/trace_event/trace_event.h:1043
2695 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:77
2684 ../../base/trace_event/trace_event.h:1030
2677 ../../base/trace_event/trace_event.h:1044
2671 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1583
2662 ../../third_party/skia/include/core/SkRefCnt.h:282
2661 ../../third_party/WebKit/Source/platform/wtf/Vector.h:397
2594 ../../third_party/skia/src/core/../opts/SkNx_neon.h:138
2554 ../../v8/src/inspector/string-16.h:112
2554 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1781
2550 ../../third_party/WebKit/Source/platform/wtf/Vector.h:433
2525 ../../v8/src/objects-inl.h:159
2518 ../../base/bind_internal.h:340
2513 ../../base/callback_internal.h:127
2471 ../../third_party/WebKit/Source/platform/wtf/text/AtomicString.h:50
2469 ../../base/logging.h:975
2467 ../../base/threading/thread_local.h:65
2464 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:3833
2464 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:3185
2450 ../../third_party/WebKit/Source/platform/heap/Member.h:36
2441 ../../base/bind.h:43
2438 ../../third_party/WebKit/Source/platform/heap/TraceTraits.h:225
2422 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/tuple:180
2421 ../../v8/src/compiler/graph.h:70
2392 ../../base/bind_internal.h:453
2391 ../../v8/include/v8.h:9447
2364 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:473
2342 ../../v8/src/compiler/js-graph.h:156
2334 ../../third_party/skia/src/core/../opts/SkNx_neon.h:176
2333 ../../third_party/WebKit/Source/bindings/core/v8/ExceptionState.h:79
2282 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1588
2278 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:3221
2275 ../../third_party/skia/src/core/../opts/SkNx_neon.h:175
2272 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/utility:306
2267 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:2198
2265 ../../base/bind_internal.h:459
2259 ../../third_party/WebKit/Source/platform/heap/Heap.h:509
2253 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:1571
2237 ../../base/memory/ref_counted.h:558
2216 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__tree:1130
2205 ../../third_party/skia/include/core/SkRefCnt.h:87
2205 ../../third_party/skia/include/core/SkRefCnt.h:84
2194 ../../base/bind_internal.h:457
2172 ../../base/memory/weak_ptr.h:242
2117 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:2486
2098 ../../mojo/public/cpp/system/handle.h:157
2089 ../../v8/src/counters.h:1386
2065 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:456
2063 ../../base/time/time.h:367
2061 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:1959
2045 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/memory:1700
2045 ../../base/synchronization/lock_impl.h:70
2044 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/vector:663
2023 ../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/string:1490
2023 ../../base/bind_internal.h:456
2015 ../../ipc/ipc_message_utils.h:106
2011 ../../v8/src/base/atomic-utils.h:116
2009 ../../base/bind_internal.h:275
2003 ../../third_party/protobuf/src/google/protobuf/io/coded_stream.h:1001
Note: use a version built at afa076bcf93368cfd37ca5fa972ce2537eaa1cc7
Takeaway:
* This experiment doesn't show at all whether any of these inlines would result in a space saving if out-lined.
* Might be worth compiling with -fno-inline and dumping the size of these functions to compute saving estimates (although apparently __attribute__((always_inline)) functions will still be inlined)
For reference, here's a snippet of what disassembly output looks like:
_ZNVSt6__ndk113__atomic_baseIiLb0EE23compare_exchange_strongERiiNS_12memory_orderES3_():
/usr/local/google/home/agrieve/ssd/git/clankium1/src/out-gn/Release/../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/atomic:862 (discriminator 24)
memory_order __s, memory_order __f) _NOEXCEPT
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) volatile _NOEXCEPT
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
2dee0e: e854 0f00 ldrex r0, [r4]
2dee12: b920 cbnz r0, 2dee1e <_Znaj+0x4a>
2dee14: e84a 5000 strex r0, r5, [sl]
2dee18: 2800 cmp r0, #0
2dee1a: d1f8 bne.n 2dee0e <_Znaj+0x3a>
2dee1c: e00d b.n 2dee3a <_Znaj+0x66>
2dee1e: f3bf 8f2f clrex
2dee22: f3bf 8f5b dmb ish
_ZN12_GLOBAL__N_114CallNewHandlerEj():
/usr/local/google/home/agrieve/ssd/git/clankium1/src/out-gn/Release/../../base/allocator/allocator_shim.cc:70
// 4.9 and newer, but it will be a few more years before a newer sysroot
// becomes available.
std::new_handler nh;
{
while (subtle::Acquire_CompareAndSwap(&g_new_handler_lock, 0, 1))
PlatformThread::YieldCurrentThread();
2dee26: f2bf f511 bl 99e84c <_ZN4base14PlatformThread18YieldCurrentThreadEv>
_ZNVSt6__ndk113__atomic_baseIiLb0EE23compare_exchange_strongERiiNS_12memory_orderES3_():
/usr/local/google/home/agrieve/ssd/git/clankium1/src/out-gn/Release/../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/atomic:862 (discriminator 24)
2dee2a: e85b 0f00 ldrex r0, [fp]
2dee2e: 2800 cmp r0, #0
2dee30: d1f5 bne.n 2dee1e <_Znaj+0x4a>
2dee32: e848 5000 strex r0, r5, [r8]
2dee36: 2800 cmp r0, #0
2dee38: d1f7 bne.n 2dee2a <_Znaj+0x56>
_ZN12_GLOBAL__N_114CallNewHandlerEj():
/usr/local/google/home/agrieve/ssd/git/clankium1/src/out-gn/Release/../../base/allocator/allocator_shim.cc:71
nh = std::set_new_handler(0);
2dee3a: 2000 movs r0, #0
_ZNVSt6__ndk113__atomic_baseIiLb0EE23compare_exchange_strongERiiNS_12memory_orderES3_():
/usr/local/google/home/agrieve/ssd/git/clankium1/src/out-gn/Release/../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/atomic:862 (discriminator 24)
2dee3c: f3bf 8f5b dmb ish
2dee40: 2600 movs r6, #0
_ZN12_GLOBAL__N_114CallNewHandlerEj():
|
Deleted:
final-trimmed (1).txt
1.8 MB
|
Comment 1 by benhenry@chromium.org
, Aug 1