Changeset 0304215a


Ignore:
Timestamp:
Feb 22, 2018, 9:47:55 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

add missing files from previous commit

Location:
src/libcfa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/exception.c

    rad4458f r0304215a  
    1010// Created On       : Mon Jun 26 15:13:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb  9 14:41:55 2018
    13 // Update Count     : 8
     12// Last Modified On : Thu Feb 22 18:17:34 2018
     13// Update Count     : 11
    1414//
    1515
     
    5252    struct __cfaabi_ehm__try_resume_node * current_resume;
    5353
    54     exception * current_exception;
     54    exception_t * current_exception;
    5555    int current_handler_index;
    5656} shared_stack = {NULL, NULL, 0, 0};
     
    7171// This macro should be the only thing that needs to change across machines.  Used in the personality function, way down
    7272// in termination.
    73 // struct _Unwind_Context * -> _Unwind_Reason_Code(*)(exception *)
     73// struct _Unwind_Context * -> _Unwind_Reason_Code(*)(exception_t *)
    7474#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))
    7676
    7777
    7878// RESUMPTION ================================================================
    7979
    80 void __cfaabi_ehm__throw_resume(exception * except) {
     80void __cfaabi_ehm__throw_resume(exception_t * except) {
    8181
    8282        __cfaabi_dbg_print_safe("Throwing resumption exception\n");
     
    106106
    107107void __cfaabi_ehm__try_resume_setup(struct __cfaabi_ehm__try_resume_node * node,
    108                         _Bool (*handler)(exception * except)) {
     108                        _Bool (*handler)(exception_t * except)) {
    109109        node->next = shared_stack.top_resume;
    110110        node->handler = handler;
     
    126126};
    127127
    128 #define NODE_TO_EXCEPT(node) ((exception *)(1 + (node)))
     128#define NODE_TO_EXCEPT(node) ((exception_t *)(1 + (node)))
    129129#define EXCEPT_TO_NODE(except) ((struct __cfaabi_ehm__node *)(except) - 1)
    130130
    131131// Creates a copy of the indicated exception and sets current_exception to it.
    132 static void __cfaabi_ehm__allocate_exception( exception * except ) {
     132static void __cfaabi_ehm__allocate_exception( exception_t * except ) {
    133133        struct exception_context_t * context = this_exception_context();
    134134
     
    151151
    152152// Delete the provided exception, unsetting current_exception if relivant.
    153 static void __cfaabi_ehm__delete_exception( exception * except ) {
     153static void __cfaabi_ehm__delete_exception( exception_t * except ) {
    154154        struct exception_context_t * context = this_exception_context();
    155155
     
    179179// If this isn't a rethrow (*except==0), delete the provided exception.
    180180void __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 );
    182182}
    183183
     
    233233}
    234234
    235 void __cfaabi_ehm__throw_terminate( exception * val ) {
     235void __cfaabi_ehm__throw_terminate( exception_t * val ) {
    236236        __cfaabi_dbg_print_safe("Throwing termination exception\n");
    237237
     
    348348                                        // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;
    349349
    350                                         _Unwind_Reason_Code (*matcher)(exception *) =
     350                                        _Unwind_Reason_Code (*matcher)(exception_t *) =
    351351                                                MATCHER_FROM_CONTEXT(context);
    352352                                        int index = matcher(shared_stack.current_exception);
     
    409409__attribute__((noinline))
    410410void __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)) {
    413413        //! volatile int xy = 0;
    414414        //! printf("%p %p %p %p\n", &try_block, &catch_block, &match_block, &xy);
  • src/libcfa/exception.h

    rad4458f r0304215a  
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:11:00 2017
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 15:44:00 2017
    13 // Update Count     : 6
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Feb 22 18:11:15 2018
     13// Update Count     : 8
    1414//
    1515
     
    2222
    2323struct __cfaabi_ehm__base_exception_t;
    24 typedef struct __cfaabi_ehm__base_exception_t exception;
     24typedef struct __cfaabi_ehm__base_exception_t exception_t;
    2525struct __cfaabi_ehm__base_exception_t_vtable {
    2626        const struct __cfaabi_ehm__base_exception_t_vtable * parent;
     
    3939
    4040// Used in throw statement translation.
    41 void __cfaabi_ehm__throw_terminate(exception * except) __attribute__((noreturn));
     41void __cfaabi_ehm__throw_terminate(exception_t * except) __attribute__((noreturn));
    4242void __cfaabi_ehm__rethrow_terminate() __attribute__((noreturn));
    43 void __cfaabi_ehm__throw_resume(exception * except);
     43void __cfaabi_ehm__throw_resume(exception_t * except);
    4444
    4545// Function catches termination exceptions.
    4646void __cfaabi_ehm__try_terminate(
    4747    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));
    5050
    5151// Clean-up the exception in catch blocks.
     
    5555struct __cfaabi_ehm__try_resume_node {
    5656    struct __cfaabi_ehm__try_resume_node * next;
    57     _Bool (*handler)(exception * except);
     57    _Bool (*handler)(exception_t * except);
    5858};
    5959
     
    6161void __cfaabi_ehm__try_resume_setup(
    6262    struct __cfaabi_ehm__try_resume_node * node,
    63     _Bool (*handler)(exception * except));
     63    _Bool (*handler)(exception_t * except));
    6464void __cfaabi_ehm__try_resume_cleanup(
    6565    struct __cfaabi_ehm__try_resume_node * node);
  • src/libcfa/stdhdr/math.h

    rad4458f r0304215a  
    1010// Created On       : Mon Jul  4 23:25:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul  5 20:38:18 2016
    13 // Update Count     : 12
     12// Last Modified On : Thu Feb 22 18:16:07 2018
     13// Update Count     : 13
    1414//
    1515
    1616extern "C" {
     17#if ! defined( exception )                                                              // nesting ?
     18#define exception `exception`                                                   // make keyword an identifier
     19#define __CFA_MATH_H__
     20#endif
     21
    1722#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
    1828} // extern "C"
    1929
Note: See TracChangeset for help on using the changeset viewer.