Overview
Comment: | Simplify detection of exception type |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8b0ab1157cdedadf3d057b9674d609b8 |
User & Date: | js on 2024-04-24 22:39:00 |
Other Links: | manifest | tags |
Context
2024-04-24
| ||
22:52 | Add SerenityOS to platform.h check-in: 4853f41b75 user: js tags: trunk | |
22:39 | Simplify detection of exception type check-in: 8b0ab1157c user: js tags: trunk | |
2024-04-23
| ||
01:00 | Simplify calls to objfw-embed check-in: 569a7aa657 user: js tags: trunk | |
Changes
Modified configure.ac from [63f2b5a434] to [aab515e691].
︙ | ︙ | |||
584 585 586 587 588 589 590 | ]) AS_IF([test x"$enable_seluid24" = x"yes"], [ AC_DEFINE(OF_SELUID24, 1, [Whether to use 24 bit selector UIDs]) ]) AC_MSG_CHECKING(for exception type) | < | < | | < | < < < < < > | < < < | | < | > | > | | | < < < < < < < < < < < < < < < < < < < < < | | | > > | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | ]) AS_IF([test x"$enable_seluid24" = x"yes"], [ AC_DEFINE(OF_SELUID24, 1, [Whether to use 24 bit selector UIDs]) ]) AC_MSG_CHECKING(for exception type) AC_EGREP_CPP(egrep_cpp_yes, [ #ifdef __SEH__ egrep_cpp_yes #endif ], [ AC_MSG_RESULT(SEH) exception_type="SEH" raise_exception="_Unwind_RaiseException" ], [ AC_EGREP_CPP(egrep_cpp_yes, [ #ifdef __USING_SJLJ_EXCEPTIONS__ egrep_cpp_yes #endif ], [ AC_MSG_RESULT(SjLj) exception_type="SjLj" raise_exception="_Unwind_SjLj_RaiseException" ], [ AC_MSG_RESULT(DWARF) exception_type="DWARF" raise_exception="_Unwind_RaiseException" ]) ]) AC_SEARCH_LIBS($raise_exception, [c++abi gcc_s gcc unwind], [ dnl c++abi requires pthread on OpenBSD AS_IF([test x"$ac_lib" = x"c++abi"], [LIBS="$LIBS -lpthread"]) ], [ AC_MSG_ERROR([$raise_exception missing!]) |
︙ | ︙ |
Modified src/runtime/exception.m from [2f0f690e96] to [a631c06b73].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "private.h" #import "macros.h" #ifdef OF_HAVE_THREADS # import "OFPlainMutex.h" #endif | | | | < | < < < > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #import "private.h" #import "macros.h" #ifdef OF_HAVE_THREADS # import "OFPlainMutex.h" #endif #ifdef __SEH__ # include <windows.h> #endif #if defined(__SEH__) # define PERSONALITY gnu_objc_personality #elif defined(__USING_SJLJ_EXCEPTIONS__) # define PERSONALITY __gnu_objc_personality_sj0 # define CXX_PERSONALITY_STR "__gxx_personality_sj0" # define _Unwind_RaiseException _Unwind_SjLj_RaiseException # define __builtin_eh_return_data_regno(i) (i) #else # define PERSONALITY __gnu_objc_personality_v0 # define CXX_PERSONALITY_STR "__gxx_personality_v0" #endif #if defined(OF_ARM) && !defined(__ARM_DWARF_EH__) # define HAVE_ARM_EHABI_EXCEPTIONS #endif #ifndef HAVE_ARM_EHABI_EXCEPTIONS |
︙ | ︙ | |||
126 127 128 129 130 131 132 | struct objc_exception { struct _Unwind_Exception { uint64_t class; void (*cleanup)( _Unwind_Reason_Code, struct _Unwind_Exception *); #ifndef HAVE_ARM_EHABI_EXCEPTIONS | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | struct objc_exception { struct _Unwind_Exception { uint64_t class; void (*cleanup)( _Unwind_Reason_Code, struct _Unwind_Exception *); #ifndef HAVE_ARM_EHABI_EXCEPTIONS # ifndef __SEH__ /* * The Itanium Exception ABI says to have those and never touch * them. */ uint64_t private1, private2; # else uint64_t private[6]; |
︙ | ︙ | |||
239 240 241 242 243 244 245 | } #endif #ifdef CXX_PERSONALITY static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR); #endif | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | } #endif #ifdef CXX_PERSONALITY static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR); #endif #ifdef __SEH__ extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT, PDISPATCHER_CONTEXT, _Unwind_Reason_Code (*)(int, int, uint64_t, struct _Unwind_Exception *, struct _Unwind_Context *)); #endif static objc_uncaught_exception_handler uncaughtExceptionHandler; static struct objc_exception emergencyExceptions[numEmergencyExceptions]; |
︙ | ︙ | |||
442 443 444 445 446 447 448 | { uintptr_t IP = _Unwind_GetIP(ctx); const uint8_t *ptr = LSDA->callsites; *landingpad = 0; *actionRecords = NULL; | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | { uintptr_t IP = _Unwind_GetIP(ctx); const uint8_t *ptr = LSDA->callsites; *landingpad = 0; *actionRecords = NULL; #ifndef __USING_SJLJ_EXCEPTIONS__ while (ptr < LSDA->actionTable) { uintptr_t callsiteStart, callsiteLength, callsiteLandingpad; uintptr_t callsiteAction; callsiteStart = LSDA->regionStart + (uintptr_t)readValue(LSDA->callsitesEnc, &ptr); callsiteLength = (uintptr_t)readValue(LSDA->callsitesEnc, &ptr); |
︙ | ︙ | |||
576 577 578 579 580 581 582 | else if (filter < 0) OBJC_ERROR("Invalid filter!"); } while (displacement != 0); return 0; } | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | else if (filter < 0) OBJC_ERROR("Invalid filter!"); } while (displacement != 0); return 0; } #ifdef __SEH__ static #endif PERSONALITY_FUNC(PERSONALITY) { #ifdef HAVE_ARM_EHABI_EXCEPTIONS int version = 1; uint64_t exClass = ex->class; |
︙ | ︙ | |||
782 783 784 785 786 787 788 | { objc_uncaught_exception_handler old = uncaughtExceptionHandler; uncaughtExceptionHandler = handler; return old; } | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | { objc_uncaught_exception_handler old = uncaughtExceptionHandler; uncaughtExceptionHandler = handler; return old; } #ifdef __SEH__ typedef EXCEPTION_DISPOSITION (*seh_personality_fn)(PEXCEPTION_RECORD, void *, PCONTEXT, PDISPATCHER_CONTEXT); static seh_personality_fn __gxx_personality_seh0; OF_CONSTRUCTOR() { /* |
︙ | ︙ |