[Lldb-commits] [lldb] r165579 - /lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Sean Callanan scallanan at apple.com
Tue Oct 9 17:46:47 PDT 2012


Author: spyffe
Date: Tue Oct  9 19:46:46 2012
New Revision: 165579

URL: http://llvm.org/viewvc/llvm-project?rev=165579&view=rev
Log:
Switched AppleObjCRuntimeV2::CreateClassDescriptor
over to simply update its cache and then look up
the descriptor in the cache.  This is fine because
the cache now builds much faster (since descriptors
are minimal).

Metaclasses aren't in the cache, so I switched
the Describe method for class descriptors from using
GetClassDescriptor to manually creating an automatic
ClassDescriptorV2.

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=165579&r1=165578&r2=165579&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Oct  9 19:46:46 2012
@@ -1112,14 +1112,14 @@
         
         if (class_method_func)
         {
-            ObjCLanguageRuntime::ClassDescriptorSP metaclass = m_runtime.ObjCLanguageRuntime::GetClassDescriptor(objc_class->m_isa);
+            ClassDescriptorV2 metaclass(m_runtime, :q!objc_class->m_isa); // The metaclass is not in the cache
             
             // We don't care about the metaclass's superclass, or its class methods.  Its instance methods are
             // our class methods.
             
-            metaclass->Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
-                                class_method_func,
-                                std::function <void (const char *, const char *)> (nullptr));
+            metaclass.Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
+                               class_method_func,
+                               std::function <void (const char *, const char *)> (nullptr));
         }
         while (0);
             
@@ -1670,10 +1670,14 @@
 ObjCLanguageRuntime::ClassDescriptorSP
 AppleObjCRuntimeV2::CreateClassDescriptor (ObjCISA isa)
 {
-    ClassDescriptorSP objc_class_sp;
-    if (isa != 0)
-        objc_class_sp.reset (new ClassDescriptorV2(*this, isa));
-    return objc_class_sp;
+    UpdateISAToDescriptorMap();
+    
+    ISAToDescriptorMap::const_iterator di = m_isa_to_descriptor_cache.find(isa);
+    
+    if (di == m_isa_to_descriptor_cache.end())
+        return ObjCLanguageRuntime::ClassDescriptorSP();
+    else
+        return di->second;
 }
 
 ObjCLanguageRuntime::ClassDescriptorSP





More information about the lldb-commits mailing list