Skip to content

Commit 64f6406

Browse files
authored
[WebAssembly] __USING_WASM_EXCEPTIONS__ -> __WASM_EXCEPTIONS__ (#92840)
We've decided to change `__USING_WASM_EXCEPTIONS__` preprocessor to `__WASM_EXCEPTIONS__` given that it's more concise.
1 parent 97025bd commit 64f6406

File tree

6 files changed

+24
-25
lines changed

6 files changed

+24
-25
lines changed

libcxxabi/include/cxxabi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB
5353
// 2.4.3 Throwing the Exception Object
5454
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
5555
__cxa_throw(void *thrown_exception, std::type_info *tinfo,
56-
#ifdef __USING_WASM_EXCEPTIONS__
56+
#ifdef __WASM_EXCEPTIONS__
5757
// In Wasm, a destructor returns its argument
5858
void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
5959
#else

libcxxabi/src/cxa_exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ will call terminate, assuming that there was no handler for the
267267
exception.
268268
*/
269269
void
270-
#ifdef __USING_WASM_EXCEPTIONS__
270+
#ifdef __WASM_EXCEPTIONS__
271271
// In Wasm, a destructor returns its argument
272272
__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
273273
#else

libcxxabi/src/cxa_exception.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
4343

4444
// Manage the exception object itself.
4545
std::type_info *exceptionType;
46-
#ifdef __USING_WASM_EXCEPTIONS__
46+
#ifdef __WASM_EXCEPTIONS__
4747
// In Wasm, a destructor returns its argument
4848
void *(_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
4949
#else

libcxxabi/src/cxa_personality.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
7070
+------------------+--+-----+-----+------------------------+--------------------------+
7171
| callSiteTableLength | (ULEB128) | Call Site Table length, used to find Action table |
7272
+---------------------+-----------+---------------------------------------------------+
73-
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
73+
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
7474
+---------------------+-----------+------------------------------------------------+
7575
| Beginning of Call Site Table The current ip lies within the |
7676
| ... (start, length) range of one of these |
@@ -84,7 +84,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
8484
| +-------------+---------------------------------+------------------------------+ |
8585
| ... |
8686
+----------------------------------------------------------------------------------+
87-
#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
87+
#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
8888
+---------------------+-----------+------------------------------------------------+
8989
| Beginning of Call Site Table The current ip is a 1-based index into |
9090
| ... this table. Or it is -1 meaning no |
@@ -97,7 +97,7 @@ extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
9797
| +-------------+---------------------------------+------------------------------+ |
9898
| ... |
9999
+----------------------------------------------------------------------------------+
100-
#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
100+
#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
101101
+---------------------------------------------------------------------+
102102
| Beginning of Action Table ttypeIndex == 0 : cleanup |
103103
| ... ttypeIndex > 0 : catch |
@@ -547,7 +547,7 @@ void
547547
set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context,
548548
const scan_results& results)
549549
{
550-
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__)
550+
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
551551
#define __builtin_eh_return_data_regno(regno) regno
552552
#elif defined(__ibmxl__)
553553
// IBM xlclang++ compiler does not support __builtin_eh_return_data_regno.
@@ -642,7 +642,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
642642
// Get beginning current frame's code (as defined by the
643643
// emitted dwarf code)
644644
uintptr_t funcStart = _Unwind_GetRegionStart(context);
645-
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__)
645+
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
646646
if (ip == uintptr_t(-1))
647647
{
648648
// no action
@@ -652,9 +652,9 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
652652
else if (ip == 0)
653653
call_terminate(native_exception, unwind_exception);
654654
// ip is 1-based index into call site table
655-
#else // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
655+
#else // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
656656
uintptr_t ipOffset = ip - funcStart;
657-
#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
657+
#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
658658
const uint8_t* classInfo = NULL;
659659
// Note: See JITDwarfEmitter::EmitExceptionTable(...) for corresponding
660660
// dwarf emission
@@ -675,7 +675,7 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
675675
// Walk call-site table looking for range that
676676
// includes current PC.
677677
uint8_t callSiteEncoding = *lsda++;
678-
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__USING_WASM_EXCEPTIONS__)
678+
#if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
679679
(void)callSiteEncoding; // When using SjLj/Wasm exceptions, callSiteEncoding is never used
680680
#endif
681681
uint32_t callSiteTableLength = static_cast<uint32_t>(readULEB128(&lsda));
@@ -686,33 +686,33 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
686686
while (callSitePtr < callSiteTableEnd)
687687
{
688688
// There is one entry per call site.
689-
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
689+
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
690690
// The call sites are non-overlapping in [start, start+length)
691691
// The call sites are ordered in increasing value of start
692692
uintptr_t start = readEncodedPointer(&callSitePtr, callSiteEncoding);
693693
uintptr_t length = readEncodedPointer(&callSitePtr, callSiteEncoding);
694694
uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
695695
uintptr_t actionEntry = readULEB128(&callSitePtr);
696696
if ((start <= ipOffset) && (ipOffset < (start + length)))
697-
#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
697+
#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
698698
// ip is 1-based index into this table
699699
uintptr_t landingPad = readULEB128(&callSitePtr);
700700
uintptr_t actionEntry = readULEB128(&callSitePtr);
701701
if (--ip == 0)
702-
#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
702+
#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
703703
{
704704
// Found the call site containing ip.
705-
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
705+
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
706706
if (landingPad == 0)
707707
{
708708
// No handler here
709709
results.reason = _URC_CONTINUE_UNWIND;
710710
return;
711711
}
712712
landingPad = (uintptr_t)lpStart + landingPad;
713-
#else // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
713+
#else // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
714714
++landingPad;
715-
#endif // __USING_SJLJ_EXCEPTIONS__ || __USING_WASM_EXCEPTIONS__
715+
#endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
716716
results.landingPad = landingPad;
717717
if (actionEntry == 0)
718718
{
@@ -838,15 +838,15 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
838838
action += actionOffset;
839839
} // there is no break out of this loop, only return
840840
}
841-
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__USING_WASM_EXCEPTIONS__)
841+
#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
842842
else if (ipOffset < start)
843843
{
844844
// There is no call site for this ip
845845
// Something bad has happened. We should never get here.
846846
// Possible stack corruption.
847847
call_terminate(native_exception, unwind_exception);
848848
}
849-
#endif // !__USING_SJLJ_EXCEPTIONS__ && !__USING_WASM_EXCEPTIONS__
849+
#endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
850850
} // there might be some tricky cases which break out of this loop
851851

