[Lldb-commits] [lldb] r145084 - in /lldb/trunk: include/lldb/Symbol/Symbol.h source/Symbol/Symbol.cpp

Greg Clayton gclayton at apple.com
Tue Nov 22 13:20:33 PST 2011


Author: gclayton
Date: Tue Nov 22 15:20:33 2011
New Revision: 145084

URL: http://llvm.org/viewvc/llvm-project?rev=145084&view=rev
Log:
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.


Modified:
    lldb/trunk/include/lldb/Symbol/Symbol.h
    lldb/trunk/source/Symbol/Symbol.cpp

Modified: lldb/trunk/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=145084&r1=145083&r2=145084&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symbol.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symbol.h Tue Nov 22 15:20:33 2011
@@ -111,10 +111,10 @@
     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 @@
 
     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 @@
                     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

Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=145084&r1=145083&r2=145084&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Tue Nov 22 15:20:33 2011
@@ -23,7 +23,6 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
         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 @@
         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 @@
 {
     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 @@
     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 *





More information about the lldb-commits mailing list