Changeset 639991a for src


Ignore:
Timestamp:
May 22, 2018, 2:43:09 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
a1a17a74
Parents:
cac8a6e
Message:

removed workaround for tuple references

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/bits/containers.h

    rcac8a6e r639991a  
    220220        }
    221221
    222         #define _next .0
    223         #define _prev .1
     222        #define next 0
     223        #define prev 1
    224224        forall(dtype T | sized(T))
    225225        static inline void push_front( __dllist(T) & this, T & node ) with( this ) {
    226226                if ( head ) {
    227                         __get( node )_next = head;
    228                         __get( node )_prev = __get( *head )_prev;
     227                        __get( node ).next = head;
     228                        __get( node ).prev = __get( *head ).prev;
    229229                        // inserted node must be consistent before it is seen
    230230                        // prevent code movement across barrier
    231231                        asm( "" : : : "memory" );
    232                         __get( *head )_prev = &node;
    233                         T & prev = *__get( node )_prev;
    234                         __get( prev )_next = &node;
     232                        __get( *head ).prev = &node;
     233                        T & _prev = *__get( node ).prev;
     234                        __get( _prev ).next = &node;
    235235                }
    236236                else {
    237                         __get( node )_next = &node;
    238                         __get( node )_prev = &node;
     237                        __get( node ).next = &node;
     238                        __get( node ).prev = &node;
    239239                }
    240240
     
    247247        static inline void remove( __dllist(T) & this, T & node ) with( this ) {
    248248                if ( &node == head ) {
    249                         if ( __get( *head )_next == head ) {
     249                        if ( __get( *head ).next == head ) {
    250250                                head = NULL;
    251251                        }
    252252                        else {
    253                                 head = __get( *head )_next;
     253                                head = __get( *head ).next;
    254254                        }
    255255                }
    256                 __get( *__get( node )_next )_prev = __get( node )_prev;
    257                 __get( *__get( node )_prev )_next = __get( node )_next;
    258                 __get( node )_next = NULL;
    259                 __get( node )_prev = NULL;
    260         }
    261         #undef _next
    262         #undef _prev
     256                __get( *__get( node ).next ).prev = __get( node ).prev;
     257                __get( *__get( node ).prev ).next = __get( node ).next;
     258                __get( node ).next = NULL;
     259                __get( node ).prev = NULL;
     260        }
     261        #undef next
     262        #undef prev
    263263#endif
    264264
  • src/libcfa/concurrency/kernel.c

    rcac8a6e r639991a  
    5454//-----------------------------------------------------------------------------
    5555// Global state
    56 
    57 // volatile thread_local bool preemption_in_progress = 0;
    58 // volatile thread_local bool preemption_enabled = false;
    59 // volatile thread_local unsigned short disable_preempt_count = 1;
    60 
    6156thread_local struct KernelThreadData kernelTLS = {
    6257        NULL,
     
    697692        else {
    698693                int len = snprintf( abort_text, abort_text_size, "Error occurred outside of any thread.\n" );
     694                __cfaabi_dbg_bits_write( abort_text, len );
    699695        }
    700696}
     
    761757// Global Queues
    762758void doregister( thread_desc & thrd ) {
    763         // lock      ( global_thread.lock );
    764         // push_front( global_thread.list, thrd );
    765         // unlock    ( global_thread.lock );
     759        lock      ( global_threads.lock __cfaabi_dbg_ctx2);
     760        push_front( global_threads.list, thrd );
     761        unlock    ( global_threads.lock );
    766762}
    767763
    768764void unregister( thread_desc & thrd ) {
    769         // lock  ( global_thread.lock );
    770         // remove( global_thread.list, thrd );
    771         // unlock( global_thread.lock );
     765        lock  ( global_threads.lock __cfaabi_dbg_ctx2);
     766        remove( global_threads.list, thrd );
     767        unlock( global_threads.lock );
    772768}
    773769
    774770void doregister( cluster     & cltr ) {
    775         // lock      ( global_cluster.lock );
    776         // push_front( global_cluster.list, cltr );
    777         // unlock    ( global_cluster.lock );
     771        lock      ( global_clusters.lock __cfaabi_dbg_ctx2);
     772        push_front( global_clusters.list, cltr );
     773        unlock    ( global_clusters.lock );
    778774}
    779775
    780776void unregister( cluster     & cltr ) {
    781         // lock  ( global_cluster.lock );
    782         // remove( global_cluster.list, cltr );
    783         // unlock( global_cluster.lock );
     777        lock  ( global_clusters.lock __cfaabi_dbg_ctx2);
     778        remove( global_clusters.list, cltr );
     779        unlock( global_clusters.lock );
    784780}
    785781
    786782
    787783void doregister( cluster * cltr, processor * proc ) {
    788         // lock      (cltr->proc_list_lock __cfaabi_dbg_ctx2);
    789         // push_front(cltr->procs, *proc);
    790         // unlock    (cltr->proc_list_lock);
     784        lock      (cltr->proc_list_lock __cfaabi_dbg_ctx2);
     785        push_front(cltr->procs, *proc);
     786        unlock    (cltr->proc_list_lock);
    791787}
    792788
    793789void unregister( cluster * cltr, processor * proc ) {
    794         // lock  (cltr->proc_list_lock __cfaabi_dbg_ctx2);
    795         // remove(cltr->procs, *proc );
    796         // unlock(cltr->proc_list_lock);
     790        lock  (cltr->proc_list_lock __cfaabi_dbg_ctx2);
     791        remove(cltr->procs, *proc );
     792        unlock(cltr->proc_list_lock);
    797793}
    798794
Note: See TracChangeset for help on using the changeset viewer.