From 63627157d8593fb760c717e0dc098d132eb6e148 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Fri, 9 Aug 2019 12:23:49 -0700 Subject: binder: Use StaticString16 for interface descriptors Binder interface descriptors is one of the biggest sources of static constructors. Use the newly implemented StaticString16 to avoid runtime construction. Bug: 138856262 Test: Build and boot cuttlefish. Test: Check interface descriptors now reside in .data sections. Test: Measure the memory usage of libraries affected by this change, including .data, .data.rel.ro, and .bss sections, on cuttlefish. Overall usage decreases by 112 KB. Change-Id: I0419aa9378570936f15a97a9ab814b035dee4c06 --- libs/binder/include/binder/IInterface.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h index 0d305608ca..adc1f05bb2 100644 --- a/libs/binder/include/binder/IInterface.h +++ b/libs/binder/include/binder/IInterface.h @@ -88,8 +88,12 @@ private: \ public: \ +#define __IINTF_CONCAT(x, y) (x ## y) #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ - const ::android::String16 I##INTERFACE::descriptor(NAME); \ + const ::android::StaticString16 \ + I##INTERFACE##_descriptor_static_str16(__IINTF_CONCAT(u, NAME));\ + const ::android::String16 I##INTERFACE::descriptor( \ + I##INTERFACE##_descriptor_static_str16); \ const ::android::String16& \ I##INTERFACE::getInterfaceDescriptor() const { \ return I##INTERFACE::descriptor; \ -- cgit v1.2.3-59-g8ed1b