Changeset 97f65d5


Ignore:
Timestamp:
Feb 15, 2017, 8:13:49 AM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
e6512c8
Parents:
aa9ee19 (diff), 3149e7e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

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

Files:
3 added
40 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    raa9ee19 r97f65d5  
    8080                        make_doc()
    8181                }
     82}
     83
     84def benchmark() {
     85        stage 'Benchmark'
     86
     87                status_prefix = 'Documentation'
     88
     89                // sh 'make -C src/benchmark csv-data >> /u/cforall/public_html/perf-history/concurrency.csv'
    8290}
    8391
     
    183191                                doc_build()
    184192
     193                                //Run benchmark and save result
     194                                benchmark()
     195
    185196                                if( bIsFullBuild ) {
    186197                                        //Compile using gcc-5
  • src/CodeTools/DeclStats.cc

    raa9ee19 r97f65d5  
    1818#include <iostream>
    1919#include <map>
     20#include <sstream>
    2021#include <string>
    2122#include <unordered_map>
     
    7172                                return *this;
    7273                        }
    73 
    74                         /// Update based on a declaration list
    75                         ArgPackStats& operator+= ( std::list<DeclarationWithType*>& decls ) {
    76                                 unsigned nn = 0;
    77                                 unsigned nn_basic = 0;
    78                                 unsigned nn_poly = 0;
    79                                 for ( auto decl : decls ) {
    80                                         nn += decl->get_type()->size();
    81                                         if ( dynamic_cast<BasicType*>( decl->get_type() ) ) ++nn_basic;
    82                                         else if ( GenPoly::hasPolyBase( decl->get_type() ) ) ++nn_poly;
    83                                 }
    84                                 ++n.at( nn );
    85                                 ++n_basic.at( nn_basic );
    86                                 ++n_poly.at( nn_poly );
    87                                 if ( nn > 0 ) {
    88                                         ++p_basic[ nn_basic*100/nn ];
    89                                         ++p_poly[ nn_poly*100/nn ];
    90                                 }
    91                                
    92                                 return *this;
    93                         }
    9474                };
    9575               
     
    10080                        /// Count of declarations with each name
    10181                        std::unordered_map<std::string, unsigned> by_name;
     82                        /// Count of uses of each basic type
     83                        std::unordered_map<std::string, unsigned> basic_type_names;
     84                        /// Count of uses of each non-basic type
     85                        std::unordered_map<std::string, unsigned> compound_type_names;
    10286                        /// Stats for the parameter list
    10387                        ArgPackStats params;
     
    11296                        ArgPackStats assn_returns;
    11397                       
    114                         Stats() : n_decls(0), n_type_params(), by_name(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
     98                        Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
    11599
    116100                public:
     
    119103                                sum( n_type_params, o.n_type_params );
    120104                                sum( by_name, o.by_name );
     105                                sum( basic_type_names, o.basic_type_names );
     106                                sum( compound_type_names, o.compound_type_names );
    121107                                sum( params, o.params );
    122108                                sum( returns, o.returns );
     
    133119                Stats total;
    134120
    135                 void analyzeFunc( FunctionType* fnTy, ArgPackStats& params, ArgPackStats& returns ) {
    136                         params += fnTy->get_parameters();
    137                         returns += fnTy->get_returnVals();
     121                /// Update arg pack stats based on a declaration list
     122                void analyze( Stats& stats, ArgPackStats& pstats, std::list<DeclarationWithType*>& decls ) {
     123                        unsigned n = 0;
     124                        unsigned n_basic = 0;
     125                        unsigned n_poly = 0;
     126                        for ( auto decl : decls ) {
     127                                n += decl->get_type()->size();
     128                                if ( BasicType* bt = dynamic_cast<BasicType*>( decl->get_type() ) ) {
     129                                        ++n_basic;
     130                                        std::stringstream ss;
     131                                        bt->print( ss );
     132                                        ++stats.basic_type_names[ ss.str() ];
     133                                } else if ( GenPoly::hasPolyBase( decl->get_type() ) ) {
     134                                        ++n_poly;
     135                                } else {
     136                                        std::stringstream ss;
     137                                        decl->get_type()->print( ss );
     138                                        ++stats.compound_type_names[ ss.str() ];
     139                                }
     140                        }
     141                        ++pstats.n.at( n );
     142                        ++pstats.n_basic.at( n_basic );
     143                        ++pstats.n_poly.at( n_poly );
     144                        if ( n > 0 ) {
     145                                ++pstats.p_basic[ n_basic*100/n ];
     146                                ++pstats.p_poly[ n_poly*100/n ];
     147                        }
     148                }
     149               
     150                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
     151                        analyze( stats, params, fnTy->get_parameters() );
     152                        analyze( stats, returns, fnTy->get_returnVals() );
    138153                }
    139154
     
    164179                                                assnTy = assnDecl->get_functionType();
    165180                                        }
    166                                         if ( assnTy ) analyzeFunc( assnTy, stats.assn_params, stats.assn_returns );
     181                                        if ( assnTy ) analyzeFunc( assnTy, stats, stats.assn_params, stats.assn_returns );
    167182                                }
    168183                        }
     
    171186                        ++stats.by_name[ decl->get_name() ];
    172187
    173                         analyzeFunc( fnTy, stats.params, stats.returns );
     188                        analyzeFunc( fnTy, stats, stats.params, stats.returns );
    174189                }
    175190
     
    266281                        printAll("unique_names", [](const Stats& stats) { return stats.by_name.size(); });
    267282                        printAllSparseHisto("overloads", [](const Stats& stats) { return stats.by_name; });
     283                        printAll("basic_type_names", [](const Stats& stats) { return stats.basic_type_names.size(); });
     284                        printAllSparseHisto("basic_type_uses", [](const Stats& stats) { return stats.basic_type_names; });
     285                        printAll("compound_type_names", [](const Stats& stats) { return stats.compound_type_names.size(); });
     286                        printAllSparseHisto("compound_type_uses", [](const Stats& stats) { return stats.compound_type_names; });
    268287                        printAllPack("params", [](const Stats& stats) { return stats.params; });
    269288                        printAllPack("returns", [](const Stats& stats) { return stats.returns; });
  • src/Common/ScopedMap.h

    raa9ee19 r97f65d5  
    230230        }
    231231
     232        /// Finds the given key in the provided scope; returns end() for none such
     233        iterator findAt( size_type scope, const Key& key ) {
     234                typename Scope::iterator val = scopes[scope].find( key );
     235                if ( val != scopes[scope].end() ) return iterator( scopes, val, scope );
     236                return end();
     237        }
     238        const_iterator findAt( size_type scope, const Key& key ) const {
     239                return const_iterator( const_cast< ScopedMap< Key, Value >* >(this)->findAt( scope, key ) );
     240        }
     241
    232242        /// Finds the given key in the outermost scope inside the given scope where it occurs
    233243        iterator findNext( const_iterator &it, const Key &key ) {
  • src/Common/SemanticError.cc

    raa9ee19 r97f65d5  
    2222#include "SemanticError.h"
    2323
     24#include <unistd.h>
     25
     26inline const std::string& error_str() {
     27        static std::string str = isatty( fileno(stderr) ) ? "\e[31merror:\e[39m " : "error: ";
     28        return str;
     29}
     30
    2431SemanticError::SemanticError() {
    2532}
    2633
    2734SemanticError::SemanticError( std::string error ) {
    28   append( error );
     35        append( error );
    2936}
    3037
    3138void SemanticError::append( SemanticError &other ) {
    32   errors.splice( errors.end(), other.errors );
     39        errors.splice( errors.end(), other.errors );
    3340}
    3441
    3542void SemanticError::append( const std::string & msg ) {
    36   errors.push_back( std::string( "Error: ") + msg );
     43        errors.emplace_back( error_str() + msg );
    3744}
    3845
     
    4249
    4350void SemanticError::print( std::ostream &os ) {
    44         std::copy( errors.begin(), errors.end(), std::ostream_iterator< std::string >( os, "\n" ) );
     51        using std::to_string;
     52        for(auto err : errors) {
     53                os << to_string( err.location ) << err.description << '\n';
     54        }
     55}
     56
     57void SemanticError::set_location( const CodeLocation& location ) {
     58        errors.begin()->maybeSet( location );
    4559}
    4660
  • src/Common/SemanticError.h

    raa9ee19 r97f65d5  
    2323#include <iostream>
    2424
     25#include "utility.h"
     26
     27struct error {
     28        std::string description;
     29        CodeLocation location;
     30
     31        error() = default;
     32        error( const std::string& str ) : description( str ) {}
     33
     34        void maybeSet( const CodeLocation& location ) {
     35                if( this->location.linenumber < 0 ) {
     36                        this->location = location;
     37                }
     38        }
     39};
     40
    2541class SemanticError : public std::exception {
    2642  public:
     
    3551        void print( std::ostream &os );
    3652
     53        void set_location( const CodeLocation& location );
    3754        // constructs an exception using the given message and the printed
    3855        // representation of the obj (T must have a print method)
    3956  private:
    40         std::list< std::string > errors;
     57        std::list< error > errors;
    4158};
    4259
  • src/Common/VectorMap.h

    raa9ee19 r97f65d5  
    3838        typedef const const_value_type* const_pointer;
    3939       
    40         class iterator : public std::iterator< std::bidirectional_iterator_tag,
     40        class iterator : public std::iterator< std::random_access_iterator_tag,
    4141                                               value_type,
    42                                                                                     difference_type,
    43                                                                                         pointer,
    44                                                                                         reference > {
     42                                                                                   difference_type,
     43                                                                                   pointer,
     44                                                                                   reference > {
    4545        friend class VectorMap;
    4646        friend class const_iterator;
     
    7474                iterator operator-- (int) { iterator tmp = *this; --(*this); return tmp; }
    7575
     76                iterator& operator+= (difference_type i) {
     77                        // SHENANIGANS: same reasons as operator++
     78                        new(&data) value_type{ (data.first + i), *(&data.second + i) };
     79                        return *this;
     80                }
     81
     82                iterator operator+ (difference_type i) const { iterator tmp = *this; return tmp += i; }
     83
     84                iterator& operator-= (difference_type i) {
     85                        // SHENANIGANS: same reasons as operator++
     86                        new(&data) value_type{ (data.first - i), *(&data.second - i) };
     87                        return *this;
     88                }
     89
     90                iterator operator- (difference_type i) const { iterator tmp = *this; return tmp -= i; }
     91
     92                difference_type operator- (const iterator& o) const { return data.first - o.data.first; }
     93
     94                value_type operator[] (difference_type i) const {
     95                        // SHENANIGANS: same reasons as operator++
     96                        return value_type{ (data.first + i), *(&data.second + i) };
     97                }
     98
    7699                bool operator== (const iterator& o) const {
    77100                        return data.first == o.data.first && &data.second == &o.data.second;
    78101                }
     102               
    79103                bool operator!= (const iterator& that) const { return !(*this == that); }
     104
     105                bool operator< (const iterator& o) const { return data.first < o.data.first; }
     106
     107                bool operator> (const iterator& o) const { return data.first > o.data.first; }
     108
     109                bool operator<= (const iterator& o) const { return data.first <= o.data.first; }
     110
     111                bool operator>= (const iterator& o) const { return data.first >= o.data.first; }
    80112        };
    81113
     
    118150                const_iterator operator-- (int) { const_iterator tmp = *this; --(*this); return tmp; }
    119151
     152                const_iterator& operator+= (difference_type i) {
     153                        // SHENANIGANS: same reasons as iterator::operator++
     154                        new(&data) const_value_type{ (data.first + i), *(&data.second + i) };
     155                        return *this;
     156                }
     157
     158                const_iterator operator+ (difference_type i) const {
     159                        const_iterator tmp = *this; return tmp += i;
     160                }
     161
     162                const_iterator& operator-= (difference_type i) {
     163                        // SHENANIGANS: same reasons as iterator::operator++
     164                        new(&data) const_value_type{ (data.first - i), *(&data.second - i) };
     165                        return *this;
     166                }
     167
     168                const_iterator operator- (difference_type i) const {
     169                        const_iterator tmp = *this; return tmp -= i;
     170                }
     171
     172                difference_type operator- (const const_iterator& o) const {
     173                        return data.first - o.data.first;
     174                }
     175
     176                const_value_type operator[] (difference_type i) const {
     177                        // SHENANIGANS: same reasons as iterator::operator++
     178                        return const_value_type{ (data.first + i), *(&data.second + i) };
     179                }
     180
    120181                bool operator== (const const_iterator& o) const {
    121182                        return data.first == o.data.first && &data.second == &o.data.second;
    122183                }
     184               
    123185                bool operator!= (const const_iterator& that) const { return !(*this == that); }
     186
     187                bool operator< (const const_iterator& o) const { return data.first < o.data.first; }
     188
     189                bool operator> (const const_iterator& o) const { return data.first > o.data.first; }
     190
     191                bool operator<= (const const_iterator& o) const { return data.first <= o.data.first; }
     192
     193                bool operator>= (const const_iterator& o) const { return data.first >= o.data.first; }
    124194        };
    125195
     
    163233};
    164234
     235template<typename T>
     236typename VectorMap<T>::iterator operator+ (typename VectorMap<T>::difference_type i,
     237                                           const typename VectorMap<T>::iterator& it) {
     238        return it + i;
     239}
     240
     241template<typename T>
     242typename VectorMap<T>::const_iterator operator+ (typename VectorMap<T>::difference_type i,
     243                                                 const typename VectorMap<T>::const_iterator& it) {
     244        return it + i;
     245}
     246
    165247#endif // _VECTORMAP_H
    166248
  • src/Common/utility.h

    raa9ee19 r97f65d5  
    2525#include <sstream>
    2626#include <string>
     27
    2728#include <cassert>
    28 
    2929template< typename T >
    3030static inline T * maybeClone( const T *orig ) {
     
    303303        return group_iterate_t<Args...>(args...);
    304304}
     305
     306struct CodeLocation {
     307        int linenumber;
     308        std::string filename;
     309
     310        CodeLocation()
     311                : linenumber( -1 )
     312                , filename("")
     313        {}
     314
     315        CodeLocation( const char* filename, int lineno )
     316                : linenumber( lineno )
     317                , filename(filename ? filename : "")
     318        {}
     319};
     320
     321inline std::string to_string( const CodeLocation& location ) {
     322        return location.linenumber >= 0 ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
     323}
    305324#endif // _UTILITY_H
    306325
  • src/GenPoly/Box.cc

    raa9ee19 r97f65d5  
    236236                                } // if
    237237                        } catch( SemanticError &e ) {
     238                                e.set_location( (*i)->location );
    238239                                errors.append( e );
    239240                        } // try
  • src/GenPoly/InstantiateGeneric.cc

    raa9ee19 r97f65d5  
    122122                /// Adds a value for a (key, typeList) pair to the current scope
    123123                void insert( Key *key, const std::list< TypeExpr* > &params, Value *value ) {
    124                         instantiations[ key ].push_back( Instantiation( TypeList( params ), value ) );
     124                        auto it = instantiations.findAt( instantiations.currentScope(), key );
     125                        if ( it == instantiations.end() ) {
     126                                instantiations.insert( key, ValueList{ Instantiation{ TypeList( params ), value } } );
     127                        } else {
     128                                it->second.push_back( Instantiation{ TypeList( params ), value } );
     129                        }
    125130                }
    126131        };
  • src/InitTweak/FixInit.cc

    raa9ee19 r97f65d5  
    313313                                        translationUnit.splice( i, fixer.staticDtorDecls );
    314314                                } catch( SemanticError &e ) {
     315                                        e.set_location( (*i)->location );
    315316                                        errors.append( e );
    316317                                } // try
  • src/Parser/DeclarationNode.cc

    raa9ee19 r97f65d5  
    921921                                Declaration * decl = extr->build();
    922922                                if ( decl ) {
     923                                        decl->location = cur->location;
    923924                                        * out++ = decl;
    924925                                } // if
     
    928929                        Declaration * decl = cur->build();
    929930                        if ( decl ) {
     931                                decl->location = cur->location;
    930932                                * out++ = decl;
    931933                        } // if
    932934                } catch( SemanticError &e ) {
     935                        e.set_location( cur->location );
    933936                        errors.append( e );
    934937                } // try
     
    950953                        if ( decl ) {
    951954                                if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     955                                        dwt->location = cur->location;
    952956                                        * out++ = dwt;
    953957                                } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {
    954958                                        StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
    955                                         * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
     959                                        auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
     960                                        obj->location = cur->location;
     961                                        * out++ = obj;
    956962                                        delete agg;
    957963                                } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
    958964                                        UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
    959                                         * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
     965                                        auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
     966                                        obj->location = cur->location;
     967                                        * out++ = obj;
    960968                                } // if
    961969                        } // if
    962970                } catch( SemanticError &e ) {
     971                        e.set_location( cur->location );
    963972                        errors.append( e );
    964973                } // try
     
    979988                        * out++ = cur->buildType();
    980989                } catch( SemanticError &e ) {
     990                        e.set_location( cur->location );
    981991                        errors.append( e );
    982992                } // try
  • src/Parser/ParseNode.h

    raa9ee19 r97f65d5  
    3939//##############################################################################
    4040
     41extern char* yyfilename;
     42extern int yylineno;
     43
    4144class ParseNode {
    4245  public:
     
    6568        ParseNode * next = nullptr;
    6669        std::string * name = nullptr;
     70        CodeLocation location = { yyfilename, yylineno };
    6771}; // ParseNode
    6872
     
    410414        while ( cur ) {
    411415                try {
    412 //                      SynTreeType * result = dynamic_cast< SynTreeType * >( maybeBuild< typename std::result_of< decltype(&NodeType::build)(NodeType)>::type >( cur ) );
    413416                        SynTreeType * result = dynamic_cast< SynTreeType * >( maybeBuild< typename std::pointer_traits< decltype(cur->build())>::element_type >( cur ) );
    414417                        if ( result ) {
     418                                result->location = cur->location;
    415419                                * out++ = result;
    416420                        } // if
    417421                } catch( SemanticError &e ) {
     422                        e.set_location( cur->location );
    418423                        errors.append( e );
    419424                } // try
  • src/ResolvExpr/Resolver.cc

    raa9ee19 r97f65d5  
    8686                Resolver resolver;
    8787                acceptAll( translationUnit, resolver );
    88 #if 0
    89                 resolver.print( cerr );
    90                 for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
    91                         (*i)->print( std::cerr );
    92                         (*i)->accept( resolver );
    93                 } // for
    94 #endif
    9588        }
    9689
  • src/SymTab/Validate.cc

    raa9ee19 r97f65d5  
    629629                } else {
    630630                        TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() );
    631                         assert( base != typedeclNames.end() );
     631                        assertf( base != typedeclNames.end(), "Can't find name %s", typeInst->get_name().c_str() );
    632632                        typeInst->set_baseType( base->second );
    633633                } // if
  • src/SynTree/Declaration.h

    raa9ee19 r97f65d5  
    1717#define DECLARATION_H
    1818
     19#include <string>
     20
     21#include "BaseSyntaxNode.h"
     22#include "Mutator.h"
     23#include "Visitor.h"
    1924#include "SynTree.h"
    20 #include "Visitor.h"
    21 #include "Mutator.h"
    2225#include "Parser/LinkageSpec.h"
    2326#include "Parser/ParseNode.h"
    24 #include <string>
    25 
    26 class Declaration {
     27
     28class Declaration : public BaseSyntaxNode {
    2729  public:
    2830        Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage );
  • src/SynTree/Expression.h

    raa9ee19 r97f65d5  
    1919#include <map>
    2020#include <memory>
     21
     22#include "BaseSyntaxNode.h"
     23#include "Constant.h"
     24#include "Mutator.h"
    2125#include "SynTree.h"
    2226#include "Visitor.h"
    23 #include "Mutator.h"
    24 #include "Constant.h"
    2527#include "Common/UniqueName.h"
    2628
    2729/// Expression is the root type for all expressions
    28 class Expression {
     30class Expression : public BaseSyntaxNode{
    2931  public:
    3032        Expression( Expression * _aname = nullptr );
  • src/SynTree/Initializer.h

    raa9ee19 r97f65d5  
    1717#define INITIALIZER_H
    1818
     19#include <cassert>
     20
     21#include "BaseSyntaxNode.h"
     22#include "Mutator.h"
    1923#include "SynTree.h"
     24#include "Type.h"
    2025#include "Visitor.h"
    21 #include "Mutator.h"
    22 #include "Type.h"
    23 
    24 #include <cassert>
    2526
    2627const std::list<Expression*> noDesignators;
    2728
    2829// Initializer: base class for object initializers (provide default values)
    29 class Initializer {
     30class Initializer : public BaseSyntaxNode {
    3031  public:
    3132        //      Initializer( std::string _name = std::string(""), int _pos = 0 );
  • src/SynTree/Mutator.h

    raa9ee19 r97f65d5  
    139139                        } // if
    140140                } catch( SemanticError &e ) {
     141                        e.set_location( (*i)->location );
    141142                        errors.append( e );
    142143                } // try
  • src/SynTree/Statement.h

    raa9ee19 r97f65d5  
    1717#define STATEMENT_H
    1818
     19#include "BaseSyntaxNode.h"
     20#include "Label.h"
     21#include "Mutator.h"
    1922#include "SynTree.h"
     23#include "Type.h"
    2024#include "Visitor.h"
    21 #include "Mutator.h"
    2225#include "Common/SemanticError.h"
    23 #include "Type.h"
    24 #include "Label.h"
    25 
    26 class Statement {
     26
     27class Statement : public BaseSyntaxNode {
    2728  public:
    2829        Statement( std::list<Label> labels );
  • src/SynTree/Type.h

    raa9ee19 r97f65d5  
    1717#define TYPE_H
    1818
     19#include "BaseSyntaxNode.h"
     20#include "Mutator.h"
    1921#include "SynTree.h"
    2022#include "Visitor.h"
    21 #include "Mutator.h"
    2223#include "Common/utility.h"
    2324
    24 class Type {
     25class Type : public BaseSyntaxNode {
    2526  public:
    2627        struct Qualifiers {
  • src/SynTree/Visitor.h

    raa9ee19 r97f65d5  
    133133                        }
    134134                } catch( SemanticError &e ) {
     135                        e.set_location( (*i)->location );
    135136                        errors.append( e );
    136137                }
     
    159160                        } // if
    160161                } catch( SemanticError &e ) {
     162                        e.set_location( (*i)->location );                       
    161163                        errors.append( e );
    162164                } // try
  • src/benchmark/Makefile.am

    raa9ee19 r97f65d5  
    4444        @rm -f ./a.out
    4545
     46csv-data:
     47        @${CC} ${AM_CFLAGS} ${CFLAGS} $${ccflags} -nodebug -lrt -quiet -DN=10000000 csv-data.c
     48        @./a.out
     49        @rm -f ./a.out
  • src/benchmark/Makefile.in

    raa9ee19 r97f65d5  
    491491        @rm -f ./a.out
    492492
     493csv-data:
     494        @${CC} ${AM_CFLAGS} ${CFLAGS} $${ccflags} -nodebug -lrt -quiet -DN=10000000 csv-data.c
     495        @./a.out
     496        @rm -f ./a.out
     497
    493498# Tell versions [3.59,3.63) of GNU make to not export all variables.
    494499# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/libcfa/concurrency/coroutines

    raa9ee19 r97f65d5  
    7777                "Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
    7878                src->name, src );
    79         assertf( src->last->notHalted,
     79        assertf( src->last->state != Halted,
    8080                "Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
    8181                "Possible cause is terminated coroutine's main routine has already returned.",
     
    9898      // not resuming self ?
    9999        if ( src != dst ) {
    100                 assertf( dst->notHalted ,
     100                assertf( dst->state != Halted ,
    101101                        "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
    102102                        "Possible cause is terminated coroutine's main routine has already returned.",
     
    116116      // not resuming self ?
    117117        if ( src != dst ) {
    118                 assertf( dst->notHalted ,
     118                assertf( dst->state != Halted ,
    119119                        "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
    120120                        "Possible cause is terminated coroutine's main routine has already returned.",
  • src/libcfa/concurrency/coroutines.c

    raa9ee19 r97f65d5  
    6161
    6262void ?{}(coroutine* this) {
    63         this->name = "Anonymous Coroutine";
    64         this->errno_ = 0;
    65         this->state = Start;
    66       this->notHalted = true;
    67         this->starter = NULL;
    68         this->last = NULL;
     63        this{ "Anonymous Coroutine" };
    6964}
    7065
     
    7368        this->errno_ = 0;
    7469        this->state = Start;
    75       this->notHalted = true;
    7670        this->starter = NULL;
    7771        this->last = NULL;
     
    169163        this->context = this->base;
    170164        this->top = (char *)this->context + cxtSize;
    171 
    172         LIB_DEBUG_PRINTF("Coroutine : created stack %p\n", this->base);
    173165}
    174166
  • src/libcfa/concurrency/invoke.c

    raa9ee19 r97f65d5  
    4848      main( this );
    4949
    50       cor->state = Halt;
    51       cor->notHalted = false;
     50      cor->state = Halted;
    5251
    5352      //Final suspend, should never return
  • src/libcfa/concurrency/invoke.h

    raa9ee19 r97f65d5  
    3030      #define SCHEDULER_CAPACITY 10
    3131
     32      struct spinlock {
     33            volatile int lock;
     34      };
     35
    3236      struct simple_thread_list {
    3337            struct thread * head;
    3438            struct thread ** tail;
     39      };
     40
     41      struct signal_once {
     42            volatile bool condition;
     43            struct spinlock lock;
     44            struct simple_thread_list blocked;
    3545      };
    3646
     
    4050            void append( struct simple_thread_list *, struct thread * );
    4151            struct thread * pop_head( struct simple_thread_list * );
     52
     53            void ?{}(spinlock * this);
     54            void ^?{}(spinlock * this);
     55
     56            void ?{}(signal_once * this);
     57            void ^?{}(signal_once * this);
    4258      }
    4359      #endif
     
    5369      };
    5470
    55       enum coroutine_state { Start, Inactive, Active, Halt, Primed };
     71      enum coroutine_state { Halted, Start, Inactive, Active, Primed };
    5672
    5773      struct coroutine {
     
    6076            int errno_;                         // copy of global UNIX variable errno
    6177            enum coroutine_state state; // current execution status for coroutine
    62             bool notHalted;                     // indicate if execuation state is not halted
    63 
    6478            struct coroutine *starter;  // first coroutine to resume this one
    6579            struct coroutine *last;             // last coroutine to resume this one
    6680      };
    6781
    68       struct simple_lock {
    69         struct simple_thread_list blocked;
    70       };
    71 
    7282      struct thread {
    73             struct coroutine c;
    74             struct simple_lock lock;
    75             struct thread * next;
     83            struct coroutine c;           // coroutine body used to store context
     84            struct signal_once terminated;// indicate if execuation state is not halted
     85            struct thread * next;         // instrusive link field for threads
    7686      };
    7787
  • src/libcfa/concurrency/kernel

    raa9ee19 r97f65d5  
    99//
    1010// Author           : Thierry Delisle
    11 // Created On       : Tue Jan 17 12:27:26 2016
     11// Created On       : Tue Jan 17 12:27:26 2017
    1212// Last Modified By : Thierry Delisle
    1313// Last Modified On : --
     
    2727
    2828//-----------------------------------------------------------------------------
     29// Locks
     30void lock( spinlock * );
     31void unlock( spinlock * );
     32
     33void wait( signal_once * );
     34void signal( signal_once * );
     35
     36//-----------------------------------------------------------------------------
    2937// Cluster
    3038struct cluster {
    3139        simple_thread_list ready_queue;
    32         // pthread_spinlock_t lock;
     40        spinlock lock;
    3341};
    3442
     
    3846//-----------------------------------------------------------------------------
    3947// Processor
    40 enum ProcessorAction {
    41         Reschedule,
    42         NoAction
     48enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule };
     49struct FinishAction {
     50        FinishOpCode action_code;
     51        thread * thrd;
     52        spinlock * lock;
    4353};
     54static inline void ?{}(FinishAction * this) {
     55        this->action_code = No_Action;
     56        this->thrd = NULL;
     57        this->lock = NULL;
     58}
     59static inline void ^?{}(FinishAction * this) {}
    4460
    4561struct processor {
     
    4965        thread * current_thread;
    5066        pthread_t kernel_thread;
    51         simple_lock lock;
    52         volatile bool terminated;
    53         ProcessorAction thread_action;
     67       
     68        signal_once terminated;
     69        volatile bool is_terminated;
     70
     71        struct FinishAction finish;
    5472};
    5573
     
    5775void ?{}(processor * this, cluster * cltr);
    5876void ^?{}(processor * this);
    59 
    60 
    61 //-----------------------------------------------------------------------------
    62 // Locks
    63 
    64 void ?{}(simple_lock * this);
    65 void ^?{}(simple_lock * this);
    66 
    67 void lock( simple_lock * );
    68 void unlock( simple_lock * );
    6977
    7078#endif //KERNEL_H
  • src/libcfa/concurrency/kernel.c

    raa9ee19 r97f65d5  
    99//
    1010// Author           : Thierry Delisle
    11 // Created On       : Tue Jan 17 12:27:26 2016
     11// Created On       : Tue Jan 17 12:27:26 2017
    1212// Last Modified By : Thierry Delisle
    1313// Last Modified On : --
     
    2020
    2121//Header
    22 #include "kernel"
     22#include "kernel_private.h"
    2323
    2424//C Includes
     
    3131//CFA Includes
    3232#include "libhdr.h"
    33 #include "threads"
    3433
    3534//Private includes
     
    3736#include "invoke.h"
    3837
    39 static volatile int lock;
    40 
    41 void spin_lock( volatile int *lock ) {
    42         for ( unsigned int i = 1;; i += 1 ) {
    43           if ( *lock == 0 && __sync_lock_test_and_set_4( lock, 1 ) == 0 ) break;
    44         }
    45 }
    46 
    47 void spin_unlock( volatile int *lock ) {
    48         __sync_lock_release_4( lock );
    49 }
    50 
    5138//-----------------------------------------------------------------------------
    5239// Kernel storage
    53 struct processorCtx_t {
    54         processor * proc;
    55         coroutine c;
    56 };
    57 
    58 DECL_COROUTINE(processorCtx_t);
    59 
    6040#define KERNEL_STORAGE(T,X) static char X##_storage[sizeof(T)]
    6141
     
    127107        this->name = "Main Thread";
    128108        this->errno_ = 0;
    129         this->state = Inactive;
    130         this->notHalted = true;
     109        this->state = Start;
    131110}
    132111
     
    149128}
    150129
    151 void start(processor * this);
    152 
    153130void ?{}(processor * this) {
    154131        this{ systemCluster };
     
    159136        this->current_coroutine = NULL;
    160137        this->current_thread = NULL;
    161         (&this->lock){};
    162         this->terminated = false;
     138        (&this->terminated){};
     139        this->is_terminated = false;
    163140
    164141        start( this );
     
    169146        this->current_coroutine = NULL;
    170147        this->current_thread = NULL;
    171         (&this->lock){};
    172         this->terminated = false;
     148        (&this->terminated){};
     149        this->is_terminated = false;
    173150
    174151        this->runner = runner;
     
    178155
    179156void ^?{}(processor * this) {
    180         if( ! this->terminated ) {
     157        if( ! this->is_terminated ) {
    181158                LIB_DEBUG_PRINTF("Kernel : core %p signaling termination\n", this);
    182                 this->terminated = true;
    183                 lock( &this->lock );
     159                this->is_terminated = true;
     160                wait( &this->terminated );
    184161        }
    185162}
     
    187164void ?{}(cluster * this) {
    188165        ( &this->ready_queue ){};
    189         lock = 0;
     166        ( &this->lock ){};
    190167}
    191168
     
    194171}
    195172
    196 //-----------------------------------------------------------------------------
    197 // Processor running routines
    198 void main(processorCtx_t *);
    199 thread * nextThread(cluster * this);
    200 void scheduleInternal(processor * this, thread * dst);
    201 void spin(processor * this, unsigned int * spin_count);
    202 void thread_schedule( thread * thrd );
    203 
     173//=============================================================================================
     174// Kernel Scheduling logic
     175//=============================================================================================
    204176//Main of the processor contexts
    205177void main(processorCtx_t * runner) {
     
    207179        LIB_DEBUG_PRINTF("Kernel : core %p starting\n", this);
    208180
    209         fenv_t envp;
    210         fegetenv( &envp );
    211         LIB_DEBUG_PRINTF("Kernel : mxcsr %x\n", envp.__mxcsr);
    212 
    213181        thread * readyThread = NULL;
    214         for( unsigned int spin_count = 0; ! this->terminated; spin_count++ ) {
    215                
     182        for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )
     183        {
    216184                readyThread = nextThread( this->cltr );
    217185
    218                 if(readyThread) {
    219                         scheduleInternal(this, readyThread);
     186                if(readyThread)
     187                {
     188                        runThread(this, readyThread);
     189
     190                        //Some actions need to be taken from the kernel
     191                        finishRunning(this);
     192
    220193                        spin_count = 0;
    221                 } else {
     194                }
     195                else
     196                {
    222197                        spin(this, &spin_count);
    223198                }               
     
    225200
    226201        LIB_DEBUG_PRINTF("Kernel : core %p unlocking thread\n", this);
    227         unlock( &this->lock );
     202        signal( &this->terminated );
    228203        LIB_DEBUG_PRINTF("Kernel : core %p terminated\n", this);
    229204}
    230205
    231 //Declarations for scheduleInternal
    232 extern void ThreadCtxSwitch(coroutine * src, coroutine * dst);
    233 
    234 // scheduleInternal runs a thread by context switching
     206// runThread runs a thread by context switching
    235207// from the processor coroutine to the target thread
    236 void scheduleInternal(processor * this, thread * dst) {
    237         this->thread_action = NoAction;
    238 
    239         // coroutine * proc_ctx = get_coroutine(this->ctx);
    240         // coroutine * thrd_ctx = get_coroutine(dst);
    241 
    242         // //Update global state
    243         // this->current_thread = dst;
    244 
    245         // // Context Switch to the thread
    246         // ThreadCtxSwitch(proc_ctx, thrd_ctx);
    247         // // when ThreadCtxSwitch returns we are back in the processor coroutine
    248 
    249         coroutine * proc_ctx = get_coroutine(this->runner);
    250         coroutine * thrd_ctx = get_coroutine(dst);
    251       thrd_ctx->last = proc_ctx;
    252  
    253       // context switch to specified coroutine
    254       // Which is now the current_coroutine
    255       // LIB_DEBUG_PRINTF("Kernel : switching to ctx %p (from %p, current %p)\n", thrd_ctx, proc_ctx, this->current_coroutine);
    256       this->current_thread = dst;
    257       this->current_coroutine = thrd_ctx;
    258       CtxSwitch( proc_ctx->stack.context, thrd_ctx->stack.context );
    259       this->current_coroutine = proc_ctx;
    260       // LIB_DEBUG_PRINTF("Kernel : returned from ctx %p (to %p, current %p)\n", thrd_ctx, proc_ctx, this->current_coroutine);
    261  
    262       // when CtxSwitch returns we are back in the processor coroutine
    263         if(this->thread_action == Reschedule) {
    264                 thread_schedule( dst );
     208void runThread(processor * this, thread * dst) {
     209        coroutine * proc_cor = get_coroutine(this->runner);
     210        coroutine * thrd_cor = get_coroutine(dst);
     211       
     212        //Reset the terminating actions here
     213        this->finish.action_code = No_Action;
     214
     215        //Update global state
     216        this->current_thread = dst;
     217
     218        // Context Switch to the thread
     219        ThreadCtxSwitch(proc_cor, thrd_cor);
     220        // when ThreadCtxSwitch returns we are back in the processor coroutine
     221}
     222
     223// Once a thread has finished running, some of
     224// its final actions must be executed from the kernel
     225void finishRunning(processor * this) {
     226        if( this->finish.action_code == Release ) {
     227                unlock( this->finish.lock );
     228        }
     229        else if( this->finish.action_code == Schedule ) {
     230                ScheduleThread( this->finish.thrd );
     231        }
     232        else if( this->finish.action_code == Release_Schedule ) {
     233                unlock( this->finish.lock );           
     234                ScheduleThread( this->finish.thrd );
     235        }
     236        else {
     237                assert(this->finish.action_code == No_Action);
    265238        }
    266239}
     
    301274        proc_cor_storage.c.state = Active;
    302275      main( &proc_cor_storage );
    303       proc_cor_storage.c.state = Halt;
    304       proc_cor_storage.c.notHalted = false;
     276      proc_cor_storage.c.state = Halted;
    305277
    306278        // Main routine of the core returned, the core is now fully terminated
     
    325297//-----------------------------------------------------------------------------
    326298// Scheduler routines
    327 void thread_schedule( thread * thrd ) {
     299void ScheduleThread( thread * thrd ) {
    328300        assertf( thrd->next == NULL, "Expected null got %p", thrd->next );
    329301       
    330         spin_lock( &lock );
     302        lock( &systemProcessor->cltr->lock );
    331303        append( &systemProcessor->cltr->ready_queue, thrd );
    332         spin_unlock( &lock );
     304        unlock( &systemProcessor->cltr->lock );
    333305}
    334306
    335307thread * nextThread(cluster * this) {
    336         spin_lock( &lock );
     308        lock( &this->lock );
    337309        thread * head = pop_head( &this->ready_queue );
    338         spin_unlock( &lock );
     310        unlock( &this->lock );
    339311        return head;
     312}
     313
     314void ScheduleInternal() {
     315        suspend();
     316}
     317
     318void ScheduleInternal( spinlock * lock ) {
     319        get_this_processor()->finish.action_code = Release;
     320        get_this_processor()->finish.lock = lock;
     321        suspend();
     322}
     323
     324void ScheduleInternal( thread * thrd ) {
     325        get_this_processor()->finish.action_code = Schedule;
     326        get_this_processor()->finish.thrd = thrd;
     327        suspend();
     328}
     329
     330void ScheduleInternal( spinlock * lock, thread * thrd ) {
     331        get_this_processor()->finish.action_code = Release_Schedule;
     332        get_this_processor()->finish.lock = lock;
     333        get_this_processor()->finish.thrd = thrd;
     334        suspend();
    340335}
    341336
     
    363358        // Add the main thread to the ready queue
    364359        // once resume is called on systemProcessor->ctx the mainThread needs to be scheduled like any normal thread
    365         thread_schedule(mainThread);
     360        ScheduleThread(mainThread);
    366361
    367362        //initialize the global state variables
     
    387382        // When its coroutine terminates, it return control to the mainThread
    388383        // which is currently here
    389         systemProcessor->terminated = true;
     384        systemProcessor->is_terminated = true;
    390385        suspend();
    391386
     
    406401//-----------------------------------------------------------------------------
    407402// Locks
    408 void ?{}( simple_lock * this ) {
    409         ( &this->blocked ){};
    410 }
    411 
    412 void ^?{}( simple_lock * this ) {
    413 
    414 }
    415 
    416 void lock( simple_lock * this ) {
     403void ?{}( spinlock * this ) {
     404        this->lock = 0;
     405}
     406void ^?{}( spinlock * this ) {
     407
     408}
     409
     410void lock( spinlock * this ) {
     411        for ( unsigned int i = 1;; i += 1 ) {
     412                if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) break;
     413        }
     414}
     415
     416void unlock( spinlock * this ) {
     417        __sync_lock_release_4( &this->lock );
     418}
     419
     420void ?{}( signal_once * this ) {
     421        this->condition = false;
     422}
     423void ^?{}( signal_once * this ) {
     424
     425}
     426
     427void wait( signal_once * this ) {
     428        lock( &this->lock );
     429        if( !this->condition ) {
     430                append( &this->blocked, this_thread() );
     431                ScheduleInternal( &this->lock );
     432                lock( &this->lock );
     433        }
     434        unlock( &this->lock );
     435}
     436
     437void signal( signal_once * this ) {
     438        lock( &this->lock );
    417439        {
    418                 spin_lock( &lock );
    419                 append( &this->blocked, this_thread() );
    420                 spin_unlock( &lock );
    421         }
    422         suspend();
    423 }
    424 
    425 void unlock( simple_lock * this ) {
    426         thread * it;
    427         while( it = pop_head( &this->blocked) ) {
    428                 thread_schedule( it );
    429         }
     440                this->condition = true;
     441
     442                thread * it;
     443                while( it = pop_head( &this->blocked) ) {
     444                        ScheduleThread( it );
     445                }
     446        }
     447        unlock( &this->lock );
    430448}
    431449
  • src/libcfa/concurrency/threads.c

    raa9ee19 r97f65d5  
    1717#include "threads"
    1818
    19 #include "kernel"
     19#include "kernel_private.h"
    2020#include "libhdr.h"
    2121
     
    4444        (&this->c){};
    4545        this->c.name = "Anonymous Coroutine";
    46         (&this->lock){};
     46        (&this->terminated){};
    4747        this->next = NULL;
    4848}
     
    7272//-----------------------------------------------------------------------------
    7373// Starting and stopping threads
    74 extern "C" {
    75       forall(dtype T | is_thread(T))
    76       void CtxInvokeThread(T * this);
    77 }
    78 
    79 extern void thread_schedule( thread * );
    80 
    8174forall( dtype T | is_thread(T) )
    8275void start( T* this ) {
     
    9285        CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
    9386
    94         fenv_t envp;
    95         fegetenv( &envp );
    96         LIB_DEBUG_PRINTF("Thread : mxcsr %x\n", envp.__mxcsr);
    97         LIB_DEBUG_PRINTF("Thread started : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
    98 
    99         thread_schedule(thrd_h);
     87        ScheduleThread(thrd_h);
    10088}
    10189
    10290forall( dtype T | is_thread(T) )
    10391void stop( T* this ) {
    104         thread*  thrd = get_thread(this);
    105         if( thrd->c.notHalted ) {
    106                 lock( &thrd->lock );
    107         }
     92        wait( & get_thread(this)->terminated );
    10893}
    10994
    11095void yield( void ) {
    111         get_this_processor()->thread_action = Reschedule;
    112         suspend();
     96        ScheduleInternal( get_this_processor()->current_thread );
    11397}
    11498
    11599void ThreadCtxSwitch(coroutine* src, coroutine* dst) {
     100        // set state of current coroutine to inactive
     101        src->state = Inactive;
     102        dst->state = Active;
     103
     104        //update the last resumer
    116105        dst->last = src;
    117106
    118         // set state of current coroutine to inactive
    119         src->state = Inactive;
    120 
    121         // set new coroutine that task is executing
     107        // set new coroutine that the processor is executing
     108        // and context switch to it
    122109        get_this_processor()->current_coroutine = dst; 
    123 
    124         // context switch to specified coroutine
    125110        CtxSwitch( src->stack.context, dst->stack.context );
    126         // when CtxSwitch returns we are back in the src coroutine
     111        get_this_processor()->current_coroutine = src; 
    127112
    128113        // set state of new coroutine to active
     114        dst->state = Inactive;
    129115        src->state = Active;
    130116}
     
    134120extern "C" {
    135121        void __thread_signal_termination( thread * this ) {
    136                 this->c.state = Halt;
    137                 this->c.notHalted = false;
    138                 unlock( &this->lock );
     122                this->c.state = Halted;
     123                LIB_DEBUG_PRINTF("Thread end : %p\n", this);
     124                signal( &this->terminated );   
    139125        }
    140126}
  • src/tests/.expect/castError.txt

    raa9ee19 r97f65d5  
    1 Error: Can't choose between 3 alternatives for expression Cast of:
     1castError.c:7 error: Can't choose between 3 alternatives for expression Cast of:
    22  Name: f
    33
  • src/tests/.expect/completeTypeError.txt

    raa9ee19 r97f65d5  
    1 Error: No reasonable alternatives for expression Applying untyped:
     1completeTypeError.c:34 error: No reasonable alternatives for expression Applying untyped:
    22  Name: *?
    33...to:
     
    55
    66
    7 Error: No reasonable alternatives for expression Applying untyped:
     7completeTypeError.c:36 error: No reasonable alternatives for expression Applying untyped:
    88  Name: baz
    99...to:
     
    1111
    1212
    13 Error: No reasonable alternatives for expression Applying untyped:
     13completeTypeError.c:37 error: No reasonable alternatives for expression Applying untyped:
    1414  Name: quux
    1515...to:
     
    1717
    1818
    19 Error: No reasonable alternatives for expression Applying untyped:
     19completeTypeError.c:58 error: No reasonable alternatives for expression Applying untyped:
    2020  Name: baz
    2121...to:
     
    2323
    2424
    25 Error: No reasonable alternatives for expression Applying untyped:
     25completeTypeError.c:59 error: No reasonable alternatives for expression Applying untyped:
    2626  Name: quux
    2727...to:
     
    2929
    3030
    31 Error: No reasonable alternatives for expression Applying untyped:
     31completeTypeError.c:60 error: No reasonable alternatives for expression Applying untyped:
    3232  Name: *?
    3333...to:
     
    3535
    3636
    37 Error: No reasonable alternatives for expression Applying untyped:
     37completeTypeError.c:72 error: No reasonable alternatives for expression Applying untyped:
    3838  Name: baz
    3939...to:
  • src/tests/.expect/constant0-1DP.txt

    raa9ee19 r97f65d5  
    1 Error: duplicate object definition for 0: signed int
    2 Error: duplicate object definition for 0: const signed int
    3 Error: duplicate object definition for 1: signed int
    4 Error: duplicate object definition for 1: const signed int
    5 Error: duplicate object definition for 0: signed int
    6 Error: duplicate object definition for 1: signed int
    7 Error: duplicate object definition for 0: signed int
    8 Error: duplicate object definition for 1: signed int
    9 Error: duplicate object definition for 0: const signed int
    10 Error: duplicate object definition for 1: const signed int
    11 Error: duplicate object definition for 0: const signed int
    12 Error: duplicate object definition for 1: const signed int
    13 Error: duplicate object definition for 0: pointer to signed int
    14 Error: duplicate object definition for 1: pointer to signed int
    15 Error: duplicate object definition for 0: pointer to signed int
    16 Error: duplicate object definition for 1: pointer to signed int
    17 Error: duplicate object definition for 0: pointer to signed int
    18 Error: duplicate object definition for 1: pointer to signed int
    19 Error: duplicate object definition for 0: pointer to signed int
    20 Error: duplicate object definition for 1: pointer to signed int
    21 Error: duplicate object definition for 0: const pointer to signed int
    22 Error: duplicate object definition for 1: const pointer to signed int
    23 Error: duplicate object definition for 0: const pointer to signed int
    24 Error: duplicate object definition for 1: const pointer to signed int
    25 Error: duplicate object definition for 0: const pointer to signed int
    26 Error: duplicate object definition for 1: const pointer to signed int
    27 Error: duplicate object definition for x: const pointer to pointer to signed int
    28 Error: duplicate object definition for 0: pointer to pointer to signed int
    29 Error: duplicate object definition for x: const pointer to pointer to signed int
    30 Error: duplicate object definition for 0: pointer to pointer to signed int
    31 Error: duplicate object definition for x: const pointer to pointer to signed int
    32 Error: duplicate object definition for 0: pointer to pointer to signed int
     1constant0-1.c:14 error: duplicate object definition for 0: signed int
     2constant0-1.c:15 error: duplicate object definition for 0: const signed int
     3constant0-1.c:16 error: duplicate object definition for 1: signed int
     4constant0-1.c:17 error: duplicate object definition for 1: const signed int
     5constant0-1.c:18 error: duplicate object definition for 0: signed int
     6constant0-1.c:18 error: duplicate object definition for 1: signed int
     7constant0-1.c:19 error: duplicate object definition for 0: signed int
     8constant0-1.c:19 error: duplicate object definition for 1: signed int
     9constant0-1.c:20 error: duplicate object definition for 0: const signed int
     10constant0-1.c:20 error: duplicate object definition for 1: const signed int
     11constant0-1.c:21 error: duplicate object definition for 0: const signed int
     12constant0-1.c:21 error: duplicate object definition for 1: const signed int
     13constant0-1.c:39 error: duplicate object definition for 0: pointer to signed int
     14constant0-1.c:39 error: duplicate object definition for 1: pointer to signed int
     15constant0-1.c:40 error: duplicate object definition for 0: pointer to signed int
     16constant0-1.c:40 error: duplicate object definition for 1: pointer to signed int
     17constant0-1.c:41 error: duplicate object definition for 0: pointer to signed int
     18constant0-1.c:41 error: duplicate object definition for 1: pointer to signed int
     19constant0-1.c:42 error: duplicate object definition for 0: pointer to signed int
     20constant0-1.c:42 error: duplicate object definition for 1: pointer to signed int
     21constant0-1.c:43 error: duplicate object definition for 0: const pointer to signed int
     22constant0-1.c:43 error: duplicate object definition for 1: const pointer to signed int
     23constant0-1.c:44 error: duplicate object definition for 0: const pointer to signed int
     24constant0-1.c:44 error: duplicate object definition for 1: const pointer to signed int
     25constant0-1.c:45 error: duplicate object definition for 0: const pointer to signed int
     26constant0-1.c:45 error: duplicate object definition for 1: const pointer to signed int
     27constant0-1.c:46 error: duplicate object definition for x: const pointer to pointer to signed int
     28constant0-1.c:46 error: duplicate object definition for 0: pointer to pointer to signed int
     29constant0-1.c:47 error: duplicate object definition for x: const pointer to pointer to signed int
     30constant0-1.c:47 error: duplicate object definition for 0: pointer to pointer to signed int
     31constant0-1.c:50 error: duplicate object definition for x: const pointer to pointer to signed int
     32constant0-1.c:50 error: duplicate object definition for 0: pointer to pointer to signed int
    3333make: *** [constant0-1DP] Error 1
  • src/tests/.expect/constant0-1NDDP.txt

    raa9ee19 r97f65d5  
    1 Error: duplicate object definition for 0: signed int
    2 Error: duplicate object definition for 0: const signed int
    3 Error: duplicate object definition for 1: signed int
    4 Error: duplicate object definition for 1: const signed int
    5 Error: duplicate object definition for 0: signed int
    6 Error: duplicate object definition for 1: signed int
    7 Error: duplicate object definition for 0: signed int
    8 Error: duplicate object definition for 1: signed int
    9 Error: duplicate object definition for 0: const signed int
    10 Error: duplicate object definition for 1: const signed int
    11 Error: duplicate object definition for 0: const signed int
    12 Error: duplicate object definition for 1: const signed int
    13 Error: duplicate object definition for x: pointer to signed int
    14 Error: duplicate object definition for 0: pointer to signed int
    15 Error: duplicate object definition for x: const pointer to signed int
    16 Error: duplicate object definition for 0: const pointer to signed int
     1constant0-1.c:14 error: duplicate object definition for 0: signed int
     2constant0-1.c:15 error: duplicate object definition for 0: const signed int
     3constant0-1.c:16 error: duplicate object definition for 1: signed int
     4constant0-1.c:17 error: duplicate object definition for 1: const signed int
     5constant0-1.c:18 error: duplicate object definition for 0: signed int
     6constant0-1.c:18 error: duplicate object definition for 1: signed int
     7constant0-1.c:19 error: duplicate object definition for 0: signed int
     8constant0-1.c:19 error: duplicate object definition for 1: signed int
     9constant0-1.c:20 error: duplicate object definition for 0: const signed int
     10constant0-1.c:20 error: duplicate object definition for 1: const signed int
     11constant0-1.c:21 error: duplicate object definition for 0: const signed int
     12constant0-1.c:21 error: duplicate object definition for 1: const signed int
     13constant0-1.c:66 error: duplicate object definition for x: pointer to signed int
     14constant0-1.c:66 error: duplicate object definition for 0: pointer to signed int
     15constant0-1.c:67 error: duplicate object definition for x: const pointer to signed int
     16constant0-1.c:67 error: duplicate object definition for 0: const pointer to signed int
    1717make: *** [constant0-1NDDP] Error 1
  • src/tests/.expect/declarationErrors.txt

    raa9ee19 r97f65d5  
    1 Error: duplicate static in declaration of x1: static const volatile short int
     1declarationErrors.c:16 error: duplicate static in declaration of x1: static const volatile short int
    22
    3 Error: conflicting extern & static in declaration of x2: extern const volatile short int
     3declarationErrors.c:17 error: conflicting extern & static in declaration of x2: extern const volatile short int
    44
    5 Error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int
     5declarationErrors.c:18 error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int
    66
    7 Error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
     7declarationErrors.c:19 error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
    88  with members
    99   with body
    1010
    1111
    12 Error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
     12declarationErrors.c:20 error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
    1313  with members
    1414   with body
    1515
    1616
    17 Error: duplicate static in declaration of x6: static const volatile instance of type Int
     17declarationErrors.c:22 error: duplicate static in declaration of x6: static const volatile instance of type Int
    1818
    19 Error: duplicate const in declaration of f01: static inline function
     19declarationErrors.c:24 error: duplicate const in declaration of f01: static inline function
    2020  with no parameters
    2121  returning const volatile int
    2222
    2323
    24 Error: duplicate volatile in declaration of f02: static inline function
     24declarationErrors.c:25 error: duplicate volatile in declaration of f02: static inline function
    2525  with no parameters
    2626  returning const volatile int
    2727
    2828
    29 Error: duplicate const in declaration of f03: static inline function
     29declarationErrors.c:26 error: duplicate const in declaration of f03: static inline function
    3030  with no parameters
    3131  returning const volatile int
    3232
    3333
    34 Error: duplicate volatile in declaration of f04: static inline function
     34declarationErrors.c:27 error: duplicate volatile in declaration of f04: static inline function
    3535  with no parameters
    3636  returning const volatile int
    3737
    3838
    39 Error: duplicate const in declaration of f05: static inline function
     39declarationErrors.c:28 error: duplicate const in declaration of f05: static inline function
    4040  with no parameters
    4141  returning const volatile int
    4242
    4343
    44 Error: duplicate volatile in declaration of f06: static inline function
     44declarationErrors.c:29 error: duplicate volatile in declaration of f06: static inline function
    4545  with no parameters
    4646  returning const volatile int
    4747
    4848
    49 Error: duplicate const in declaration of f07: static inline function
     49declarationErrors.c:30 error: duplicate const in declaration of f07: static inline function
    5050  with no parameters
    5151  returning const volatile int
    5252
    5353
    54 Error: duplicate const, duplicate volatile in declaration of f08: static inline function
     54declarationErrors.c:31 error: duplicate const, duplicate volatile in declaration of f08: static inline function
    5555  with no parameters
    5656  returning const volatile int
    5757
    5858
    59 Error: duplicate const, duplicate volatile in declaration of f09: static inline function
     59declarationErrors.c:33 error: duplicate const, duplicate volatile in declaration of f09: static inline function
    6060  with no parameters
    6161  returning const volatile int
    6262
    6363
    64 Error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
     64declarationErrors.c:34 error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
    6565  with no parameters
    6666  returning const restrict volatile _Atomic int
  • src/tests/.expect/dtor-early-exit-ERR1.txt

    raa9ee19 r97f65d5  
    1 Error: jump to label 'L1' crosses initialization of y Branch (Goto)
     1dtor-early-exit.c:142 error: jump to label 'L1' crosses initialization of y Branch (Goto)
    22
    33make: *** [dtor-early-exit-ERR1] Error 1
  • src/tests/.expect/dtor-early-exit-ERR2.txt

    raa9ee19 r97f65d5  
    1 Error: jump to label 'L2' crosses initialization of y Branch (Goto)
     1dtor-early-exit.c:142 error: jump to label 'L2' crosses initialization of y Branch (Goto)
    22
    33make: *** [dtor-early-exit-ERR2] Error 1
  • src/tests/.expect/memberCtors-ERR1.txt

    raa9ee19 r97f65d5  
    1 Error: in void ?{}(struct B *b), field a2 used before being constructed
     1error: in void ?{}(struct B *b), field a2 used before being constructed
    22make: *** [memberCtors-ERR1] Error 1
  • src/tests/.expect/scopeErrors.txt

    raa9ee19 r97f65d5  
    1 Error: duplicate object definition for thisIsAnError: signed int
    2 Error: duplicate function definition for butThisIsAnError: function
     1scopeErrors.c:2 error: duplicate object definition for thisIsAnError: signed int
     2scopeErrors.c:20 error: duplicate function definition for butThisIsAnError: function
    33  with parameters
    44    double
  • src/tests/thread.c

    raa9ee19 r97f65d5  
    44#include <threads>
    55
    6 struct First { thread t; simple_lock* lock; };
    7 struct Second { thread t; simple_lock* lock; };
     6struct First { thread t; signal_once* lock; };
     7struct Second { thread t; signal_once* lock; };
    88
    99DECL_THREAD(First);
    1010DECL_THREAD(Second);
    1111
    12 void ?{}( First * this, simple_lock* lock ) { this->lock = lock; }
    13 void ?{}( Second * this, simple_lock* lock ) { this->lock = lock; }
     12void ?{}( First * this, signal_once* lock ) { this->lock = lock; }
     13void ?{}( Second * this, signal_once* lock ) { this->lock = lock; }
    1414
    1515void main(First* this) {
     
    1818                yield();
    1919        }
    20         unlock(this->lock);
     20        signal(this->lock);
    2121}
    2222
    2323void main(Second* this) {
    24         lock(this->lock);       
     24        wait(this->lock);
    2525        for(int i = 0; i < 10; i++) {
    2626                sout | "Second : Suspend No." | i + 1 | endl;
     
    3131
    3232int main(int argc, char* argv[]) {
    33         simple_lock lock;
     33        signal_once lock;
    3434        sout | "User main begin" | endl;
    3535        {
    36                 // processor p;
     36                processor p;
    3737                {
    3838                        scoped(First)  f = { &lock };
Note: See TracChangeset for help on using the changeset viewer.