From 01575f86aa6dabbdd89f29696c80e3d9ffaa5de9 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 22 Nov 2011 21:20:33 +0000 Subject: [PATCH] Got the sizeof(lldb_private::Symbol) down to 64 bytes (from 72 bytes) by not having the enumeration take up 32 bits for the type and by putting it into the bitfields that were already being used. llvm-svn: 145084 --- lldb/include/lldb/Symbol/Symbol.h | 10 +++++----- lldb/source/Symbol/Symbol.cpp | 32 +++++++++++++++---------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lldb/include/lldb/Symbol/Symbol.h b/lldb/include/lldb/Symbol/Symbol.h index d8898e97cf39..fea2457068ac 100644 --- a/lldb/include/lldb/Symbol/Symbol.h +++ b/lldb/include/lldb/Symbol/Symbol.h @@ -111,10 +111,10 @@ public: GetByteSize () const { return m_addr_range.GetByteSize(); } lldb::SymbolType - GetType () const { return m_type; } + GetType () const { return (lldb::SymbolType)m_type; } void - SetType (lldb::SymbolType type) { m_type = type; } + SetType (lldb::SymbolType type) { m_type = (lldb::SymbolType)type; } const char * GetTypeAsString () const; @@ -204,7 +204,6 @@ protected: uint32_t m_uid; // User ID (usually the original symbol table index) Mangled m_mangled; // uniqued symbol name/mangled name pair - lldb::SymbolType m_type; // symbol type uint16_t m_type_data; // data specific to m_type uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated m_is_synthetic:1, // non-zero if this symbol is not actually in the symbol table, but synthesized from other info in the object file. @@ -212,9 +211,10 @@ protected: m_is_external:1, // non-zero if this symbol is globally visible m_size_is_sibling:1, // m_size contains the index of this symbol's sibling m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next - m_searched_for_function:1;// non-zero if we have looked for the function associated with this symbol already. - AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any) + m_searched_for_function:1,// non-zero if we have looked for the function associated with this symbol already. + m_type:8; uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these + AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any) }; } // namespace lldb_private diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp index 67717bdba0ef..bd084c8894ff 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -23,7 +23,6 @@ Symbol::Symbol() : SymbolContextScope (), m_uid (UINT32_MAX), m_mangled (), - m_type (eSymbolTypeInvalid), m_type_data (0), m_type_data_resolved (false), m_is_synthetic (false), @@ -32,8 +31,9 @@ Symbol::Symbol() : m_size_is_sibling (false), m_size_is_synthesized (false), m_searched_for_function (false), - m_addr_range (), - m_flags () + m_type (eSymbolTypeInvalid), + m_flags (), + m_addr_range () { } @@ -55,7 +55,6 @@ Symbol::Symbol SymbolContextScope (), m_uid (symID), m_mangled (name, name_is_mangled), - m_type (type), m_type_data (0), m_type_data_resolved (false), m_is_synthetic (is_artificial), @@ -64,8 +63,9 @@ Symbol::Symbol m_size_is_sibling (false), m_size_is_synthesized (false), m_searched_for_function (false), - m_addr_range (section, offset, size), - m_flags (flags) + m_type (type), + m_flags (flags), + m_addr_range (section, offset, size) { } @@ -85,7 +85,6 @@ Symbol::Symbol SymbolContextScope (), m_uid (symID), m_mangled (name, name_is_mangled), - m_type (type), m_type_data (0), m_type_data_resolved (false), m_is_synthetic (is_artificial), @@ -94,8 +93,9 @@ Symbol::Symbol m_size_is_sibling (false), m_size_is_synthesized (false), m_searched_for_function (false), - m_addr_range (range), - m_flags (flags) + m_type (type), + m_flags (flags), + m_addr_range (range) { } @@ -103,7 +103,6 @@ Symbol::Symbol(const Symbol& rhs): SymbolContextScope (rhs), m_uid (rhs.m_uid), m_mangled (rhs.m_mangled), - m_type (rhs.m_type), m_type_data (rhs.m_type_data), m_type_data_resolved (rhs.m_type_data_resolved), m_is_synthetic (rhs.m_is_synthetic), @@ -112,8 +111,9 @@ Symbol::Symbol(const Symbol& rhs): m_size_is_sibling (rhs.m_size_is_sibling), m_size_is_synthesized (false), m_searched_for_function (false), - m_addr_range (rhs.m_addr_range), - m_flags (rhs.m_flags) + m_type (rhs.m_type), + m_flags (rhs.m_flags), + m_addr_range (rhs.m_addr_range) { } @@ -125,7 +125,6 @@ Symbol::operator= (const Symbol& rhs) SymbolContextScope::operator= (rhs); m_uid = rhs.m_uid; m_mangled = rhs.m_mangled; - m_type = rhs.m_type; m_type_data = rhs.m_type_data; m_type_data_resolved = rhs.m_type_data_resolved; m_is_synthetic = rhs.m_is_synthetic; @@ -134,8 +133,9 @@ Symbol::operator= (const Symbol& rhs) m_size_is_sibling = rhs.m_size_is_sibling; m_size_is_synthesized = rhs.m_size_is_sibling; m_searched_for_function = rhs.m_searched_for_function; - m_addr_range = rhs.m_addr_range; + m_type = rhs.m_type; m_flags = rhs.m_flags; + m_addr_range = rhs.m_addr_range; } return *this; } @@ -145,7 +145,6 @@ Symbol::Clear() { m_uid = UINT32_MAX; m_mangled.Clear(); - m_type = eSymbolTypeInvalid; m_type_data = 0; m_type_data_resolved = false; m_is_synthetic = false; @@ -154,8 +153,9 @@ Symbol::Clear() m_size_is_sibling = false; m_size_is_synthesized = false; m_searched_for_function = false; - m_addr_range.Clear(); + m_type = eSymbolTypeInvalid; m_flags = 0; + m_addr_range.Clear(); } AddressRange *