Changes in / [a14926b:a7662b8]


Ignore:
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    ra14926b ra7662b8  
    215215                struct __thread_user_link cltr_link;
    216216
     217                // used to store state between clh lock/unlock
     218                volatile bool * clh_prev;
     219
    217220                // used to point to this thd's current clh node
    218221                volatile bool * clh_node;
  • libcfa/src/concurrency/locks.hfa

    ra14926b ra7662b8  
    228228struct clh_lock {
    229229        volatile bool * volatile tail;
    230     volatile bool * volatile head;
    231230};
    232231
     
    238237        *(curr_thd->clh_node) = false;
    239238        volatile bool * prev = __atomic_exchange_n((bool **)(&l.tail), (bool *)(curr_thd->clh_node), __ATOMIC_SEQ_CST);
    240         while(!__atomic_load_n(prev, __ATOMIC_SEQ_CST)) Pause();
    241     __atomic_store_n((bool **)(&l.head), (bool *)curr_thd->clh_node, __ATOMIC_SEQ_CST);
    242     curr_thd->clh_node = prev;
     239        while(!__atomic_load_n(prev, __ATOMIC_ACQUIRE)) Pause();
     240        curr_thd->clh_prev = prev;
    243241}
    244242
    245243static inline void unlock(clh_lock & l) {
    246         __atomic_store_n((bool *)(l.head), true, __ATOMIC_SEQ_CST);
     244        thread$ * curr_thd = active_thread();
     245        __atomic_store_n(curr_thd->clh_node, true, __ATOMIC_RELEASE);
     246        curr_thd->clh_node = curr_thd->clh_prev;
    247247}
    248248
  • src/AST/Pass.hpp

    ra14926b ra7662b8  
    8686        {
    8787                // After the pass is constructed, check if it wants the have a pointer to the wrapping visitor
    88                 type * const * visitor = __pass::visitor( core, 0 );
    89                 if ( visitor ) {
     88                type * const * visitor = __pass::visitor(core, 0);
     89                if(visitor) {
    9090                        *const_cast<type **>( visitor ) = this;
    9191                }
     
    9898
    9999        /// If the core defines a result, call it if possible, otherwise return it.
    100         inline auto get_result() -> decltype( __pass::result::get( core, '0' ) ) {
    101                 return __pass::result::get( core, '0' );
     100        inline auto get_result() -> decltype( __pass::get_result( core, '0' ) ) {
     101                return __pass::get_result( core, '0' );
    102102        }
    103103
  • src/AST/Pass.proto.hpp

    ra14926b ra7662b8  
    489489                template<typename core_t>
    490490                static inline auto replace( core_t &, long, const ast::TypeInstType *& ) {}
     491
    491492        } // namespace forall
    492493
     
    505506        }
    506507
    507         // For passes, usually utility passes, that have a result.
    508         namespace result {
    509                 template<typename core_t>
    510                 static inline auto get( core_t & core, char ) -> decltype( core.result() ) {
    511                         return core.result();
    512                 }
    513 
    514                 template<typename core_t>
    515                 static inline auto get( core_t & core, int ) -> decltype( core.result ) {
    516                         return core.result;
    517                 }
    518 
    519                 template<typename core_t>
    520                 static inline void get( core_t &, long ) {}
    521         }
     508        template<typename core_t>
     509        static inline auto get_result( core_t & core, char ) -> decltype( core.result() ) {
     510                return core.result();
     511        }
     512
     513        template<typename core_t>
     514        static inline auto get_result( core_t & core, int ) -> decltype( core.result ) {
     515                return core.result;
     516        }
     517
     518        template<typename core_t>
     519        static inline void get_result( core_t &, long ) {}
    522520} // namespace __pass
    523521} // namespace ast
  • src/GenPoly/Box.cc

    ra14926b ra7662b8  
    424424        namespace {
    425425                std::string makePolyMonoSuffix( FunctionType const * function, const TyVarMap &tyVars ) {
     426                        std::stringstream name;
     427
    426428                        // NOTE: this function previously used isPolyObj, which failed to produce
    427429                        // the correct thing in some situations. It's not clear to me why this wasn't working.
     
    430432                        // to take those polymorphic types as pointers. Therefore, there can be two different functions
    431433                        // with the same mangled name, so we need to further mangle the names.
    432                         std::stringstream name;
    433434                        for ( DeclarationWithType const * const ret : function->returnVals ) {
    434                                 name << ( isPolyType( ret->get_type(), tyVars ) ? 'P' : 'M' );
    435                         }
    436                         name << '_';
     435                                if ( isPolyType( ret->get_type(), tyVars ) ) {
     436                                        name << "P";
     437                                } else {
     438                                        name << "M";
     439                                }
     440                        }
     441                        name << "_";
    437442                        for ( DeclarationWithType const * const arg : function->parameters ) {
    438                                 name << ( isPolyType( arg->get_type(), tyVars ) ? 'P' : 'M' );
    439                         }
     443                                if ( isPolyType( arg->get_type(), tyVars ) ) {
     444                                        name << "P";
     445                                } else {
     446                                        name << "M";
     447                                }
     448                        } // for
    440449                        return name.str();
    441450                }
     
    556565                        // even when converted to strings, sort in the original order.
    557566                        // (At least, that is the best explination I have.)
    558                         for ( std::pair<const std::string, TypeDecl::Data> const & tyParam : exprTyVars ) {
     567                        for ( std::pair<std::string, TypeDecl::Data> const & tyParam : exprTyVars ) {
    559568                                if ( !tyParam.second.isComplete ) continue;
    560569                                Type *concrete = env->lookup( tyParam.first );
Note: See TracChangeset for help on using the changeset viewer.