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
This commit is contained in:
Sean Callanan 2012-10-10 00:46:46 +00:00
parent 8fd10ef0d6
commit 2cc1fbfc9b
1 changed files with 12 additions and 8 deletions

View File

@ -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 <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 @@ 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