Overview
Comment: | Add support for SjLj exceptions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5eb22639e4f33d2b2e693d1ef3be3dc3 |
User & Date: | js on 2013-04-09 18:08:43 |
Other Links: | manifest | tags |
Context
2013-04-09
| ||
21:35 | Add -[OFEnumerator allObjects]. check-in: 7f0e327251 user: js tags: trunk | |
18:08 | Add support for SjLj exceptions. check-in: 5eb22639e4 user: js tags: trunk | |
06:47 | Check for OBJC_NEW_PROPERTIES as a fallback. check-in: 241692d895 user: js tags: trunk | |
Changes
Modified configure.ac from [246c410c6b] to [1dac072c32].
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | [Whether to use assembly for lookup]) ]) AS_IF([test x"$enable_seluid24" = x"yes"], [ AC_DEFINE(OF_SELUID24, 1, [Whether to use 24 bit selector UIDs]) ]) ;; "Apple runtime") AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime]) AC_CHECK_LIB(objc, objc_msgSend, [ LIBS="-lobjc $LIBS" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | [Whether to use assembly for lookup]) ]) 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_TRY_COMPILE([ extern void foo(); ], [ @try { foo(); } @finally { foo(); } ], [ AS_IF([$EGREP __gnu_objc_personality_v0 \ conftest.$ac_objext >/dev/null], [ exception_type="DWARF" ]) AS_IF([$EGREP __gnu_objc_personality_sj0 \ conftest.$ac_objext >/dev/null], [ exception_type="SjLj" ]) case $exception_type in DWARF) AC_DEFINE(HAVE_DWARF_EXCEPTIONS, 1, [Whether DWARF exceptions are used]) ;; SjLj) AC_DEFINE(HAVE_SJLJ_EXCEPTIONS, 1, [Whether SjLj exceptions are used]) ;; *) AC_MSG_RESULT(unknown) AC_MSG_ERROR([Exception type not detected!]) ;; esac AC_MSG_RESULT($exception_type) ], [ AC_MSG_RESULT(exceptions unavailable!) AC_MSG_ERROR([Exceptions not accepted by compiler!]) ]) ;; "Apple runtime") AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime]) AC_CHECK_LIB(objc, objc_msgSend, [ LIBS="-lobjc $LIBS" |
︙ | ︙ |
Modified src/runtime/exception.m from [33f7be3a9f] to [337aac59db].
︙ | ︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | uint8_t typestable_enc; const uint8_t *typestable; uintptr_t typestable_base; uint8_t callsites_enc; const uint8_t *callsites, *actiontable; }; extern _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception*); extern void* _Unwind_GetLanguageSpecificData(struct _Unwind_Context*); extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context*); extern uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context*); extern uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context*); #if defined(__arm__) || defined(__ARM__) extern _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*, | > > > > > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | uint8_t typestable_enc; const uint8_t *typestable; uintptr_t typestable_base; uint8_t callsites_enc; const uint8_t *callsites, *actiontable; }; #ifndef HAVE_SJLJ_EXCEPTIONS extern _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception*); #else extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException( struct _Unwind_Exception*); #endif extern void* _Unwind_GetLanguageSpecificData(struct _Unwind_Context*); extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context*); extern uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context*); extern uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context*); #if defined(__arm__) || defined(__ARM__) extern _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*, |
︙ | ︙ | |||
164 165 166 167 168 169 170 171 172 173 174 175 176 177 | #else # define CONTINUE_UNWIND return _URC_CONTINUE_UNWIND extern uintptr_t _Unwind_GetIP(struct _Unwind_Context*); extern void _Unwind_SetIP(struct _Unwind_Context*, uintptr_t); extern void _Unwind_SetGR(struct _Unwind_Context*, int, uintptr_t); #endif static objc_uncaught_exception_handler uncaught_exception_handler; static uint64_t read_uleb128(const uint8_t **ptr) { uint64_t value = 0; | > > > > > > > > > > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #else # define CONTINUE_UNWIND return _URC_CONTINUE_UNWIND extern uintptr_t _Unwind_GetIP(struct _Unwind_Context*); extern void _Unwind_SetIP(struct _Unwind_Context*, uintptr_t); extern void _Unwind_SetGR(struct _Unwind_Context*, int, uintptr_t); #endif #if defined(HAVE_DWARF_EXCEPTIONS) # define PERSONALITY __gnu_objc_personality_v0 # define RAISE_EXCEPTION _Unwind_RaiseException #elif defined(HAVE_SJLJ_EXCEPTIONS) # define PERSONALITY __gnu_objc_personality_sj0 # define RAISE_EXCEPTION _Unwind_SjLj_RaiseException #else # error Unknown exception type! #endif static objc_uncaught_exception_handler uncaught_exception_handler; static uint64_t read_uleb128(const uint8_t **ptr) { uint64_t value = 0; |
︙ | ︙ | |||
335 336 337 338 339 340 341 | } static bool find_callsite(struct _Unwind_Context *ctx, struct lsda *lsda, uintptr_t *landingpad, const uint8_t **actionrecords) { uintptr_t ip = _Unwind_GetIP(ctx); | | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | } static bool find_callsite(struct _Unwind_Context *ctx, struct lsda *lsda, uintptr_t *landingpad, const uint8_t **actionrecords) { uintptr_t ip = _Unwind_GetIP(ctx); const uint8_t *ptr = lsda->callsites; *landingpad = 0; *actionrecords = NULL; #ifndef HAVE_SJLJ_EXCEPTIONS while (ptr < lsda->actiontable) { uintptr_t callsite_start, callsite_len, callsite_landingpad; uintptr_t callsite_action; callsite_start = lsda->region_start + (uintptr_t)read_value(lsda->callsites_enc, &ptr); callsite_len = (uintptr_t)read_value(lsda->callsites_enc, &ptr); |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | callsite_action - 1; return true; } } return false; } static bool class_matches(Class class, id object) { Class iter; | > > > > > > > > > > > > > > > > > | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | callsite_action - 1; return true; } } return false; #else uintptr_t callsite_landingpad, callsite_action; if ((uintptr_t)ip < 1) return false; do { callsite_landingpad = (uintptr_t)read_uleb128(&ptr); callsite_action = (uintptr_t)read_uleb128(&ptr); } while (--ip > 1); *landingpad = callsite_landingpad + 1; if (callsite_action != 0) *actionrecords = lsda->actiontable + callsite_action - 1; return true; #endif } static bool class_matches(Class class, id object) { Class iter; |
︙ | ︙ | |||
456 457 458 459 460 461 462 | } while (displacement != 0); return 0; } #if defined(__arm__) || defined(__ARM__) _Unwind_Reason_Code | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | } while (displacement != 0); return 0; } #if defined(__arm__) || defined(__ARM__) _Unwind_Reason_Code PERSONALITY(uint32_t state, struct _Unwind_Exception *ex, struct _Unwind_Context *ctx) { int version = 1; uint64_t ex_class = ex->class; int actions; switch (state) { |
︙ | ︙ | |||
481 482 483 484 485 486 487 | default: return _URC_FAILURE; } _Unwind_SetGR(ctx, 12, (uintptr_t)ex); #else _Unwind_Reason_Code | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | default: return _URC_FAILURE; } _Unwind_SetGR(ctx, 12, (uintptr_t)ex); #else _Unwind_Reason_Code PERSONALITY(int version, int actions, uint64_t ex_class, struct _Unwind_Exception *ex, struct _Unwind_Context *ctx) { #endif struct objc_exception *e = (struct objc_exception*)ex; bool foreign = (ex_class != objc_exception_class); const uint8_t *lsda_addr, *actionrecords; struct lsda lsda; |
︙ | ︙ | |||
592 593 594 595 596 597 598 | abort(); memset(e, 0, sizeof(*e)); e->exception.class = objc_exception_class; e->exception.cleanup = cleanup; e->object = object; | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | abort(); memset(e, 0, sizeof(*e)); e->exception.class = objc_exception_class; e->exception.cleanup = cleanup; e->object = object; if (RAISE_EXCEPTION(&e->exception) == _URC_END_OF_STACK && uncaught_exception_handler != NULL) uncaught_exception_handler(object); abort(); } objc_uncaught_exception_handler |
︙ | ︙ |