Changes in / [3959595:be73f30]


Ignore:
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/alarm.cfa

    r3959595 rbe73f30  
    4545//=============================================================================================
    4646
    47 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period) with( this ) {
     47void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period ) with( this ) {
    4848        this.thrd = thrd;
    4949        this.alarm = alarm;
    5050        this.period = period;
    5151        set = false;
    52         type = User;
     52        kernel_alarm = false;
    5353}
    5454
     
    5858        this.period = period;
    5959        set = false;
    60         type = Kernel;
    61 }
    62 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback ) with( this ) {
    63         this.thrd = thrd;
    64         this.alarm = alarm;
    65         this.period = period;
    66         this.callback = callback;
    67         set = false;
    68         type = Callback;
     60        kernel_alarm = true;
    6961}
    7062
  • libcfa/src/concurrency/alarm.hfa

    r3959595 rbe73f30  
    3939//=============================================================================================
    4040
    41 enum alarm_type{ Kernel = 0, User = 1, Callback = 2 };
    42 
    43 struct alarm_node_t;
    44 
    45 typedef void (*Alarm_Callback)(alarm_node_t & );
    46 
    4741struct alarm_node_t {
    4842        Time alarm;                             // time when alarm goes off
     
    5650        };
    5751
    58         Alarm_Callback callback;
    59 
    6052        bool set                :1;             // whether or not the alarm has be registered
    61         enum alarm_type type;           // true if this is not a user defined alarm
     53        bool kernel_alarm       :1;             // true if this is not a user defined alarm
    6254};
    6355DLISTED_MGD_IMPL_OUT(alarm_node_t)
     
    6557void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
    6658void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
    67 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback );
    6859void ^?{}( alarm_node_t & this );
    6960
  • libcfa/src/concurrency/locks.cfa

    r3959595 rbe73f30  
    1515                this.t = t;
    1616                this.lock = 0p;
    17                 this.listed = false;
    1817        }
    1918
     
    2221                this.info = info;
    2322                this.lock = 0p;
    24                 this.listed = false;
    2523        }
    2624
     
    8078        if ( owner == thrd && !multi_acquisition) {
    8179                fprintf(stderr, "A single acquisition lock holder attempted to reacquire the lock resulting in a deadlock."); // Possibly throw instead
    82         exit(EXIT_FAILURE);
     80                exit(EXIT_FAILURE);
    8381        } else if ( owner != 0p && owner != thrd ) {
    8482                append( blocked_threads, thrd );
    8583                wait_count++;
    8684                unlock( lock );
    87                 park( );
     85                park( __cfaabi_dbg_ctx );
    8886        } else if ( owner == thrd && multi_acquisition ) {
    8987                recursion_count++;
     
    117115                fprintf( stderr, "There was an attempt to release a lock that isn't held" );
    118116                return;
    119         } else if ( strict_owner && active_thread() ) {
     117        } else if ( strict_owner && owner != active_thread() ) {
    120118                fprintf( stderr, "A thread other than the owner attempted to release an owner lock" );
    121119                return;
     
    127125                recursion_count = ( thrd && multi_acquisition ? 1 : 0 );
    128126                wait_count--;
    129                 unpark( thrd );
     127                unpark( thrd __cfaabi_dbg_ctx2 );
    130128        }
    131129        unlock( lock );
     
    154152                owner = t;
    155153                if ( multi_acquisition ) recursion_count = 1;
    156                 #if !defined( __CFA_NO_STATISTICS__ )
    157                         kernelTLS.this_stats = t->curr_cluster->stats;
    158                 #endif
    159                 unpark( t );
     154                unpark( t __cfaabi_dbg_ctx2 );
    160155                unlock( lock );
    161156        }
     
    166161        if ( owner == 0p ){ // no owner implies lock isn't held
    167162                fprintf( stderr, "A lock that is not held was passed to a synchronization lock" );
    168         } else if ( strict_owner && active_thread() ) {
     163        } else if ( strict_owner && owner != active_thread() ) {
    169164                fprintf( stderr, "A thread other than the owner of a lock passed it to a synchronization lock" );
    170165        } else {
     
    173168                recursion_count = ( thrd && multi_acquisition ? 1 : 0 );
    174169                wait_count--;
    175                 unpark( thrd );
     170                unpark( thrd __cfaabi_dbg_ctx2 );
    176171        }
    177172        unlock( lock );
     
    182177///////////////////////////////////////////////////////////////////
    183178
    184 // This is temporary until an inheritance bug is fixed
     179// In an ideal world this may not be necessary
     180// Is it possible for nominal inheritance to inherit traits??
     181// If that occurs we would avoid all this extra code
    185182
    186183void lock( mutex_lock & this ){
     
    233230
    234231///////////////////////////////////////////////////////////////////
    235 //// condition variable
     232//// Synchronization Locks
    236233///////////////////////////////////////////////////////////////////
    237234
    238235forall(dtype L | is_blocking_lock(L)) {
    239 
    240         void timeout_handler ( alarm_node_wrap(L) & this ) with( this ) {
    241         // This condition_variable member is called from the kernel, and therefore, cannot block, but it can spin.
    242             lock( cond->lock __cfaabi_dbg_ctx2 );
    243             if ( (*i)->listed ) {                       // is thread on queue
    244                 info_thread(L) * copy = *i;
    245                         remove( cond->blocked_threads, i );              //remove this thread O(1)
    246                         cond->wait_count--;
    247                         if( !copy->lock ) {
    248                                 unlock( cond->lock );
    249                                 #if !defined( __CFA_NO_STATISTICS__ )
    250                                         #warning unprotected access to tls TODO discuss this
    251                                         kernelTLS.this_stats = copy->t->curr_cluster->stats;
    252                                 #endif
    253                                 unpark( copy->t );
    254                 } else {
    255                         add_(*copy->lock, copy->t);                     // call lock's add_
    256                 }
    257             }
    258             unlock( cond->lock );
    259         }
    260 
    261         void alarm_node_wrap_cast( alarm_node_t & a ) {
    262                 timeout_handler( (alarm_node_wrap(L) &)a );
    263         }
    264 
    265         void ?{}( condition_variable(L) & this ){
     236        void ?{}( synchronization_lock(L) & this, bool reacquire_after_signal ){
    266237                this.lock{};
    267238                this.blocked_threads{};
    268239                this.count = 0;
     240                this.reacquire_after_signal = reacquire_after_signal;
     241        }
     242
     243        void ^?{}( synchronization_lock(L) & this ){
     244                // default
     245        }
     246
     247        void ?{}( condition_variable(L) & this ){
     248                ((synchronization_lock(L) &)this){ true };
    269249        }
    270250
     
    273253        }
    274254
    275         void ?{}( alarm_node_wrap(L) & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback ) {
    276                 this.alarm_node{ thrd, alarm, period, callback };
    277         }
    278 
    279         void ^?{}( alarm_node_wrap(L) & this ) {
    280                 // default
    281         }
    282 
    283         bool notify_one( condition_variable(L) & this ) with( this ) {
     255        void ?{}( thread_queue(L) & this ){
     256                ((synchronization_lock(L) &)this){ false };
     257        }
     258
     259        void ^?{}( thread_queue(L) & this ){
     260                // default
     261        }
     262
     263        bool notify_one( synchronization_lock(L) & this ) with( this ) {
    284264                lock( lock __cfaabi_dbg_ctx2 );
    285265                bool ret = !!blocked_threads;
    286266                info_thread(L) * popped = pop_head( blocked_threads );
    287                 popped->listed = false;
    288267                if(popped != 0p) {
    289                         count--;
    290                         if (popped->lock) {
     268                        if( reacquire_after_signal ){
    291269                                add_(*popped->lock, popped->t);
    292270                        } else {
    293                                 unpark(popped->t);
     271                                unpark(
     272                                        popped->t __cfaabi_dbg_ctx2
     273                                );
    294274                        }
    295275                }
     
    298278        }
    299279
    300         bool notify_all( condition_variable(L) & this ) with(this) {
     280        bool notify_all( synchronization_lock(L) & this ) with(this) {
    301281                lock( lock __cfaabi_dbg_ctx2 );
    302282                bool ret = blocked_threads ? true : false;
    303283                while( blocked_threads ) {
    304284                        info_thread(L) * popped = pop_head( blocked_threads );
    305                         popped->listed = false;
    306285                        if(popped != 0p){
    307                                 count--;
    308                                 if (popped->lock) {
     286                                if( reacquire_after_signal ){
    309287                                        add_(*popped->lock, popped->t);
    310288                                } else {
    311                                         unpark(popped->t);
     289                                        unpark(
     290                                                popped->t __cfaabi_dbg_ctx2
     291                                        );
    312292                                }
    313293                        }
     
    317297        }
    318298
    319         uintptr_t front( condition_variable(L) & this ) with(this) {
    320                 if(!blocked_threads) return NULL;
    321                 return peek(blocked_threads)->info;
    322         }
    323 
    324         bool empty( condition_variable(L) & this ) with(this) {
     299        uintptr_t front( synchronization_lock(L) & this ) with(this) {
     300                return (*peek(blocked_threads)).info;
     301        }
     302
     303        bool empty( synchronization_lock(L) & this ) with(this) {
    325304                return blocked_threads ? false : true;
    326305        }
    327306
    328         int counter( condition_variable(L) & this ) with(this) {
     307        int counter( synchronization_lock(L) & this ) with(this) {
    329308                return count;
    330309        }
    331310
    332         // helper for wait()'s' without a timeout
    333         void queue_info_thread( condition_variable(L) & this, info_thread(L) & i ) with(this) {
     311        void queue_info_thread( synchronization_lock(L) & this, info_thread(L) & i ) with(this) {
     312                lock( lock __cfaabi_dbg_ctx2 );
     313                append( blocked_threads, &i );
     314                count++;
     315                unlock( lock );
     316                park( __cfaabi_dbg_ctx );
     317        }
     318
     319
     320        void wait( synchronization_lock(L) & this ) with(this) {
     321                info_thread( L ) i = { active_thread() };
     322                queue_info_thread( this, i );
     323        }
     324
     325        void wait( synchronization_lock(L) & this, uintptr_t info ) with(this) {
     326                info_thread( L ) i = { active_thread(), info };
     327                queue_info_thread( this, i );
     328        }
     329        // I still need to implement the time delay wait routines
     330        bool wait( synchronization_lock(L) & this, Duration duration ) with(this) {
     331                timeval tv = { time(0) };
     332                Time t = { tv };
     333                return wait( this, t + duration );
     334        }
     335
     336        bool wait( synchronization_lock(L) & this, uintptr_t info, Duration duration ) with(this) {
     337                // TODO: ADD INFO
     338                return wait( this, duration );
     339        }
     340
     341        bool wait( synchronization_lock(L) & this, Time time ) with(this) {
     342                return false; //default
     343        }
     344
     345        bool wait( synchronization_lock(L) & this, uintptr_t info, Time time ) with(this) {
     346                // TODO: ADD INFO
     347                return wait( this, time );
     348        }
     349
     350        void queue_info_thread_unlock( synchronization_lock(L) & this, L & l, info_thread(L) & i ) with(this) {
    334351                lock( lock __cfaabi_dbg_ctx2 );
    335352                append( this.blocked_threads, &i );
    336353                count++;
    337                 i.listed = true;
    338                 size_t recursion_count;
    339                 if (i.lock) {
    340                         recursion_count = get_recursion_count(*i.lock);
    341                         remove_( *i.lock );
    342                 }
    343 
    344                 unlock( lock );
    345                 park( ); // blocks here
    346 
    347                 if (i.lock) set_recursion_count(*i.lock, recursion_count); // resets recursion count here after waking
    348         }
    349 
    350         // helper for wait()'s' with a timeout
    351         void queue_info_thread_timeout( condition_variable(L) & this, info_thread(L) & info, Time t ) with(this) {
    352                 lock( lock __cfaabi_dbg_ctx2 );
    353 
    354                 info_thread(L) * queue_ptr = &info;
    355 
    356                 alarm_node_wrap(L) node_wrap = { info.t, t, 0`s, alarm_node_wrap_cast };
    357                 node_wrap.cond = &this;
    358                 node_wrap.i = &queue_ptr;
    359 
    360                 register_self( &node_wrap.alarm_node );
    361 
    362                 append( blocked_threads, queue_ptr );
    363                 info.listed = true;
    364                 count++;
    365 
    366                 size_t recursion_count;
    367                 if (info.lock) {
    368                         recursion_count = get_recursion_count(*info.lock);
    369                         remove_( *info.lock );
    370                 }
    371 
    372                 unlock( lock );
    373                 park();
    374 
    375                 if (info.lock) set_recursion_count(*info.lock, recursion_count);
    376         }
    377 
    378         void wait( condition_variable(L) & this ) with(this) {
    379                 info_thread( L ) i = { active_thread() };
    380                 queue_info_thread( this, i );
    381         }
    382 
    383         void wait( condition_variable(L) & this, uintptr_t info ) with(this) {
    384                 info_thread( L ) i = { active_thread(), info };
    385                 queue_info_thread( this, i );
    386         }
    387 
    388         void wait( condition_variable(L) & this, Duration duration ) with(this) {
    389                 info_thread( L ) i = { active_thread() };
    390                 queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    391         }
    392 
    393         void wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) {
    394                 info_thread( L ) i = { active_thread(), info };
    395                 queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    396         }
    397 
    398         void wait( condition_variable(L) & this, Time time ) with(this) {
    399                 info_thread( L ) i = { active_thread() };
    400                 queue_info_thread_timeout(this, i, time);
    401         }
    402 
    403         void wait( condition_variable(L) & this, uintptr_t info, Time time ) with(this) {
    404                 info_thread( L ) i = { active_thread(), info };
    405                 queue_info_thread_timeout(this, i, time);
    406         }
    407 
    408         void wait( condition_variable(L) & this, L & l ) with(this) {
     354                i.lock = &l;
     355                size_t recursion_count = get_recursion_count(l);
     356                remove_( l );
     357                unlock( lock );
     358                park( __cfaabi_dbg_ctx ); // blocks here
     359
     360                set_recursion_count(l, recursion_count); // resets recursion count here after waking
     361        }
     362
     363        void wait( synchronization_lock(L) & this, L & l ) with(this) {
    409364                info_thread(L) i = { active_thread() };
    410                 i.lock = &l;
    411                 queue_info_thread( this, i );
    412         }
    413 
    414         void wait( condition_variable(L) & this, L & l, uintptr_t info ) with(this) {
     365                queue_info_thread_unlock( this, l, i );
     366        }
     367
     368        void wait( synchronization_lock(L) & this, L & l, uintptr_t info ) with(this) {
    415369                info_thread(L) i = { active_thread(), info };
    416                 i.lock = &l;
    417                 queue_info_thread( this, i );
    418         }
    419 
    420         void wait( condition_variable(L) & this, L & l, Duration duration ) with(this) {
    421                 info_thread(L) i = { active_thread() };
    422                 i.lock = &l;
    423                 queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    424         }
    425 
    426         void wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) {
    427                 info_thread(L) i = { active_thread(), info };
    428                 i.lock = &l;
    429                 queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    430         }
    431 
    432         void wait( condition_variable(L) & this, L & l, Time time ) with(this) {
    433                 info_thread(L) i = { active_thread() };
    434                 i.lock = &l;
    435                 queue_info_thread_timeout(this, i, time );
    436         }
    437 
    438         void wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) {
    439                 info_thread(L) i = { active_thread(), info };
    440                 i.lock = &l;
    441                 queue_info_thread_timeout(this, i, time );
    442         }
    443 }
     370                queue_info_thread_unlock( this, l, i );
     371        }
     372
     373        bool wait( synchronization_lock(L) & this, L & l, Duration duration ) with(this) {
     374                timeval tv = { time(0) };
     375                Time t = { tv };
     376                return wait( this, l, t + duration );
     377        }
     378
     379        bool wait( synchronization_lock(L) & this, L & l, uintptr_t info, Duration duration ) with(this) {
     380                // TODO: ADD INFO
     381                return wait( this, l, duration );
     382        }
     383
     384        bool wait( synchronization_lock(L) & this, L & l, Time time ) with(this) {
     385                return false; //default
     386        }
     387
     388        bool wait( synchronization_lock(L) & this, L & l, uintptr_t info, Time time ) with(this) {
     389                // TODO: ADD INFO
     390                return wait( this, l, time );
     391        }
     392}
     393
     394///////////////////////////////////////////////////////////////////
     395//// condition lock alternative approach
     396///////////////////////////////////////////////////////////////////
     397
     398// the solution below is less efficient but does not require the lock to have a specific add/remove routine
     399
     400///////////////////////////////////////////////////////////////////
     401//// is_simple_lock
     402///////////////////////////////////////////////////////////////////
     403
     404forall(dtype L | is_simple_lock(L)) {
     405        void ?{}( condition_lock(L) & this ){
     406                // default
     407        }
     408
     409        void ^?{}( condition_lock(L) & this ){
     410                // default
     411        }
     412
     413        bool notify_one( condition_lock(L) & this ) with(this) {
     414                return notify_one( c_var );
     415        }
     416
     417        bool notify_all( condition_lock(L) & this ) with(this) {
     418                return notify_all( c_var );
     419        }
     420
     421        void wait( condition_lock(L) & this, L & l ) with(this) {
     422                lock( m_lock );
     423                size_t recursion = get_recursion_count( l );
     424                unlock( l );
     425                wait( c_var, m_lock );
     426                lock( l );
     427                set_recursion_count( l , recursion );
     428                unlock( m_lock );
     429        }
     430}
  • libcfa/src/concurrency/locks.hfa

    r3959595 rbe73f30  
    1 #pragma once
    2 
    31#include <stdbool.h>
    42
     
    1210#include "time.hfa"
    1311#include <sys/time.h>
    14 #include "alarm.hfa"
    1512
    1613///////////////////////////////////////////////////////////////////
     
    3532                info_thread(L) * next;
    3633                L * lock;
    37                 bool listed;                                    // true if info_thread is on queue, false otherwise;
    3834        };
    3935
     
    123119///////////////////////////////////////////////////////////////////
    124120forall(dtype L | is_blocking_lock(L)) {
    125         struct condition_variable {
     121        struct synchronization_lock {
    126122                // Spin lock used for mutual exclusion
    127123                __spinlock_t lock;
     
    132128                // Count of current blocked threads
    133129                int count;
    134         };
     130
     131                // If true threads will reacquire the lock they block on upon waking
     132                bool reacquire_after_signal;
     133        };
     134
     135        struct condition_variable {
     136                inline synchronization_lock(L);
     137        };
     138
     139        struct thread_queue {
     140                inline synchronization_lock(L);
     141        };
     142
     143
     144        void ?{}( synchronization_lock(L) & this, bool multi_acquisition, bool strict_owner );
     145        void ^?{}( synchronization_lock(L) & this );
    135146
    136147        void ?{}( condition_variable(L) & this );
    137148        void ^?{}( condition_variable(L) & this );
    138149
    139         struct alarm_node_wrap {
    140                 alarm_node_t alarm_node;
    141 
    142                 condition_variable(L) * cond;
    143 
    144                 info_thread(L) ** i;
    145         };
    146 
    147         void ?{}( alarm_node_wrap(L) & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback );
    148         void ^?{}( alarm_node_wrap(L) & this );
    149 
    150         void alarm_node_callback( alarm_node_wrap(L) & this );
    151 
    152         void alarm_node_wrap_cast( alarm_node_t & a );
    153 
    154         bool notify_one( condition_variable(L) & this );
    155         bool notify_all( condition_variable(L) & this );
    156 
    157         uintptr_t front( condition_variable(L) & this );
    158 
    159         bool empty( condition_variable(L) & this );
    160         int counter( condition_variable(L) & this );
    161 
    162         // TODO: look into changing timout routines to return bool showing if signalled or woken by kernel
    163         void wait( condition_variable(L) & this );
    164         void wait( condition_variable(L) & this, uintptr_t info );
    165         void wait( condition_variable(L) & this, Duration duration );
    166         void wait( condition_variable(L) & this, uintptr_t info, Duration duration );
    167         void wait( condition_variable(L) & this, Time time );
    168         void wait( condition_variable(L) & this, uintptr_t info, Time time );
    169 
    170         void wait( condition_variable(L) & this, L & l );
    171         void wait( condition_variable(L) & this, L & l, uintptr_t info );
    172         void wait( condition_variable(L) & this, L & l, Duration duration );
    173         void wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration );
    174         void wait( condition_variable(L) & this, L & l, Time time );
    175         void wait( condition_variable(L) & this, L & l, uintptr_t info, Time time );
     150        void ?{}( thread_queue(L) & this );
     151        void ^?{}( thread_queue(L) & this );
     152
     153        bool notify_one( synchronization_lock(L) & this );
     154        bool notify_all( synchronization_lock(L) & this );
     155
     156        uintptr_t front( synchronization_lock(L) & this );
     157
     158        bool empty( synchronization_lock(L) & this );
     159        int counter( synchronization_lock(L) & this );
     160
     161        // wait functions that are not passed a mutex lock
     162        void wait( synchronization_lock(L) & this );
     163        void wait( synchronization_lock(L) & this, uintptr_t info );
     164        bool wait( synchronization_lock(L) & this, Duration duration );
     165        bool wait( synchronization_lock(L) & this, uintptr_t info, Duration duration );
     166        bool wait( synchronization_lock(L) & this, Time time );
     167        bool wait( synchronization_lock(L) & this, uintptr_t info, Time time );
     168
     169        // wait functions that are passed a lock
     170        bool notify_one( synchronization_lock(L) & this, L & l );
     171        bool notify_all( synchronization_lock(L) & this, L & l );
     172
     173        void wait( synchronization_lock(L) & this, L & l );
     174        void wait( synchronization_lock(L) & this, L & l, uintptr_t info );
     175        bool wait( synchronization_lock(L) & this, L & l, Duration duration );
     176        bool wait( synchronization_lock(L) & this, L & l, uintptr_t info, Duration duration );
     177        bool wait( synchronization_lock(L) & this, L & l, Time time );
     178        bool wait( synchronization_lock(L) & this, L & l, uintptr_t info, Time time );
    176179}
     180
     181///////////////////////////////////////////////////////////////////
     182//// condition lock alternative approach
     183///////////////////////////////////////////////////////////////////
     184
     185
     186///////////////////////////////////////////////////////////////////
     187//// is_simple_lock
     188///////////////////////////////////////////////////////////////////
     189
     190trait is_simple_lock(dtype L | sized(L)) {
     191        void lock( L & );               // For synchronization locks to use when acquiring
     192        void unlock( L & );    // For synchronization locks to use when releasing
     193        size_t get_recursion_count( L & ); // to get recursion count for cond lock to reset after waking
     194        void set_recursion_count( L &, size_t recursion ); // to set recursion count after getting signalled;
     195};
     196
     197forall(dtype L | is_simple_lock(L)) {
     198        struct condition_lock {
     199                // Spin lock used for mutual exclusion
     200                mutex_lock m_lock;
     201
     202                condition_variable( mutex_lock ) c_var;
     203        };
     204
     205        void ?{}( condition_lock(L) & this );
     206        void ^?{}( condition_lock(L) & this );
     207
     208        bool notify_one( condition_lock(L) & this );
     209        bool notify_all( condition_lock(L) & this );
     210        void wait( condition_lock(L) & this, L & l );
     211}
  • libcfa/src/concurrency/preemption.cfa

    r3959595 rbe73f30  
    105105
    106106                // Check if this is a kernel
    107                 if( node->type == Kernel ) {
     107                if( node->kernel_alarm ) {
    108108                        preempt( node->proc );
    109109                }
    110                 else if( node->type == User ) {
     110                else {
    111111                        timeout( node->thrd );
    112                 }
    113                 else {
    114                         node->callback(*node);
    115112                }
    116113
  • src/InitTweak/FixGlobalInit.cc

    r3959595 rbe73f30  
    183183                        } // if
    184184                        if ( const ast::Stmt * ctor = ctorInit->ctor ) {
    185                                 addDataSectionAttribute(mutDecl);
    186185                                initStmts.push_back( ctor );
    187186                                mutDecl->init = nullptr;
  • src/InitTweak/FixInitNew.cpp

    r3959595 rbe73f30  
    864864                        if ( const ast::Stmt * ctor = ctorInit->ctor ) {
    865865                                if ( objDecl->storage.is_static ) {
    866                                         addDataSectionAttribute(objDecl);
    867866                                        // originally wanted to take advantage of gcc nested functions, but
    868867                                        // we get memory errors with this approach. To remedy this, the static
     
    948947                                                objDecl->name = objDecl->name + staticNamer.newName();
    949948                                                objDecl->mangleName = Mangle::mangle( objDecl );
    950                                                 objDecl->init = nullptr;
    951949
    952950                                                // xxx - temporary hack: need to return a declaration, but want to hoist the current object out of this scope
  • src/InitTweak/InitTweak.cc

    r3959595 rbe73f30  
    11131113        }
    11141114
    1115         void addDataSectionAttribute( ast::ObjectDecl * objDecl ) {
    1116                 auto strLitT = new ast::PointerType(new ast::BasicType(ast::BasicType::Char));
    1117                 objDecl->attributes.push_back(new ast::Attribute("section", {new ast::ConstantExpr(objDecl->location, strLitT, "\".data#\"", std::nullopt)}));
    1118         }
    1119 
    11201115}
  • src/InitTweak/InitTweak.h

    r3959595 rbe73f30  
    119119        void addDataSectonAttribute( ObjectDecl * objDecl );
    120120
    121         void addDataSectionAttribute( ast::ObjectDecl * objDecl );
    122 
    123121        class InitExpander_old {
    124122        public:
Note: See TracChangeset for help on using the changeset viewer.