[Lldb-commits] [lldb] r270938 - Don't cache the stret/vrs. non-stret code pointer as static data in the runtime.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu May 26 16:49:49 PDT 2016


Author: jingham
Date: Thu May 26 18:49:49 2016
New Revision: 270938

URL: http://llvm.org/viewvc/llvm-project?rev=270938&view=rev
Log:
Don't cache the stret/vrs. non-stret code pointer as static data in the runtime.
It belongs in the instance, since then when you change architectures it can be adjusted
appropriately.

<rdar://problem/26308079>

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

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=270938&r1=270937&r2=270938&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Thu May 26 18:49:49 2016
@@ -44,7 +44,6 @@ using namespace lldb;
 using namespace lldb_private;
 
 const char *AppleObjCTrampolineHandler::g_lookup_implementation_function_name = "__lldb_objc_find_implementation_for_selector";
-const char *AppleObjCTrampolineHandler::g_lookup_implementation_function_code = NULL;
 const char *AppleObjCTrampolineHandler::g_lookup_implementation_with_stret_function_code = "                               \n\
 extern \"C\"                                                                                                    \n\
 {                                                                                                               \n\
@@ -658,6 +657,7 @@ AppleObjCTrampolineHandler::AppleObjCTra
                                                         const ModuleSP &objc_module_sp) :
     m_process_wp (),
     m_objc_module_sp (objc_module_sp),
+    m_lookup_implementation_function_code(nullptr),
     m_impl_fn_addr (LLDB_INVALID_ADDRESS),
     m_impl_stret_fn_addr (LLDB_INVALID_ADDRESS),
     m_msg_forward_addr (LLDB_INVALID_ADDRESS)
@@ -704,11 +704,11 @@ AppleObjCTrampolineHandler::AppleObjCTra
         // It there is no stret return lookup function, assume that it is the same as the straight lookup:
         m_impl_stret_fn_addr = m_impl_fn_addr;
         // Also we will use the version of the lookup code that doesn't rely on the stret version of the function.
-        g_lookup_implementation_function_code = g_lookup_implementation_no_stret_function_code;
+        m_lookup_implementation_function_code = g_lookup_implementation_no_stret_function_code;
     }
     else
     {
-        g_lookup_implementation_function_code = g_lookup_implementation_with_stret_function_code;
+        m_lookup_implementation_function_code = g_lookup_implementation_with_stret_function_code;
     }
         
     // Look up the addresses for the objc dispatch functions and cache them.  For now I'm inspecting the symbol
@@ -757,10 +757,10 @@ AppleObjCTrampolineHandler::SetupDispatc
 
         if (!m_impl_code.get())
         {
-            if (g_lookup_implementation_function_code != NULL)
+            if (m_lookup_implementation_function_code != NULL)
             {
                 Error error;
-                m_impl_code.reset (exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage (g_lookup_implementation_function_code,
+                m_impl_code.reset (exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage (m_lookup_implementation_function_code,
                                                                                          eLanguageTypeObjC,
                                                                                          g_lookup_implementation_function_name,
                                                                                          error));

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=270938&r1=270937&r2=270938&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Thu May 26 18:49:49 2016
@@ -65,7 +65,6 @@ public:
 
 private:
     static const char *g_lookup_implementation_function_name;
-    static const char *g_lookup_implementation_function_code;
     static const char *g_lookup_implementation_with_stret_function_code;
     static const char *g_lookup_implementation_no_stret_function_code;
 
@@ -195,6 +194,7 @@ private:
     MsgsendMap m_msgSend_map;
     lldb::ProcessWP m_process_wp;
     lldb::ModuleSP m_objc_module_sp;
+    const char *m_lookup_implementation_function_code;
     std::unique_ptr<UtilityFunction> m_impl_code;
     std::mutex m_impl_function_mutex;
     lldb::addr_t m_impl_fn_addr;




More information about the lldb-commits mailing list