Changes in / [4f7b418:bdfc032]


Ignore:
Files:
29 added
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    r4f7b418 rbdfc032  
    4141headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
    4242headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    43           containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
     43          containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa \
     44          vec/vec.hfa vec/vec2.hfa vec/vec3.hfa vec/vec4.hfa
    4445
    4546libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
  • libcfa/src/Makefile.in

    r4f7b418 rbdfc032  
    142142        time.cfa stdlib.cfa common.cfa containers/maybe.cfa \
    143143        containers/pair.cfa containers/result.cfa \
    144         containers/vector.cfa
     144        containers/vector.cfa vec/vec.cfa vec/vec2.cfa vec/vec3.cfa \
     145        vec/vec4.cfa
    145146am__dirstamp = $(am__leading_dot)dirstamp
    146147@BUILDLIB_TRUE@am__objects_1 = fstream.lo iostream.lo iterator.lo \
     
    148149@BUILDLIB_TRUE@ common.lo containers/maybe.lo \
    149150@BUILDLIB_TRUE@ containers/pair.lo containers/result.lo \
    150 @BUILDLIB_TRUE@ containers/vector.lo
     151@BUILDLIB_TRUE@ containers/vector.lo vec/vec.lo vec/vec2.lo \
     152@BUILDLIB_TRUE@ vec/vec3.lo vec/vec4.lo
    151153@BUILDLIB_TRUE@am__objects_2 = startup.lo interpose.lo bits/debug.lo \
    152154@BUILDLIB_TRUE@ assert.lo exception.lo virtual.lo heap.lo \
     
    237239        limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    238240        containers/maybe.hfa containers/pair.hfa containers/result.hfa \
    239         containers/vector.hfa math.hfa gmp.hfa time_t.hfa \
    240         bits/align.hfa bits/containers.hfa bits/defs.hfa \
    241         bits/debug.hfa bits/locks.hfa concurrency/coroutine.hfa \
     241        containers/vector.hfa vec/vec.hfa vec/vec2.hfa vec/vec3.hfa \
     242        vec/vec4.hfa math.hfa gmp.hfa time_t.hfa bits/align.hfa \
     243        bits/containers.hfa bits/defs.hfa bits/debug.hfa \
     244        bits/locks.hfa concurrency/coroutine.hfa \
    242245        concurrency/thread.hfa concurrency/kernel.hfa \
    243246        concurrency/monitor.hfa concurrency/mutex.hfa \
     
    460463@BUILDLIB_FALSE@headers =
    461464@BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    462 @BUILDLIB_TRUE@   containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
     465@BUILDLIB_TRUE@   containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa \
     466@BUILDLIB_TRUE@   vec/vec.hfa vec/vec2.hfa vec/vec3.hfa vec/vec4.hfa
    463467
    464468@BUILDLIB_FALSE@libsrc =
     
    590594containers/vector.lo: containers/$(am__dirstamp) \
    591595        containers/$(DEPDIR)/$(am__dirstamp)
     596vec/$(am__dirstamp):
     597        @$(MKDIR_P) vec
     598        @: > vec/$(am__dirstamp)
     599vec/$(DEPDIR)/$(am__dirstamp):
     600        @$(MKDIR_P) vec/$(DEPDIR)
     601        @: > vec/$(DEPDIR)/$(am__dirstamp)
     602vec/vec.lo: vec/$(am__dirstamp) vec/$(DEPDIR)/$(am__dirstamp)
     603vec/vec2.lo: vec/$(am__dirstamp) vec/$(DEPDIR)/$(am__dirstamp)
     604vec/vec3.lo: vec/$(am__dirstamp) vec/$(DEPDIR)/$(am__dirstamp)
     605vec/vec4.lo: vec/$(am__dirstamp) vec/$(DEPDIR)/$(am__dirstamp)
    592606
    593607libcfa.la: $(libcfa_la_OBJECTS) $(libcfa_la_DEPENDENCIES) $(EXTRA_libcfa_la_DEPENDENCIES)
     
    629643        -rm -f containers/*.$(OBJEXT)
    630644        -rm -f containers/*.lo
     645        -rm -f vec/*.$(OBJEXT)
     646        -rm -f vec/*.lo
    631647
    632648distclean-compile:
     
    694710        -rm -rf concurrency/.libs concurrency/_libs
    695711        -rm -rf containers/.libs containers/_libs
     712        -rm -rf vec/.libs vec/_libs
    696713install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS)
    697714        @$(NORMAL_INSTALL)
     
    840857        -rm -f containers/$(DEPDIR)/$(am__dirstamp)
    841858        -rm -f containers/$(am__dirstamp)
     859        -rm -f vec/$(DEPDIR)/$(am__dirstamp)
     860        -rm -f vec/$(am__dirstamp)
    842861
    843862maintainer-clean-generic:
  • src/ResolvExpr/ResolveAssertions.cc

    r4f7b418 rbdfc032  
    390390
    391391        /// Limit to depth of recursion of assertion satisfaction
    392         static const int recursionLimit = 4;
     392        static const int recursionLimit = 7;
    393393        /// Maximum number of simultaneously-deferred assertions to attempt concurrent satisfaction of
    394394        static const int deferLimit = 10;
  • src/ResolvExpr/SatisfyAssertions.cpp

    r4f7b418 rbdfc032  
    5757                ast::UniqueId resnSlot;          ///< Slot for any recursive assertion IDs
    5858
    59                 AssnCandidate( 
    60                         const ast::SymbolTable::IdData c, const ast::Type * at, ast::TypeEnvironment && e, 
     59                AssnCandidate(
     60                        const ast::SymbolTable::IdData c, const ast::Type * at, ast::TypeEnvironment && e,
    6161                        ast::AssertionSet && h, ast::AssertionSet && n, ast::OpenVarSet && o, ast::UniqueId rs )
    62                 : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ), 
     62                : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ),
    6363                  need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {}
    6464        };
     
    7373                const AssnCandidate & match;
    7474        };
    75        
    76         /// Wrapper for the deferred items from a single assertion satisfaction. 
     75
     76        /// Wrapper for the deferred items from a single assertion satisfaction.
    7777        /// Acts like an indexed list of DeferRef
    7878        struct DeferItem {
     
    8181                AssnCandidateList matches;
    8282
    83                 DeferItem( 
     83                DeferItem(
    8484                        const ast::DeclWithType * d, const ast::AssertionSetValue & i, AssnCandidateList && ms )
    8585                : decl( d ), info( i ), matches( std::move( ms ) ) {}
     
    117117                /// Initial satisfaction state for a candidate
    118118                SatState( CandidateRef & c, const ast::SymbolTable & syms )
    119                 : cand( c ), need(), newNeed(), deferred(), inferred(), costs{ Cost::zero }, 
     119                : cand( c ), need(), newNeed(), deferred(), inferred(), costs{ Cost::zero },
    120120                  symtab( syms ) { need.swap( c->need ); }
    121                
     121
    122122                /// Update satisfaction state for next step after previous state
    123123                SatState( SatState && o, IterateFlag )
    124                 : cand( std::move( o.cand ) ), need( o.newNeed.begin(), o.newNeed.end() ), newNeed(), 
    125                   deferred(), inferred( std::move( o.inferred ) ), costs( std::move( o.costs ) ), 
     124                : cand( std::move( o.cand ) ), need( o.newNeed.begin(), o.newNeed.end() ), newNeed(),
     125                  deferred(), inferred( std::move( o.inferred ) ), costs( std::move( o.costs ) ),
    126126                  symtab( o.symtab ) { costs.emplace_back( Cost::zero ); }
    127                
     127
    128128                /// Field-wise next step constructor
    129129                SatState(
    130                         CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs, 
     130                        CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs,
    131131                        ast::SymbolTable && syms )
    132                 : cand( std::move( c ) ), need( nn.begin(), nn.end() ), newNeed(), deferred(), 
     132                : cand( std::move( c ) ), need( nn.begin(), nn.end() ), newNeed(), deferred(),
    133133                  inferred( std::move( i ) ), costs( std::move( cs ) ), symtab( std::move( syms ) )
    134134                  { costs.emplace_back( Cost::zero ); }
     
    143143
    144144        /// Binds a single assertion, updating satisfaction state
    145         void bindAssertion( 
    146                 const ast::DeclWithType * decl, const ast::AssertionSetValue & info, CandidateRef & cand, 
     145        void bindAssertion(
     146                const ast::DeclWithType * decl, const ast::AssertionSetValue & info, CandidateRef & cand,
    147147                AssnCandidate & match, InferCache & inferred
    148148        ) {
    149149                const ast::DeclWithType * candidate = match.cdata.id;
    150                 assertf( candidate->uniqueId, 
     150                assertf( candidate->uniqueId,
    151151                        "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
    152                
     152
    153153                ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cvtCost );
    154154                varExpr->result = match.adjType;
     
    175175                        ast::OpenVarSet newOpen{ sat.cand->open };
    176176                        ast::ptr< ast::Type > toType = assn.first->get_type();
    177                         ast::ptr< ast::Type > adjType = 
     177                        ast::ptr< ast::Type > adjType =
    178178                                renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ) );
    179179
     
    187187                                }
    188188
    189                                 matches.emplace_back( 
    190                                         cdata, adjType, std::move( newEnv ), std::move( newNeed ), std::move( have ), 
     189                                matches.emplace_back(
     190                                        cdata, adjType, std::move( newEnv ), std::move( newNeed ), std::move( have ),
    191191                                        std::move( newOpen ), crntResnSlot );
    192192                        }
     
    257257        };
    258258
    259         /// Replace ResnSlots with InferParams and add alternative to output list, if it meets pruning 
     259        /// Replace ResnSlots with InferParams and add alternative to output list, if it meets pruning
    260260        /// threshold.
    261         void finalizeAssertions( 
    262                 CandidateRef & cand, InferCache & inferred, PruneMap & thresholds, CostVec && costs, 
    263                 CandidateList & out 
     261        void finalizeAssertions(
     262                CandidateRef & cand, InferCache & inferred, PruneMap & thresholds, CostVec && costs,
     263                CandidateList & out
    264264        ) {
    265265                // prune if cheaper alternative for same key has already been generated
     
    278278        }
    279279
    280         /// Combo iterator that combines candidates into an output list, merging their environments. 
    281         /// Rejects an appended candidate if environments cannot be merged. See `Common/FilterCombos.h` 
     280        /// Combo iterator that combines candidates into an output list, merging their environments.
     281        /// Rejects an appended candidate if environments cannot be merged. See `Common/FilterCombos.h`
    282282        /// for description of "combo iterator".
    283283        class CandidateEnvMerger {
     
    299299                        Cost cost;
    300300
    301                         OutType( 
    302                                 const ast::TypeEnvironment & e, const ast::OpenVarSet & o, 
     301                        OutType(
     302                                const ast::TypeEnvironment & e, const ast::OpenVarSet & o,
    303303                                const std::vector< DeferRef > & as, const ast::SymbolTable & symtab )
    304304                        : env( e ), open( o ), assns( as ), cost( Cost::zero ) {
     
    306306                                for ( const DeferRef & assn : assns ) {
    307307                                        // compute conversion cost from satisfying decl to assertion
    308                                         cost += computeConversionCost( 
     308                                        cost += computeConversionCost(
    309309                                                assn.match.adjType, assn.decl->get_type(), symtab, env );
    310                                        
     310
    311311                                        // mark vars+specialization on function-type assertions
    312                                         const ast::FunctionType * func = 
     312                                        const ast::FunctionType * func =
    313313                                                GenPoly::getFunctionType( assn.match.cdata.id->get_type() );
    314314                                        if ( ! func ) continue;
     
    317317                                                cost.decSpec( specCost( param->get_type() ) );
    318318                                        }
    319                                        
     319
    320320                                        cost.incVar( func->forall.size() );
    321                                        
     321
    322322                                        for ( const ast::TypeDecl * td : func->forall ) {
    323323                                                cost.decSpec( td->assertions.size() );
     
    329329                };
    330330
    331                 CandidateEnvMerger( 
    332                         const ast::TypeEnvironment & env, const ast::OpenVarSet & open, 
     331                CandidateEnvMerger(
     332                        const ast::TypeEnvironment & env, const ast::OpenVarSet & open,
    333333                        const ast::SymbolTable & syms )
    334334                : crnt(), envs{ env }, opens{ open }, symtab( syms ) {}
     
    357357
    358358        /// Limit to depth of recursion of assertion satisfaction
    359         static const int recursionLimit = 4;
     359        static const int recursionLimit = 7;
    360360        /// Maximum number of simultaneously-deferred assertions to attempt concurrent satisfaction of
    361361        static const int deferLimit = 10;
    362362} // anonymous namespace
    363363
    364 void satisfyAssertions( 
    365         CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out, 
     364void satisfyAssertions(
     365        CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out,
    366366        std::vector<std::string> & errors
    367367) {
     
    408408                                // either add successful match or push back next state
    409409                                if ( sat.newNeed.empty() ) {
    410                                         finalizeAssertions( 
     410                                        finalizeAssertions(
    411411                                                sat.cand, sat.inferred, thresholds, std::move( sat.costs ), out );
    412412                                } else {
     
    430430                                std::vector< CandidateEnvMerger::OutType > compatible = filterCombos(
    431431                                        sat.deferred, CandidateEnvMerger{ sat.cand->env, sat.cand->open, sat.symtab } );
    432                                
     432
    433433                                // fail early if no mutually-compatible assertion satisfaction
    434434                                if ( compatible.empty() ) {
     
    453453                                        // set up next satisfaction state
    454454                                        CandidateRef nextCand = std::make_shared<Candidate>(
    455                                                 sat.cand->expr, std::move( compat.env ), std::move( compat.open ), 
     455                                                sat.cand->expr, std::move( compat.env ), std::move( compat.open ),
    456456                                                ast::AssertionSet{} /* need moved into satisfaction state */,
    457457                                                sat.cand->cost, sat.cand->cvtCost );
     
    459459                                        ast::AssertionSet nextNewNeed{ sat.newNeed };
    460460                                        InferCache nextInferred{ sat.inferred };
    461                                        
     461
    462462                                        CostVec nextCosts{ sat.costs };
    463463                                        nextCosts.back() += compat.cost;
    464                                                                
     464
    465465                                        ast::SymbolTable nextSymtab{ sat.symtab };
    466466
     
    476476                                        // either add successful match or push back next state
    477477                                        if ( nextNewNeed.empty() ) {
    478                                                 finalizeAssertions( 
     478                                                finalizeAssertions(
    479479                                                        nextCand, nextInferred, thresholds, std::move( nextCosts ), out );
    480480                                        } else {
    481                                                 nextSats.emplace_back( 
    482                                                         std::move( nextCand ), std::move( nextNewNeed ), 
    483                                                         std::move( nextInferred ), std::move( nextCosts ), 
     481                                                nextSats.emplace_back(
     482                                                        std::move( nextCand ), std::move( nextNewNeed ),
     483                                                        std::move( nextInferred ), std::move( nextCosts ),
    484484                                                        std::move( nextSymtab ) );
    485485                                        }
     
    493493                nextSats.clear();
    494494        }
    495        
     495
    496496        // exceeded recursion limit if reaches here
    497497        if ( out.empty() ) {
Note: See TracChangeset for help on using the changeset viewer.