From 2cc1fbfc9bbc59badd85c476f12211ae608712ea Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Wed, 10 Oct 2012 00:46:46 +0000 Subject: [PATCH] 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. llvm-svn: 165579 --- .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index e5ad473..82051d5 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1112,14 +1112,14 @@ public: 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 (nullptr), - class_method_func, - std::function (nullptr)); + metaclass.Describe(std::function (nullptr), + class_method_func, + std::function (nullptr)); } while (0); @@ -1670,10 +1670,14 @@ private: 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 -- 2.7.4