Changeset 1584:f4c56ed32238
- Timestamp:
- 10/20/09 23:46:56
(3 years ago)
- Author:
- tomas@localhost.localdomain
- branch:
- default
- Message:
Fixed issue in exception runtime with recent LLVM revisions, with this in place EH seems to work properly on x86-64. These fixes need to be merged into tango trunk still!
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1571 |
r1584 |
|
| 134 | 134 | // if there's a finally, the eh table has to have a 0 action |
|---|
| 135 | 135 | if(hasFinally) |
|---|
| 136 | | selectorargs.push_back(LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0)); |
|---|
| | 136 | selectorargs.push_back(DtoConstSize_t(0));//LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0)); |
|---|
| 137 | 137 | |
|---|
| 138 | 138 | // personality fn |
|---|
| r1289 |
r1584 |
|
| 9 | 9 | |
|---|
| 10 | 10 | // debug = EH_personality; |
|---|
| | 11 | // debug = EH_personality_verbose; |
|---|
| 11 | 12 | |
|---|
| 12 | 13 | // current EH implementation works on x86 |
|---|
| … | … | |
| 37 | 38 | extern(C) |
|---|
| 38 | 39 | { |
|---|
| 39 | | enum _Unwind_Reason_Code |
|---|
| | 40 | enum _Unwind_Reason_Code : int |
|---|
| 40 | 41 | { |
|---|
| 41 | 42 | NO_REASON = 0, |
|---|
| … | … | |
| 50 | 51 | } |
|---|
| 51 | 52 | |
|---|
| 52 | | enum _Unwind_Action |
|---|
| | 53 | enum _Unwind_Action : int |
|---|
| 53 | 54 | { |
|---|
| 54 | 55 | SEARCH_PHASE = 1, |
|---|
| … | … | |
| 64 | 65 | struct _Unwind_Exception |
|---|
| 65 | 66 | { |
|---|
| 66 | | char[8] exception_class; |
|---|
| | 67 | ulong exception_class; |
|---|
| 67 | 68 | _Unwind_Exception_Cleanup_Fn exception_cleanup; |
|---|
| 68 | 69 | ptrdiff_t private_1; |
|---|
| … | … | |
| 208 | 209 | extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions, ulong exception_class, _Unwind_Exception* exception_info, _Unwind_Context_Ptr context) |
|---|
| 209 | 210 | { |
|---|
| | 211 | debug(EH_personality_verbose) printf("entering personality function. context: %p\n", context); |
|---|
| 210 | 212 | // check ver: the C++ Itanium ABI only allows ver == 1 |
|---|
| 211 | 213 | if(ver != 1) |
|---|
| … | … | |
| 225 | 227 | ClassInfo* classinfo_table; |
|---|
| 226 | 228 | _d_getLanguageSpecificTables(context, callsite_table, action_table, classinfo_table); |
|---|
| 227 | | |
|---|
| | 229 | if (callsite_table is null) |
|---|
| | 230 | return _Unwind_Reason_Code.CONTINUE_UNWIND; |
|---|
| 228 | 231 | |
|---|
| 229 | 232 | /* |
|---|
| … | … | |
| 378 | 381 | { |
|---|
| 379 | 382 | ubyte* data = cast(ubyte*)_Unwind_GetLanguageSpecificData(context); |
|---|
| | 383 | if (data is null) |
|---|
| | 384 | { |
|---|
| | 385 | //printf("language specific data was null\n"); |
|---|
| | 386 | callsite = null; |
|---|
| | 387 | action = null; |
|---|
| | 388 | ci = null; |
|---|
| | 389 | return; |
|---|
| | 390 | } |
|---|
| 380 | 391 | |
|---|
| 381 | 392 | //TODO: Do proper DWARF reading here |
|---|
| … | … | |
| 406 | 417 | { |
|---|
| 407 | 418 | _d_exception* exc_struct = new _d_exception; |
|---|
| 408 | | exc_struct.unwind_info.exception_class[] = _d_exception_class; |
|---|
| | 419 | exc_struct.unwind_info.exception_class = *cast(ulong*)_d_exception_class.ptr; |
|---|
| 409 | 420 | exc_struct.exception_object = e; |
|---|
| 410 | 421 | _Unwind_Reason_Code ret = _Unwind_RaiseException(&exc_struct.unwind_info); |
|---|