summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ExecutionContext.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-05-24 00:58:29 +0000
committerGreg Clayton <gclayton@apple.com>2013-05-24 00:58:29 +0000
commit7bcb93d5a5cd4effcb8ddb1fa1ac1b54716309e1 (patch)
tree297afeae0a9860918b6b6c9ebb56d266a9f11571 /lldb/source/Target/ExecutionContext.cpp
parent48ed4b614cb055fa2f8a3948b284f0ad8730ec3f (diff)
downloadbcm5719-llvm-7bcb93d5a5cd4effcb8ddb1fa1ac1b54716309e1.tar.gz
bcm5719-llvm-7bcb93d5a5cd4effcb8ddb1fa1ac1b54716309e1.zip
<rdar://problem/13643315>
Fixed performance issues that arose after changing SBTarget, SBProcess, SBThread and SBFrame over to using a std::shared_ptr to a ExecutionContextRef. The ExecutionContextRef doesn't store a std::weak_ptr to a stack frame because stack frames often get replaced with new version, so it held onto a StackID object that would allow us to ask the thread each time for the frame for the StackID. The linear function was too slow for large recursive stacks. We also fixed an issue where anytime the std::shared_ptr<ExecutionContextRef> in any SBTarget, SBProcess, SBThread objects was turned into an ExecutionContext object, it would try to resolve all items in the ExecutionContext which are shared pointers. Even if the StackID in the ExecutionContextRef was invalid, it was looking through all frames in every thread. This causes a lot of unnecessary frame accesses. llvm-svn: 182627
Diffstat (limited to 'lldb/source/Target/ExecutionContext.cpp')
-rw-r--r--lldb/source/Target/ExecutionContext.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp
index 6ab03553cbc..8b5731e8028 100644
--- a/lldb/source/Target/ExecutionContext.cpp
+++ b/lldb/source/Target/ExecutionContext.cpp
@@ -806,9 +806,12 @@ ExecutionContextRef::GetThreadSP () const
lldb::StackFrameSP
ExecutionContextRef::GetFrameSP () const
{
- lldb::ThreadSP thread_sp (GetThreadSP());
- if (thread_sp)
- return thread_sp->GetFrameWithStackID (m_stack_id);
+ if (m_stack_id.IsValid())
+ {
+ lldb::ThreadSP thread_sp (GetThreadSP());
+ if (thread_sp)
+ return thread_sp->GetFrameWithStackID (m_stack_id);
+ }
return lldb::StackFrameSP();
}
OpenPOWER on IntegriCloud