Changeset 779a4a3 for src


Ignore:
Timestamp:
May 3, 2018, 4:33:19 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
f3152ab
Parents:
f465f0e (diff), c9d5c4f (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' into fix-reference-overloading

Location:
src
Files:
2 added
33 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rf465f0e r779a4a3  
    887887                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    888888                output << " )" ;
     889        }
     890
     891        void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) {
     892                output << dirStmt->directive;
    889893        }
    890894
  • src/CodeGen/CodeGenerator.h

    rf465f0e r779a4a3  
    9999                void postvisit( ExprStmt * );
    100100                void postvisit( AsmStmt * );
     101                void postvisit( DirectiveStmt * );
    101102                void postvisit( AsmDecl * );                            // special: statement in declaration context
    102103                void postvisit( IfStmt * );
  • src/Common/PassVisitor.h

    rf465f0e r779a4a3  
    7171        virtual void visit( ExprStmt * exprStmt ) override final;
    7272        virtual void visit( AsmStmt * asmStmt ) override final;
     73        virtual void visit( DirectiveStmt * dirStmt ) override final;
    7374        virtual void visit( IfStmt * ifStmt ) override final;
    7475        virtual void visit( WhileStmt * whileStmt ) override final;
     
    168169        virtual Statement * mutate( ExprStmt * exprStmt ) override final;
    169170        virtual Statement * mutate( AsmStmt * asmStmt ) override final;
     171        virtual Statement * mutate( DirectiveStmt * dirStmt ) override final;
    170172        virtual Statement * mutate( IfStmt * ifStmt ) override final;
    171173        virtual Statement * mutate( WhileStmt * whileStmt ) override final;
  • src/Common/PassVisitor.impl.h

    rf465f0e r779a4a3  
    777777
    778778//--------------------------------------------------------------------------
     779// AsmStmt
     780template< typename pass_type >
     781void PassVisitor< pass_type >::visit( DirectiveStmt * node ) {
     782        VISIT_START( node )
     783
     784        VISIT_END( node );
     785}
     786
     787template< typename pass_type >
     788Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
     789        MUTATE_START( node );
     790
     791        MUTATE_END( Statement, node );
     792}
     793
     794//--------------------------------------------------------------------------
    779795// IfStmt
    780796template< typename pass_type >
  • src/Common/SemanticError.cc

    rf465f0e r779a4a3  
    77// SemanticError.cc --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Thierry Delisle
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 18:17:35 2017
    13 // Update Count     : 3
     12// Last Modified On : Wed May  2 18:13:37 2018
     13// Update Count     : 8
    1414//
    1515
    1616#include <cstdarg>
    1717#include <cstdio>                                                                               // for fileno, stderr
     18#include <cstring>
    1819#include <unistd.h>                                                                             // for isatty
    1920#include <iostream>                                                                             // for basic_ostream, operator<<, ostream
    2021#include <list>                                                                                 // for list, _List_iterator
    2122#include <string>                                                                               // for string, operator<<, operator+, to_string
     23#include <vector>
    2224
    2325#include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
    2426#include "SemanticError.h"
    2527
     28//-----------------------------------------------------------------------------
     29// Severity Handling
     30std::vector<Severity> & get_severities() {
     31        static std::vector<Severity> severities;
     32        if(severities.empty()) {
     33                severities.reserve((size_t)Warning::NUMBER_OF_WARNINGS);
     34                for ( const auto w : WarningFormats ) {
     35                        severities.push_back( w.default_severity );
     36                } // for
     37        }
     38        return severities;
     39}
     40
     41void SemanticWarning_SuppressAll() {
     42        for( auto & s : get_severities() ) {
     43                s = Severity::Suppress;
     44        }
     45}
     46
     47void SemanticWarning_EnableAll() {
     48        for( auto & s : get_severities() ) {
     49                s = Severity::Warn;
     50        }
     51}
     52
     53void SemanticWarning_WarningAsError() {
     54        for( auto & s : get_severities() ) {
     55                if(s == Severity::Warn) s = Severity::Error;
     56        }
     57}
     58
     59void SemanticWarning_Set(const char * const name, Severity s) {
     60        size_t idx = 0;
     61        for ( const auto & w : WarningFormats ) {
     62                if ( std::strcmp( name, w.name ) == 0 ) {
     63                        get_severities()[idx] = s;
     64                        break;
     65                }
     66                idx++;
     67        }
     68}
     69
     70//-----------------------------------------------------------------------------
     71// Semantic Error
    2672SemanticErrorException::SemanticErrorException( CodeLocation location, std::string error ) {
    2773        append( location, error );
     
    69115
    70116void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) {
    71         Severity severity = WarningFormats[(int)warning].severity;
     117        Severity severity = get_severities()[(int)warning];
    72118        switch(severity) {
    73119        case Severity::Suppress :
  • src/Common/SemanticError.h

    rf465f0e r779a4a3  
    77// SemanticError.h --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Thierry Delisle
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 19 17:52:03 2018
    13 // Update Count     : 19
     12// Last Modified On : Wed May  2 18:13:15 2018
     13// Update Count     : 29
    1414//
    1515
     
    1717
    1818#include "ErrorObjects.h"
     19#include <cstring>
    1920
    2021//-----------------------------------------------------------------------------
     
    4647        const char * const name;
    4748        const char * const message;
    48         mutable Severity severity;
     49        const Severity default_severity;
    4950};
    5051
    51 constexpr const WarningData WarningFormats[] = {
    52         {"self-assign"         , "self assignment of expression: %s"           , Severity::Warn},
    53         {"reference-conversion", "rvalue to reference conversion of rvalue: %s", Severity::Warn},
     52constexpr WarningData WarningFormats[] = {
     53        {"self-assign"            , "self assignment of expression: %s"            , Severity::Warn},
     54        {"reference-conversion"   , "rvalue to reference conversion of rvalue: %s" , Severity::Warn},
    5455        {"qualifiers-zero_t-one_t", "questionable use of type qualifier %s with %s", Severity::Warn},
    5556};
     
    7172void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
    7273
     74void SemanticWarning_SuppressAll   ();
     75void SemanticWarning_EnableAll     ();
     76void SemanticWarning_WarningAsError();
     77void SemanticWarning_Set           (const char * const name, Severity s);
     78
     79// SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine.
     80static inline bool SemanticWarning_Exist(const char * const name) {
     81        for ( const auto & w : WarningFormats ) {
     82                if ( std::strcmp( name, w.name ) == 0 ) return true;
     83        }
     84        return false;
     85}
    7386
    7487//-----------------------------------------------------------------------------
  • src/Common/module.mk

    rf465f0e r779a4a3  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    1818       Common/UniqueName.cc \
    1919       Common/DebugMalloc.cc \
    20        Common/Assert.cc
     20       Common/Assert.cc \
     21       Common/Heap.cc
  • src/Common/utility.h

    rf465f0e r779a4a3  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr 20 22:35:33 2018
    13 // Update Count     : 38
     12// Last Modified On : Thu May  3 12:18:31 2018
     13// Update Count     : 39
    1414//
    1515
     
    441441
    442442template<typename T>
    443 inline constexpr T ilog2(const T & t) {
    444         if ( std::is_integral<T>::value ) {
     443inline
     444#if __GNUC__ > 4
     445constexpr
     446#endif
     447T ilog2(const T & t) {
     448        if(std::is_integral<T>::value) {
    445449                const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1;
    446                 if ( sizeof(T) == sizeof(unsigned int ) ) return r - __builtin_clz( t );
    447                 if ( sizeof(T) == sizeof(unsigned long) ) return r - __builtin_clzl( t );
    448                 if ( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
    449         } // if
     450                if( sizeof(T) == sizeof(unsigned       int) ) return r - __builtin_clz  ( t );
     451                if( sizeof(T) == sizeof(unsigned      long) ) return r - __builtin_clzl ( t );
     452                if( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
     453        }
     454        assert(false);
    450455        return -1;
    451 } // ilong2
     456} // ilog2
    452457
    453458
  • src/Makefile.in

    rf465f0e r779a4a3  
    164164        Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT) \
    165165        Common/driver_cfa_cpp-Assert.$(OBJEXT) \
     166        Common/driver_cfa_cpp-Heap.$(OBJEXT) \
    166167        ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \
    167168        ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \
     
    486487        Concurrency/Waitfor.cc Common/SemanticError.cc \
    487488        Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
    488         ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    489         ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    490         ControlStruct/ForExprMutator.cc \
     489        Common/Heap.cc ControlStruct/LabelGenerator.cc \
     490        ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
     491        ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
    491492        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    492493        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     
    672673        Common/$(DEPDIR)/$(am__dirstamp)
    673674Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \
     675        Common/$(DEPDIR)/$(am__dirstamp)
     676Common/driver_cfa_cpp-Heap.$(OBJEXT): Common/$(am__dirstamp) \
    674677        Common/$(DEPDIR)/$(am__dirstamp)
    675678ControlStruct/$(am__dirstamp):
     
    973976@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po@am__quote@
    974977@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po@am__quote@
     978@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po@am__quote@
    975979@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@
    976980@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
     
    13081312@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi`
    13091313
     1314Common/driver_cfa_cpp-Heap.o: Common/Heap.cc
     1315@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Heap.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo -c -o Common/driver_cfa_cpp-Heap.o `test -f 'Common/Heap.cc' || echo '$(srcdir)/'`Common/Heap.cc
     1316@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po
     1317@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Heap.cc' object='Common/driver_cfa_cpp-Heap.o' libtool=no @AMDEPBACKSLASH@
     1318@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1319@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Heap.o `test -f 'Common/Heap.cc' || echo '$(srcdir)/'`Common/Heap.cc
     1320
     1321Common/driver_cfa_cpp-Heap.obj: Common/Heap.cc
     1322@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Heap.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo -c -o Common/driver_cfa_cpp-Heap.obj `if test -f 'Common/Heap.cc'; then $(CYGPATH_W) 'Common/Heap.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Heap.cc'; fi`
     1323@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po
     1324@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Heap.cc' object='Common/driver_cfa_cpp-Heap.obj' libtool=no @AMDEPBACKSLASH@
     1325@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1326@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Heap.obj `if test -f 'Common/Heap.cc'; then $(CYGPATH_W) 'Common/Heap.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Heap.cc'; fi`
     1327
    13101328ControlStruct/driver_cfa_cpp-LabelGenerator.o: ControlStruct/LabelGenerator.cc
    13111329@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelGenerator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.o `test -f 'ControlStruct/LabelGenerator.cc' || echo '$(srcdir)/'`ControlStruct/LabelGenerator.cc
  • src/Parser/ParseNode.h

    rf465f0e r779a4a3  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 29 14:04:05 2018
    13 // Update Count     : 830
     12// Last Modified On : Mon Apr 30 09:19:17 2018
     13// Update Count     : 831
    1414//
    1515
     
    416416Statement * build_finally( StatementNode * stmt );
    417417Statement * build_compound( StatementNode * first );
    418 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    419 Statement * build_dirstmt( std::string * directive );
     418Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     419Statement * build_directive( std::string * directive );
    420420WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when );
    421421WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing );
  • src/Parser/StatementNode.cc

    rf465f0e r779a4a3  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 29 14:21:45 2018
    13 // Update Count     : 353
     12// Last Modified On : Mon Apr 30 09:21:16 2018
     13// Update Count     : 354
    1414//
    1515
     
    310310}
    311311
    312 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
     312Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
    313313        std::list< Expression * > out, in;
    314314        std::list< ConstantExpr * > clob;
     
    320320}
    321321
    322 Statement * build_dirstmt( string * directive ) {
    323         cout << *directive << endl;
    324         return nullptr;
     322Statement * build_directive( string * directive ) {
     323        return new DirectiveStmt( *directive );
    325324}
    326325
  • src/Parser/lex.ll

    rf465f0e r779a4a3  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Apr 29 14:10:49 2018
    13  * Update Count     : 675
     12 * Last Modified On : Thu May  3 13:42:40 2018
     13 * Update Count     : 676
    1414 */
    1515
     
    174174}
    175175
    176                                 /* ignore preprocessor-style directives (for now) */
     176                                /* preprocessor-style directives */
    177177^{h_white}*"#"[^\n]*"\n" { RETURN_VAL( DIRECTIVE ); }
    178178
  • src/Parser/parser.yy

    rf465f0e r779a4a3  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 29 14:20:17 2018
    13 // Update Count     : 3206
     12// Last Modified On : Thu May  3 08:20:09 2018
     13// Update Count     : 3225
    1414//
    1515
     
    877877        | asm_statement
    878878        | DIRECTIVE
    879                 { $$ = new StatementNode( build_dirstmt( $1 ) ); }
     879                { $$ = new StatementNode( build_directive( $1 ) ); }
    880880        ;
    881881
     
    12071207asm_statement:
    12081208        ASM asm_volatile_opt '(' string_literal ')' ';'
    1209                 { $$ = new StatementNode( build_asmstmt( $2, $4, 0 ) ); }
     1209                { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); }
    12101210        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC
    1211                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6 ) ); }
     1211                { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); }
    12121212        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ')' ';'
    1213                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8 ) ); }
     1213                { $$ = new StatementNode( build_asm( $2, $4, $6, $8 ) ); }
    12141214        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';'
    1215                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8, $10 ) ); }
     1215                { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); }
    12161216        | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    1217                 { $$ = new StatementNode( build_asmstmt( $2, $5, 0, $8, $10, $12 ) ); }
     1217                { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); }
    12181218        ;
    12191219
     
    24052405        | ASM '(' string_literal ')' ';'                                        // GCC, global assembler statement
    24062406                {
    2407                         $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asmstmt( false, $3, 0 ) ) );
     2407                        $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) );
    24082408                }
    24092409        | EXTERN STRINGliteral                                                          // C++-style linkage specifier
     
    24512451        | declaration_qualifier_list type_qualifier_list
    24522452                {
    2453                         if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2453                        // forall must be in the type_qualifier_list
     2454                        if ( $2->type->forall ) xxx = forall = true; // remember generic type
    24542455                }
    24552456          push '{' external_definition_list '}'                         // CFA, namespace
  • src/ResolvExpr/AlternativeFinder.cc

    rf465f0e r779a4a3  
    459459        /// Adds type variables to the open variable set and marks their assertions
    460460        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    461                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     461                for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
    462462                        unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar };
    463                         for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) {
     463                        for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->assertions.begin(); assert != (*tyvar)->assertions.end(); ++assert ) {
    464464                                needAssertions[ *assert ].isUsed = true;
    465465                        }
  • src/ResolvExpr/AlternativeFinder.h

    rf465f0e r779a4a3  
    126126        void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt = 0 );
    127127
     128        /// Adds type variables to the open variable set and marks their assertions
     129        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions );
     130
    128131        template< typename InputIterator >
    129132        void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
  • src/ResolvExpr/Resolver.cc

    rf465f0e r779a4a3  
    544544                                                        OpenVarSet openVars;
    545545                                                        AssertionSet resultNeed, resultHave;
    546                                                         TypeEnvironment resultEnv;
     546                                                        TypeEnvironment resultEnv( func.env );
     547                                                        makeUnifiableVars( function, openVars, resultNeed );
     548                                                        // add all type variables as open variables now so that those not used in the parameter
     549                                                        // list are still considered open.
     550                                                        resultEnv.add( function->forall );
    547551
    548552                                                        // Load type variables from arguemnts into one shared space
     
    583587                                                                        ss << "' to '";
    584588                                                                        arg.expr->get_result()->print( ss );
     589                                                                        ss << "' with env '";
     590                                                                        resultEnv.print(ss);
    585591                                                                        ss << "'\n";
    586592                                                                        SemanticError( function, ss.str() );
  • src/SynTree/Mutator.h

    rf465f0e r779a4a3  
    3939        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
    4040        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
     41        virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
    4142        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
    4243        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
  • src/SynTree/Statement.cc

    rf465f0e r779a4a3  
    9494
    9595
     96DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
     97
     98void DirectiveStmt::print( std::ostream &os, Indenter ) const {
     99        os << "GCC Directive:" << directive << endl;
     100}
     101
     102
    96103const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    97104
  • src/SynTree/Statement.h

    rf465f0e r779a4a3  
    126126};
    127127
     128class DirectiveStmt : public Statement {
     129        public:
     130        std::string directive;
     131
     132        DirectiveStmt( const std::string & );
     133        virtual ~DirectiveStmt(){}
     134
     135        virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
     136        virtual void accept( Visitor & v ) { v.visit( this ); }
     137        virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     138        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     139};
     140
    128141class IfStmt : public Statement {
    129142  public:
  • src/SynTree/SynTree.h

    rf465f0e r779a4a3  
    4444class ExprStmt;
    4545class AsmStmt;
     46class DirectiveStmt;
    4647class IfStmt;
    4748class WhileStmt;
  • src/SynTree/Visitor.h

    rf465f0e r779a4a3  
    4141        virtual void visit( ExprStmt * exprStmt ) = 0;
    4242        virtual void visit( AsmStmt * asmStmt ) = 0;
     43        virtual void visit( DirectiveStmt * directiveStmt ) = 0;
    4344        virtual void visit( IfStmt * ifStmt ) = 0;
    4445        virtual void visit( WhileStmt * whileStmt ) = 0;
  • src/benchmark/bench.h

    rf465f0e r779a4a3  
    66        #include <stdlib.h>
    77        #include <unistd.h>                                     // sysconf
    8         #include <sys/times.h>                                  // times
     8#if ! defined(__cforall)
    99        #include <time.h>
    10 #if defined(__cforall)
     10        #include <sys/time.h>
     11#else
    1112}
    12 //#include <bits/cfatime.h>
     13#include <time>
    1314#endif
    1415
    1516
    16 static inline unsigned long long int Time() {
     17static inline unsigned long long int bench_time() {
    1718    struct timespec ts;
    1819    clock_gettime(
     
    4142        }                                               \
    4243        long long int StartTime, EndTime;       \
    43         StartTime = Time();                     \
     44        StartTime = bench_time();               \
    4445        statement;                                      \
    45         EndTime = Time();                               \
     46        EndTime = bench_time();                 \
    4647        unsigned long long int output =         \
    4748        ( EndTime - StartTime ) / n;
    4849
    49 __cfa_time_t default_preemption() {
     50#if defined(__cforall)
     51Duration default_preemption() {
    5052        return 0;
    5153}
     54#endif
  • src/benchmark/ctxswitch/cfa_cor.c

    rf465f0e r779a4a3  
    11#include <stdio.h>
     2#include <kernel>
    23#include <thread>
    34
  • src/driver/Makefile.am

    rf465f0e r779a4a3  
    1111## Created On       : Sun May 31 08:49:31 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri Oct 28 13:46:06 2016
    14 ## Update Count     : 10
     13## Last Modified On : Mon Apr 30 17:44:17 2018
     14## Update Count     : 11
    1515###############################################################################
    1616
    1717# applies to both programs
    18 AM_CXXFLAGS = -Wall -O2 -g -std=c++14
     18AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
    1919if BUILD_NO_LIB
    2020else
  • src/driver/Makefile.in

    rf465f0e r779a4a3  
    294294
    295295# applies to both programs
    296 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 $(am__append_1) $(am__append_2) \
    297         $(am__append_3)
     296AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src \
     297        $(am__append_1) $(am__append_2) $(am__append_3)
    298298cfa_SOURCES = cfa.cc
    299299
  • src/driver/cfa.cc

    rf465f0e r779a4a3  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  5 22:05:28 2018
    13 // Update Count     : 166
     12// Last Modified On : Wed May  2 17:57:43 2018
     13// Update Count     : 224
    1414//
    1515
     
    1919#include <unistd.h>                                                                             // execvp
    2020#include <string>                                                                               // STL version
    21 
     21#include <string.h>                                                                             // strcmp
     22
     23#include "Common/SemanticError.h"
    2224#include "config.h"                                                                             // configure info
    2325
     
    160162                                args[nargs] = argv[i];                                  // pass the argument along
    161163                                nargs += 1;
     164                        } else if ( arg == "-w" ) {
     165                                args[nargs] = argv[i];                                  // pass the argument along
     166                                nargs += 1;
     167                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     168                                nargs += 1;
     169                        } else if ( prefix( arg, "-W" ) ) {                     // check before next tests
     170                                if ( arg == "-Werror" || arg == "-Wall" ) {
     171                                        args[nargs] = argv[i];                          // pass the argument along
     172                                        nargs += 1;
     173                                        args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
     174                                        nargs += 1;
     175                                } else {
     176                                        unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
     177                                        args[nargs] = argv[i];                          // conditionally pass the argument along
     178                                        const char * warning = argv[i] + adv;     // extract warning
     179                                        if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
     180                                                args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
     181                                        } // if
     182                                        nargs += 1;
     183                                } // if
    162184                        } else if ( prefix( arg, "-B" ) ) {
    163185                                Bprefix = arg.substr(2);                                // strip the -B flag
     
    247269                #if ! defined(HAVE_LIBCFA_RELEASE)
    248270                        if( !debug ) {
    249                                 cerr << "error: Option -nodebug is not available, libcfa was not installed." << endl;
     271                                cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
    250272                                exit( EXIT_FAILURE );
    251273                                }
     
    253275                #if ! defined(HAVE_LIBCFA_DEBUG)
    254276                        if( debug ) {
    255                                 cerr << "error: Option -debug is not available, libcfa-d was not installed." << endl;
     277                                cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
    256278                                exit( EXIT_FAILURE );
    257279                                }
  • src/libcfa/concurrency/preemption.c

    rf465f0e r779a4a3  
    404404}
    405405
     406//=============================================================================================
     407// Kernel Signal Debug
     408//=============================================================================================
     409
     410void __cfaabi_check_preemption() {
     411        bool ready = TL_GET( preemption_state ).enabled;
     412        if(!ready) { abort("Preemption should be ready"); }
     413
     414        sigset_t oldset;
     415        int ret;
     416        ret = sigprocmask(0, NULL, &oldset);
     417        if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
     418
     419        ret = sigismember(&oldset, SIGUSR1);
     420        if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
     421
     422        if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
     423}
     424
    406425// Local Variables: //
    407426// mode: c //
  • src/libcfa/concurrency/thread

    rf465f0e r779a4a3  
    2020
    2121#include "coroutine"
     22#include "kernel"
    2223#include "monitor"
    2324
  • src/libcfa/interpose.c

    rf465f0e r779a4a3  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  8 16:18:09 2018
    13 // Update Count     : 75
     12// Last Modified On : Tue May  1 15:05:35 2018
     13// Update Count     : 83
    1414//
    1515
     
    9595void sigHandler_fpe  ( __CFA_SIGPARMS__ );
    9696void sigHandler_abort( __CFA_SIGPARMS__ );
     97void sigHandler_term ( __CFA_SIGPARMS__ );
    9798
    9899struct {
     
    114115                __cfaabi_sigaction( SIGFPE , sigHandler_fpe  , SA_SIGINFO ); // Failure handler
    115116                __cfaabi_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO ); // Failure handler
     117                __cfaabi_sigaction( SIGTERM, sigHandler_term , SA_SIGINFO ); // Failure handler
     118                __cfaabi_sigaction( SIGINT , sigHandler_term , SA_SIGINFO ); // Failure handler
    116119        }
    117120}
     
    268271}
    269272
     273void sigHandler_term( __CFA_SIGPARMS__ ) {
     274        abort( "Application stopped by %s signal.", sig == SIGINT ? "an interrupt (SIGINT)" : "a terminate (SIGTERM)" );
     275}
     276
    270277// Local Variables: //
    271278// mode: c //
  • src/main.cc

    rf465f0e r779a4a3  
    1 
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    1110// Created On       : Fri May 15 23:12:02 2015
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Oct 31 12:22:40 2017
    14 // Update Count     : 445
     12// Last Modified On : Wed May  2 14:59:02 2018
     13// Update Count     : 490
    1514//
    1615
     
    3534#include "CodeTools/DeclStats.h"            // for printDeclStats
    3635#include "CodeTools/TrackLoc.h"             // for fillLocations
     36#include "Common/CompilerError.h"           // for CompilerError
     37#include "Common/Heap.h"
    3738#include "Common/PassVisitor.h"
    38 #include "Common/CompilerError.h"           // for CompilerError
    3939#include "Common/SemanticError.h"           // for SemanticError
    4040#include "Common/UnimplementedError.h"      // for UnimplementedError
     
    175175        signal( SIGABRT, sigAbortHandler );
    176176
     177        // std::cout << "main" << std::endl;
     178        // for ( int i = 0; i < argc; i += 1 ) {
     179        //      std::cout << '\t' << argv[i] << std::endl;
     180        // } // for
     181
    177182        parse_cmdline( argc, argv, filename );                          // process command-line arguments
    178183        CodeGen::FixMain::setReplaceMain( !nomainp );
     
    354359                OPTPRINT( "end" )
    355360
     361
    356362                if ( output != &cout ) {
    357363                        delete output;
     
    384390
    385391        deleteAll( translationUnit );
     392        HeapStats::printStats();
    386393        return 0;
    387394} // main
     
    416423        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    417424
     425        bool Werror = false;
    418426        int c;
    419         while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     427        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    420428                switch ( c ) {
    421429                  case Ast:
     
    453461                        yydebug = true;
    454462                        break;
    455                   case 'G':                   // dump AST after instantiate generics
     463                  case 'G':                                                                             // dump AST after instantiate generics
    456464                        genericsp = true;
    457465                        break;
     
    501509                  case 'v':                                                                             // dump AST after decl validation pass
    502510                        validp = true;
     511                        break;
     512                  case 'w':
     513                        SemanticWarning_SuppressAll();
     514                        break;
     515                  case 'W':
     516                        if ( strcmp( optarg, "all" ) == 0 ) {
     517                                SemanticWarning_EnableAll();
     518                        } else if ( strcmp( optarg, "error" ) == 0 ) {
     519                                Werror = true;
     520                        } else {
     521                                char * warning = optarg;
     522                                Severity s;
     523                                if ( strncmp( optarg, "no-", 3 ) == 0 ) {
     524                                        warning += 3;
     525                                        s = Severity::Suppress;
     526                                } else {
     527                                        s = Severity::Warn;
     528                                } // if
     529                                SemanticWarning_Set( warning, s );
     530                        } // if
    503531                        break;
    504532                  case 'y':                                                                             // dump AST on error
     
    530558                } // switch
    531559        } // while
     560
     561        if ( Werror ) {
     562                SemanticWarning_WarningAsError();
     563        } // if
     564        // for ( const auto w : WarningFormats ) {
     565        //      cout << w.name << ' ' << (int)w.severity << endl;
     566        // } // for
    532567} // parse_cmdline
    533568
  • src/tests/concurrent/examples/boundedBufferEXT.c

    rf465f0e r779a4a3  
    88// Created On       : Wed Apr 18 22:52:12 2018
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Fri Apr 20 22:25:14 2018
    11 // Update Count     : 6
     10// Last Modified On : Wed May  2 16:12:58 2018
     11// Update Count     : 7
    1212//
    1313
     
    2222enum { BufferSize = 50 };
    2323
    24 forall( otype T )
    25 monitor Buffer {
    26         int front, back, count;
    27         T elements[BufferSize];
    28 };
     24forall( otype T ) {
     25        monitor Buffer {
     26                int front, back, count;
     27                T elements[BufferSize];
     28        }; // Buffer
    2929
    30 forall( otype T )
    31 void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
     30        void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
    3231
    33 forall( otype T )
    34 int query( Buffer(T) & buffer ) { return buffer.count; }
     32        int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
    3533
    36 forall( otype T )                                                                               // forward
    37 T remove( Buffer(T) & mutex buffer );
     34        T remove( Buffer(T) & mutex buffer );                           // forward
    3835
    39 forall( otype T )
    40 void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    41         if ( count == BufferSize ) waitfor( remove, buffer );
    42         elements[back] = elem;
    43         back = ( back + 1 ) % BufferSize;
    44         count += 1;
    45 }
     36        void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
     37                if ( count == BufferSize ) waitfor( remove, buffer );
     38                elements[back] = elem;
     39                back = ( back + 1 ) % BufferSize;
     40                count += 1;
     41        } // insert
    4642
    47 forall( otype T )
    48 T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    49         if ( count == 0 ) waitfor( insert, buffer );
    50         T elem = elements[front];
    51         front = ( front + 1 ) % BufferSize;
    52         count -= 1;
    53         return elem;
     43        T remove( Buffer(T) & mutex buffer ) with( buffer ) {
     44                if ( count == 0 ) waitfor( insert, buffer );
     45                T elem = elements[front];
     46                front = ( front + 1 ) % BufferSize;
     47                count -= 1;
     48                return elem;
     49        } // remove
    5450}
    5551
  • src/tests/concurrent/examples/boundedBufferINT.c

    rf465f0e r779a4a3  
    88// Created On       : Mon Oct 30 12:45:13 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Fri Apr 20 22:18:18 2018
    11 // Update Count     : 78
     10// Last Modified On : Thu Apr 26 23:08:17 2018
     11// Update Count     : 82
    1212//
    1313
     
    2222enum { BufferSize = 50 };
    2323
    24 forall( otype T )
    25 monitor Buffer {
    26         condition full, empty;
    27         int front, back, count;
    28         T elements[BufferSize];
    29 };
     24forall( otype T ) {
     25        monitor Buffer {
     26                condition full, empty;
     27                int front, back, count;
     28                T elements[BufferSize];
     29        }; // Buffer
    3030
    31 forall( otype T )
    32 void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
     31        void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
    3332
    34 forall( otype T )
    35 int query( Buffer(T) & buffer ) { return buffer.count; }
     33        int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
    3634
    37 forall( otype T )
    38 void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    39         if ( count == BufferSize ) wait( empty );
    40         elements[back] = elem;
    41         back = ( back + 1 ) % BufferSize;
    42         count += 1;
    43         signal( full );
    44 }
     35        void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
     36                if ( count == BufferSize ) wait( empty );
     37                elements[back] = elem;
     38                back = ( back + 1 ) % BufferSize;
     39                count += 1;
     40                signal( full );
     41        } // insert
    4542
    46 forall( otype T )
    47 T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    48         if ( count == 0 ) wait( full );
    49         T elem = elements[front];
    50         front = ( front + 1 ) % BufferSize;
    51         count -= 1;
    52         signal( empty );
    53         return elem;
     43        T remove( Buffer(T) & mutex buffer ) with( buffer ) {
     44                if ( count == 0 ) wait( full );
     45                T elem = elements[front];
     46                front = ( front + 1 ) % BufferSize;
     47                count -= 1;
     48                signal( empty );
     49                return elem;
     50        } // remove
    5451}
    5552
  • src/tests/concurrent/preempt.c

    rf465f0e r779a4a3  
    1717#endif
    1818
     19extern void __cfaabi_check_preemption();
     20
    1921static volatile int counter = 0;
    2022
     
    2931void main(worker_t & this) {
    3032        while(counter < N) {
     33                __cfaabi_check_preemption();
    3134                if( (counter % 7) == this.value ) {
     35                        __cfaabi_check_preemption();
    3236                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
     37                        __cfaabi_check_preemption();
    3338                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
     39                        __cfaabi_check_preemption();
    3440                }
     41                __cfaabi_check_preemption();
    3542        }
    3643}
Note: See TracChangeset for help on using the changeset viewer.