Changeset 0304215a
- Timestamp:
- Feb 22, 2018, 9:47:55 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 566b74f
- Parents:
- ad4458f
- Location:
- src/libcfa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/exception.c
rad4458f r0304215a 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 9 14:41:55201813 // Update Count : 812 // Last Modified On : Thu Feb 22 18:17:34 2018 13 // Update Count : 11 14 14 // 15 15 … … 52 52 struct __cfaabi_ehm__try_resume_node * current_resume; 53 53 54 exception * current_exception;54 exception_t * current_exception; 55 55 int current_handler_index; 56 56 } shared_stack = {NULL, NULL, 0, 0}; … … 71 71 // This macro should be the only thing that needs to change across machines. Used in the personality function, way down 72 72 // in termination. 73 // struct _Unwind_Context * -> _Unwind_Reason_Code(*)(exception *)73 // struct _Unwind_Context * -> _Unwind_Reason_Code(*)(exception_t *) 74 74 #define MATCHER_FROM_CONTEXT(ptr_to_context) \ 75 (*(_Unwind_Reason_Code(**)(exception *))(_Unwind_GetCFA(ptr_to_context) + 8))75 (*(_Unwind_Reason_Code(**)(exception_t *))(_Unwind_GetCFA(ptr_to_context) + 8)) 76 76 77 77 78 78 // RESUMPTION ================================================================ 79 79 80 void __cfaabi_ehm__throw_resume(exception * except) {80 void __cfaabi_ehm__throw_resume(exception_t * except) { 81 81 82 82 __cfaabi_dbg_print_safe("Throwing resumption exception\n"); … … 106 106 107 107 void __cfaabi_ehm__try_resume_setup(struct __cfaabi_ehm__try_resume_node * node, 108 _Bool (*handler)(exception * except)) {108 _Bool (*handler)(exception_t * except)) { 109 109 node->next = shared_stack.top_resume; 110 110 node->handler = handler; … … 126 126 }; 127 127 128 #define NODE_TO_EXCEPT(node) ((exception *)(1 + (node)))128 #define NODE_TO_EXCEPT(node) ((exception_t *)(1 + (node))) 129 129 #define EXCEPT_TO_NODE(except) ((struct __cfaabi_ehm__node *)(except) - 1) 130 130 131 131 // Creates a copy of the indicated exception and sets current_exception to it. 132 static void __cfaabi_ehm__allocate_exception( exception * except ) {132 static void __cfaabi_ehm__allocate_exception( exception_t * except ) { 133 133 struct exception_context_t * context = this_exception_context(); 134 134 … … 151 151 152 152 // Delete the provided exception, unsetting current_exception if relivant. 153 static void __cfaabi_ehm__delete_exception( exception * except ) {153 static void __cfaabi_ehm__delete_exception( exception_t * except ) { 154 154 struct exception_context_t * context = this_exception_context(); 155 155 … … 179 179 // If this isn't a rethrow (*except==0), delete the provided exception. 180 180 void __cfaabi_ehm__cleanup_terminate( void * except ) { 181 if ( *(void**)except ) __cfaabi_ehm__delete_exception( *(exception **)except );181 if ( *(void**)except ) __cfaabi_ehm__delete_exception( *(exception_t **)except ); 182 182 } 183 183 … … 233 233 } 234 234 235 void __cfaabi_ehm__throw_terminate( exception * val ) {235 void __cfaabi_ehm__throw_terminate( exception_t * val ) { 236 236 __cfaabi_dbg_print_safe("Throwing termination exception\n"); 237 237 … … 348 348 // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher; 349 349 350 _Unwind_Reason_Code (*matcher)(exception *) =350 _Unwind_Reason_Code (*matcher)(exception_t *) = 351 351 MATCHER_FROM_CONTEXT(context); 352 352 int index = matcher(shared_stack.current_exception); … … 409 409 __attribute__((noinline)) 410 410 void __cfaabi_ehm__try_terminate(void (*try_block)(), 411 void (*catch_block)(int index, exception * except),412 __attribute__((unused)) int (*match_block)(exception * except)) {411 void (*catch_block)(int index, exception_t * except), 412 __attribute__((unused)) int (*match_block)(exception_t * except)) { 413 413 //! volatile int xy = 0; 414 414 //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy); -
src/libcfa/exception.h
rad4458f r0304215a 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jun 26 15:11:00 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Th r Aug 17 15:44:00 201713 // Update Count : 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 22 18:11:15 2018 13 // Update Count : 8 14 14 // 15 15 … … 22 22 23 23 struct __cfaabi_ehm__base_exception_t; 24 typedef struct __cfaabi_ehm__base_exception_t exception ;24 typedef struct __cfaabi_ehm__base_exception_t exception_t; 25 25 struct __cfaabi_ehm__base_exception_t_vtable { 26 26 const struct __cfaabi_ehm__base_exception_t_vtable * parent; … … 39 39 40 40 // Used in throw statement translation. 41 void __cfaabi_ehm__throw_terminate(exception * except) __attribute__((noreturn));41 void __cfaabi_ehm__throw_terminate(exception_t * except) __attribute__((noreturn)); 42 42 void __cfaabi_ehm__rethrow_terminate() __attribute__((noreturn)); 43 void __cfaabi_ehm__throw_resume(exception * except);43 void __cfaabi_ehm__throw_resume(exception_t * except); 44 44 45 45 // Function catches termination exceptions. 46 46 void __cfaabi_ehm__try_terminate( 47 47 void (*try_block)(), 48 void (*catch_block)(int index, exception * except),49 int (*match_block)(exception * except));48 void (*catch_block)(int index, exception_t * except), 49 int (*match_block)(exception_t * except)); 50 50 51 51 // Clean-up the exception in catch blocks. … … 55 55 struct __cfaabi_ehm__try_resume_node { 56 56 struct __cfaabi_ehm__try_resume_node * next; 57 _Bool (*handler)(exception * except);57 _Bool (*handler)(exception_t * except); 58 58 }; 59 59 … … 61 61 void __cfaabi_ehm__try_resume_setup( 62 62 struct __cfaabi_ehm__try_resume_node * node, 63 _Bool (*handler)(exception * except));63 _Bool (*handler)(exception_t * except)); 64 64 void __cfaabi_ehm__try_resume_cleanup( 65 65 struct __cfaabi_ehm__try_resume_node * node); -
src/libcfa/stdhdr/math.h
rad4458f r0304215a 10 10 // Created On : Mon Jul 4 23:25:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 5 20:38:18 201613 // Update Count : 1 212 // Last Modified On : Thu Feb 22 18:16:07 2018 13 // Update Count : 13 14 14 // 15 15 16 16 extern "C" { 17 #if ! defined( exception ) // nesting ? 18 #define exception `exception` // make keyword an identifier 19 #define __CFA_MATH_H__ 20 #endif 21 17 22 #include_next <math.h> // has internal check for multiple expansion 23 24 #if defined( exception ) && defined( __CFA_MATH_H__ ) // reset only if set 25 #undef exception 26 #undef __CFA_MATH_H__ 27 #endif 18 28 } // extern "C" 19 29
Note: See TracChangeset
for help on using the changeset viewer.