852852
// It is possible that no eh table entry specify how to handle
@@ -903,7 +903,7 @@ _UA_CLEANUP_PHASE
903903
*/
904904

905905
#if !defined(_LIBCXXABI_ARM_EHABI)
906-
#ifdef __USING_WASM_EXCEPTIONS__
906+
#ifdef __WASM_EXCEPTIONS__
907907
_Unwind_Reason_Code __gxx_personality_wasm0
908908
#elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
909909
static _Unwind_Reason_Code __gxx_personality_imp
@@ -972,7 +972,7 @@ __gxx_personality_v0
972972
exc->languageSpecificData = results.languageSpecificData;
973973
exc->catchTemp = reinterpret_cast<void*>(results.landingPad);
974974
exc->adjustedPtr = results.adjustedPtr;
975-
#ifdef __USING_WASM_EXCEPTIONS__
975+
#ifdef __WASM_EXCEPTIONS__
976976
// Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the
977977
// results here.
978978
set_registers(unwind_exception, context, results);

libunwind/src/Unwind-wasm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "config.h"
1616

17-
#ifdef __USING_WASM_EXCEPTIONS__
17+
#ifdef __WASM_EXCEPTIONS__
1818

1919
#include "unwind.h"
2020
#include <threads.h>
@@ -120,4 +120,4 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
120120
return 0;
121121
}
122122

123-
#endif // defined(__USING_WASM_EXCEPTIONS__)
123+
#endif // defined(__WASM_EXCEPTIONS__)

libunwind/src/libunwind.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start) {
347347
}
348348

349349
#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
350-
#endif // !defined(__USING_SJLJ_EXCEPTIONS__) &&
351-
// !defined(__wasm__)
350+
#endif // !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__wasm__)
352351

353352
#ifdef __APPLE__
354353

0 commit comments

Comments
 (0)