Changeset 3d560060 for src/libcfa/bits


Ignore:
Timestamp:
Nov 30, 2017, 3:05:25 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, resolv-new, with_gc
Children:
557435e, 5da9d6a
Parents:
dd9b59e (diff), c2b9f21 (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:
src/libcfa/bits
Files:
1 added
3 edited
2 moved

Legend:

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

    rdd9b59e r3d560060  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // libdebug.h --
     7// align.h --
    88//
    99// Author           : Thierry Delisle
  • src/libcfa/bits/containers.h

    rdd9b59e r3d560060  
    1515#pragma once
    1616
     17#include "bits/align.h"
    1718#include "bits/defs.h"
    18 #include "libhdr.h"
    1919
    2020//-----------------------------------------------------------------------------
  • src/libcfa/bits/debug.c

    rdd9b59e r3d560060  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // libdebug.c --
     7// debug.c --
    88//
    99// Author           : Thierry Delisle
     
    2828extern "C" {
    2929
    30         void __lib_debug_write( const char *in_buffer, int len ) {
     30        void __cfaabi_dbg_bits_write( const char *in_buffer, int len ) {
    3131                // ensure all data is written
    3232                for ( int count = 0, retcode; count < len; count += retcode ) {
     
    4444        }
    4545
    46         void __lib_debug_acquire() __attribute__((__weak__)) {}
    47         void __lib_debug_release() __attribute__((__weak__)) {}
     46        void __cfaabi_dbg_bits_acquire() __attribute__((__weak__)) {}
     47        void __cfaabi_dbg_bits_release() __attribute__((__weak__)) {}
    4848
    49         void __lib_debug_print_safe  ( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) )) {
     49        void __cfaabi_dbg_bits_print_safe  ( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) )) {
    5050                va_list args;
    5151
    5252                va_start( args, fmt );
    53                 __lib_debug_acquire();
     53                __cfaabi_dbg_bits_acquire();
    5454
    5555                int len = vsnprintf( buffer, buffer_size, fmt, args );
    56                 __lib_debug_write( buffer, len );
     56                __cfaabi_dbg_bits_write( buffer, len );
    5757
    58                 __lib_debug_release();
     58                __cfaabi_dbg_bits_release();
    5959                va_end( args );
    6060        }
    6161
    62         void __lib_debug_print_nolock( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) )) {
     62        void __cfaabi_dbg_bits_print_nolock( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) )) {
    6363                va_list args;
    6464
     
    6666
    6767                int len = vsnprintf( buffer, buffer_size, fmt, args );
    68                 __lib_debug_write( buffer, len );
     68                __cfaabi_dbg_bits_write( buffer, len );
    6969
    7070                va_end( args );
    7171        }
    7272
    73         void __lib_debug_print_vararg( const char fmt[], va_list args ) {
     73        void __cfaabi_dbg_bits_print_vararg( const char fmt[], va_list args ) {
    7474                int len = vsnprintf( buffer, buffer_size, fmt, args );
    75                 __lib_debug_write( buffer, len );
     75                __cfaabi_dbg_bits_write( buffer, len );
    7676        }
    7777
    78         void __lib_debug_print_buffer( char in_buffer[], int in_buffer_size, const char fmt[], ... ) __attribute__(( format (printf, 3, 4) )) {
     78        void __cfaabi_dbg_bits_print_buffer( char in_buffer[], int in_buffer_size, const char fmt[], ... ) __attribute__(( format (printf, 3, 4) )) {
    7979                va_list args;
    8080
     
    8282
    8383                int len = vsnprintf( in_buffer, in_buffer_size, fmt, args );
    84                 __lib_debug_write( in_buffer, len );
     84                __cfaabi_dbg_bits_write( in_buffer, len );
    8585
    8686                va_end( args );
  • src/libcfa/bits/defs.h

    rdd9b59e r3d560060  
    3232#define __cfa_anonymous_object __cfa_anonymous_object
    3333#endif
     34
     35#ifdef __cforall
     36extern "C" {
     37#endif
     38void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));
     39#ifdef __cforall
     40}
     41#endif
  • src/libcfa/bits/locks.h

    rdd9b59e r3d560060  
    1616#pragma once
    1717
     18#include "bits/debug.h"
    1819#include "bits/defs.h"
    19 
    20 #include "libhdr.h"
    2120
    2221// pause to prevent excess processor bus usage
     
    6564
    6665        // Lock the spinlock, return false if already acquired
    67         static inline _Bool try_lock  ( __spinlock_t & this DEBUG_CTX_PARAM2 ) {
     66        static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    6867                _Bool result = __lock_test_and_test_and_set( this.lock );
    69                 LIB_DEBUG_DO(
     68                __cfaabi_dbg_debug_do(
    7069                        if( result ) {
    7170                                this.prev_name = caller;
     
    7776
    7877        // Lock the spinlock, spin if already acquired
    79         static inline void lock( __spinlock_t & this DEBUG_CTX_PARAM2 ) {
     78        static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    8079                #ifndef NOEXPBACK
    8180                        enum { SPIN_START = 4, SPIN_END = 64 * 1024, };
     
    9897                        #endif
    9998                }
    100                 LIB_DEBUG_DO(
     99                __cfaabi_dbg_debug_do(
    101100                        this.prev_name = caller;
    102101                        this.prev_thrd = this_thread;
     
    105104
    106105        // Lock the spinlock, spin if already acquired
    107         static inline void lock_yield( __spinlock_t & this DEBUG_CTX_PARAM2 ) {
     106        static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
    108107                for ( unsigned int i = 1;; i += 1 ) {
    109108                        if ( __lock_test_and_test_and_set( this.lock ) ) break;
    110109                        yield( i );
    111110                }
    112                 LIB_DEBUG_DO(
     111                __cfaabi_dbg_debug_do(
    113112                        this.prev_name = caller;
    114113                        this.prev_thrd = this_thread;
Note: See TracChangeset for help on using the changeset viewer.