Changeset 9d264e1


Ignore:
Timestamp:
Nov 12, 2020, 1:29:43 PM (11 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
b5344a3
Parents:
d6ad99e (diff), 8ca26d5 (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:software/cfa/cfa-cc

Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • benchmark/rmit.py

    rd6ad99e r9d264e1  
    1212import datetime
    1313import itertools
     14import json
    1415import os
    1516import random
     
    117118        # ================================================================================
    118119        # parse command line arguments
    119         formats = ['raw', 'csv']
     120        formats = ['raw', 'csv', 'json']
    120121        parser = argparse.ArgumentParser(description='Python Script to implement R.M.I.T. testing : Randomized Multiple Interleaved Trials')
    121122        parser.add_argument('--list', help='List all the commands that would be run', action='store_true')
    122         parser.add_argument('--format', help='How to print the result', choices=formats, default='csv')
     123        parser.add_argument('--format', help='How to print the result', choices=formats, default='json')
    123124        parser.add_argument('--file', nargs='?', type=argparse.FileType('w'), default=sys.stdout)
    124125        parser.add_argument('-t', '--trials', help='Number of trials to run per combinaison', type=int, default=3)
     
    203204
    204205        # ================================================================================
    205         # Print csv
     206        # Print raw
    206207        if options.format == 'raw':
    207208                for r in result:
    208209                        print(r, file=options.file)
     210                sys.exit(0)
     211
     212        # ================================================================================
     213        # Print json
     214        if options.format == 'json':
     215                json.dump(result, options.file)
    209216                sys.exit(0)
    210217
  • libcfa/src/Makefile.am

    rd6ad99e r9d264e1  
    9696        concurrency/exception.hfa \
    9797        concurrency/kernel.hfa \
     98        concurrency/locks.hfa \
    9899        concurrency/monitor.hfa \
    99100        concurrency/mutex.hfa \
  • libcfa/src/concurrency/locks.cfa

    rd6ad99e r9d264e1  
    5151}
    5252
    53 void ?{}( mutex_lock & this ) {
     53void ?{}( single_acquisition_lock & this ) {
    5454        ((blocking_lock &)this){ false, false };
    5555}
    5656
    57 void ^?{}( mutex_lock & this ) {
     57void ^?{}( single_acquisition_lock & this ) {
    5858        // default
    5959}
     
    6767}
    6868
    69 void ?{}( recursive_mutex_lock & this ) {
     69void ?{}( multiple_acquisition_lock & this ) {
    7070        ((blocking_lock &)this){ true, false };
    7171}
    7272
    73 void ^?{}( recursive_mutex_lock & this ) {
     73void ^?{}( multiple_acquisition_lock & this ) {
    7474        // default
    7575}
    7676
    7777void lock( blocking_lock & this ) with( this ) {
    78         $thread * thrd = active_thread();
    7978        lock( lock __cfaabi_dbg_ctx2 );
    80         if ( owner == thrd && !multi_acquisition) {
     79        if ( owner == active_thread() && !multi_acquisition) {
    8180                fprintf(stderr, "A single acquisition lock holder attempted to reacquire the lock resulting in a deadlock."); // Possibly throw instead
    8281        exit(EXIT_FAILURE);
    83         } else if ( owner != 0p && owner != thrd ) {
    84                 append( blocked_threads, thrd );
     82        } else if ( owner != 0p && owner != active_thread() ) {
     83                append( blocked_threads, active_thread() );
    8584                wait_count++;
    8685                unlock( lock );
    8786                park( );
    88         } else if ( owner == thrd && multi_acquisition ) {
     87        } else if ( owner == active_thread() && multi_acquisition ) {
    8988                recursion_count++;
    9089                unlock( lock );
    9190        } else {
    92                 owner = thrd;
     91                owner = active_thread();
    9392                recursion_count = 1;
    9493                unlock( lock );
     
    9796
    9897bool try_lock( blocking_lock & this ) with( this ) {
    99         $thread * thrd = active_thread();
    10098        bool ret = false;
    10199        lock( lock __cfaabi_dbg_ctx2 );
    102100        if ( owner == 0p ) {
    103                 owner = thrd;
    104                 if ( multi_acquisition ) recursion_count = 1;
     101                owner = active_thread();
     102                recursion_count = 1;
    105103                ret = true;
    106         } else if ( owner == thrd && multi_acquisition ) {
     104        } else if ( owner == active_thread() && multi_acquisition ) {
    107105                recursion_count++;
    108106                ret = true;
     
    115113        lock( lock __cfaabi_dbg_ctx2 );
    116114        if ( owner == 0p ){ // no owner implies lock isn't held
    117                 fprintf( stderr, "There was an attempt to release a lock that isn't held" );
     115                fprintf( stderr, "There was an attempt to release a lock that isn't held" ); 
    118116                return;
    119         } else if ( strict_owner && active_thread() ) {
    120                 fprintf( stderr, "A thread other than the owner attempted to release an owner lock" );
     117        } else if ( strict_owner && owner != active_thread() ) {
     118                fprintf( stderr, "A thread other than the owner attempted to release an owner lock" ); 
    121119                return;
    122120        }
     
    125123                $thread * thrd = pop_head( blocked_threads );
    126124                owner = thrd;
    127                 recursion_count = ( thrd && multi_acquisition ? 1 : 0 );
     125                recursion_count = ( thrd ? 1 : 0 );
    128126                wait_count--;
    129127                unpark( thrd );
     
    153151        } else {
    154152                owner = t;
    155                 if ( multi_acquisition ) recursion_count = 1;
     153                recursion_count = 1;
    156154                #if !defined( __CFA_NO_STATISTICS__ )
    157                         kernelTLS.this_stats = t->curr_cluster->stats;
     155                        //kernelTLS.this_stats = t->curr_cluster->stats;
    158156                #endif
    159157                unpark( t );
     
    165163    lock( lock __cfaabi_dbg_ctx2 );
    166164        if ( owner == 0p ){ // no owner implies lock isn't held
    167                 fprintf( stderr, "A lock that is not held was passed to a synchronization lock" );
    168         } else if ( strict_owner && active_thread() ) {
    169                 fprintf( stderr, "A thread other than the owner of a lock passed it to a synchronization lock" );
     165                fprintf( stderr, "A lock that is not held was passed to a synchronization lock" ); 
     166        } else if ( strict_owner && owner != active_thread() ) {
     167                fprintf( stderr, "A thread other than the owner of a lock passed it to a synchronization lock" ); 
    170168        } else {
    171169                $thread * thrd = pop_head( blocked_threads );
    172170                owner = thrd;
    173                 recursion_count = ( thrd && multi_acquisition ? 1 : 0 );
     171                recursion_count = ( thrd ? 1 : 0 );
    174172                wait_count--;
    175173                unpark( thrd );
     
    184182// This is temporary until an inheritance bug is fixed
    185183
    186 void lock( mutex_lock & this ){
     184void lock( single_acquisition_lock & this ){
    187185        lock( (blocking_lock &)this );
    188186}
    189187
    190 void unlock( mutex_lock & this ){
     188void unlock( single_acquisition_lock & this ){
    191189        unlock( (blocking_lock &)this );
    192190}
    193191
    194 void add_( mutex_lock & this, struct $thread * t ){
     192void add_( single_acquisition_lock & this, struct $thread * t ){
    195193        add_( (blocking_lock &)this, t );
    196194}
    197195
    198 void remove_( mutex_lock & this ){
     196void remove_( single_acquisition_lock & this ){
    199197        remove_( (blocking_lock &)this );
    200198}
    201199
    202 void set_recursion_count( mutex_lock & this, size_t recursion ){
     200void set_recursion_count( single_acquisition_lock & this, size_t recursion ){
    203201        set_recursion_count( (blocking_lock &)this, recursion );
    204202}
    205203
    206 size_t get_recursion_count( mutex_lock & this ){
    207         get_recursion_count( (blocking_lock &)this );
    208 }
    209 
    210 void lock( recursive_mutex_lock & this ){
     204size_t get_recursion_count( single_acquisition_lock & this ){
     205        return get_recursion_count( (blocking_lock &)this );
     206}
     207
     208void lock( owner_lock & this ){
    211209        lock( (blocking_lock &)this );
    212210}
    213211
    214 void unlock( recursive_mutex_lock & this ){
     212void unlock( owner_lock & this ){
    215213        unlock( (blocking_lock &)this );
    216214}
    217215
    218 void add_( recursive_mutex_lock & this, struct $thread * t ){
     216void add_( owner_lock & this, struct $thread * t ){
    219217        add_( (blocking_lock &)this, t );
    220218}
    221219
    222 void remove_( recursive_mutex_lock & this ){
     220void remove_( owner_lock & this ){
    223221        remove_( (blocking_lock &)this );
    224222}
    225223
    226 void set_recursion_count( recursive_mutex_lock & this, size_t recursion ){
     224void set_recursion_count( owner_lock & this, size_t recursion ){
    227225        set_recursion_count( (blocking_lock &)this, recursion );
    228226}
    229227
    230 size_t get_recursion_count( recursive_mutex_lock & this ){
    231         get_recursion_count( (blocking_lock &)this );
     228size_t get_recursion_count( owner_lock & this ){
     229        return get_recursion_count( (blocking_lock &)this );
     230}
     231
     232void lock( multiple_acquisition_lock & this ){
     233        lock( (blocking_lock &)this );
     234}
     235
     236void unlock( multiple_acquisition_lock & this ){
     237        unlock( (blocking_lock &)this );
     238}
     239
     240void add_( multiple_acquisition_lock & this, struct $thread * t ){
     241        add_( (blocking_lock &)this, t );
     242}
     243
     244void remove_( multiple_acquisition_lock & this ){
     245        remove_( (blocking_lock &)this );
     246}
     247
     248void set_recursion_count( multiple_acquisition_lock & this, size_t recursion ){
     249        set_recursion_count( (blocking_lock &)this, recursion );
     250}
     251
     252size_t get_recursion_count( multiple_acquisition_lock & this ){
     253        return get_recursion_count( (blocking_lock &)this );
    232254}
    233255
     
    244266                info_thread(L) * copy = *i;
    245267                        remove( cond->blocked_threads, i );              //remove this thread O(1)
    246                         cond->wait_count--;
     268                        cond->count--;
    247269                        if( !copy->lock ) {
    248                                 unlock( cond->lock );
    249270                                #if !defined( __CFA_NO_STATISTICS__ )
    250                                         #warning unprotected access to tls TODO discuss this
    251                                         kernelTLS.this_stats = copy->t->curr_cluster->stats;
     271                                        //kernelTLS.this_stats = copy->t->curr_cluster->stats;
    252272                                #endif
    253273                                unpark( copy->t );
     
    285305                bool ret = !!blocked_threads;
    286306                info_thread(L) * popped = pop_head( blocked_threads );
    287                 popped->listed = false;
    288307                if(popped != 0p) {
     308                        popped->listed = false;
    289309                        count--;
    290310                        if (popped->lock) {
     
    303323                while( blocked_threads ) {
    304324                        info_thread(L) * popped = pop_head( blocked_threads );
    305                         popped->listed = false;
    306325                        if(popped != 0p){
     326                                popped->listed = false;
    307327                                count--;
    308328                                if (popped->lock) {
     
    341361                        remove_( *i.lock );
    342362                }
    343 
     363               
    344364                unlock( lock );
    345365                park( ); // blocks here
     
    385405                queue_info_thread( this, i );
    386406        }
    387 
     407       
    388408        void wait( condition_variable(L) & this, Duration duration ) with(this) {
    389409                info_thread( L ) i = { active_thread() };
     
    391411        }
    392412
    393         void wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) {
     413        void wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) { 
    394414                info_thread( L ) i = { active_thread(), info };
    395415                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
     
    417437                queue_info_thread( this, i );
    418438        }
    419 
     439       
    420440        void wait( condition_variable(L) & this, L & l, Duration duration ) with(this) {
    421441                info_thread(L) i = { active_thread() };
     
    423443                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    424444        }
    425 
     445       
    426446        void wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) {
    427447                info_thread(L) i = { active_thread(), info };
     
    429449                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    430450        }
    431 
     451       
    432452        void wait( condition_variable(L) & this, L & l, Time time ) with(this) {
    433453                info_thread(L) i = { active_thread() };
     
    435455                queue_info_thread_timeout(this, i, time );
    436456        }
    437 
     457       
    438458        void wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) {
    439459                info_thread(L) i = { active_thread(), info };
     
    442462        }
    443463}
     464
     465// thread T1 {};
     466// thread T2 {};
     467
     468// multiple_acquisition_lock m;
     469// condition_variable( multiple_acquisition_lock ) c;
     470
     471// void main( T1 & this ) {
     472//      printf("T1 start\n");
     473//      lock(m);
     474//      printf("%d\n", counter(c));
     475//      if(empty(c)) {
     476//              printf("T1 wait\n");
     477//              wait(c,m,12);
     478//      }else{
     479//              printf("%d\n", front(c));
     480//              notify_one(c);
     481//      }
     482//      unlock(m);
     483//      printf("curr thd in main %p \n", active_thread());
     484//      printf("T1 waits for 2s\n");
     485//      lock(m);
     486//      wait( c, m, 2`s );
     487//      unlock(m);
     488//      printf("T1 wakes\n");
     489//      printf("T1 done\n");
     490// }
     491
     492// void main( T2 & this ) {
     493//      printf("T2 start\n");
     494//      lock(m);
     495//      printf("%d\n", counter(c));
     496//      if(empty(c)) {
     497//              printf("T2 wait\n");
     498//              wait(c,m,12);
     499//      }else{
     500//              printf("%d\n", front(c));
     501//              notify_one(c);
     502//      }
     503//      unlock(m);
     504//      printf("T2 done\n");
     505// }
     506
     507// int main() {
     508//      printf("start\n");
     509//      processor p[2];
     510//      {
     511//              T1 t1;
     512//              T2 t2;
     513//      }
     514//      printf("done\n");
     515// }
  • libcfa/src/concurrency/locks.hfa

    rd6ad99e r9d264e1  
    4949//// Blocking Locks
    5050///////////////////////////////////////////////////////////////////
     51
    5152struct blocking_lock {
    5253        // Spin lock used for mutual exclusion
     
    7273};
    7374
    74 struct mutex_lock {
     75struct single_acquisition_lock {
    7576        inline blocking_lock;
    7677};
     
    8081};
    8182
    82 struct recursive_mutex_lock {
     83struct multiple_acquisition_lock {
    8384        inline blocking_lock;
    8485};
     
    8788void ^?{}( blocking_lock & this );
    8889
    89 void ?{}( mutex_lock & this );
    90 void ^?{}( mutex_lock & this );
     90void ?{}( single_acquisition_lock & this );
     91void ^?{}( single_acquisition_lock & this );
    9192
    9293void ?{}( owner_lock & this );
    9394void ^?{}( owner_lock & this );
    9495
    95 void ?{}( recursive_mutex_lock & this );
    96 void ^?{}( recursive_mutex_lock & this );
     96void ?{}( multiple_acquisition_lock & this );
     97void ^?{}( multiple_acquisition_lock & this );
    9798
    9899void lock( blocking_lock & this );
     
    105106size_t get_recursion_count( blocking_lock & this );
    106107
    107 void lock( mutex_lock & this );
    108 void unlock( mutex_lock & this );
    109 void add_( mutex_lock & this, struct $thread * t );
    110 void remove_( mutex_lock & this );
    111 void set_recursion_count( mutex_lock & this, size_t recursion );
    112 size_t get_recursion_count( mutex_lock & this );
     108void lock( single_acquisition_lock & this );
     109void unlock( single_acquisition_lock & this );
     110void add_( single_acquisition_lock & this, struct $thread * t );
     111void remove_( single_acquisition_lock & this );
     112void set_recursion_count( single_acquisition_lock & this, size_t recursion );
     113size_t get_recursion_count( single_acquisition_lock & this );
    113114
    114 void lock( recursive_mutex_lock & this );
    115 void unlock( recursive_mutex_lock & this );
    116 void add_( recursive_mutex_lock & this, struct $thread * t );
    117 void remove_( recursive_mutex_lock & this );
    118 void set_recursion_count( recursive_mutex_lock & this, size_t recursion );
    119 size_t get_recursion_count( recursive_mutex_lock & this );
     115void lock( owner_lock & this );
     116void unlock( owner_lock & this );
     117void add_( owner_lock & this, struct $thread * t );
     118void remove_( owner_lock & this );
     119void set_recursion_count( owner_lock & this, size_t recursion );
     120size_t get_recursion_count( owner_lock & this );
     121
     122void lock( multiple_acquisition_lock & this );
     123void unlock( multiple_acquisition_lock & this );
     124void add_( multiple_acquisition_lock & this, struct $thread * t );
     125void remove_( multiple_acquisition_lock & this );
     126void set_recursion_count( multiple_acquisition_lock & this, size_t recursion );
     127size_t get_recursion_count( multiple_acquisition_lock & this );
    120128
    121129///////////////////////////////////////////////////////////////////
  • libcfa/src/stdlib.cfa

    rd6ad99e r9d264e1  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 19 15:05:28 2020
    13 // Update Count     : 501
     12// Last Modified On : Thu Nov 12 07:46:09 2020
     13// Update Count     : 503
    1414//
    1515
     
    2626//---------------------------------------
    2727
    28 // allocation/deallocation and constructor/destructor, non-array types
    29 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
    30 T * new( Params p ) {
    31         return &(*malloc()){ p };                                                       // run constructor
    32 } // new
    33 
    34 forall( dtype T | { void ^?{}( T & ); } )
    35 void delete( T * ptr ) {
    36         if ( ptr ) {                                                                            // ignore null
    37                 ^(*ptr){};                                                                              // run destructor
    38                 free( ptr );
    39         } // if
    40 } // delete
    41 
    42 forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } )
    43 void delete( T * ptr, Params rest ) {
    44         delete( ptr );
    45         delete( rest );
    46 } // delete
    47 
    48 
    49 // allocation/deallocation and constructor/destructor, array types
    50 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
    51 T * anew( size_t dim, Params p ) {
     28// Cforall allocation/deallocation and constructor/destructor, array types
     29
     30forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } )
     31T * anew( size_t dim, TT p ) {
    5232        T * arr = alloc( dim );
    5333        for ( unsigned int i = 0; i < dim; i += 1 ) {
     
    6848} // adelete
    6949
    70 forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } )
    71 void adelete( T arr[], Params rest ) {
     50forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype TT | { void adelete( TT ); } )
     51void adelete( T arr[], TT rest ) {
    7252        if ( arr ) {                                                                            // ignore null
    7353                size_t dim = malloc_size( arr ) / sizeof( T );
  • libcfa/src/stdlib.hfa

    rd6ad99e r9d264e1  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Sep  1 20:32:34 2020
    13 // Update Count     : 505
     12// Last Modified On : Thu Nov 12 08:12:08 2020
     13// Update Count     : 515
    1414//
    1515
    1616#pragma once
    1717
    18 #include "bits/defs.hfa"
    19 #include "bits/align.hfa"
     18#include "bits/defs.hfa"                                                                // OPTIONAL_THREAD
     19#include "bits/align.hfa"                                                               // libAlign
    2020
    2121#include <stdlib.h>                                                                             // *alloc, strto*, ato*
     
    107107} // distribution
    108108
    109 static inline forall( ttype TT | { void free( TT ); } ) {
    110         // T* does not take void* and vice-versa
    111 
    112         void free( void * addr, TT rest ) {
    113                 free( addr );
    114                 free( rest );
    115         } // free
    116 
    117         forall( dtype T | sized(T) )
    118         void free( T * addr, TT rest ) {
    119                 free( addr );
    120                 free( rest );
    121         } // free
    122 } // distribution
    123 
    124109/*
    125110        FIX ME : fix alloc interface after Ticker Number 214 is resolved, define and add union to S_fill. Then, modify postfix-fill functions to support T * with nmemb, char, and T object of any size. Finally, change alloc_internal.
     
    129114                forall( dtype T | sized(T) ) {
    130115                        union  U_fill           { char c; T * a; T t; };
    131                         struct S_fill           { char tag; char c; size_t size; T * at; char t[50]; };
     116                        struct S_fill           { char tag; U_fill(T) fill; };
    132117                        struct S_realloc        { inline T *; };
    133118                }
     
    177162static inline T_align   ?`align   ( size_t a )  { return (T_align){a}; }
    178163static inline T_resize  ?`resize  ( void * a )  { return (T_resize){a}; }
     164
    179165static inline forall( dtype T | sized(T) ) {
    180 
    181166        S_fill(T) ?`fill ( T t ) {
    182167                S_fill(T) ret = { 't' };
     
    250235
    251236        } // distribution TT
    252 
    253237} // distribution T
    254238
     
    262246                return (T *)memcpy( dest, src, sizeof(T) );
    263247        } // memcpy
    264 } // distribution
    265 
    266 static inline forall( dtype T | sized(T) ) {
     248
    267249        // Cforall safe initialization/copy, i.e., implicit size specification, array types
    268250        T * amemset( T dest[], char fill, size_t dim ) {
     
    275257} // distribution
    276258
     259// Cforall deallocation for multiple objects
     260static inline forall( dtype T, ttype TT | { void free( TT ); } )
     261void free( T * addr, TT rest ) {
     262        free( addr );
     263        free( rest );
     264} // free
     265
    277266// Cforall allocation/deallocation and constructor/destructor, non-array types
    278 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * new( Params p );
    279 forall( dtype T | { void ^?{}( T & ); } ) void delete( T * ptr );
    280 forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } ) void delete( T * ptr, Params rest );
     267static inline forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } )
     268T * new( TT p ) {
     269        return &(*malloc()){ p };                                                       // run constructor
     270} // new
     271
     272static inline forall( dtype T | { void ^?{}( T & ); } )
     273void delete( T * ptr ) {
     274        if ( ptr ) {                                                                            // ignore null
     275                ^(*ptr){};                                                                              // run destructor
     276                free( ptr );
     277        } // if
     278} // delete
     279
     280static inline forall( dtype T, ttype TT | { void ^?{}( T & ); void delete( TT ); } )
     281void delete( T * ptr, TT rest ) {
     282        delete( ptr );
     283        delete( rest );
     284} // delete
    281285
    282286// Cforall allocation/deallocation and constructor/destructor, array types
    283 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * anew( size_t dim, Params p );
     287forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } ) T * anew( size_t dim, TT p );
    284288forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( T arr[] );
    285 forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } ) void adelete( T arr[], Params rest );
     289forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype TT | { void adelete( TT ); } ) void adelete( T arr[], TT rest );
    286290
    287291//---------------------------------------
     
    379383//---------------------------------------
    380384
    381 extern bool threading_enabled(void) OPTIONAL_THREAD;
     385extern bool threading_enabled( void ) OPTIONAL_THREAD;
    382386
    383387// Local Variables: //
  • src/AST/Convert.cpp

    rd6ad99e r9d264e1  
    99// Author           : Thierry Delisle
    1010// Created On       : Thu May 09 15::37::05 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 21:39:32 2019
    13 // Update Count     : 33
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Nov 12 10:07:00 2020
     13// Update Count     : 34
    1414//
    1515
     
    187187                auto init = get<Initializer>().accept1( node->init );
    188188                decl->init = init;
    189                
     189
    190190                this->node = decl;
    191191                return nullptr;
     
    28122812        }
    28132813        deleteAll(translationUnit);
     2814
     2815        // Load the local static varables into the global store.
     2816        unit.global.sizeType = ast::sizeType;
     2817        unit.global.dereference = ast::dereferenceOperator;
     2818        unit.global.dtorStruct = ast::dtorStruct;
     2819        unit.global.dtorDestroy = ast::dtorStructDestroy;
     2820
    28142821        return unit;
    28152822}
  • src/AST/Pass.impl.hpp

    rd6ad99e r9d264e1  
    423423                }
    424424                catch( SemanticErrorException &e ) {
    425                         if (__pass::onError (visitor.core, *i, 0))
     425                        if (__pass::on_error (visitor.core, *i, 0))
    426426                                errors.append( e );
    427427                }
  • src/AST/Pass.proto.hpp

    rd6ad99e r9d264e1  
    270270
    271271        template< typename core_t >
    272         static bool onError (core_t &, ptr<Decl> &, long) { return true; }
    273 
    274         template< typename core_t >
    275         static auto onError (core_t & core, ptr<Decl> & decl, int) -> decltype(core.onError(decl)) {
    276                 return core.onError(decl);
     272        static bool on_error (core_t &, ptr<Decl> &, long) { return true; }
     273
     274        template< typename core_t >
     275        static auto on_error (core_t & core, ptr<Decl> & decl, int) -> decltype(core.on_error(decl)) {
     276                return core.on_error(decl);
    277277        }
    278278
  • src/InitTweak/GenInit.cc

    rd6ad99e r9d264e1  
    202202                        }
    203203                        // don't need to hoist dimension if it's definitely pure - only need to if there's potential for side effects.
    204                         // xxx - hoisting has no side effects anyways, so don't skip since we delay resolve     
    205                         // only skip in the most trivial case, which does not require resolve
    206                         if (dynamic_cast<ConstantExpr *>(arrayType->dimension)) return;
    207                         // if ( ! Tuples::maybeImpure( arrayType->dimension ) ) return;
     204                        // xxx - hoisting has no side effects anyways, so don't skip since we delay resolve
     205                        // still try to detect constant expressions
     206                        if ( ! Tuples::maybeImpure( arrayType->dimension ) ) return;
    208207
    209208                        ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageClasses, LinkageSpec::C, 0, Validate::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );
  • src/ResolvExpr/Resolver.cc

    rd6ad99e r9d264e1  
    12891289                void beginScope() { managedTypes.beginScope(); }
    12901290                void endScope() { managedTypes.endScope(); }
    1291                 bool onError(ast::ptr<ast::Decl> & decl);
     1291                bool on_error(ast::ptr<ast::Decl> & decl);
    12921292        };
    12931293        // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver");
     
    20682068
    20692069        // suppress error on autogen functions and mark invalid autogen as deleted.
    2070         bool Resolver_new::onError(ast::ptr<ast::Decl> & decl) {
     2070        bool Resolver_new::on_error(ast::ptr<ast::Decl> & decl) {
    20712071                if (auto functionDecl = decl.as<ast::FunctionDecl>()) {
    20722072                        // xxx - can intrinsic gen ever fail?
  • src/main.cc

    rd6ad99e r9d264e1  
    341341
    342342                if( useNewAST) {
     343                        if (Stats::Counters::enabled) {
     344                                ast::pass_visitor_stats.avg = Stats::Counters::build<Stats::Counters::AverageCounter<double>>("Average Depth - New");
     345                                ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
     346                        }
    343347                        auto transUnit = convert( move( translationUnit ) );
    344348                        PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
  • tests/.expect/alloc-ERROR.txt

    rd6ad99e r9d264e1  
    1 alloc.cfa:361:1 error: No reasonable alternatives for expression Applying untyped:
     1alloc.cfa:382:1 error: No reasonable alternatives for expression Applying untyped:
    22  Name: ?=?
    33...to:
     
    1919
    2020
    21 alloc.cfa:362:1 error: No reasonable alternatives for expression Applying untyped:
     21alloc.cfa:383:1 error: No reasonable alternatives for expression Applying untyped:
    2222  Name: ?=?
    2323...to:
     
    3030
    3131
    32 alloc.cfa:363:1 error: No reasonable alternatives for expression Applying untyped:
     32alloc.cfa:384:1 error: No reasonable alternatives for expression Applying untyped:
    3333  Name: ?=?
    3434...to:
  • tests/alloc.cfa

    rd6ad99e r9d264e1  
    1010// Created On       : Wed Feb  3 07:56:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct  9 23:03:11 2020
    13 // Update Count     : 431
     12// Last Modified On : Thu Nov 12 10:02:18 2020
     13// Update Count     : 432
    1414//
    1515
     
    375375        dp = alloc(5.0`fill); // just for testing multiple free
    376376        assert(*dp == 5.0);
    377         free( ip, dp );
     377        free( ip, dp, 0p );
    378378
    379379#ifdef ERR1
  • tests/malloc.cfa

    rd6ad99e r9d264e1  
    319319        free(ip);
    320320
    321         free( (void*) 0p ); // sanity check
     321        free( (void *) 0p ); // sanity check
    322322        free( NULL ); // sanity check
    323323
     
    605605        return 0;
    606606}
     607
     608// Local Variables: //
     609// tab-width: 4 //
     610// compile-command: "cfa malloc.cfa" //
     611// End: //
  • tests/manipulatorsOutput3.cfa

    rd6ad99e r9d264e1  
    156156        sout | nl;
    157157
    158         ui128 = 0x7fffffffffffffff;
    159         ui128 <<= 64;
    160         ui128 += 0xffffffffffffffff;
    161158        sout | left( wd( 160, i128 ) );
    162159        sout | left( sign( wd( 0, i128 ) ) );
     
    177174        sout | left( wd( 160, bin( i128 ) ) );
    178175        sout | left( sign( wd( 160, i128 ) ) );
    179         sout | left( wd( 160, upcase(hex( i128 )) ) );
    180         sout | left( wd( 160, upcase(oct( i128 ) )) );
    181         sout | left( wd( 160, upcase(bin( i128 )) ) );
     176        sout | left( wd( 160, upcase( hex( i128 ) ) ) );
     177        sout | left( wd( 160, upcase( oct( i128 ) ) ) );
     178        sout | left( wd( 160, upcase( bin( i128 ) ) ) );
    182179
    183180        x = 1234;
     
    316313        }
    317314
    318 
    319315        // int128 constants (and printing)
    320316        int128 v = 0xffff_ffffffff_ffffffff_L128 + 0xffffffff_ffffffff_ffffffff_ffffffff_L128;
Note: See TracChangeset for help on using the changeset viewer.