[libcxxabi] r208352 - Fixes more incorrect #ifs for SJ/LJ exceptions

Jonathan Roelofs jonathan at codesourcery.com
Thu May 8 12:13:16 PDT 2014


Author: jroelofs
Date: Thu May  8 14:13:16 2014
New Revision: 208352

URL: http://llvm.org/viewvc/llvm-project?rev=208352&view=rev
Log:
Fixes more incorrect #ifs for SJ/LJ exceptions

Replaces several `#if __arm__` with `#if __USING_SJLJ_EXCEPTIONS__`.

Modified:
    libcxxabi/trunk/include/unwind.h
    libcxxabi/trunk/src/cxa_personality.cpp

Modified: libcxxabi/trunk/include/unwind.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/unwind.h?rev=208352&r1=208351&r2=208352&view=diff
==============================================================================
--- libcxxabi/trunk/include/unwind.h (original)
+++ libcxxabi/trunk/include/unwind.h Thu May  8 14:13:16 2014
@@ -101,7 +101,7 @@ extern void _Unwind_SetIP(struct _Unwind
 extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
 extern uintptr_t
     _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
-#if __arm__
+#if __USING_SJLJ_EXCEPTIONS__
 extern _Unwind_Reason_Code
     _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *exception_object,
                               _Unwind_Stop_Fn stop, void *stop_parameter);
@@ -111,7 +111,7 @@ extern _Unwind_Reason_Code
                          _Unwind_Stop_Fn stop, void *stop_parameter);
 #endif
 
-#if __arm__
+#if __USING_SJLJ_EXCEPTIONS__
 typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t;
 extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc);
 extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc);
@@ -124,7 +124,7 @@ extern void _Unwind_SjLj_Unregister(_Unw
 //
 //  called by __cxa_rethrow().
 //
-#if __arm__
+#if __USING_SJLJ_EXCEPTIONS__
 extern _Unwind_Reason_Code
     _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object);
 #else

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=208352&r1=208351&r2=208352&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Thu May  8 14:13:16 2014
@@ -49,7 +49,7 @@
 +------------------+--+-----+-----+------------------------+--------------------------+
 | callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table |
 +---------------------+-----------+---------------------------------------------------+
-#if !__arm__
+#if !__USING_SJLJ_EXCEPTIONS__
 +---------------------+-----------+------------------------------------------------+
 | Beginning of Call Site Table            The current ip lies within the           |
 | ...                                     (start, length) range of one of these    |
@@ -63,7 +63,7 @@
 | +-------------+---------------------------------+------------------------------+ |
 | ...                                                                              |
 +----------------------------------------------------------------------------------+
-#else  // __arm_
+#else  // __USING_SJLJ_EXCEPTIONS__
 +---------------------+-----------+------------------------------------------------+
 | Beginning of Call Site Table            The current ip is a 1-based index into   |
 | ...                                     this table.  Or it is -1 meaning no      |
@@ -76,7 +76,7 @@
 | +-------------+---------------------------------+------------------------------+ |
 | ...                                                                              |
 +----------------------------------------------------------------------------------+
-#endif  // __arm_
+#endif  // __USING_SJLJ_EXCEPTIONS__
 +---------------------------------------------------------------------+
 | Beginning of Action Table       ttypeIndex == 0 : cleanup           |
 | ...                             ttypeIndex  > 0 : catch             |
@@ -511,7 +511,7 @@ scan_eh_tab(scan_results& results, _Unwi
     // Get beginning current frame's code (as defined by the 
     // emitted dwarf code)
     uintptr_t funcStart = _Unwind_GetRegionStart(context);
-#if __arm__
+#if __USING_SJLJ_EXCEPTIONS__
     if (ip == uintptr_t(-1))
     {
         // no action
@@ -521,9 +521,9 @@ scan_eh_tab(scan_results& results, _Unwi
     else if (ip == 0)
         call_terminate(native_exception, unwind_exception);
     // ip is 1-based index into call site table
-#else  // __arm__
+#else  // !__USING_SJLJ_EXCEPTIONS__
     uintptr_t ipOffset = ip - funcStart;
-#endif  // __arm__
+#endif  // !defined(_USING_SLJL_EXCEPTIONS__)
     const uint8_t* classInfo = NULL;
     // Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding
     //       dwarf emission
@@ -544,8 +544,8 @@ scan_eh_tab(scan_results& results, _Unwi
     // Walk call-site table looking for range that 
     // includes current PC. 
     uint8_t callSiteEncoding = *lsda++;
-#if __arm__
-    (void)callSiteEncoding;  // On arm callSiteEncoding is never used
+#if __USING_SJLJ_EXCEPTIONS__
+    (void)callSiteEncoding;  // When using SjLj exceptions, callSiteEncoding is never used
 #endif
     uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda));
     const uint8_t* callSiteTableStart = lsda;
@@ -555,7 +555,7 @@ scan_eh_tab(scan_results& results, _Unwi
     while (callSitePtr < callSiteTableEnd)
     {
         // There is one entry per call site.
-#if !__arm__
+#if !__USING_SJLJ_EXCEPTIONS__
         // The call sites are non-overlapping in [start, start+length)
         // The call sites are ordered in increasing value of start
         uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
@@ -563,15 +563,15 @@ scan_eh_tab(scan_results& results, _Unwi
         uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
         uintptr_t actionEntry = readULEB128(&callSitePtr);
         if ((start <= ipOffset) && (ipOffset < (start + length)))
-#else  // __arm__
+#else  // __USING_SJLJ_EXCEPTIONS__
         // ip is 1-based index into this table
         uintptr_t landingPad = readULEB128(&callSitePtr);
         uintptr_t actionEntry = readULEB128(&callSitePtr);
         if (--ip == 0)
-#endif  // __arm__
+#endif  // __USING_SJLJ_EXCEPTIONS__
         {
             // Found the call site containing ip.
-#if !__arm__
+#if !__USING_SJLJ_EXCEPTIONS__
             if (landingPad == 0)
             {
                 // No handler here
@@ -579,9 +579,9 @@ scan_eh_tab(scan_results& results, _Unwi
                 return;
             }
             landingPad = (uintptr_t)lpStart + landingPad;
-#else  // __arm__
+#else  // __USING_SJLJ_EXCEPTIONS__
             ++landingPad;
-#endif  // __arm__
+#endif  // __USING_SJLJ_EXCEPTIONS__
             if (actionEntry == 0)
             {
                 // Found a cleanup
@@ -773,7 +773,7 @@ scan_eh_tab(scan_results& results, _Unwi
                 action += actionOffset;
             }  // there is no break out of this loop, only return
         }
-#if !__arm__
+#if !__USING_SJLJ_EXCEPTIONS__
         else if (ipOffset < start)
         {
             // There is no call site for this ip
@@ -781,7 +781,7 @@ scan_eh_tab(scan_results& results, _Unwi
             // Possible stack corruption.
             call_terminate(native_exception, unwind_exception);
         }
-#endif  // !__arm__
+#endif  // !__USING_SJLJ_EXCEPTIONS__
     }  // there might be some tricky cases which break out of this loop
 
     // It is possible that no eh table entry specify how to handle





More information about the cfe-commits mailing list