Differences From Artifact [ff0a7a161b]:
- File
src/runtime/exception.m
— part of check-in
[0d383aeb8a]
at
2020-06-21 15:57:17
on branch trunk
— Ignore return value from _Unwind_RaiseException()
It seems to be garbage on some platforms and both libsupc++ and libobjc
don't check its return value either. (user: js, size: 19855) [annotate] [blame] [check-ins using] [more...]
To Artifact [3255d28641]:
- File src/runtime/exception.m — part of check-in [8f271bed22] at 2020-12-20 03:06:55 on branch trunk — Let OF_ENSURE use OBJC_ERROR in runtime (user: js, size: 19870) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
245 246 247 248 249 250 251 | static struct objc_exception emergencyExceptions[NUM_EMERGENCY_EXCEPTIONS]; #ifdef OF_HAVE_THREADS static of_spinlock_t emergencyExceptionsSpinlock; OF_CONSTRUCTOR() { if (!of_spinlock_new(&emergencyExceptionsSpinlock)) | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | static struct objc_exception emergencyExceptions[NUM_EMERGENCY_EXCEPTIONS]; #ifdef OF_HAVE_THREADS static of_spinlock_t emergencyExceptionsSpinlock; OF_CONSTRUCTOR() { if (!of_spinlock_new(&emergencyExceptionsSpinlock)) OBJC_ERROR("Cannot create spinlock!"); } #endif static uint64_t readULEB128(const uint8_t **ptr) { uint64_t value = 0; |
︙ | ︙ | |||
306 307 308 309 310 311 312 | #endif #ifdef HAVE__UNWIND_GETTEXTRELBASE case DW_EH_PE_textrel: return _Unwind_GetTextRelBase(ctx); #endif } | | | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | #endif #ifdef HAVE__UNWIND_GETTEXTRELBASE case DW_EH_PE_textrel: return _Unwind_GetTextRelBase(ctx); #endif } OBJC_ERROR("Unknown encoding!"); } static size_t sizeForEncoding(uint8_t enc) { if (enc == DW_EH_PE_omit) return 0; switch (enc & 0x07) { case DW_EH_PE_absptr: return sizeof(void *); case DW_EH_PE_udata2: return 2; case DW_EH_PE_udata4: return 4; case DW_EH_PE_udata8: return 8; } OBJC_ERROR("Unknown encoding!"); } static uint64_t readValue(uint8_t enc, const uint8_t **ptr) { uint64_t value; if (enc == DW_EH_PE_aligned) OBJC_ERROR("DW_EH_PE_aligned is not implemented!"); #define READ(type) \ { \ type tmp; \ memcpy(&tmp, *ptr, sizeof(type)); \ value = tmp; \ *ptr += sizeForEncoding(enc); \ |
︙ | ︙ | |||
367 368 369 370 371 372 373 | case DW_EH_PE_sdata2: READ(int16_t) case DW_EH_PE_sdata4: READ(int32_t) case DW_EH_PE_sdata8: READ(int64_t) default: | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | case DW_EH_PE_sdata2: READ(int16_t) case DW_EH_PE_sdata4: READ(int32_t) case DW_EH_PE_sdata8: READ(int64_t) default: OBJC_ERROR("Unknown encoding!"); } #undef READ return value; } #ifndef HAVE_ARM_EHABI_EXCEPTIONS |
︙ | ︙ | |||
556 557 558 559 560 561 562 | if (classMatches(class, e->object)) { *filterPtr = filter; return HANDLER_FOUND; } } else if (filter == 0) return CLEANUP_FOUND; else if (filter < 0) | | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | if (classMatches(class, e->object)) { *filterPtr = filter; return HANDLER_FOUND; } } else if (filter == 0) return CLEANUP_FOUND; else if (filter < 0) OBJC_ERROR("Invalid filter!"); } while (displacement != 0); return 0; } #ifdef HAVE_SEH_EXCEPTIONS static |
︙ | ︙ | |||
688 689 690 691 692 693 694 | (uintptr_t)ex); _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(1), filter); _Unwind_SetIP(ctx, landingpad); return _URC_INSTALL_CONTEXT; } | > | | 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | (uintptr_t)ex); _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(1), filter); _Unwind_SetIP(ctx, landingpad); return _URC_INSTALL_CONTEXT; } OBJC_ERROR( "Neither _UA_SEARCH_PHASE nor _UA_CLEANUP_PHASE in actions!"); } static void cleanup(_Unwind_Reason_Code reason, struct _Unwind_Exception *ex) { free(ex); } |
︙ | ︙ | |||
743 744 745 746 747 748 749 | #ifdef OF_HAVE_THREADS if (!of_spinlock_unlock(&emergencyExceptionsSpinlock)) OBJC_ERROR("Cannot lock spinlock!"); #endif } if (e == NULL) | | | | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | #ifdef OF_HAVE_THREADS if (!of_spinlock_unlock(&emergencyExceptionsSpinlock)) OBJC_ERROR("Cannot lock spinlock!"); #endif } if (e == NULL) OBJC_ERROR("Not enough memory to allocate exception!"); e->exception.class = GNUCOBJC_EXCEPTION_CLASS; e->exception.cleanup = (emergency ? emergencyExceptionCleanup : cleanup); e->object = object; _Unwind_RaiseException(&e->exception); if (uncaughtExceptionHandler != NULL) uncaughtExceptionHandler(object); OBJC_ERROR("_Unwind_RaiseException() returned!"); } objc_uncaught_exception_handler_t objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler_t handler) { objc_uncaught_exception_handler_t old = uncaughtExceptionHandler; uncaughtExceptionHandler = handler; |
︙ | ︙ |