Changeset 566b74f for src


Ignore:
Timestamp:
Feb 23, 2018, 11:38:29 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
2c39855
Parents:
d8548e2 (diff), 0304215a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rd8548e2 r566b74f  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 20 09:21:52 2017
    13 // Update Count     : 1031
     12// Last Modified On : Thu Feb 22 15:37:17 2018
     13// Update Count     : 1033
    1414//
    1515
     
    120120} // DeclarationNode::clone
    121121
    122 bool DeclarationNode::get_hasEllipsis() const {
    123         return hasEllipsis;
    124 }
    125 
    126122void DeclarationNode::print( std::ostream &os, int indent ) const {
    127123        os << string( indent, ' ' );
     
    167163}
    168164
    169 DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle ) {
     165DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
    170166        DeclarationNode * newnode = new DeclarationNode;
    171167        newnode->name = name;
    172168        newnode->type = new TypeData( TypeData::Function );
    173169        newnode->type->function.params = param;
    174         newnode->type->function.newStyle = newStyle;
    175170        newnode->type->function.body = body;
    176171
  • src/Parser/ParseNode.h

    rd8548e2 r566b74f  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 27 17:33:35 2017
    13 // Update Count     : 824
     12// Last Modified On : Thu Feb 22 17:49:31 2018
     13// Update Count     : 827
    1414//
    1515
     
    209209        enum Length { Short, Long, LongLong, NoLength };
    210210        static const char * lengthNames[];
    211         enum Aggregate { Struct, Union, Trait, Coroutine, Monitor, Thread, NoAggregate };
     211        enum Aggregate { Struct, Union, Exception, Trait, Coroutine, Monitor, Thread, NoAggregate };
    212212        static const char * aggregateNames[];
    213213        enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
     
    226226        static DeclarationNode * newForall( DeclarationNode * );
    227227        static DeclarationNode * newFromTypedef( std::string * );
    228         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
     228        static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    229229        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    230230        static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
     
    288288        Type * buildType() const;
    289289
    290         bool get_hasEllipsis() const;
    291290        LinkageSpec::Spec get_linkage() const { return linkage; }
    292291        DeclarationNode * extractAggregate() const;
  • src/Parser/TypeData.cc

    rd8548e2 r566b74f  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 18:33:41 2017
    13 // Update Count     : 587
     12// Last Modified On : Thu Feb 22 15:49:00 2018
     13// Update Count     : 597
    1414//
    1515
     
    5454                function.oldDeclList = nullptr;
    5555                function.body = nullptr;
    56                 function.newStyle = false;
    5756                function.withExprs = nullptr;
    5857                break;
     
    195194                newtype->function.oldDeclList = maybeClone( function.oldDeclList );
    196195                newtype->function.body = maybeClone( function.body );
    197                 newtype->function.newStyle = function.newStyle;
    198196                newtype->function.withExprs = maybeClone( function.withExprs );
    199197                break;
     
    881879FunctionType * buildFunction( const TypeData * td ) {
    882880        assert( td->kind == TypeData::Function );
    883         bool hasEllipsis = td->function.params ? td->function.params->get_hasEllipsis() : true;
    884         if ( ! td->function.params ) hasEllipsis = ! td->function.newStyle;
    885         FunctionType * ft = new FunctionType( buildQualifiers( td ), hasEllipsis );
     881        FunctionType * ft = new FunctionType( buildQualifiers( td ), ! td->function.params || td->function.params->hasEllipsis );
    886882        buildList( td->function.params, ft->get_parameters() );
    887883        buildForall( td->forall, ft->get_forall() );
  • src/Parser/TypeData.h

    rd8548e2 r566b74f  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:33:45 2017
    13 // Update Count     : 190
     12// Last Modified On : Thu Feb 22 15:21:23 2018
     13// Update Count     : 191
    1414//
    1515
     
    6464                mutable DeclarationNode * oldDeclList;
    6565                StatementNode * body;
    66                 bool newStyle;
    6766                ExpressionNode * withExprs;             // expressions from function's with_clause
    6867        };
  • src/Parser/lex.ll

    rd8548e2 r566b74f  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Oct 25 13:53:56 2017
    13  * Update Count     : 634
     12 * Last Modified On : Thu Feb 22 18:11:27 2018
     13 * Update Count     : 637
    1414 */
    1515
     
    232232enum                    { KEYWORD_RETURN(ENUM); }
    233233__extension__   { KEYWORD_RETURN(EXTENSION); }                  // GCC
     234exception               { KEYWORD_RETURN(EXCEPTION); }                  // CFA
    234235extern                  { KEYWORD_RETURN(EXTERN); }
    235236fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
  • src/Parser/parser.yy

    rd8548e2 r566b74f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 15 17:12:31 2018
    13 // Update Count     : 3006
     12// Last Modified On : Thu Feb 22 17:48:54 2018
     13// Update Count     : 3028
    1414//
    1515
     
    187187%token TYPEOF LABEL                                                                             // GCC
    188188%token ENUM STRUCT UNION
     189%token EXCEPTION                                                                                // CFA
    189190%token COROUTINE MONITOR THREAD                                                 // CFA
    190191%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
     
    314315%type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr
    315316
    316 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_type_list cfa_parameter_type_list_opt
     317%type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_type_list_opt
    317318
    318319%type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier
     
    322323%type<decl> KR_declaration_list KR_declaration_list_opt
    323324
    324 %type<decl> parameter_declaration parameter_list parameter_type_list
    325 %type<decl> parameter_type_list_opt
     325%type<decl> parameter_declaration parameter_list parameter_type_list_opt
    326326
    327327%type<decl> paren_identifier paren_type
     
    779779        | unary_expression assignment_operator assignment_expression
    780780                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
    781         | unary_expression '=' '{' initializer_list comma_opt '}' // FIX ME
    782                 { $$ = nullptr; }
     781        | unary_expression '=' '{' initializer_list comma_opt '}'
     782                { throw SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; } // FIX ME
    783783        ;
    784784
     
    849849        | waitfor_statement
    850850        | exception_statement
     851        | enable_disable_statement
     852                { throw SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } // FIX ME
    851853        | asm_statement
    852854        ;
     
    10641066        | RETURN comma_expression_opt ';'
    10651067                { $$ = new StatementNode( build_return( $2 ) ); }
    1066         | RETURN '{' initializer_list comma_opt '}'                     // FIX ME
    1067                 { $$ = nullptr; }
     1068        | RETURN '{' initializer_list comma_opt '}'
     1069                { throw SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; } // FIX ME
    10681070        | THROW assignment_expression_opt ';'                           // handles rethrow
    10691071                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    11931195        ;
    11941196
     1197enable_disable_statement:
     1198        enable_disable_key identifier_list compound_statement
     1199        ;
     1200
     1201enable_disable_key:
     1202        ENABLE
     1203        | DISABLE
     1204        ;
     1205
    11951206asm_statement:
    11961207        ASM asm_volatile_opt '(' string_literal ')' ';'
     
    13921403                        DeclarationNode * ret = new DeclarationNode;
    13931404                        ret->type = maybeClone( $1->type->base );
    1394                         $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr, true ) );
     1405                        $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr ) );
    13951406                }
    13961407        ;
     
    14221433                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    14231434                {
    1424                         $$ = DeclarationNode::newFunction( $2, $1, $5, 0, true );
     1435                        $$ = DeclarationNode::newFunction( $2, $1, $5, 0 );
    14251436                }
    14261437        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
    14271438                {
    1428                         $$ = DeclarationNode::newFunction( $2, $1, $5, 0, true );
     1439                        $$ = DeclarationNode::newFunction( $2, $1, $5, 0 );
    14291440                }
    14301441        ;
     
    18811892        | UNION
    18821893                { $$ = DeclarationNode::Union; }
     1894        | EXCEPTION
     1895                { $$ = DeclarationNode::Exception; }
    18831896        | COROUTINE
    18841897                { $$ = DeclarationNode::Coroutine; }
     
    19902003        ;
    19912004
    1992 // Minimum of one parameter after which ellipsis is allowed only at the end.
    1993 
    1994 cfa_parameter_type_list_opt:                                                    // CFA
     2005cfa_parameter_type_list_opt:                                                    // CFA, abstract + real
    19952006        // empty
     2007                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     2008        | ELLIPSIS
    19962009                { $$ = nullptr; }
    1997         | cfa_parameter_type_list
    1998         ;
    1999 
    2000 cfa_parameter_type_list:                                                                // CFA, abstract + real
    2001         cfa_abstract_parameter_list
     2010        | cfa_abstract_parameter_list
    20022011        | cfa_parameter_list
    20032012        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list
     
    20302039        // empty
    20312040                { $$ = nullptr; }
    2032         | parameter_type_list
    2033         ;
    2034 
    2035 parameter_type_list:
    2036         parameter_list
     2041        | ELLIPSIS
     2042                { $$ = nullptr; }
     2043        | parameter_list
    20372044        | parameter_list pop ',' push ELLIPSIS
    20382045                { $$ = $1->addVarArgs(); }
  • src/libcfa/exception.c

    rd8548e2 r566b74f  
    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

    rd8548e2 r566b74f  
    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

    rd8548e2 r566b74f  
    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.