Changes in / [8a1d95af:c99a0d1]


Ignore:
Files:
4 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/monitor.cfa

    r8a1d95af rc99a0d1  
    367367
    368368        // __cfaabi_dbg_print_safe( "MGUARD : entered\n" );
    369 }
    370 
    371 void ?{}( monitor_guard_t & this, monitor$ * m [], __lock_size_t count ) {
    372         this{ m, count, 0p };
    373369}
    374370
  • libcfa/src/concurrency/monitor.hfa

    r8a1d95af rc99a0d1  
    4848
    4949void ?{}( monitor_guard_t & this, monitor$ ** m, __lock_size_t count, void (*func)() );
    50 void ?{}( monitor_guard_t & this, monitor$ ** m, __lock_size_t count );
    5150void ^?{}( monitor_guard_t & this );
    5251
  • src/AST/Convert.cpp

    r8a1d95af rc99a0d1  
    606606        }
    607607
    608         const ast::Stmt * visit( const ast::MutexStmt * node ) override final {
    609                 if ( inCache( node ) ) return nullptr;
    610                  auto stmt = new MutexStmt(
    611                         get<Statement>().accept1( node->stmt ),
    612                         get<Expression>().acceptL( node->mutexObjs )
    613                 );
    614                 return stmtPostamble( stmt, node );
    615         }
    616 
    617608        TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) {
    618609
     
    21332124        }
    21342125
    2135         virtual void visit( const MutexStmt * old ) override final {
    2136                 if ( inCache( old ) ) return;
    2137                 this->node = new ast::MutexStmt(
    2138                         old->location,
    2139                         GET_ACCEPT_1(stmt, Stmt),
    2140                         GET_ACCEPT_V(mutexObjs, Expr)
    2141                 );
    2142                 cache.emplace( old, this->node );
    2143         }
    2144 
    21452126        // TypeSubstitution shouldn't exist yet in old.
    21462127        ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) {
  • src/AST/Fwd.hpp

    r8a1d95af rc99a0d1  
    6060class NullStmt;
    6161class ImplicitCtorDtorStmt;
    62 class MutexStmt;
    6362
    6463class Expr;
  • src/AST/Node.cpp

    r8a1d95af rc99a0d1  
    176176template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::weak >;
    177177template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::strong >;
    178 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::weak >;
    179 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::strong >;
    180178template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >;
    181179template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >;
  • src/AST/Pass.hpp

    r8a1d95af rc99a0d1  
    162162        const ast::Stmt *             visit( const ast::DeclStmt             * ) override final;
    163163        const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) override final;
    164         const ast::Stmt *             visit( const ast::MutexStmt            * ) override final;
    165164        const ast::Expr *             visit( const ast::ApplicationExpr      * ) override final;
    166165        const ast::Expr *             visit( const ast::UntypedExpr          * ) override final;
  • src/AST/Pass.impl.hpp

    r8a1d95af rc99a0d1  
    10391039
    10401040//--------------------------------------------------------------------------
    1041 // MutexStmt
    1042 template< typename core_t >
    1043 const ast::Stmt * ast::Pass< core_t >::visit( const ast::MutexStmt * node ) {
    1044         VISIT_START( node );
    1045 
    1046         VISIT({
    1047                 // mutex statements introduce a level of scope (for the initialization)
    1048                 guard_symtab guard { *this };
    1049                 maybe_accept( node, &MutexStmt::stmt );
    1050                 maybe_accept( node, &MutexStmt::mutexObjs );
    1051         })
    1052 
    1053         VISIT_END( Stmt, node );
    1054 }
    1055 
    1056 //--------------------------------------------------------------------------
    10571041// ApplicationExpr
    10581042template< typename core_t >
  • src/AST/Print.cpp

    r8a1d95af rc99a0d1  
    794794                ++indent;
    795795                safe_print( node->callStmt );
    796                 --indent;
    797                 os << endl;
    798 
    799                 return node;
    800         }
    801 
    802         virtual const ast::Stmt * visit( const ast::MutexStmt * node ) override final {
    803                 os << "Mutex Statement" << endl;
    804                 os << indent << "... with Mutex Parameters: ";
    805                 ++indent;
    806                 printAll( node->mutexObjs );
    807                 --indent;
    808                 os << indent << "... with Statement: ";
    809                 ++indent;
    810                 safe_print( node->stmt );
    811796                --indent;
    812797                os << endl;
  • src/AST/Stmt.hpp

    r8a1d95af rc99a0d1  
    426426};
    427427
    428 /// Mutex Statement
    429 class MutexStmt final : public Stmt {
    430 public:
    431         ptr<Stmt> stmt;
    432         std::vector<ptr<Expr>> mutexObjs;
    433 
    434         MutexStmt( const CodeLocation & loc, const Stmt * stmt,
    435                 std::vector<ptr<Expr>> && mutexes, std::vector<Label> && labels = {} )
    436         : Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {}
    437 
    438         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    439 private:
    440         MutexStmt * clone() const override { return new MutexStmt{ *this }; }
    441         MUTATE_FRIEND
    442 };
    443 
    444428}
    445429
  • src/AST/Visitor.hpp

    r8a1d95af rc99a0d1  
    5454    virtual const ast::Stmt *             visit( const ast::DeclStmt             * ) = 0;
    5555    virtual const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) = 0;
    56     virtual const ast::Stmt *             visit( const ast::MutexStmt            * ) = 0;
    5756    virtual const ast::Expr *             visit( const ast::ApplicationExpr      * ) = 0;
    5857    virtual const ast::Expr *             visit( const ast::UntypedExpr          * ) = 0;
  • src/CodeGen/CodeGenerator.cc

    r8a1d95af rc99a0d1  
    11871187        }
    11881188
    1189         void CodeGenerator::postvisit( MutexStmt * stmt ) {
    1190                 assertf( ! options.genC, "ImplicitCtorDtorStmts should not reach code generation." );
    1191                 stmt->stmt->accept( *visitor );
    1192         }
    1193 
    11941189        void CodeGenerator::handleStorageClass( DeclarationWithType * decl ) {
    11951190                if ( decl->get_storageClasses().any() ) {
  • src/CodeGen/CodeGenerator.h

    r8a1d95af rc99a0d1  
    121121                void postvisit( DeclStmt * );
    122122                void postvisit( ImplicitCtorDtorStmt * );
    123                 void postvisit( MutexStmt * stmt );
    124123
    125124                void genAttributes( std::list< Attribute * > & attributes );
  • src/Common/CodeLocationTools.cpp

    r8a1d95af rc99a0d1  
    125125    macro(DeclStmt, Stmt) \
    126126    macro(ImplicitCtorDtorStmt, Stmt) \
    127     macro(MutexStmt, Stmt) \
    128127    macro(ApplicationExpr, Expr) \
    129128    macro(UntypedExpr, Expr) \
  • src/Common/PassVisitor.h

    r8a1d95af rc99a0d1  
    124124        virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
    125125        virtual void visit( const ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
    126         virtual void visit( MutexStmt * mutexStmt ) override final;
    127         virtual void visit( const MutexStmt * mutexStmt ) override final;
    128126
    129127        virtual void visit( ApplicationExpr * applicationExpr ) override final;
     
    293291        virtual Statement * mutate( DeclStmt * declStmt ) override final;
    294292        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
    295         virtual Statement * mutate( MutexStmt * mutexStmt ) override final;
    296293
    297294        virtual Expression * mutate( ApplicationExpr * applicationExpr ) override final;
  • src/Common/PassVisitor.impl.h

    r8a1d95af rc99a0d1  
    17811781
    17821782//--------------------------------------------------------------------------
    1783 // MutexStmt
    1784 template< typename pass_type >
    1785 void PassVisitor< pass_type >::visit( MutexStmt * node ) {
    1786         VISIT_START( node );
    1787         // mutex statements introduce a level of scope (for the initialization)
    1788         maybeAccept_impl( node->mutexObjs, *this );
    1789         {
    1790                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1791                 node->stmt = visitStatement( node->stmt );
    1792         }
    1793         VISIT_END( node );
    1794 }
    1795 
    1796 template< typename pass_type >
    1797 void PassVisitor< pass_type >::visit( const MutexStmt * node ) {
    1798         VISIT_START( node );
    1799         maybeAccept_impl( node->mutexObjs, *this );
    1800         {
    1801                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1802                 visitStatement( node->stmt );
    1803         }
    1804         VISIT_END( node );
    1805 }
    1806 
    1807 template< typename pass_type >
    1808 Statement * PassVisitor< pass_type >::mutate( MutexStmt * node ) {
    1809         MUTATE_START( node );
    1810         maybeMutate_impl( node->mutexObjs, *this );
    1811         {
    1812                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1813                 node->stmt = mutateStatement( node->stmt );
    1814         }
    1815         MUTATE_END( Statement, node );
    1816 }
    1817 
    1818 //--------------------------------------------------------------------------
    18191783// ApplicationExpr
    18201784template< typename pass_type >
  • src/Concurrency/Keywords.cc

    r8a1d95af rc99a0d1  
    302302                void postvisit( FunctionDecl * decl );
    303303                void postvisit(   StructDecl * decl );
    304                 Statement * postmutate( MutexStmt * stmt );
    305304
    306305                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl*, bool & first );
     
    308307                void addDtorStatements( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
    309308                void addStatements( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
    310                 void addStatements( CompoundStmt * body, const std::list<Expression * > & args );
    311309                void addThreadDtorStatements( FunctionDecl* func, CompoundStmt * body, const std::list<DeclarationWithType * > & args );
    312310
     
    314312                        PassVisitor< MutexKeyword > impl;
    315313                        acceptAll( translationUnit, impl );
    316                         mutateAll( translationUnit, impl );
    317314                }
    318315
     
    938935                        thread_guard_decl = decl;
    939936                }
    940         }
    941 
    942         Statement * MutexKeyword::postmutate( MutexStmt * stmt ) {
    943                 std::list<Statement *> stmtsForCtor;
    944                 stmtsForCtor.push_back(stmt->stmt);
    945                 CompoundStmt * body = new CompoundStmt( stmtsForCtor );
    946                 addStatements( body, stmt->mutexObjs);
    947                 return body;
    948937        }
    949938
     
    10691058                        ))
    10701059                );
    1071         }
    1072 
    1073         void MutexKeyword::addStatements( CompoundStmt * body, const std::list<Expression * > & args ) {
    1074                 ObjectDecl * monitors = new ObjectDecl(
    1075                         "__monitors",
    1076                         noStorageClasses,
    1077                         LinkageSpec::Cforall,
    1078                         nullptr,
    1079                         new ArrayType(
    1080                                 noQualifiers,
    1081                                 new PointerType(
    1082                                         noQualifiers,
    1083                                         new StructInstType(
    1084                                                 noQualifiers,
    1085                                                 monitor_decl
    1086                                         )
    1087                                 ),
    1088                                 new ConstantExpr( Constant::from_ulong( args.size() ) ),
    1089                                 false,
    1090                                 false
    1091                         ),
    1092                         new ListInit(
    1093                                 map_range < std::list<Initializer*> > ( args, [](Expression * var ){
    1094                                         return new SingleInit( new UntypedExpr(
    1095                                                 new NameExpr( "get_monitor" ),
    1096                                                 { var }
    1097                                         ) );
    1098                                 })
    1099                         )
    1100                 );
    1101 
    1102                 // in reverse order :
    1103                 // monitor_guard_t __guard = { __monitors, # };
    1104                 body->push_front(
    1105                         new DeclStmt( new ObjectDecl(
    1106                                 "__guard",
    1107                                 noStorageClasses,
    1108                                 LinkageSpec::Cforall,
    1109                                 nullptr,
    1110                                 new StructInstType(
    1111                                         noQualifiers,
    1112                                         guard_decl
    1113                                 ),
    1114                                 new ListInit(
    1115                                         {
    1116                                                 new SingleInit( new VariableExpr( monitors ) ),
    1117                                                 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) )
    1118                                         },
    1119                                         noDesignators,
    1120                                         true
    1121                                 )
    1122                         ))
    1123                 );
    1124 
    1125                 //monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) };
    1126                 body->push_front( new DeclStmt( monitors) );
    11271060        }
    11281061
  • src/Parser/ParseNode.h

    r8a1d95af rc99a0d1  
    437437WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when, StatementNode * else_stmt, ExpressionNode * else_when );
    438438Statement * build_with( ExpressionNode * exprs, StatementNode * stmt );
    439 Statement * build_mutex( ExpressionNode * exprs, StatementNode * stmt );
    440439
    441440//##############################################################################
  • src/Parser/StatementNode.cc

    r8a1d95af rc99a0d1  
    374374} // build_directive
    375375
    376 Statement * build_mutex( ExpressionNode * exprs, StatementNode * stmt ) {
    377         std::list< Expression * > expList;
    378         buildMoveList( exprs, expList );
    379         Statement * body = maybeMoveBuild<Statement>( stmt );
    380         return new MutexStmt( body, expList );
    381 } // build_mutex
    382 
    383376// Local Variables: //
    384377// tab-width: 4 //
  • src/Parser/parser.yy

    r8a1d95af rc99a0d1  
    13471347mutex_statement:
    13481348        MUTEX '(' argument_expression_list_opt ')' statement
    1349                 { $$ = new StatementNode( build_mutex( $3, $5 ) ); }
     1349                { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; }
    13501350        ;
    13511351
  • src/SynTree/Mutator.h

    r8a1d95af rc99a0d1  
    5858        virtual Statement * mutate( DeclStmt * declStmt ) = 0;
    5959        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
    60         virtual Statement * mutate( MutexStmt * mutexStmt ) = 0;
    6160
    6261        virtual Expression * mutate( ApplicationExpr * applicationExpr ) = 0;
  • src/SynTree/Statement.cc

    r8a1d95af rc99a0d1  
    565565}
    566566
    567 MutexStmt::MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs )
    568         : Statement(), stmt( stmt ), mutexObjs( mutexObjs ) { }
    569 
    570 MutexStmt::MutexStmt( const MutexStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) {
    571         cloneAll( other.mutexObjs, mutexObjs );
    572 }
    573 
    574 MutexStmt::~MutexStmt() {
    575         deleteAll( mutexObjs );
    576         delete stmt;
    577 }
    578 
    579 void MutexStmt::print( std::ostream & os, Indenter indent ) const {
    580         os << "Mutex Statement" << endl;
    581         os << indent << "... with Expressions: " << endl;
    582         for (auto * obj : mutexObjs) {
    583                 os << indent+1;
    584                 obj->print( os, indent+1);
    585                 os << endl;
    586         }
    587         os << indent << "... with Statement: " << endl << indent+1;
    588         stmt->print( os, indent+1 );
    589 }
    590 
    591567// Local Variables: //
    592568// tab-width: 4 //
  • src/SynTree/Statement.h

    r8a1d95af rc99a0d1  
    535535};
    536536
    537 class MutexStmt : public Statement {
    538   public:
    539         Statement * stmt;
    540         std::list<Expression *> mutexObjs; // list of mutex objects to acquire
    541 
    542         MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs );
    543         MutexStmt( const MutexStmt & other );
    544         virtual ~MutexStmt();
    545 
    546         virtual MutexStmt * clone() const override { return new MutexStmt( *this ); }
    547         virtual void accept( Visitor & v ) override { v.visit( this ); }
    548         virtual void accept( Visitor & v ) const override { v.visit( this ); }
    549         virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
    550         virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    551 };
    552 
    553537// Local Variables: //
    554538// tab-width: 4 //
  • src/SynTree/SynTree.h

    r8a1d95af rc99a0d1  
    6262class NullStmt;
    6363class ImplicitCtorDtorStmt;
    64 class MutexStmt;
    6564
    6665class Expression;
  • src/SynTree/Visitor.h

    r8a1d95af rc99a0d1  
    9292        virtual void visit( ImplicitCtorDtorStmt * node ) { visit( const_cast<const ImplicitCtorDtorStmt *>(node) ); }
    9393        virtual void visit( const ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
    94         virtual void visit( MutexStmt * node ) { visit( const_cast<const MutexStmt *>(node) ); }
    95         virtual void visit( const MutexStmt * mutexStmt ) = 0;
    9694
    9795        virtual void visit( ApplicationExpr * node ) { visit( const_cast<const ApplicationExpr *>(node) ); }
Note: See TracChangeset for help on using the changeset viewer.