Changes in / [a12d5aa:62423350]


Ignore:
Files:
3 added
24 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    ra12d5aa r62423350  
    3131
    3232src/prelude/builtins.cf
    33 src/prelude/gcc-builtins.cf
    34 src/prelude/gcc-builtins.c
     33src/prelude/builtins.c
    3534src/prelude/extras.cf
    3635src/prelude/bootloader.c
    3736src/libcfa/libcfa-prelude.c
    3837
    39 # generated by bison and lex from parser.yy and lex.ll
     38# generated by bison and lex from cfa.yy and lex.ll, respectively
    4039src/Parser/parser.output
    4140src/Parser/lex.cc
     
    4342src/Parser/parser.h
    4443
    45 tools/prettyprinter/parser.output
    46 tools/prettyprinter/lex.cc
    47 tools/prettyprinter/parser.cc
    48 tools/prettyprinter/parser.h
    49 tools/prettyprinter/pretty
    50 tools/pretty
    51 
    5244# generated by xfig for user manual
    5345doc/user/Cdecl.tex
  • configure

    ra12d5aa r62423350  
    62516251
    62526252
    6253 ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile tools/prettyprinter/Makefile"
     6253ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile"
    62546254
    62556255
     
    70227022    "src/prelude/Makefile") CONFIG_FILES="$CONFIG_FILES src/prelude/Makefile" ;;
    70237023    "src/libcfa/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcfa/Makefile" ;;
    7024     "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;;
    70257024
    70267025  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
  • configure.ac

    ra12d5aa r62423350  
    238238        src/prelude/Makefile
    239239        src/libcfa/Makefile
    240         tools/prettyprinter/Makefile
    241240        ])
    242241
  • doc/proposals/tagged-struct.txt

    ra12d5aa r62423350  
    1414say which of the possible values is currently stored in the union. The idea
    1515here is similar, however the possibilities are more open ended.
    16 
    17 Alternate names include virtual structure and abstract structure.
    1816
    1917
     
    3836their parent's fields to their field list so they can be upcast.
    3937
    40 The type field may be public, if it is then it can be accessed through a
    41 simple field access "instance.type". The type field would then be able to be
    42 used to access the type object, which contains the information for the type.
    43 It may just be a pointer to the type object "*instance.type", although a
    44 lookup function could also be used.
    45 
    46 
    47 Usage:
    48 
    49 The central feature for tagged structs is a checked cast between pointer types
    50 to the structures. A cast is successful if the true type of the pointed object
    51 is of the type being cast to or any of its children, otherwise the cast
    52 returns null.
    53 
    54 The type field should also allow for equality comparison of types.
    55 
    56 Currently, with only these operations (and similar features) the type field
    57 could be hidden and the operations given through helper functions. However
    58 if the type object has more complex (or even open ended) information in it
    59 than providing direct access becomes very valuable.
    60 
    6138
    6239Implemenation:
    6340
    64 Adding to the field list would have to be handled during translation. The
    65 simple act of adding declarations should not be difficult, althought it might
    66 take a bit of work to find the parent's declarations.
     41Adding to the field list is a simple matter, should be doable during
     42translation. The type field is just a pointer to a type object. With proper
     43linking we can create a single unique instance of the type object for each
     44declared tagged struct. The instance's address is used as an id for the type.
     45It also holds data about the type, such as its parent's id/a pointer to the
     46parent type object.
    6747
    68 Type objects are also simple in to generate, they should just be global
    69 (program lifetime) structures. Getting there to be exactly one instance of
    70 each allows the pointer to the structure to be used as the type id, and that
    71 should be possible to do during linking.
     48The type field could be hidden (as best as C can hide it) or it could be
     49visible to the user with easy access to allow the user to examine the type
     50object directly.
     51
     52Direct access is more useful if the data on the type-objects can change, other
     53wise the build in function could handle all cases. Perhaps each root object
     54can specify a type object to use or the type objects are themselves tagged,
     55although there may not be a base case with the latter.
     56
     57In the simplest case the type object is a pointer to the parent type object.
     58Additional data could be added, such as a name, or a function pointer to the
     59destructor.
    7260
    7361
     
    10694If unions are declared tagged instead of creating a new tagged type, all
    10795possible values of the union must be of that tagged type or a child type.
    108 
    109 
    110 Custom Type Objects (Extention):
    111 
    112 Some method to define type objects used within a tree of types. One option is
    113 to allow the tree's type object to be specified by the tree root. It would
    114 then have to be filled in for each type in the tree, including the root.
    115 
    116 The only required field is the parent field, a pointer to the type object's
    117 type. (This is also the only required field on the tagged structure itself.)
    118 
    119 A further extention could allow expanding type objects, so child types could
    120 append fields to their parent's feild list. They might need their own type
    121 objects at that point, or maybe static checks will be enough to see the
    122 minimum field list.
  • src/CodeGen/FixNames.cc

    ra12d5aa r62423350  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:26:00 2017
    13 // Update Count     : 20
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Jun 21 14:22:59 2017
     13// Update Count     : 19
    1414//
    1515
     
    9393        void FixNames::fixDWT( DeclarationWithType *dwt ) {
    9494                if ( dwt->get_name() != "" ) {
    95                         if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
     95                        if ( LinkageSpec::isDecoratable( dwt->get_linkage() ) ) {
    9696                                dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) );
    9797                                dwt->set_scopeLevel( scopeLevel );
  • src/ControlStruct/ExceptTranslate.cc

    ra12d5aa r62423350  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 29 15:18:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Thr Jun 22 15:57:00 2017
     13// Update Count     : 0
    1414//
    1515
    1616#include "ExceptTranslate.h"
    1717#include "Common/PassVisitor.h"
    18 #include "SynTree/Statement.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Attribute.h"
    2318
    2419namespace ControlFlow {
     
    3934
    4035        static void init_func_types() {
    41                 static bool init_complete = false;
     36                static init_complete = false;
    4237                if (init_complete) {
    4338                        return;
    4439                }
    4540                ObjectDecl index_obj(
    46                         "__handler_index",
     41                        "index_t",
    4742                        Type::StorageClasses(),
    4843                        LinkageSpec::Cforall,
     
    5247                );
    5348                ObjectDecl exception_obj(
    54                         "__exception_inst",
     49                        "exception_t",
    5550                        Type::StorageClasses(),
    5651                        LinkageSpec::Cforall,
     
    6055                );
    6156                ObjectDecl bool_obj(
    62                         "__ret_bool",
     57                        "bool_t",
    6358                        Type::StorageClasses(),
    6459                        LinkageSpec::Cforall,
     
    8378
    8479        void split( CatchList& allHandlers, CatchList& terHandlers,
    85                                 CatchList& resHandlers ) {
     80                    CatchList& resHandlers ) {
    8681                while ( !allHandlers.empty() ) {
    87                         CatchStmt * stmt = allHandlers.front();
     82                        Statement * stmt = allHandlers.front();
    8883                        allHandlers.pop_front();
    89                         if (CatchStmt::Terminate == stmt->get_kind()) {
     84                        if (CaseStmt::Terminate == stmt->get_kind()) {
    9085                                terHandlers.push_back(stmt);
    9186                        } else {
     
    9792        template<typename T>
    9893        void free_all( std::list<T *> &list ) {
    99                 typename std::list<T *>::iterator it;
     94                std::list<T *>::iterator it;
    10095                for ( it = list.begin() ; it != list.end() ; ++it ) {
    10196                        delete *it;
     
    105100
    106101        void appendDeclStmt( CompoundStmt * block, Declaration * item ) {
    107                 block->push_back(new DeclStmt(noLabels, item));
    108         }
    109 
    110         Expression * nameOf( DeclarationWithType * decl ) {
    111                 return new VariableExpr( decl );
     102                block->push_back(new DeclStmt(no_labels, item));
     103        }
     104
     105        Expression * nameOf( FunctionDecl * function ) {
     106                return new VariableExpr( function );
    112107        }
    113108
     
    116111        Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
    117112                // __throw_terminate( EXPR );
    118                 UntypedExpr * call = new UntypedExpr( new NameExpr(
    119                         "__cfaehm__throw_termination" ) );
    120                 call->get_args().push_back( throwStmt->get_expr() );
     113                ApplicationExpr * call = new ApplicationExpr( /* ... */ );
     114                call->get_args.push_back( throwStmt->get_expr() );
    121115                Statement * result = new ExprStmt( throwStmt->get_labels(), call );
    122116                throwStmt->set_expr( nullptr );
     
    126120        Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) {
    127121                // __rethrow_terminate();
    128                 assert( nullptr == throwStmt->get_expr() );
    129122                Statement * result = new ExprStmt(
    130123                        throwStmt->get_labels(),
    131                         new UntypedExpr( new NameExpr( "__cfaehm__rethrow_termination" ) )
     124                        new ApplicationExpr( /* ... */ );
    132125                        );
    133126                delete throwStmt;
     
    136129        Statement * create_resume_throw( ThrowStmt *throwStmt ) {
    137130                // __throw_resume( EXPR );
    138                 UntypedExpr * call = new UntypedExpr( new NameExpr(
    139                         "__cfaehm__throw_resumption" ) );
    140                 call->get_args().push_back( throwStmt->get_expr() );
     131                ApplicationExpr * call = new ApplicationExpr( /* ... */ );
     132                call->get_args.push_back( throwStmt->get_expr() );
    141133                Statement * result = new ExprStmt( throwStmt->get_labels(), call );
    142134                throwStmt->set_expr( nullptr );
     
    148140                Statement * result = new ReturnStmt(
    149141                        throwStmt->get_labels(),
    150                         new ConstantExpr( Constant::from_bool( false ) )
     142                        new ConstantExpr(
     143                                Constant(
     144                                        new BasicType(
     145                                                Type::Qualifiers(),
     146                                                BasicType::Bool
     147                                                ),
     148                                        "0")
     149                                )
    151150                        );
    152151                delete throwStmt;
     
    161160                return block;
    162161        }
    163         FunctionDecl * create_try_wrapper( CompoundStmt *body ) {
    164 
    165                 return new FunctionDecl( "try", Type::StorageClasses(),
    166                         LinkageSpec::Cforall, void_func_t.clone(), body );
     162        FunctionDecl * create_try_wrapper( TryStmt *tryStmt ) {
     163                CompoundStmt * body = base_try->get_block();
     164                base_try->set_block(nullptr);
     165
     166                return new FunctionDecl("try", Type::StorageClasses(),
     167                        LinkageSpec::Cforall, void_func_t, body);
    167168        }
    168169
    169170        FunctionDecl * create_terminate_catch( CatchList &handlers ) {
    170171                std::list<CaseStmt *> handler_wrappers;
    171 
    172                 FunctionType *func_type = catch_func_t.clone();
    173                 DeclarationWithType * index_obj = func_type->get_parameters().front();
    174         //      DeclarationWithType * except_obj = func_type->get_parameters().back();
    175172
    176173                // Index 1..{number of handlers}
     
    181178                        CatchStmt * handler = *it;
    182179
    183                         // INTEGERconstant Version
    184                         // case `index`:
    185                         // {
    186                         //     `handler.body`
    187                         // }
    188                         // return;
    189                         std::list<Statement *> caseBody;
    190                         caseBody.push_back( handler->get_body() );
    191                         handler->set_body( nullptr );
    192                         caseBody.push_back( new ReturnStmt( noLabels, nullptr ) );
    193 
    194                         handler_wrappers.push_back( new CaseStmt(
     180                        std::list<Statement *> core;
     181                        if ( /*the exception is named*/ ) {
     182                                ObjectDecl * local_except = /* Dynamic case, same */;
     183                                core->push_back( new DeclStmt( noLabel, local_except ) );
     184                        }
     185                        // Append the provided statement to the handler.
     186                        core->push_back( cur_handler->get_body() );
     187                        // Append return onto the inner block? case stmt list?
     188                        CaseStmt * wrapper = new CaseStmt(
    195189                                noLabels,
    196190                                new ConstantExpr( Constant::from_int( index ) ),
    197                                 caseBody
    198                                 ) );
     191                                core
     192                                );
     193                        handler_wrappers.push_back(wrapper);
    199194                }
    200195                // TODO: Some sort of meaningful error on default perhaps?
    201 
    202                 std::list<Statement*> stmt_handlers;
    203                 while ( !handler_wrappers.empty() ) {
    204                         stmt_handlers.push_back( handler_wrappers.front() );
    205                         handler_wrappers.pop_front();
    206                 }
    207196
    208197                SwitchStmt * handler_lookup = new SwitchStmt(
    209198                        noLabels,
    210                         nameOf( index_obj ),
    211                         stmt_handlers
     199                        /*parameter 0: index*/,
     200                        handler_wrappers,
     201                        false
    212202                        );
    213203                CompoundStmt * body = new CompoundStmt( noLabels );
     
    215205
    216206                return new FunctionDecl("catch", Type::StorageClasses(),
    217                         LinkageSpec::Cforall, func_type, body);
     207                        LinkageSpec::Cforall, catch_func_t, body);
    218208        }
    219209
    220210        // Create a single check from a moddified handler.
    221         // except_obj is referenced, modded_handler will be freed.
    222         CompoundStmt *create_single_matcher(
    223                         DeclarationWithType * except_obj, CatchStmt * modded_handler ) {
    224                 CompoundStmt * block = new CompoundStmt( noLabels );
    225 
    226                 // INTEGERconstant Version
    227                 assert( nullptr == modded_handler->get_decl() );
    228                 ConstantExpr * number =
    229                         dynamic_cast<ConstantExpr*>( modded_handler->get_cond() );
    230                 assert( number );
    231                 modded_handler->set_cond( nullptr );
    232 
    233                 Expression * cond;
    234                 {
    235                         std::list<Expression *> args;
    236                         args.push_back( number );
    237                         args.push_back( nameOf( except_obj ) );
    238                         cond = new UntypedExpr( new NameExpr( "?==?" /*???*/), args );
    239                 }
     211        CompoundStmt *create_single_matcher( CatchStmt * modded_handler ) {
     212                CompoundStmt * block = new CompoundStmt( noLables );
     213
     214                appendDeclStmt( block, modded_handler->get_decl() );
     215
     216                // TODO: This is not the actual check.
     217                LogicalExpr * cond = new ConstantExpr( Constant::from_bool( false ) );
    240218
    241219                if ( modded_handler->get_cond() ) {
    242                         cond = new LogicalExpr( cond, modded_handler->get_cond() );
     220                        cond = new LogicalExpr( cond, modded_handler->get_cond() )q
    243221                }
    244222                block->push_back( new IfStmt( noLabels,
    245                         cond, modded_handler->get_body(), nullptr ) );
     223                        cond, modded_handler->get_body() );
    246224
    247225                modded_handler->set_decl( nullptr );
     
    254232        FunctionDecl * create_terminate_match( CatchList &handlers ) {
    255233                CompoundStmt * body = new CompoundStmt( noLabels );
    256 
    257                 FunctionType * func_type = match_func_t.clone();
    258                 DeclarationWithType * except_obj = func_type->get_parameters().back();
    259234
    260235                // Index 1..{number of handlers}
     
    265240                        CatchStmt * handler = *it;
    266241
    267                         // Body should have been taken by create_terminate_catch.
    268                         assert( nullptr == handler->get_body() );
    269 
    270                         // Create new body.
     242                        // body should have been taken by create_terminate_catch.
     243                        // assert( nullptr == handler->get_body() );
    271244                        handler->set_body( new ReturnStmt( noLabels,
    272245                                new ConstantExpr( Constant::from_int( index ) ) ) );
    273246
    274                         // Create the handler.
    275                         body->push_back( create_single_matcher( except_obj, handler ) );
    276                         *it = nullptr;
     247                        body->push_back( create_single_matcher( handler ) );
    277248                }
    278249
    279250                return new FunctionDecl("match", Type::StorageClasses(),
    280                         LinkageSpec::Cforall, func_type, body);
    281         }
    282 
    283         CompoundStmt * create_terminate_caller(
     251                        LinkageSpec::Cforall, match_func_t, body);
     252        }
     253
     254        Statement * create_terminate_caller(
    284255                        FunctionDecl * try_wrapper,
    285256                        FunctionDecl * terminate_catch,
    286257                        FunctionDecl * terminate_match) {
    287258
    288                 UntypedExpr * caller = new UntypedExpr( new NameExpr(
    289                         "__cfaehm__try_terminate" ) );
    290                 std::list<Expression *>& args = caller->get_args();
     259                ApplicationExpr * caller = new ApplicationExpr( /* ... */ );
     260                std::list<Expression *>& args = caller.get_args();
    291261                args.push_back( nameOf( try_wrapper ) );
    292262                args.push_back( nameOf( terminate_catch ) );
    293263                args.push_back( nameOf( terminate_match ) );
    294264
    295                 CompoundStmt * callStmt = new CompoundStmt( noLabels );
    296                 callStmt->push_back( new ExprStmt( noLabels, caller ) );
    297                 return callStmt;
     265                return new ExprStmt( noLabels, caller );
    298266        }
    299267
    300268        FunctionDecl * create_resume_handler( CatchList &handlers ) {
    301                 CompoundStmt * body = new CompoundStmt( noLabels );
    302 
    303                 FunctionType * func_type = match_func_t.clone();
    304                 DeclarationWithType * except_obj = func_type->get_parameters().back();
     269                CompoundStmt * body = new CompountStmt( noLabels );
    305270
    306271                CatchList::iterator it;
     
    315280                                handling_code->push_back( handler->get_body() );
    316281                        }
    317                         handling_code->push_back( new ReturnStmt( noLabels,
     282                        handling_code->push_back( new ReturnStmt( noLabel,
    318283                                new ConstantExpr( Constant::from_bool( false ) ) ) );
    319284                        handler->set_body( handling_code );
    320285
    321286                        // Create the handler.
    322                         body->push_back( create_single_matcher( except_obj, handler ) );
    323                         *it = nullptr;
     287                        body->push_back( create_single_matcher( handler ) );
    324288                }
    325289
    326290                return new FunctionDecl("handle", Type::StorageClasses(),
    327                         LinkageSpec::Cforall, func_type, body);
    328         }
    329 
    330         CompoundStmt * create_resume_wrapper(
    331                         StructDecl * node_decl,
     291                        LinkageSpec::Cforall, handle_func_t, body);
     292        }
     293
     294        Statement * create_resume_wrapper(
    332295                        Statement * wraps,
    333296                        FunctionDecl * resume_handler ) {
    334297                CompoundStmt * body = new CompoundStmt( noLabels );
    335298
    336                 // struct __try_resume_node __resume_node
    337                 //      __attribute__((cleanup( __cfaehm__try_resume_cleanup )));
    338                 // ** unwinding of the stack here could cause problems **
    339                 // ** however I don't think that can happen currently **
    340                 // __cfaehm__try_resume_setup( &__resume_node, resume_handler );
     299                // struct node = {current top resume handler, call to resume_handler};
     300                // __attribute__((cleanup( ... )));
     301                // set top resume handler to node.
     302                // The wrapped statement.
     303
     304                ListInit * node_init;
     305                {
     306                        std::list<Initializer*> field_inits;
     307                        field_inits.push_back( new SingleInit( /* ... */ ) );
     308                        field_inits.push_back( new SingleInit( nameOf( resume_handler ) ) );
     309                        node_init = new ListInit( field_inits );
     310                }
    341311
    342312                std::list< Attribute * > attributes;
    343313                {
    344314                        std::list< Expression * > attr_params;
    345                         attr_params.push_back( new NameExpr(
    346                                 "__cfaehm__try_resume_cleanup" ) );
    347                         attributes.push_back( new Attribute( "cleanup", attr_params ) );
    348                 }
    349 
    350                 ObjectDecl * obj = new ObjectDecl(
    351                         "__resume_node",
     315                        attr_params.push_back( nameOf( /* ... deconstructor ... */ ) );
     316                        attrributes.push_back( new Attribute( "cleanup", attr_params ) );
     317                }
     318
     319                appendDeclStmt( body,
     320                /**/ ObjectDecl(
     321                        "resume_node",
    352322                        Type::StorageClasses(),
    353323                        LinkageSpec::Cforall,
    354324                        nullptr,
    355                         new StructInstType(
    356                                 Type::Qualifiers(),
    357                                 node_decl
    358                                 ),
    359                         nullptr,
     325                        /* Type* = resume_node */,
     326                        node_init,
    360327                        attributes
    361                         );
    362                 appendDeclStmt( body, obj );
    363 
    364                 UntypedExpr *setup = new UntypedExpr( new NameExpr(
    365                         "__cfaehm__try_resume_setup" ) );
    366                 setup->get_args().push_back( nameOf( obj ) );
    367                 setup->get_args().push_back( nameOf( resume_handler ) );
    368 
    369                 body->push_back( new ExprStmt( noLabels, setup ) );
    370 
     328                        )
     329                );
    371330                body->push_back( wraps );
    372331                return body;
     
    374333
    375334        FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ) {
    376                 FinallyStmt * finally = tryStmt->get_finally();
    377                 CompoundStmt * body = finally->get_block();
    378                 finally->set_block( nullptr );
    379                 delete finally;
     335                CompoundStmt * body = tryStmt->get_finally();
    380336                tryStmt->set_finally( nullptr );
    381337
    382338                return new FunctionDecl("finally", Type::StorageClasses(),
    383                         LinkageSpec::Cforall, void_func_t.clone(), body);
    384         }
    385 
    386         ObjectDecl * create_finally_hook(
    387                         StructDecl * hook_decl, FunctionDecl * finally_wrapper ) {
    388                 // struct __cfaehm__cleanup_hook __finally_hook
    389                 //      __attribute__((cleanup( finally_wrapper )));
     339                        LinkageSpec::Cforall, void_func_t, body);
     340        }
     341
     342        ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ) {
     343                // struct _cleanup_hook NAME __attribute__((cleanup( ... )));
    390344
    391345                // Make Cleanup Attribute.
     
    394348                        std::list< Expression * > attr_params;
    395349                        attr_params.push_back( nameOf( finally_wrapper ) );
    396                         attributes.push_back( new Attribute( "cleanup", attr_params ) );
    397                 }
    398 
    399                 return new ObjectDecl(
    400                         "__finally_hook",
     350                        attrributes.push_back( new Attribute( "cleanup", attr_params ) );
     351                }
     352
     353                return ObjectDecl( /* ... */
     354                        const std::string &name "finally_hook",
    401355                        Type::StorageClasses(),
    402356                        LinkageSpec::Cforall,
    403357                        nullptr,
    404                         new StructInstType(
    405                                 emptyQualifiers,
    406                                 hook_decl
    407                                 ),
     358                        /* ... Type * ... */,
    408359                        nullptr,
    409360                        attributes
     
    412363
    413364
    414         class ExceptionMutatorCore : public WithGuards {
     365        class ExceptionMutatorCore : public WithScoping {
    415366                enum Context { NoHandler, TerHandler, ResHandler };
    416367
     
    419370                // loop, switch or the goto stays within the function.
    420371
    421                 Context cur_context;
     372                Context curContext;
    422373
    423374                // We might not need this, but a unique base for each try block's
     
    426377                //unsigned int try_count = 0;
    427378
    428                 StructDecl *node_decl;
    429                 StructDecl *hook_decl;
    430379
    431380        public:
    432381                ExceptionMutatorCore() :
    433                         cur_context(NoHandler),
    434                         node_decl(nullptr), hook_decl(nullptr)
     382                        curContext(NoHandler)
    435383                {}
    436384
    437                 void premutate( CatchStmt *catchStmt );
    438                 void premutate( StructDecl *structDecl );
     385                void premutate( CatchStmt *tryStmt );
    439386                Statement * postmutate( ThrowStmt *throwStmt );
    440387                Statement * postmutate( TryStmt *tryStmt );
     
    446393                        if ( throwStmt->get_expr() ) {
    447394                                return create_terminate_throw( throwStmt );
    448                         } else if ( TerHandler == cur_context ) {
     395                        } else if ( TerHandler == curContext ) {
    449396                                return create_terminate_rethrow( throwStmt );
    450397                        } else {
    451398                                assertf(false, "Invalid throw in %s at %i\n",
    452                                         throwStmt->location.filename.c_str(),
     399                                        throwStmt->location.filename,
    453400                                        throwStmt->location.linenumber);
    454401                                return nullptr;
     
    457404                        if ( throwStmt->get_expr() ) {
    458405                                return create_resume_throw( throwStmt );
    459                         } else if ( ResHandler == cur_context ) {
     406                        } else if ( ResHandler == curContext ) {
    460407                                return create_resume_rethrow( throwStmt );
    461408                        } else {
    462409                                assertf(false, "Invalid throwResume in %s at %i\n",
    463                                         throwStmt->location.filename.c_str(),
     410                                        throwStmt->location.filename,
    464411                                        throwStmt->location.linenumber);
    465412                                return nullptr;
     
    469416
    470417        Statement * ExceptionMutatorCore::postmutate( TryStmt *tryStmt ) {
    471                 assert( node_decl );
    472                 assert( hook_decl );
    473 
    474418                // Generate a prefix for the function names?
    475419
    476                 CompoundStmt * block = new CompoundStmt( noLabels );
    477                 CompoundStmt * inner = take_try_block( tryStmt );
     420                CompoundStmt * block = new CompoundStmt();
     421                Statement * inner = take_try_block( tryStmt );
    478422
    479423                if ( tryStmt->get_finally() ) {
     
    483427                        appendDeclStmt( block, finally_block );
    484428                        // Create and add the finally cleanup hook.
    485                         appendDeclStmt( block,
    486                                 create_finally_hook( hook_decl, finally_block ) );
    487                 }
    488 
    489                 CatchList termination_handlers;
    490                 CatchList resumption_handlers;
    491                 split( tryStmt->get_catchers(),
    492                            termination_handlers, resumption_handlers );
    493 
    494                 if ( resumption_handlers.size() ) {
     429                        appendDeclStmt( block, create_finally_hook( finally_block ) );
     430                }
     431
     432                StatementList termination_handlers;
     433                StatementList resumption_handlers;
     434                split( tryStmt->get_handlers(),
     435                       termination_handlers, resumption_handlers );
     436
     437                if ( resumeption_handlers.size() ) {
    495438                        // Define the helper function.
    496439                        FunctionDecl * resume_handler =
     
    498441                        appendDeclStmt( block, resume_handler );
    499442                        // Prepare hooks
    500                         inner = create_resume_wrapper( node_decl, inner, resume_handler );
     443                        inner = create_resume_wrapper( inner, resume_handler );
    501444                }
    502445
     
    519462                block->push_back( inner );
    520463
    521                 //free_all( termination_handlers );
    522                 //free_all( resumption_handlers );
     464                free_all( termination_handlers );
     465                free_all( resumption_handlers );
    523466
    524467                return block;
     
    526469
    527470        void ExceptionMutatorCore::premutate( CatchStmt *catchStmt ) {
    528                 GuardValue( cur_context );
    529                 if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
    530                         cur_context = TerHandler;
     471                GuardValue( curContext );
     472                if ( CatchStmt::Termination == catchStmt->get_kind() ) {
     473                        curContext = TerHandler;
    531474                } else {
    532                         cur_context = ResHandler;
    533                 }
    534         }
    535 
    536         void ExceptionMutatorCore::premutate( StructDecl *structDecl ) {
    537                 if ( !structDecl->has_body() ) {
    538                         // Skip children?
    539                         return;
    540                 } else if ( structDecl->get_name() == "__cfaehm__try_resume_node" ) {
    541                         assert( nullptr == node_decl );
    542                         node_decl = structDecl;
    543                 } else if ( structDecl->get_name() == "__cfaehm__cleanup_hook" ) {
    544                         assert( nullptr == hook_decl );
    545                         hook_decl = structDecl;
    546                 }
    547                 // Later we might get the exception type as well.
    548         }
    549 
    550         void translateEHM( std::list< Declaration *> & translationUnit ) {
    551                 init_func_types();
    552 
     475                        curContext = ResHandler;
     476                }
     477        }
     478
     479    void translateEHM( std::list< Declaration *> & translationUnit ) {
    553480                PassVisitor<ExceptionMutatorCore> translator;
    554481                for ( Declaration * decl : translationUnit ) {
    555                         decl->acceptMutator( translator );
     482                        decl->mutate( translator );
    556483                }
    557484        }
  • src/ControlStruct/ExceptTranslate.h

    ra12d5aa r62423350  
    1010// Created On       : Tus Jun 06 10:13:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 29 15:18:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Thr Jun 22 15:57:00 2017
     13// Update Count     : 0
    1414//
    1515
    1616#ifndef EXCEPT_TRANSLATE_H
    1717#define EXCEPT_TRANSLATE_H
    18 
    19 #include <list>
    20 #include "SynTree/SynTree.h"
    2118
    2219namespace ControlFlow {
  • src/ControlStruct/module.mk

    ra12d5aa r62423350  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jun 28 16:15:00 2017
    14 ## Update Count     : 4
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Thu Aug  4 11:38:06 2016
     14## Update Count     : 3
    1515###############################################################################
    1616
    1717SRC +=  ControlStruct/LabelGenerator.cc \
    1818        ControlStruct/LabelFixer.cc \
    19         ControlStruct/MLEMutator.cc \
     19        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc \
    22         ControlStruct/ExceptTranslate.cc
     21        ControlStruct/ForExprMutator.cc
     22
  • src/Makefile.in

    ra12d5aa r62423350  
    119119        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    120120        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
    121         ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \
    122121        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    123122        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    144143        Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \
    145144        Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \
    146         Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \
     145        Parser/driver_cfa_cpp-parseutility.$(OBJEXT) \
    147146        ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \
    148147        ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \
     
    396395        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    397396        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    398         ControlStruct/ForExprMutator.cc \
    399         ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
     397        ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
    400398        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    401399        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    408406        Parser/ExpressionNode.cc Parser/StatementNode.cc \
    409407        Parser/InitializerNode.cc Parser/TypeData.cc \
    410         Parser/LinkageSpec.cc Parser/parserutility.cc \
     408        Parser/LinkageSpec.cc Parser/parseutility.cc \
    411409        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    412410        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    597595        ControlStruct/$(am__dirstamp) \
    598596        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    599 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT):  \
    600         ControlStruct/$(am__dirstamp) \
    601         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    602597GenPoly/$(am__dirstamp):
    603598        @$(MKDIR_P) GenPoly
     
    669664Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
    670665        Parser/$(DEPDIR)/$(am__dirstamp)
    671 Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
     666Parser/driver_cfa_cpp-parseutility.$(OBJEXT): Parser/$(am__dirstamp) \
    672667        Parser/$(DEPDIR)/$(am__dirstamp)
    673668ResolvExpr/$(am__dirstamp):
     
    862857        -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
    863858        -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT)
    864         -rm -f ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT)
    865859        -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT)
    866860        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
     
    892886        -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT)
    893887        -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT)
    894         -rm -f Parser/driver_cfa_cpp-parserutility.$(OBJEXT)
     888        -rm -f Parser/driver_cfa_cpp-parseutility.$(OBJEXT)
    895889        -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT)
    896890        -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT)
     
    976970@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    977971@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
    978 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    979972@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    980973@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
     
    1006999@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@
    10071000@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@
    1008 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@
     1001@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po@am__quote@
    10091002@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@
    10101003@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@
     
    13681361@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    13691362
    1370 ControlStruct/driver_cfa_cpp-ExceptTranslate.o: ControlStruct/ExceptTranslate.cc
    1371 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1372 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.o' libtool=no @AMDEPBACKSLASH@
    1374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1375 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1376 
    1377 ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc
    1378 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1379 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@
    1381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1382 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1383 
    13841363GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    13851364@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
     
    17181697@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi`
    17191698
    1720 Parser/driver_cfa_cpp-parserutility.o: Parser/parserutility.cc
    1721 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1722 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1723 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.o' libtool=no @AMDEPBACKSLASH@
    1724 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1725 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1726 
    1727 Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc
    1728 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
    1729 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1730 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@
    1731 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1732 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
     1699Parser/driver_cfa_cpp-parseutility.o: Parser/parseutility.cc
     1700@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc
     1701@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
     1702@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.o' libtool=no @AMDEPBACKSLASH@
     1703@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1704@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc
     1705
     1706Parser/driver_cfa_cpp-parseutility.obj: Parser/parseutility.cc
     1707@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`
     1708@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
     1709@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.obj' libtool=no @AMDEPBACKSLASH@
     1710@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1711@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`
    17331712
    17341713ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc
  • src/Parser/DeclarationNode.cc

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:27:00 2017
    13 // Update Count     : 1019
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 15:46:33 2017
     13// Update Count     : 1018
    1414//
    1515
     
    10631063          case TypeData::Enum:
    10641064          case TypeData::Aggregate: {
    1065                   ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
     1065                  ReferenceToType * ret = buildComAggInst( type, attributes );
    10661066                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10671067                  return ret;
  • src/Parser/ExpressionNode.cc

    ra12d5aa r62423350  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:15 2017
    13 // Update Count     : 542
     12// Last Modified On : Wed Jun 21 16:44:46 2017
     13// Update Count     : 541
    1414//
    1515
     
    2727#include "SynTree/Declaration.h"
    2828#include "Common/UnimplementedError.h"
    29 #include "parserutility.h"
     29#include "parseutility.h"
    3030#include "Common/utility.h"
    3131
  • src/Parser/LinkageSpec.cc

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:22:09 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 11:51:00 2017
    13 // Update Count     : 24
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Oct  2 23:16:21 2016
     13// Update Count     : 23
    1414//
    1515
     
    2828        } else if ( *spec == "\"C\"" ) {
    2929                return C;
    30         } else if ( *spec == "\"BuiltinC\"" ) {
    31                 return BuiltinC;
    3230        } else {
    3331                throw SemanticError( "Invalid linkage specifier " + *spec );
     
    3836        assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
    3937        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
    40                 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in",
     38                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
    4139        };
    4240        return linkageKinds[linkage];
    4341}
    4442
    45 bool LinkageSpec::isMangled( Spec spec ) {
     43bool LinkageSpec::isDecoratable( Spec spec ) {
    4644        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    4745        static bool decoratable[LinkageSpec::NoOfSpecs] = {
    48                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
     46                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    4947                        true,           true,           false,  true,           false,
    50                 //      Builtin,        BuiltinC,
    51                         true,           false,
    5248        };
    5349        return decoratable[spec];
     
    5753        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    5854        static bool generatable[LinkageSpec::NoOfSpecs] = {
    59                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
     55                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    6056                        true,           true,           true,   true,           false,
    61                 //      Builtin,        BuiltinC,
    62                         true,           true,
    6357        };
    6458        return generatable[spec];
     
    6862        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    6963        static bool overridable[LinkageSpec::NoOfSpecs] = {
    70                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
     64                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    7165                        true,           false,          false,  true,           false,
    72                 //      Builtin,        BuiltinC,
    73                         false,          false,
    7466        };
    7567        return overridable[spec];
     
    7971        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    8072        static bool builtin[LinkageSpec::NoOfSpecs] = {
    81                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
     73                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
    8274                        true,           false,          false,  false,          true,
    83                 //      Builtin,        BuiltinC,
    84                         true,           true,
    8575        };
    8676        return builtin[spec];
  • src/Parser/LinkageSpec.h

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 11:50:00 2017
    13 // Update Count     : 12
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Oct  1 23:03:17 2016
     13// Update Count     : 11
    1414//
    1515
     
    2626                AutoGen,                                                                                // built by translator (struct assignment)
    2727                Compiler,                                                                               // gcc internal
    28                 Builtin,                                                                                // mangled builtins
    29                 BuiltinC,                                                                               // non-mangled builtins
    3028                NoOfSpecs
    3129        };
     
    3432        static std::string linkageName( Spec );
    3533 
    36         static bool isMangled( Spec );
     34        static bool isDecoratable( Spec );
    3735        static bool isGeneratable( Spec );
    3836        static bool isOverridable( Spec );
  • src/Parser/StatementNode.cc

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 14:59:41 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:37 2017
    13 // Update Count     : 330
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 13:03:00 2017
     13// Update Count     : 329
    1414//
    1515
     
    2121#include "SynTree/Statement.h"
    2222#include "SynTree/Expression.h"
    23 #include "parserutility.h"
     23#include "parseutility.h"
    2424#include "Common/utility.h"
    2525
  • src/Parser/TypeData.cc

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:12:51 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:28:00 2017
    13 // Update Count     : 564
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 15:52:43 2017
     13// Update Count     : 563
    1414//
    1515
     
    614614} // buildPointer
    615615
    616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     616AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {
    617617        assert( td->kind == TypeData::Aggregate );
    618618        AggregateDecl * at;
     
    622622          case DeclarationNode::Monitor:
    623623          case DeclarationNode::Thread:
    624                 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage );
     624                at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );
    625625                buildForall( td->aggregate.params, at->get_parameters() );
    626626                break;
     
    643643} // buildAggregate
    644644
    645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     645ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
    646646        switch ( type->kind ) {
    647647          case TypeData::Enum: {
     
    656656                  ReferenceToType * ret;
    657657                  if ( type->aggregate.body ) {
    658                           AggregateDecl * typedecl = buildAggregate( type, attributes, linkage );
     658                          AggregateDecl * typedecl = buildAggregate( type, attributes );
    659659                          switch ( type->aggregate.kind ) {
    660660                                case DeclarationNode::Struct:
     
    803803                return decl->set_asmName( asmName );
    804804        } else if ( td->kind == TypeData::Aggregate ) {
    805                 return buildAggregate( td, attributes, linkage );
     805                return buildAggregate( td, attributes );
    806806        } else if ( td->kind == TypeData::Enum ) {
    807807                return buildEnum( td, attributes );
  • src/Parser/TypeData.h

    ra12d5aa r62423350  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:18:36 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:29:00 2017
    13 // Update Count     : 186
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 16 08:32:39 2017
     13// Update Count     : 185
    1414//
    1515
     
    102102ArrayType * buildArray( const TypeData * );
    103103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
     104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
    105105ReferenceToType * buildAggInst( const TypeData * );
    106106TypeDecl * buildVariable( const TypeData * );
  • src/Parser/TypedefTable.h

    ra12d5aa r62423350  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:56:34 2017
    13 // Update Count     : 33
     12// Last Modified On : Mon Aug 15 18:25:04 2016
     13// Update Count     : 28
    1414//
    1515
     
    2222#include <stack>
    2323
    24 #include "parser.hh"
     24#include "lex.h"
    2525#include "parser.h"
    2626
  • src/Parser/lex.ll

    ra12d5aa r62423350  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Jun 28 21:03:45 2017
    13  * Update Count     : 529
     12 * Last Modified On : Tue May 30 22:00:48 2017
     13 * Update Count     : 527
    1414 */
    1515
     
    2727#include <cstdio>                                                                               // FILENAME_MAX
    2828
     29#include "lex.h"
     30#include "parser.h"                                                                             // YACC generated definitions based on C++ grammar
    2931#include "ParseNode.h"
    3032#include "TypedefTable.h"
  • src/Parser/module.mk

    ra12d5aa r62423350  
    1111## Created On       : Sat May 16 15:29:09 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Jun 28 21:58:29 2017
    14 ## Update Count     : 104
     13## Last Modified On : Tue Aug 16 17:28:34 2016
     14## Update Count     : 101
    1515###############################################################################
    1616
     
    2929       Parser/TypeData.cc \
    3030       Parser/LinkageSpec.cc \
    31        Parser/parserutility.cc
     31       Parser/parseutility.cc
    3232
    3333MAINTAINERCLEANFILES += Parser/parser.output
  • src/Parser/parser.yy

    ra12d5aa r62423350  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // parser.yy --
     7// cfa.y --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 22:11:22 2017
    13 // Update Count     : 2414
     12// Last Modified On : Mon Jun 12 12:59:00 2017
     13// Update Count     : 2402
    1414//
    1515
     
    4848#include <cstdio>
    4949#include <stack>
     50#include "lex.h"
     51#include "parser.h"
    5052#include "ParseNode.h"
    5153#include "TypedefTable.h"
     
    8688bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8789%}
    88 
    89 // Types declaration
    90 %union
    91 {
    92         Token tok;
    93         ParseNode * pn;
    94         ExpressionNode * en;
    95         DeclarationNode * decl;
    96         DeclarationNode::Aggregate aggKey;
    97         DeclarationNode::TypeClass tclass;
    98         StatementNode * sn;
    99         ConstantExpr * constant;
    100         ForCtl * fctl;
    101         LabelNode * label;
    102         InitializerNode * in;
    103         OperKinds op;
    104         std::string * str;
    105         bool flag;
    106 }
    10790
    10891//************************* TERMINAL TOKENS ********************************
     
    156139
    157140%token ATassign                                                                                 // @=
     141
     142// Types declaration
     143%union
     144{
     145        Token tok;
     146        ParseNode * pn;
     147        ExpressionNode * en;
     148        DeclarationNode * decl;
     149        DeclarationNode::Aggregate aggKey;
     150        DeclarationNode::TypeClass tclass;
     151        StatementNode * sn;
     152        ConstantExpr * constant;
     153        ForCtl * fctl;
     154        LabelNode * label;
     155        InitializerNode * in;
     156        OperKinds op;
     157        std::string * str;
     158        bool flag;
     159}
    158160
    159161%type<tok> identifier  no_attr_identifier  zero_one
     
    957959
    958960handler_clause:
    959         // TEMPORARY, TEST EXCEPTIONS
    960         CATCH '(' push push INTEGERconstant pop ')' compound_statement pop
    961                 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
    962         | handler_clause CATCH '(' push push INTEGERconstant pop ')' compound_statement pop
    963                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    964 
    965         | CATCH '(' push push exception_declaration pop ')' compound_statement pop
     961        CATCH '(' push push exception_declaration pop ')' compound_statement pop
    966962                { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); }
    967963        | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
  • src/SymTab/Autogen.cc

    ra12d5aa r62423350  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 03 15:45:56 2016
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:30:00 2017
    13 // Update Count     : 61
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 09:41:08 2017
     13// Update Count     : 60
    1414//
    1515
     
    400400        /// generates struct constructors, destructor, and assignment functions
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
    402                 // Builtins do not use autogeneration.
    403                 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||
    404                          aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    405                         return;
    406                 }
    407 
    408402                // Make function polymorphic in same parameters as generic struct, if applicable
    409403                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
  • src/SymTab/Mangler.cc

    ra12d5aa r62423350  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:31:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 09:40:01 2017
     13// Update Count     : 20
    1414//
    1515
     
    7272                        } else {
    7373                                // if we add another kind of overridable function, this has to change
    74                                 assert( false && "unknown overrideable linkage" );
     74                                assert( false );
    7575                        } // if
    7676                }
  • src/SynTree/AggregateDecl.cc

    ra12d5aa r62423350  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:56:39 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:30:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 16 07:49:07 2017
     13// Update Count     : 20
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Declaration.h

    ra12d5aa r62423350  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:31:00 2017
    13 // Update Count     : 122
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 16:05:08 2017
     13// Update Count     : 121
    1414//
    1515
     
    238238        typedef Declaration Parent;
    239239  public:
    240         AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
     240        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );
    241241        AggregateDecl( const AggregateDecl &other );
    242242        virtual ~AggregateDecl();
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}
     268        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ), kind( kind ) {}
    269269        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270270
     
    284284        typedef AggregateDecl Parent;
    285285  public:
    286         UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
     286        UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    287287        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    288288
     
    297297        typedef AggregateDecl Parent;
    298298  public:
    299         EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
     299        EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    300300        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    301301
  • src/libcfa/Makefile.am

    ra12d5aa r62423350  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:54:01 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jun 28 15:36:00 2017
    14 ## Update Count     : 215
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Sun May 14 21:04:21 2017
     14## Update Count     : 214
    1515###############################################################################
    1616
     
    6464        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6565
    66 libcfa_a-exception.o : exception.c
    67         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    68 
    6966concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    70         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    71 
    72 libcfa_d_a-exception.o : exception.c
    7367        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    7468
     
    7872libcfa_a_CFLAGS = -nodebug -O2
    7973libcfa_d_a_SOURCES = ${libsrc}
    80 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
     74libcfa_d_a_CFLAGS = -debug -O0
    8175
    8276stdhdr = ${shell echo stdhdr/*}
  • src/libcfa/Makefile.in

    ra12d5aa r62423350  
    332332libcfa_a_CFLAGS = -nodebug -O2
    333333libcfa_d_a_SOURCES = ${libsrc}
    334 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
     334libcfa_d_a_CFLAGS = -debug -O0
    335335stdhdr = ${shell echo stdhdr/*}
    336336cfa_includedir = $(CFA_INCDIR)
     
    14281428        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    14291429
    1430 libcfa_a-exception.o : exception.c
    1431         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    1432 
    14331430concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    1434         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    1435 
    1436 libcfa_d_a-exception.o : exception.c
    14371431        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    14381432
  • src/main.cc

    ra12d5aa r62423350  
    1010// Author           : Richard C. Bilson
    1111// Created On       : Fri May 15 23:12:02 2015
    12 // Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu Jun 29 12:46:50 2017
    14 // Update Count     : 441
     12// Last Modified By : Andrew Beach
     13// Last Modified On : Wed May 10 14:45:00 2017
     14// Update Count     : 437
    1515//
    1616
     
    2525using namespace std;
    2626
    27 #include "Parser/parser.hh"
     27#include "Parser/lex.h"
     28#include "Parser/parser.h"
    2829#include "Parser/TypedefTable.h"
    2930#include "GenPoly/Lvalue.h"
     
    185186                if ( ! nopreludep ) {                                                   // include gcc builtins
    186187                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    187 
    188                         // Read to gcc builtins, if not generating the cfa library
    189                         FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" );
    190                         assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
    191                         parse( gcc_builtins, LinkageSpec::Compiler );
     188                        FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     189                        assertf( builtins, "cannot open builtins.cf\n" );
     190                        parse( builtins, LinkageSpec::Compiler );
    192191
    193192                        // read the extra prelude in, if not generating the cfa library
     
    201200                                assertf( prelude, "cannot open prelude.cf\n" );
    202201                                parse( prelude, LinkageSpec::Intrinsic );
    203 
    204                                 // Read to cfa builtins, if not generating the cfa library
    205                                 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
    206                                 assertf( builtins, "cannot open builtins.cf\n" );
    207                                 parse( builtins, LinkageSpec::Builtin );
    208202                        } // if
    209203                } // if
     
    481475                        break;
    482476                  case '?':
    483                         if ( optopt ) {                                                         // short option ?
    484                                 assertf( false, "Unknown option: -%c\n", (char)optopt );
    485                         } else {
    486                                 assertf( false, "Unknown option: %s\n", argv[optind - 1] );
    487                         } // if
     477                        assertf( false, "Unknown option: '%c'\n", (char)optopt );
    488478                  default:
    489479                        abort();
  • src/prelude/Makefile.am

    ra12d5aa r62423350  
    2020# put into lib for now
    2121cfalibdir = ${CFA_LIBDIR}
    22 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
     22cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
    24 
    25 $(DEPDIR) :
    26         mkdir $(DEPDIR)
    27 
    28 $(DEPDIR)/builtins.Po : $(DEPDIR)
    29         touch ${@}
    3024
    3125# create extra forward types/declarations to reduce inclusion of library files
     
    3428
    3529# create forward declarations for gcc builtins
    36 gcc-builtins.cf : gcc-builtins.c prototypes.sed
     30builtins.cf : builtins.c prototypes.sed
    3731        ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
    3832
    39 gcc-builtins.c : builtins.def prototypes.awk
     33builtins.c : builtins.def prototypes.awk
    4034        ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
    4135
     
    4438prototypes.awk :
    4539
    46 # create forward declarations for cfa builtins
    47 builtins.cf : builtins.c
    48         ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    49         ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    50 
    51 include $(DEPDIR)/builtins.Po
    52 
    53 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     40../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    5441        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    5542
    56 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     43bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    5744        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    5845
    59 maintainer-clean-local :
    60         rm -rf $(DEPDIR)
    61 
    62 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     46MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • src/prelude/Makefile.in

    ra12d5aa r62423350  
    211211# put into lib for now
    212212cfalibdir = ${CFA_LIBDIR}
    213 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
     213cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    214214noinst_DATA = ../libcfa/libcfa-prelude.c
    215 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     215MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
    216216all: all-am
    217217
     
    390390maintainer-clean: maintainer-clean-am
    391391        -rm -f Makefile
    392 maintainer-clean-am: distclean-am maintainer-clean-generic \
    393         maintainer-clean-local
     392maintainer-clean-am: distclean-am maintainer-clean-generic
    394393
    395394mostlyclean: mostlyclean-am
     
    417416        install-ps install-ps-am install-strip installcheck \
    418417        installcheck-am installdirs maintainer-clean \
    419         maintainer-clean-generic maintainer-clean-local mostlyclean \
    420         mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
    421         uninstall-cfalibDATA
    422 
    423 
    424 $(DEPDIR) :
    425         mkdir $(DEPDIR)
    426 
    427 $(DEPDIR)/builtins.Po : $(DEPDIR)
    428         touch ${@}
     418        maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
     419        pdf-am ps ps-am uninstall uninstall-am uninstall-cfalibDATA
     420
    429421
    430422# create extra forward types/declarations to reduce inclusion of library files
     
    433425
    434426# create forward declarations for gcc builtins
    435 gcc-builtins.cf : gcc-builtins.c prototypes.sed
     427builtins.cf : builtins.c prototypes.sed
    436428        ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@
    437429
    438 gcc-builtins.c : builtins.def prototypes.awk
     430builtins.c : builtins.def prototypes.awk
    439431        ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@
    440432
     
    443435prototypes.awk :
    444436
    445 # create forward declarations for cfa builtins
    446 builtins.cf : builtins.c
    447         ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    448         ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    449 
    450 include $(DEPDIR)/builtins.Po
    451 
    452 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     437../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    453438        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    454439
    455 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     440bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    456441        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    457 
    458 maintainer-clean-local :
    459         rm -rf $(DEPDIR)
    460442
    461443# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/preempt_longrun/Makefile.am

    ra12d5aa r62423350  
    1616
    1717repeats=10
    18 max_time=30
     18max_time=10
     19N=10ul
    1920preempt=10_000ul
    2021
    2122REPEAT = ${abs_top_srcdir}/tools/repeat -s
    2223
    23 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
     24BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
    2425CFLAGS = ${BUILD_FLAGS}
    2526CC = @CFA_BINDIR@/@CFA_NAME@
    2627
    27 TESTS = barge block create disjoint processor stack wait yield
     28TESTS = create stack yield
    2829
    2930.INTERMEDIATE: ${TESTS}
  • src/tests/preempt_longrun/Makefile.in

    ra12d5aa r62423350  
    178178top_srcdir = @top_srcdir@
    179179repeats = 10
    180 max_time = 30
     180max_time = 10
     181N = 10ul
    181182preempt = 10_000ul
    182183REPEAT = ${abs_top_srcdir}/tools/repeat -s
    183 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
    184 TESTS = barge block create disjoint processor stack wait yield
     184BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
     185TESTS = create stack yield
    185186all: all-am
    186187
  • src/tests/sched-int-block.c

    ra12d5aa r62423350  
    55#include <thread>
    66
    7 #ifndef N
    8 #define N 100_000
    9 #endif
     7static const unsigned N = 100_000;
    108
    119enum state_t { WAITED, SIGNAL, BARGE };
  • src/tests/sched-int-disjoint.c

    ra12d5aa r62423350  
    44#include <thread>
    55
    6 #ifndef N
    76#define N 100_000
    8 #endif
    97
    108enum state_t { WAIT, SIGNAL, BARGE };
  • src/tests/sched-int-wait.c

    ra12d5aa r62423350  
    55#include <thread>
    66
    7 #ifndef N
    8 #define N 10_000
    9 #endif
     7static const int N = 10_000;
    108
    119monitor global_t {};
  • tools/cfa.nanorc

    ra12d5aa r62423350  
    22## WIP
    33
    4 syntax "cfa" "\.cfa"
     4syntax "cfa" "\.cfa$"
     5## No magic
    56
    67# Macros
     
    1819# Control Flow Structures
    1920color brightyellow "\<(if|else|while|do|for|switch|choose|case|default)\>"
    20 color brightyellow "\<(try|catch|catchResume|finally)\>"
     21##color brightyellow "\<(try|catch|catchResume|finally)\>"
    2122
    2223# Control Flow Statements
    23 color magenta "\<(return|break|continue|fallthru|throw|throwResume)\>"
     24color magenta "\<(return|break|continue|fallthru|throw)\>"
    2425
    2526# Operator Names
     
    4546color brightmagenta "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
    4647# Strings and Angle Strings
    47 color yellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
     48color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
    4849# Multiline Strings: This regex is VERY expencive and often too strong.
    4950###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
  • tools/repeat

    ra12d5aa r62423350  
    2020for (( i = 0; i < ITERATION; i ++ )); do
    2121        echo -ne "\r$i / $ITERATION"
    22         $@ > /dev/null &
     22        $@ &
    2323        child=$!
    2424        wait "$child"
Note: See TracChangeset for help on using the changeset viewer.