Changeset c2b10fa


Ignore:
Timestamp:
Jun 7, 2018, 3:03:10 PM (3 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, with_gc
Children:
61accc5
Parents:
61d9b4b (diff), a43c561 (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

Location:
src
Files:
1 added
2 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r61d9b4b rc2b10fa  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 22 08:39:29 2018
    13 // Update Count     : 1074
     12// Last Modified On : Wed Jun  6 15:57:50 2018
     13// Update Count     : 1076
    1414//
    1515
     
    174174}
    175175
    176 DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
     176DeclarationNode * DeclarationNode::newFunction( const string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
    177177        DeclarationNode * newnode = new DeclarationNode;
    178178        newnode->name = name;
     
    245245} // DeclarationNode::newForall
    246246
    247 DeclarationNode * DeclarationNode::newFromTypedef( string * name ) {
     247DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
    248248        DeclarationNode * newnode = new DeclarationNode;
    249249        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    268268} // DeclarationNode::newAggregate
    269269
    270 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants, bool body ) {
     270DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body ) {
    271271        assert( name );
    272272        DeclarationNode * newnode = new DeclarationNode;
     
    278278} // DeclarationNode::newEnum
    279279
    280 DeclarationNode * DeclarationNode::newEnumConstant( string * name, ExpressionNode * constant ) {
     280DeclarationNode * DeclarationNode::newEnumConstant( const string * name, ExpressionNode * constant ) {
    281281        DeclarationNode * newnode = new DeclarationNode;
    282282        newnode->name = name;
     
    285285} // DeclarationNode::newEnumConstant
    286286
    287 DeclarationNode * DeclarationNode::newName( string * name ) {
     287DeclarationNode * DeclarationNode::newName( const string * name ) {
    288288        DeclarationNode * newnode = new DeclarationNode;
    289289        newnode->name = name;
     
    291291} // DeclarationNode::newName
    292292
    293 DeclarationNode * DeclarationNode::newFromTypeGen( string * name, ExpressionNode * params ) {
     293DeclarationNode * DeclarationNode::newFromTypeGen( const string * name, ExpressionNode * params ) {
    294294        DeclarationNode * newnode = new DeclarationNode;
    295295        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    300300} // DeclarationNode::newFromTypeGen
    301301
    302 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, string * name ) {
     302DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
    303303        DeclarationNode * newnode = new DeclarationNode;
    304304        newnode->type = nullptr;
     
    331331} // DeclarationNode::newTraitUse
    332332
    333 DeclarationNode * DeclarationNode::newTypeDecl( string * name, DeclarationNode * typeParams ) {
     333DeclarationNode * DeclarationNode::newTypeDecl( const string * name, DeclarationNode * typeParams ) {
    334334        DeclarationNode * newnode = new DeclarationNode;
    335335        newnode->name = name;
     
    406406} // DeclarationNode::newBuiltinType
    407407
    408 DeclarationNode * DeclarationNode::newAttr( string * name, ExpressionNode * expr ) {
     408DeclarationNode * DeclarationNode::newAttr( const string * name, ExpressionNode * expr ) {
    409409        DeclarationNode * newnode = new DeclarationNode;
    410410        newnode->type = nullptr;
     
    415415}
    416416
    417 DeclarationNode * DeclarationNode::newAttr( string * name, DeclarationNode * type ) {
     417DeclarationNode * DeclarationNode::newAttr( const string * name, DeclarationNode * type ) {
    418418        DeclarationNode * newnode = new DeclarationNode;
    419419        newnode->type = nullptr;
     
    424424}
    425425
    426 DeclarationNode * DeclarationNode::newAttribute( string * name, ExpressionNode * expr ) {
     426DeclarationNode * DeclarationNode::newAttribute( const string * name, ExpressionNode * expr ) {
    427427        DeclarationNode * newnode = new DeclarationNode;
    428428        newnode->type = nullptr;
  • src/Parser/ParseNode.h

    r61d9b4b rc2b10fa  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 22:21:04 2018
    13 // Update Count     : 832
     12// Last Modified On : Wed Jun  6 16:17:18 2018
     13// Update Count     : 843
    1414//
    1515
     
    7777
    7878        ParseNode * next = nullptr;
    79         std::string * name = nullptr;
     79        const std::string * name = nullptr;
    8080        CodeLocation location = yylloc;
    8181}; // ParseNode
     
    171171};
    172172
    173 Expression * build_constantInteger( std::string &str );
    174 Expression * build_constantFloat( std::string &str );
    175 Expression * build_constantChar( std::string &str );
    176 Expression * build_constantStr( std::string &str );
     173Expression * build_constantInteger( std::string & str ); // these 4 routines modify the string
     174Expression * build_constantFloat( std::string & str );
     175Expression * build_constantChar( std::string & str );
     176Expression * build_constantStr( std::string & str );
    177177Expression * build_field_name_FLOATING_FRACTIONconstant( const std::string & str );
    178178Expression * build_field_name_FLOATING_DECIMALconstant( const std::string & str );
     
    230230        static DeclarationNode * newBuiltinType( BuiltinType );
    231231        static DeclarationNode * newForall( DeclarationNode * );
    232         static DeclarationNode * newFromTypedef( std::string * );
    233         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
     232        static DeclarationNode * newFromTypedef( const std::string * );
     233        static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    234234        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    235         static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
    236         static DeclarationNode * newEnumConstant( std::string * name, ExpressionNode * constant );
    237         static DeclarationNode * newName( std::string * );
    238         static DeclarationNode * newFromTypeGen( std::string *, ExpressionNode * params );
    239         static DeclarationNode * newTypeParam( TypeClass, std::string * );
     235        static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body );
     236        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
     237        static DeclarationNode * newName( const std::string * );
     238        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
     239        static DeclarationNode * newTypeParam( TypeClass, const std::string * );
    240240        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    241241        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    242         static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
     242        static DeclarationNode * newTypeDecl( const std::string * name, DeclarationNode * typeParams );
    243243        static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind );
    244244        static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic );
     
    247247        static DeclarationNode * newTuple( DeclarationNode * members );
    248248        static DeclarationNode * newTypeof( ExpressionNode * expr );
    249         static DeclarationNode * newAttr( std::string *, ExpressionNode * expr ); // @ attributes
    250         static DeclarationNode * newAttr( std::string *, DeclarationNode * type ); // @ attributes
    251         static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
     249        static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes
     250        static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes
     251        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    252252        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    253253        static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
  • src/Parser/TypeData.cc

    r61d9b4b rc2b10fa  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 26 13:46:07 2018
    13 // Update Count     : 603
     12// Last Modified On : Wed Jun  6 17:40:33 2018
     13// Update Count     : 604
    1414//
    1515
     
    610610
    611611                if ( td->basictype == DeclarationNode::Float80 || td->basictype == DeclarationNode::Float128 ) {
    612                         if ( td->complextype != DeclarationNode::NoComplexType ) {
    613                                 genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    614                         }
     612                        // if ( td->complextype != DeclarationNode::NoComplexType ) {
     613                        //      genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
     614                        // }
    615615                        if ( td->basictype == DeclarationNode::Float80 ) ret = BasicType::Float80;
    616616                        else ret = BasicType::Float128;
  • src/Parser/lex.ll

    r61d9b4b rc2b10fa  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu May  3 13:42:40 2018
    13  * Update Count     : 676
     12 * Last Modified On : Wed Jun  6 17:31:09 2018
     13 * Update Count     : 677
    1414 */
    1515
     
    232232finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    233233float                   { KEYWORD_RETURN(FLOAT); }
     234_Float32                { KEYWORD_RETURN(FLOAT); }                              // GCC
     235_Float32x               { KEYWORD_RETURN(FLOAT); }                              // GCC
     236_Float64                { KEYWORD_RETURN(DOUBLE); }                             // GCC
     237_Float64x               { KEYWORD_RETURN(DOUBLE); }                             // GCC
    234238__float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
    235239float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
     240_Float128               { KEYWORD_RETURN(FLOAT128); }                   // GCC
     241_Float128x              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    236242__float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    237243float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
  • src/Parser/parser.yy

    r61d9b4b rc2b10fa  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 22:22:04 2018
    13 // Update Count     : 3492
     12// Last Modified On : Wed Jun  6 14:53:38 2018
     13// Update Count     : 3522
    1414//
    1515
     
    503503                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    504504        | type_name '.' no_attr_identifier                                      // CFA, nested type
    505                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     505                // { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     506                { $$ = nullptr; }
    506507        | type_name '.' '[' field_list ']'                                      // CFA, nested type / tuple field selector
    507                 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     508                // { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     509                { $$ = nullptr; }
    508510        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    509511                {
     
    13001302        ;
    13011303
    1302 KR_parameter_list_opt:                                                          // used to declare parameter types in K&R style functions
     1304KR_parameter_list_opt:                                                                  // used to declare parameter types in K&R style functions
    13031305        // empty
    13041306                { $$ = nullptr; }
     
    17901792                { $$ = DeclarationNode::newFromTypedef( $1 ); }
    17911793        | '.' TYPEDEFname
    1792                 { $$ = DeclarationNode::newFromTypedef( $2 ); } // FIX ME
     1794                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17931795        | type_name '.' TYPEDEFname
    1794                 { $$ = DeclarationNode::newFromTypedef( $3 ); } // FIX ME
     1796                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17951797        | typegen_name
    17961798        | '.' typegen_name
    1797                 { $$ = $2; }                                                                    // FIX ME
     1799                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    17981800        | type_name '.' typegen_name
    1799                 { $$ = $3; }                                                                    // FIX ME
     1801                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
    18001802        ;
    18011803
     
    18221824        aggregate_key attribute_list_opt '{' field_declaration_list_opt '}'
    18231825                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    1824         | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
     1826        | aggregate_key attribute_list_opt no_attr_identifier
    18251827                {
    18261828                        typedefTable.makeTypedef( *$3 );                        // create typedef
     
    18301832          '{' field_declaration_list_opt '}'
    18311833                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
     1834        | aggregate_key attribute_list_opt type_name
     1835                {
     1836                        typedefTable.makeTypedef( *$3->type->symbolic.name ); // create typedef
     1837                        if ( forall ) typedefTable.changeKind( *$3->type->symbolic.name, TYPEGENname ); // possibly update
     1838                        forall = false;                                                         // reset
     1839                }
     1840          '{' field_declaration_list_opt '}'
     1841                { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, nullptr, $6, true )->addQualifiers( $2 ); }
    18321842        | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list_opt '}' // CFA
    18331843                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); }
     
    18431853                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18441854                }
    1845         | aggregate_key attribute_list_opt TYPEDEFname
    1846                 {
    1847                         typedefTable.makeTypedef( *$3 );
    1848                         $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    1849                 }
    1850         | aggregate_key attribute_list_opt typegen_name         // CFA
     1855        | aggregate_key attribute_list_opt type_name
    18511856                {
    18521857                        // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is
     
    19431948        ENUM attribute_list_opt '{' enumerator_list comma_opt '}'
    19441949                { $$ = DeclarationNode::newEnum( new string( DeclarationNode::anonymous.newName() ), $4, true )->addQualifiers( $2 ); }
    1945         | ENUM attribute_list_opt no_attr_identifier_or_type_name
     1950        | ENUM attribute_list_opt no_attr_identifier
    19461951                { typedefTable.makeTypedef( *$3 ); }
    19471952          '{' enumerator_list comma_opt '}'
    19481953                { $$ = DeclarationNode::newEnum( $3, $6, true )->addQualifiers( $2 ); }
     1954        | ENUM attribute_list_opt type_name
     1955          '{' enumerator_list comma_opt '}'
     1956                { $$ = DeclarationNode::newEnum( $3->type->symbolic.name, $5, true )->addQualifiers( $2 ); }
    19491957        | enum_type_nobody
    19501958        ;
    19511959
    19521960enum_type_nobody:                                                                               // enum - {...}
    1953         ENUM attribute_list_opt no_attr_identifier_or_type_name
     1961        ENUM attribute_list_opt no_attr_identifier
    19541962                {
    19551963                        typedefTable.makeTypedef( *$3 );
    19561964                        $$ = DeclarationNode::newEnum( $3, 0, false )->addQualifiers( $2 );
     1965                }
     1966        | ENUM attribute_list_opt type_name
     1967                {
     1968                        typedefTable.makeTypedef( *$3->type->symbolic.name );
     1969                        $$ = DeclarationNode::newEnum( $3->type->symbolic.name, 0, false )->addQualifiers( $2 );
    19571970                }
    19581971        ;
  • src/libcfa/bits/locks.h

    r61d9b4b rc2b10fa  
    1818#include "bits/debug.h"
    1919#include "bits/defs.h"
     20#include <assert.h>
     21
     22#ifdef __cforall
     23        extern "C" {
     24                #include <pthread.h>
     25        }
     26#endif
    2027
    2128// pause to prevent excess processor bus usage
     
    112119                __atomic_clear( &this.lock, __ATOMIC_RELEASE );
    113120        }
     121
     122
     123        #ifdef __CFA_WITH_VERIFY__
     124                extern bool __cfaabi_dbg_in_kernel();
     125        #endif
     126
     127        struct __bin_sem_t {
     128                int_fast8_t     counter;
     129                pthread_mutex_t lock;
     130                pthread_cond_t  cond;
     131        };
     132
     133        static inline void ?{}(__bin_sem_t & this) with( this ) {
     134                counter = 0;
     135                pthread_mutex_init(&lock, NULL);
     136                pthread_cond_init (&cond, NULL);
     137        }
     138
     139        static inline void ^?{}(__bin_sem_t & this) with( this ) {
     140                pthread_mutex_destroy(&lock);
     141                pthread_cond_destroy (&cond);
     142        }
     143
     144        static inline void wait(__bin_sem_t & this) with( this ) {
     145                verify(__cfaabi_dbg_in_kernel());
     146                pthread_mutex_lock(&lock);
     147                if(counter != 0) {   // this must be a loop, not if!
     148                        pthread_cond_wait(&cond, &lock);
     149                }
     150                counter = 1;
     151                pthread_mutex_unlock(&lock);
     152        }
     153
     154        static inline void post(__bin_sem_t & this) with( this ) {
     155                verify(__cfaabi_dbg_in_kernel());
     156                pthread_mutex_lock(&lock);
     157                bool needs_signal = counter == 0;
     158                counter = 1;
     159                pthread_mutex_unlock(&lock);
     160                if (!needs_signal)
     161                        pthread_cond_signal(&cond);
     162                }
    114163#endif
  • src/libcfa/concurrency/kernel

    r61d9b4b rc2b10fa  
    133133        // Idle lock
    134134        sem_t idleLock;
     135        // __bin_sem_t idleLock;
    135136
    136137        // Link lists fields
    137         struct {
     138        struct __dbg_node_proc {
    138139                struct processor * next;
    139140                struct processor * prev;
     
    182183
    183184        // Link lists fields
    184         struct {
     185        struct __dbg_node_cltr {
    185186                cluster * next;
    186187                cluster * prev;
  • src/libcfa/concurrency/kernel.c

    r61d9b4b rc2b10fa  
    1717#include <stddef.h>
    1818#include <errno.h>
     19#include <string.h>
    1920extern "C" {
    2021#include <stdio.h>
     
    5051thread_desc * mainThread;
    5152
    52 struct { __dllist_t(cluster) list; __spinlock_t lock; } global_clusters;
     53extern "C" {
     54struct { __dllist_t(cluster) list; __spinlock_t lock; } __cfa_dbg_global_clusters;
     55}
    5356
    5457//-----------------------------------------------------------------------------
     
    150153
    151154void ^?{}(processor & this) with( this ){
    152         if( ! do_terminate ) {
     155        if( ! __atomic_load_n(&do_terminate, __ATOMIC_ACQUIRE) ) {
    153156                __cfaabi_dbg_print_safe("Kernel : core %p signaling termination\n", &this);
    154157                terminate(&this);
    155                 verify(this.do_terminate);
     158                verify( __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) );
    156159                verify( kernelTLS.this_processor != &this);
    157160                P( terminated );
     
    199202
    200203                thread_desc * readyThread = NULL;
    201                 for( unsigned int spin_count = 0; ! this->do_terminate; spin_count++ )
     204                for( unsigned int spin_count = 0; ! __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST); spin_count++ )
    202205                {
    203206                        readyThread = nextThread( this->cltr );
     
    218221                        else
    219222                        {
    220                                 spin(this, &spin_count);
     223                                // spin(this, &spin_count);
     224                                halt(this);
    221225                        }
    222226                }
     
    545549        __cfaabi_dbg_print_safe("Kernel : Starting\n");
    546550
    547         global_clusters.list{ __get };
    548         global_clusters.lock{};
     551        __cfa_dbg_global_clusters.list{ __get };
     552        __cfa_dbg_global_clusters.lock{};
    549553
    550554        // Initialize the main cluster
     
    627631        // When its coroutine terminates, it return control to the mainThread
    628632        // which is currently here
    629         mainProcessor->do_terminate = true;
     633        __atomic_store_n(&mainProcessor->do_terminate, true, __ATOMIC_RELEASE);
    630634        returnToKernel();
     635        mainThread->self_cor.state = Halted;
    631636
    632637        // THE SYSTEM IS NOW COMPLETELY STOPPED
     
    644649        ^(mainThread){};
    645650
    646         ^(global_clusters.list){};
    647         ^(global_clusters.lock){};
     651        ^(__cfa_dbg_global_clusters.list){};
     652        ^(__cfa_dbg_global_clusters.lock){};
    648653
    649654        __cfaabi_dbg_print_safe("Kernel : Shutdown complete\n");
     
    655660
    656661void halt(processor * this) with( *this ) {
     662        verify( ! __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) );
     663
    657664        with( *cltr ) {
    658665                lock      (proc_list_lock __cfaabi_dbg_ctx2);
     
    664671        __cfaabi_dbg_print_safe("Kernel : Processor %p ready to sleep\n", this);
    665672
    666         verify( ({int sval = 0; sem_getvalue(&this->idleLock, &sval); sval; }) < 200);
     673        // #ifdef __CFA_WITH_VERIFY__
     674        //      int sval = 0;
     675        //      sem_getvalue(&this->idleLock, &sval);
     676        //      verifyf(sval < 200, "Binary semaphore reached value %d : \n", sval);
     677        // #endif
     678
     679        verify( ! __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) );
    667680        int __attribute__((unused)) ret = sem_wait(&idleLock);
    668         verify(ret > 0 || errno == EINTR);
     681        // verifyf(ret >= 0 || errno == EINTR, "Sem_wait returned %d (errno %d : %s\n", ret, errno, strerror(errno));
     682
     683        // wait( idleLock );
    669684
    670685        __cfaabi_dbg_print_safe("Kernel : Processor %p woke up and ready to run\n", this);
     
    681696        __cfaabi_dbg_print_safe("Kernel : Waking up processor %p\n", this);
    682697        int __attribute__((unused)) ret = sem_post(&this->idleLock);
    683         verify(ret > 0 || errno == EINTR);
    684         verify( ({int sval = 0; sem_getvalue(&this->idleLock, &sval); sval; }) < 200);
     698        // verifyf(ret >= 0 || errno == EINTR, "Sem_post returned %d (errno %d : %s\n", ret, errno, strerror(errno));
     699
     700        // #ifdef __CFA_WITH_VERIFY__
     701        //      int sval = 0;
     702        //      sem_getvalue(&this->idleLock, &sval);
     703        //      verifyf(sval < 200, "Binary semaphore reached value %d\n", sval);
     704        // #endif
     705
     706        // post( this->idleLock );
    685707}
    686708
     
    798820// Global Queues
    799821void doregister( cluster     & cltr ) {
    800         lock      ( global_clusters.lock __cfaabi_dbg_ctx2);
    801         push_front( global_clusters.list, cltr );
    802         unlock    ( global_clusters.lock );
     822        lock      ( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
     823        push_front( __cfa_dbg_global_clusters.list, cltr );
     824        unlock    ( __cfa_dbg_global_clusters.lock );
    803825}
    804826
    805827void unregister( cluster     & cltr ) {
    806         lock  ( global_clusters.lock __cfaabi_dbg_ctx2);
    807         remove( global_clusters.list, cltr );
    808         unlock( global_clusters.lock );
     828        lock  ( __cfa_dbg_global_clusters.lock __cfaabi_dbg_ctx2);
     829        remove( __cfa_dbg_global_clusters.list, cltr );
     830        unlock( __cfa_dbg_global_clusters.lock );
    809831}
    810832
  • src/libcfa/concurrency/preemption.c

    r61d9b4b rc2b10fa  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 13:52:39 2018
    13 // Update Count     : 36
     12// Last Modified On : Tue Jun  5 17:35:49 2018
     13// Update Count     : 37
    1414//
    1515
     
    116116        // If there are still alarms pending, reset the timer
    117117        if( alarms->head ) {
    118                 __cfaabi_dbg_print_buffer_decl( " KERNEL: @%lu(%lu) resetting alarm to %lu.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv);
     118                __cfaabi_dbg_print_buffer_decl( " KERNEL: @%ju(%ju) resetting alarm to %ju.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv);
    119119                Duration delta = alarms->head->alarm - currtime;
    120120                Duration caped = max(delta, 50`us);
     
    265265// kill wrapper : signal a processor
    266266void terminate(processor * this) {
    267         this->do_terminate = true;
    268         wake(this);
     267        disable_interrupts();
     268        __atomic_store_n(&this->do_terminate, true, __ATOMIC_SEQ_CST);
     269        wake( this );
    269270        sigval_t value = { PREEMPT_TERMINATE };
     271        enable_interrupts( __cfaabi_dbg_ctx );
    270272        pthread_sigqueue( this->kernel_thread, SIGUSR1, value );
    271273}
     
    369371        choose(sfp->si_value.sival_int) {
    370372                case PREEMPT_NORMAL   : ;// Normal case, nothing to do here
    371                 case PREEMPT_TERMINATE: verify( kernelTLS.this_processor->do_terminate);
     373                case PREEMPT_TERMINATE: verify( __atomic_load_n( &kernelTLS.this_processor->do_terminate, __ATOMIC_SEQ_CST ) );
    372374                default:
    373375                        abort( "internal error, signal value is %d", sfp->si_value.sival_int );
     
    488490}
    489491
     492#ifdef __CFA_WITH_VERIFY__
     493bool __cfaabi_dbg_in_kernel() {
     494        return !kernelTLS.preemption_state.enabled;
     495}
     496#endif
     497
    490498// Local Variables: //
    491499// mode: c //
  • src/libcfa/fstream

    r61d9b4b rc2b10fa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 15:17:26 2017
    13 // Update Count     : 130
     12// Last Modified On : Tue Jun  5 10:20:25 2018
     13// Update Count     : 131
    1414//
    1515
     
    5454void open( ofstream &, const char * name );
    5555void close( ofstream & );
    56 ofstream & write( ofstream &, const char * data, unsigned long int size );
     56ofstream & write( ofstream &, const char * data, size_t size );
    5757int fmt( ofstream &, const char fmt[], ... );
    5858
     
    7474void open( ifstream & is, const char * name );
    7575void close( ifstream & is );
    76 ifstream & read( ifstream & is, char * data, unsigned long int size );
     76ifstream & read( ifstream & is, char * data, size_t size );
    7777ifstream & ungetc( ifstream & is, char c );
    7878int fmt( ifstream &, const char fmt[], ... );
  • src/libcfa/fstream.c

    r61d9b4b rc2b10fa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Dec  9 09:31:23 2017
    13 // Update Count     : 275
     12// Last Modified On : Tue Jun  5 17:02:56 2018
     13// Update Count     : 281
    1414//
    1515
     
    116116} // close
    117117
    118 ofstream & write( ofstream & os, const char * data, unsigned long int size ) {
     118ofstream & write( ofstream & os, const char * data, size_t size ) {
    119119        if ( fail( os ) ) {
    120120                fprintf( stderr, "attempt write I/O on failed stream\n" );
     
    198198} // close
    199199
    200 ifstream & read( ifstream & is, char * data, unsigned long int size ) {
     200ifstream & read( ifstream & is, char * data, size_t size ) {
    201201        if ( fail( is ) ) {
    202202                fprintf( stderr, "attempt read I/O on failed stream\n" );
  • src/libcfa/stdhdr/assert.h

    r61d9b4b rc2b10fa  
    3333        #define verify(x) assert(x)
    3434        #define verifyf(x, ...) assertf(x, __VA_ARGS__)
     35        #define __CFA_WITH_VERIFY__
    3536#else
    3637        #define verify(x)
  • src/main.cc

    r61d9b4b rc2b10fa  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 30 17:53:14 2018
    13 // Update Count     : 496
     12// Last Modified On : Wed Jun  6 15:51:47 2018
     13// Update Count     : 498
    1414//
    1515
     
    157157                 << "." << endl;
    158158        backtrace( 2 );                                                                         // skip first 2 stack frames
    159         exit( EXIT_FAILURE );
     159        //_exit( EXIT_FAILURE );
     160        abort();
    160161} // sigSegvBusHandler
    161162
  • src/prelude/extras.regx

    r61d9b4b rc2b10fa  
    11typedef.* size_t;
    22typedef.* ptrdiff_t;
     3typedef.* __int8_t;
     4typedef.* __int16_t;
     5typedef.* __int32_t;
     6typedef.* __int64_t;
     7typedef.* __uint8_t;
     8typedef.* __uint16_t;
     9typedef.* __uint32_t;
     10typedef.* __uint64_t;
    311typedef.* int8_t;
    412typedef.* int16_t;
  • src/prelude/sync-builtins.cf

    r61d9b4b rc2b10fa  
    248248#endif
    249249
     250_Bool __atomic_load_n(const volatile _Bool *, int);
     251void __atomic_load(const volatile _Bool *, volatile _Bool *, int);
    250252char __atomic_load_n(const volatile char *, int);
    251253char __atomic_load_1(const volatile char *, int);
     
    285287
    286288void __atomic_store_n(volatile _Bool *, _Bool, int);
    287 void __atomic_store_1(volatile _Bool *, _Bool, int);
    288289void __atomic_store(volatile _Bool *, _Bool *, int);
    289290void __atomic_store_n(volatile char *, char, int);
  • src/tests/Makefile.am

    r61d9b4b rc2b10fa  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Nov 27 21:34:33 2017
    14 ## Update Count     : 48
     13## Last Modified On : Wed Jun  6 16:42:20 2018
     14## Update Count     : 49
    1515###############################################################################
    1616
     
    9292        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    9393
    94 literals : literals.c @CFA_BINDIR@/@CFA_NAME@
    95         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    96 
    9794sched-ext-parse : sched-ext-parse.c @CFA_BINDIR@/@CFA_NAME@
    9895        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
  • src/tests/Makefile.in

    r61d9b4b rc2b10fa  
    769769        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    770770
    771 literals : literals.c @CFA_BINDIR@/@CFA_NAME@
    772         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    773 
    774771sched-ext-parse : sched-ext-parse.c @CFA_BINDIR@/@CFA_NAME@
    775772        ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
  • src/tests/ifwhileCtl.c

    r61d9b4b rc2b10fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ifcond.c --
     7// ifwhileCtl.c --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Aug 26 10:13:11 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 22:46:48 2018
    13 // Update Count     : 19
     12// Last Modified On : Wed Jun  6 17:15:09 2018
     13// Update Count     : 21
    1414//
    1515
     
    7272// Local Variables: //
    7373// tab-width: 4 //
    74 // compile-command: "cfa ifcond.c" //
     74// compile-command: "cfa ifwhileCtl.c" //
    7575// End: //
  • src/tests/preempt_longrun/processor.c

    r61d9b4b rc2b10fa  
    22#include <thread>
    33#include <time>
     4
     5#include <unistd.h>
    46
    57#ifndef PREEMPTION_RATE
     
    1517int main(int argc, char* argv[]) {
    1618        processor * p[15];
     19        write(STDERR_FILENO, "Preparing\n", sizeof("Preparing\n"));
    1720        for ( int pi = 0; pi < 15; pi++ ) {
    1821                p[pi] = new();
    1922        }
     23        write(STDERR_FILENO, "Starting\n", sizeof("Starting\n"));
    2024        for ( int i = 0; i < N; i++) {
    2125                int pi = i % 15;
     
    2327                p[pi] = new();
    2428        }
     29        write(STDERR_FILENO, "Stopping\n", sizeof("Stopping\n"));
    2530        for ( int pi = 0; pi < 15; pi++ ) {
    2631                delete( p[pi] );
    2732        }
     33        write(STDERR_FILENO, "Done\n", sizeof("Done\n"));
    2834}
Note: See TracChangeset for help on using the changeset viewer.