Changes in / [a01faa98:b09ca2b]


Ignore:
Files:
200 added
207 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    ra01faa98 rb09ca2b  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu May 25 15:20:04 2023
    14 ## Update Count     : 259
     13## Last Modified On : Fri Jul 16 16:00:40 2021
     14## Update Count     : 255
    1515###############################################################################
    1616
     
    5959        bits/queue.hfa \
    6060        bits/sequence.hfa \
    61         concurrency/atomic.hfa \
    6261        concurrency/iofwd.hfa \
    6362        concurrency/barrier.hfa \
     
    116115        concurrency/kernel/fwd.hfa \
    117116        concurrency/mutex_stmt.hfa \
    118         concurrency/channel.hfa \
    119         concurrency/actor.hfa
     117    concurrency/channel.hfa \
     118    concurrency/actor.hfa
    120119
    121120inst_thread_headers_src = \
     
    128127        concurrency/monitor.hfa \
    129128        concurrency/mutex.hfa \
    130         concurrency/select.hfa \
     129    concurrency/select.hfa \
    131130        concurrency/thread.hfa
    132131
  • src/AST/Pass.impl.hpp

    ra01faa98 rb09ca2b  
    2020#include <unordered_map>
    2121
    22 #include "AST/Copy.hpp"
    2322#include "AST/TranslationUnit.hpp"
    2423#include "AST/TypeSubstitution.hpp"
  • src/AST/Print.cpp

    ra01faa98 rb09ca2b  
    1616#include "Print.hpp"
    1717
    18 #include "Attribute.hpp"
    1918#include "Decl.hpp"
    2019#include "Expr.hpp"
    21 #include "Init.hpp"
    2220#include "Stmt.hpp"
    2321#include "Type.hpp"
    2422#include "TypeSubstitution.hpp"
    2523#include "CompilationState.h"
    26 #include "Common/Iterate.hpp"
     24
     25#include "Common/utility.h" // for group_iterate
    2726
    2827using namespace std;
  • src/AST/SymbolTable.cpp

    ra01faa98 rb09ca2b  
    1818#include <cassert>
    1919
    20 #include "Copy.hpp"
    2120#include "Decl.hpp"
    2221#include "Expr.hpp"
  • src/AST/TypeSubstitution.cpp

    ra01faa98 rb09ca2b  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 25 11:24:00 2023
    13 // Update Count     : 6
    14 //
    15 
     12// Last Modified On : Mon Jun  3 13:26:00 2017
     13// Update Count     : 5
     14//
     15
     16#include "Type.hpp"   // for TypeInstType, Type, StructInstType, UnionInstType
    1617#include "TypeSubstitution.hpp"
    1718
    18 #include "Type.hpp"   // for TypeInstType, Type, StructInstType, UnionInstType
    19 #include "Pass.hpp"   // for Pass, PureVisitor, WithGuards, WithVisitorRef
    20 
    2119namespace ast {
     20
     21
     22// size_t TypeSubstitution::Substituter::traceId = Stats::Heap::new_stacktrace_id("TypeSubstitution");
    2223
    2324TypeSubstitution::TypeSubstitution() {
     
    118119}
    119120
    120 // definitition must happen after PassVisitor is included so that WithGuards can be used
    121 struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter>, public PureVisitor {
    122         //static size_t traceId;
    123 
    124         Substituter( const TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
    125 
    126         const Type * postvisit( const TypeInstType * aggregateUseType );
    127 
    128         /// Records type variable bindings from forall-statements
    129         void previsit( const FunctionType * type );
    130         /// Records type variable bindings from forall-statements and instantiations of generic types
    131         // void handleAggregateType( const BaseInstType * type );
    132 
    133         // void previsit( const StructInstType * aggregateUseType );
    134         // void previsit( const UnionInstType * aggregateUseType );
    135 
    136         const TypeSubstitution & sub;
    137         int subCount = 0;
    138         bool freeOnly;
    139         typedef std::unordered_set< TypeEnvKey > BoundVarsType;
    140         BoundVarsType boundVars;
    141 };
    142 
    143 // size_t TypeSubstitution::Substituter::traceId = Stats::Heap::new_stacktrace_id("TypeSubstitution");
    144 
    145121void TypeSubstitution::normalize() {
    146122        Pass<Substituter> sub( *this, true );
     
    152128                }
    153129        } while ( sub.core.subCount );
    154 }
    155 
    156 TypeSubstitution::ApplyResult<Node> TypeSubstitution::applyBase(
    157                 const Node * input, bool isFree ) const {
    158         assert( input );
    159         Pass<Substituter> sub( *this, isFree );
    160         const Node * output = input->accept( sub );
    161         return { output, sub.core.subCount };
    162130}
    163131
  • src/AST/TypeSubstitution.hpp

    ra01faa98 rb09ca2b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 25 12:31:00 2023
    13 // Update Count     : 10
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Apr 30 22:52:47 2019
     13// Update Count     : 9
    1414//
    1515
     
    4646        TypeSubstitution &operator=( const TypeSubstitution &other );
    4747
    48         template< typename node_t >
     48        template< typename SynTreeClass >
    4949        struct ApplyResult {
    50                 ast::ptr<node_t> node;
     50                ast::ptr<SynTreeClass> node;
    5151                int count;
    5252        };
    5353
    54         template< typename node_t >
    55         ApplyResult<node_t> apply( const node_t * input ) const {
    56                 ApplyResult<Node> ret = applyBase( input, false );
    57                 return { ret.node.strict_as<node_t>(), ret.count };
    58         }
     54        template< typename SynTreeClass > ApplyResult<SynTreeClass> apply( const SynTreeClass * input ) const;
     55        template< typename SynTreeClass > ApplyResult<SynTreeClass> applyFree( const SynTreeClass * input ) const;
    5956
    6057        template< typename node_t, enum Node::ref_type ref_t >
    6158        int apply( ptr_base< node_t, ref_t > & input ) const {
    62                 ApplyResult<Node> ret = applyBase( input.get(), false );
    63                 input = ret.node.strict_as<node_t>();
     59                const node_t * p = input.get();
     60                auto ret = apply(p);
     61                input = ret.node;
    6462                return ret.count;
    6563        }
    6664
    67         template< typename node_t >
    68         ApplyResult<node_t> applyFree( const node_t * input ) const {
    69                 ApplyResult<Node> ret = applyBase( input, true );
    70                 return { ret.node.strict_as<node_t>(), ret.count };
    71         }
    72 
    7365        template< typename node_t, enum Node::ref_type ref_t >
    7466        int applyFree( ptr_base< node_t, ref_t > & input ) const {
    75                 ApplyResult<Node> ret = applyBase( input.get(), true );
    76                 input = ret.node.strict_as<node_t>();
     67                const node_t * p = input.get();
     68                auto ret = applyFree(p);
     69                input = ret.node;
    7770                return ret.count;
    7871        }
     
    10497        // Mutator that performs the substitution
    10598        struct Substituter;
    106         ApplyResult<Node> applyBase( const Node * input, bool isFree ) const;
    10799
    108100        // TODO: worry about traversing into a forall-qualified function type or type decl with assertions
     
    166158} // namespace ast
    167159
     160// include needs to happen after TypeSubstitution is defined so that both TypeSubstitution and
     161// PassVisitor are defined before PassVisitor implementation accesses TypeSubstitution internals.
     162#include "Pass.hpp"
     163#include "Copy.hpp"
     164
     165namespace ast {
     166
     167// definitition must happen after PassVisitor is included so that WithGuards can be used
     168struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter>, public PureVisitor {
     169                static size_t traceId;
     170
     171                Substituter( const TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
     172
     173                const Type * postvisit( const TypeInstType * aggregateUseType );
     174
     175                /// Records type variable bindings from forall-statements
     176                void previsit( const FunctionType * type );
     177                /// Records type variable bindings from forall-statements and instantiations of generic types
     178                // void handleAggregateType( const BaseInstType * type );
     179
     180                // void previsit( const StructInstType * aggregateUseType );
     181                // void previsit( const UnionInstType * aggregateUseType );
     182
     183                const TypeSubstitution & sub;
     184                int subCount = 0;
     185                bool freeOnly;
     186                typedef std::unordered_set< TypeEnvKey > BoundVarsType;
     187                BoundVarsType boundVars;
     188
     189};
     190
     191template< typename SynTreeClass >
     192TypeSubstitution::ApplyResult<SynTreeClass> TypeSubstitution::apply( const SynTreeClass * input ) const {
     193        assert( input );
     194        Pass<Substituter> sub( *this, false );
     195        input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) );
     196        return { input, sub.core.subCount };
     197}
     198
     199template< typename SynTreeClass >
     200TypeSubstitution::ApplyResult<SynTreeClass> TypeSubstitution::applyFree( const SynTreeClass * input ) const {
     201        assert( input );
     202        Pass<Substituter> sub( *this, true );
     203        input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) );
     204        return { input, sub.core.subCount };
     205}
     206
     207} // namespace ast
     208
    168209// Local Variables: //
    169210// tab-width: 4 //
  • src/Concurrency/Waituntil.cpp

    ra01faa98 rb09ca2b  
    1414//
    1515
     16#include <string>
     17
    1618#include "Waituntil.hpp"
    17 
    18 #include <string>
    19 
    20 #include "AST/Copy.hpp"
    2119#include "AST/Expr.hpp"
    2220#include "AST/Pass.hpp"
  • src/ControlStruct/ExceptDeclNew.cpp

    ra01faa98 rb09ca2b  
    1818#include <sstream>
    1919
    20 #include "AST/Copy.hpp"
    2120#include "AST/Decl.hpp"
    2221#include "AST/Pass.hpp"
  • src/GenPoly/SpecializeNew.cpp

    ra01faa98 rb09ca2b  
    1616#include "Specialize.h"
    1717
    18 #include "AST/Copy.hpp"                  // for deepCopy
    1918#include "AST/Inspect.hpp"               // for isIntrinsicCallExpr
    2019#include "AST/Pass.hpp"                  // for Pass
  • src/MakeLibCfaNew.cpp

    ra01faa98 rb09ca2b  
    1616#include "MakeLibCfa.h"
    1717
    18 #include "AST/Copy.hpp"
    1918#include "AST/Fwd.hpp"
    2019#include "AST/Pass.hpp"
  • src/ResolvExpr/CommonType.cc

    ra01faa98 rb09ca2b  
    2121
    2222#include "AST/Decl.hpp"
    23 #include "AST/Pass.hpp"
    2423#include "AST/Type.hpp"
    2524#include "Common/PassVisitor.h"
  • src/ResolvExpr/PolyCost.cc

    ra01faa98 rb09ca2b  
    1515
    1616#include "AST/SymbolTable.hpp"
    17 #include "AST/Pass.hpp"
    1817#include "AST/Type.hpp"
    1918#include "AST/TypeEnvironment.hpp"
  • src/Tuples/Explode.cc

    ra01faa98 rb09ca2b  
    1717#include <list>                  // for list
    1818
    19 #include "AST/Pass.hpp"          // for Pass
    2019#include "SynTree/Mutator.h"     // for Mutator
    2120#include "Common/PassVisitor.h"  // for PassVisitor
  • src/Validate/Autogen.cpp

    ra01faa98 rb09ca2b  
    2525
    2626#include "AST/Attribute.hpp"
    27 #include "AST/Copy.hpp"
    2827#include "AST/Create.hpp"
    2928#include "AST/Decl.hpp"
  • src/Validate/FixQualifiedTypes.cpp

    ra01faa98 rb09ca2b  
    1616#include "Validate/FixQualifiedTypes.hpp"
    1717
    18 #include "AST/Copy.hpp"
    1918#include "AST/LinkageSpec.hpp"             // for Linkage
    2019#include "AST/Pass.hpp"
  • src/Validate/GenericParameter.cpp

    ra01faa98 rb09ca2b  
    1616#include "GenericParameter.hpp"
    1717
    18 #include "AST/Copy.hpp"
    1918#include "AST/Decl.hpp"
    2019#include "AST/Expr.hpp"
  • src/Validate/ReplaceTypedef.cpp

    ra01faa98 rb09ca2b  
    1616#include "ReplaceTypedef.hpp"
    1717
    18 #include "AST/Copy.hpp"
    1918#include "AST/Pass.hpp"
    2019#include "Common/ScopedMap.h"
  • src/Virtual/ExpandCasts.cc

    ra01faa98 rb09ca2b  
    2020#include <string>                  // for string, allocator, operator==, ope...
    2121
    22 #include "AST/Copy.hpp"
    2322#include "AST/Decl.hpp"
    2423#include "AST/Expr.hpp"
  • src/main.cc

    ra01faa98 rb09ca2b  
    3232
    3333#include "AST/Convert.hpp"
    34 #include "AST/Pass.hpp"                     // for pass_visitor_stats
    35 #include "AST/TranslationUnit.hpp"          // for TranslationUnit
    3634#include "AST/Util.hpp"                     // for checkInvariants
    3735#include "CompilationState.h"
  • tests/.expect/array.txt

    ra01faa98 rb09ca2b  
    1 array.cfa:105:25: warning: Preprocessor started
     1array.cfa:52:25: warning: Compiled
  • tests/Makefile.am

    ra01faa98 rb09ca2b  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri May 26 08:23:09 2023
    14 ## Update Count     : 179
     13## Last Modified On : Tue May 16 09:27:48 2023
     14## Update Count     : 178
    1515###############################################################################
    1616
     
    7979        avltree/avl-private.h \
    8080        avltree/avl.h \
     81        concurrent/clib_tls.c \
     82        concurrent/clib.c \
    8183        configs/.in/parseconfig-all.txt \
    8284        configs/.in/parseconfig-errors.txt \
     
    8789        io/.in/many_read.data \
    8890        meta/fork+exec.hfa \
    89         concurrency/clib_tls.c \
    90         concurrency/clib.c \
    91         concurrency/unified_locking/mutex_test.hfa \
    92         concurrentcy/channels/parallel_harness.hfa
     91        concurrent/unified_locking/mutex_test.hfa \
     92        concurrent/channels/parallel_harness.hfa
    9393
    9494dist-hook:
     
    204204
    205205SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
    206         init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrency/waitfor/parse
     206        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
    207207${SYNTAX_ONLY_CODE} : % : %.cfa ${CFACCBIN}
    208208        ${CFACOMPILE_SYNTAX}
     
    211211# expected failures
    212212# use custom target since they require a custom define *and* have a name that doesn't match the file
    213 
    214 array-ERR1 : array.cfa ${CFACCBIN}
    215         ${CFACOMPILE_SYNTAX} -DERR1
    216         -cp ${test} ${abspath ${@}}
    217 
    218 array-ERR2 : array.cfa ${CFACCBIN}
    219         ${CFACOMPILE_SYNTAX} -DERR2
    220         -cp ${test} ${abspath ${@}}
    221 
    222 array-ERR3 : array.cfa ${CFACCBIN}
    223         ${CFACOMPILE_SYNTAX} -DERR3
    224         -cp ${test} ${abspath ${@}}
    225 
    226213alloc-ERROR : alloc.cfa ${CFACCBIN}
    227214        ${CFACOMPILE_SYNTAX} -DERR1
  • tests/PRNG.cfa

    ra01faa98 rb09ca2b  
    1 //
     1//                               -*- Mode: C -*-
     2//
    23// Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo
    3 //
    4 // PRNG.c -- high-perforamnce pseudo-random numbers
    5 //
    6 // The contents of this file are covered under the licence agreement in the
    7 // file "LICENCE" distributed with Cforall.
    8 //
     4//
     5// PRNG.c --
     6//
    97// Author           : Peter A. Buhr
    108// Created On       : Wed Dec 29 09:38:12 2021
    119// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May 25 15:39:52 2023
    13 // Update Count     : 422
     10// Last Modified On : Sun Apr 23 22:02:09 2023
     11// Update Count     : 420
    1412//
    1513
  • tests/array.cfa

    ra01faa98 rb09ca2b  
    1515//
    1616
    17 // Tests syntax.  Comments explain semantics.  Test does not show semantics.
    18 // Mostly illustrates facts about C (with which CFA is being tested to agree).
    19 // Is a test oracle under `gcc -x c`.
     17int a1[0];
     18//int a2[*];
     19//double a4[3.0];
    2020
    21 #ifdef ERR1
    22 #define E1(...) __VA_ARGS__
    23 #else
    24 #define E1(...)
    25 #endif
     21int m1[0][3];
     22//int m2[*][*];
     23int m4[3][3];
    2624
    27 #ifdef ERR2
    28 #define E2(...) __VA_ARGS__
    29 #else
    30 #define E2(...)
    31 #endif
     25typedef int T;
    3226
    33 #ifdef ERR3
    34 #define E3(...) __VA_ARGS__
    35 #else
    36 #define E3(...)
    37 #endif
     27int fred() {
     28//      int a1[];
     29//      int a2[*];
     30        int a4[3];
     31        int T[3];
     32}
    3833
    39     int a1[0];
    40 E1( int a2[*];       )
    41                                                         #ifndef __cforall
    42 E1( double a4[3.0];  )                                  // BUG 275: CFA accepts but should reject
    43                                                         #endif
     34int mary( int T[3],
     35                  int p1[const 3],
     36                  int p2[static 3],
     37                  int p3[static const 3]
     38        ) {
     39}
    4440
    45     int m1[0][3];
    46 E1( int m2[*][*];    )
    47     int m4[3][3];
     41int (*tom())[3] {
     42}
    4843
    49     typedef int T;
    50 
    51     int fred(int n) {
    52 E1(     int a1[];    )
    53 E1(     int a2[*];   )
    54         int a4[3];
    55         int T[3];
    56         int a5[n];
    57     }
    58 
    59     int mary( int T[3],                                 // same as: int *T
    60               int p1[const 3],                          // same as: int const *p1
    61               int p2[static 3],                         // same as T, but length >=3 checked
    62               int p3[static const 3]                    // both above: 3 is static, p3 is const
    63         ) {
    64     }
    65 
    66     // function taking (), returning pointer to array of ints
    67     int (*tom())[3] {
    68     }
    69 
    70     // function taking (), returning pointer to function of same type as mary
    71     int (*(jane)())( int T[3],
    72                      int p1[const 3],
    73                      int p2[static 3],
    74                      int p3[static const 3]
    75         ) {
    76     }
    77 
    78     // functions returning same exotic pointers, in CFA's non-onion syntax
    79     #ifdef __cforall
    80     [ * [3] int ] toms_twin(...) {
    81     }
    82     [ * [int]( [3] int T,
    83             [const 3] int p1,
    84             [static 3] int p2,
    85             [static const 3] int p3
    86             )
    87     ] janes_twin(...) {
    88     }
    89     #endif
    90 
    91 
    92 //  int fm1( int, int, int[][*] );                      // TODO: investigate gcc-11 warning
    93 //  int fm1( int r, int c, int m[][c] ) {}
    94     int fm2( int r, int c, int (*m)[c] ) {}             // same as fm1
    95 E2( int fm3( int r, int c, int m[][static c] ) {}  )    // that's not static
    96 E3( int fm4( int r, int c, int m[][] );            )    // m's immediate element type is incomplete
    97     int fm5( int, int, int[*][*] );                     // same as fm1 decl
    98                                                         #ifndef __cforall
    99     int fm5( int r, int c, int m[r][c] ) {}             // BUG 276: CFA chokes but should accept
    100                                                         // C: same as fm1 defn
    101                                                         #endif
    102 
     44int (*(jane)())( int T[3],
     45                                 int p1[const 3],
     46                                 int p2[static 3],
     47                                 int p3[static const 3]
     48        ) {
     49}
    10350
    10451int main() {
    105     #pragma GCC warning "Preprocessor started"          // force non-empty .expect file, NO TABS!!!
     52    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    10653}
    10754
Note: See TracChangeset for help on using the changeset viewer.