Changeset d46bdac for libcfa


Ignore:
Timestamp:
Jan 15, 2021, 3:01:31 PM (5 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
77ff383
Parents:
2d63023 (diff), b7664a03 (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

Location:
libcfa/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io/setup.cfa

    r2d63023 rd46bdac  
    4242        void ^?{}(io_context & this, bool cluster_context) {}
    4343
     44        void register_fixed_files( io_context &, int *, unsigned ) {}
     45        void register_fixed_files( cluster    &, int *, unsigned ) {}
     46
    4447#else
    4548        #include <errno.h>
  • libcfa/src/concurrency/kernel.cfa

    r2d63023 rd46bdac  
    624624// Unexpected Terminating logic
    625625//=============================================================================================
    626 static __spinlock_t kernel_abort_lock;
    627 static bool kernel_abort_called = false;
     626
     627extern "C" {
     628        extern void __cfaabi_real_abort(void);
     629}
     630static volatile bool kernel_abort_called = false;
    628631
    629632void * kernel_abort(void) __attribute__ ((__nothrow__)) {
    630633        // abort cannot be recursively entered by the same or different processors because all signal handlers return when
    631634        // the globalAbort flag is true.
    632         lock( kernel_abort_lock __cfaabi_dbg_ctx2 );
     635        bool first = __atomic_test_and_set( &kernel_abort_called, __ATOMIC_SEQ_CST);
     636
     637        // first task to abort ?
     638        if ( !first ) {
     639                // We aren't the first to abort.
     640                // I give up, just let C handle it
     641                __cfaabi_real_abort();
     642        }
    633643
    634644        // disable interrupts, it no longer makes sense to try to interrupt this processor
    635645        disable_interrupts();
    636 
    637         // first task to abort ?
    638         if ( kernel_abort_called ) {                    // not first task to abort ?
    639                 unlock( kernel_abort_lock );
    640 
    641                 sigset_t mask;
    642                 sigemptyset( &mask );
    643                 sigaddset( &mask, SIGALRM );            // block SIGALRM signals
    644                 sigaddset( &mask, SIGUSR1 );            // block SIGALRM signals
    645                 sigsuspend( &mask );                            // block the processor to prevent further damage during abort
    646                 _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it
    647         }
    648         else {
    649                 kernel_abort_called = true;
    650                 unlock( kernel_abort_lock );
    651         }
    652646
    653647        return __cfaabi_tls.this_thread;
  • libcfa/src/concurrency/stats.hfa

    r2d63023 rd46bdac  
    22
    33#include <stdint.h>
     4
     5enum {
     6        CFA_STATS_READY_Q  = 0x01,
     7        CFA_STATS_IO = 0x02,
     8};
    49
    510#if defined(__CFA_NO_STATISTICS__)
     
    914        static inline void __print_stats( struct __stats_t *, int, const char *, const char *, void * ) {}
    1015#else
    11         enum {
    12                 CFA_STATS_READY_Q  = 0x01,
    13                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
    14                         CFA_STATS_IO = 0x02,
    15                 #endif
    16         };
    1716
    1817        struct __attribute__((aligned(64))) __stats_readQ_t {
  • libcfa/src/interpose.cfa

    r2d63023 rd46bdac  
    284284}
    285285
     286extern "C" {
     287        void __cfaabi_real_abort(void) {
     288                __cabi_libc.abort();
     289        }
     290}
     291
    286292void sigHandler_segv( __CFA_SIGPARMS__ ) {
    287293                if ( sfp->si_addr == 0p ) {
  • libcfa/src/parseargs.cfa

    r2d63023 rd46bdac  
    3939                        if( options[i].short_name != '\0'
    4040                        && options[i].short_name == options[j].short_name)
    41                                 abort("Parse Args error: two options have short name '%c' (%d & %d)", options[i].short_name, i, j);
    42 
    43                         if(0 == strcmp(options[i].long_name, options[j].long_name)) abort("Parse Args error: two options have long name '%s' (%d & %d)", options[i].long_name, i, j);
     41                                abort("Parse Args error: two options have short name '%c' (%zu & %zu)", options[i].short_name, i, j);
     42
     43                        if(0 == strcmp(options[i].long_name, options[j].long_name)) abort("Parse Args error: two options have long name '%s' (%zu & %zu)", options[i].long_name, i, j);
    4444                }
    4545        }
Note: See TracChangeset for help on using the changeset viewer.