Changeset 2f19e03 for libcfa/src


Ignore:
Timestamp:
Jun 15, 2021, 12:28:48 PM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b51e389c
Parents:
4aba055 (diff), 4f1b8f3f (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' into andrew-mmath, collecting updates.

Location:
libcfa/src
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    r4aba055 r2f19e03  
    6969        common.hfa \
    7070        fstream.hfa \
    71         strstream.hfa \
    7271        heap.hfa \
    7372        iostream.hfa \
     
    7877        rational.hfa \
    7978        stdlib.hfa \
     79        strstream.hfa \
    8080        time.hfa \
    8181        bits/weakso_locks.hfa \
     
    8383        containers/pair.hfa \
    8484        containers/result.hfa \
    85         containers/vector.hfa
     85        containers/vector.hfa \
     86        device/cpu.hfa
    8687
    8788libsrc = ${inst_headers_src} ${inst_headers_src:.hfa=.cfa} \
  • libcfa/src/concurrency/kernel.cfa

    r4aba055 r2f19e03  
    422422                __cfactx_switch( &proc_cor->context, &thrd_dst->context );
    423423                // when __cfactx_switch returns we are back in the processor coroutine
     424
     425
    424426
    425427                /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary );
     
    522524
    523525        /* paranoid */ verify( ! __preemption_enabled() );
    524         /* paranoid */ verifyf( ((uintptr_t)thrd_src->context.SP) < ((uintptr_t)__get_stack(thrd_src->curr_cor)->base ), "ERROR : Returning $thread %p has been corrupted.\n StackPointer too small.\n", thrd_src );
    525         /* paranoid */ verifyf( ((uintptr_t)thrd_src->context.SP) > ((uintptr_t)__get_stack(thrd_src->curr_cor)->limit), "ERROR : Returning $thread %p has been corrupted.\n StackPointer too large.\n", thrd_src );
     526        /* paranoid */ verifyf( ((uintptr_t)thrd_src->context.SP) < ((uintptr_t)__get_stack(thrd_src->curr_cor)->base ) || thrd_src->corctx_flag, "ERROR : Returning $thread %p has been corrupted.\n StackPointer too small.\n", thrd_src );
     527        /* paranoid */ verifyf( ((uintptr_t)thrd_src->context.SP) > ((uintptr_t)__get_stack(thrd_src->curr_cor)->limit) || thrd_src->corctx_flag, "ERROR : Returning $thread %p has been corrupted.\n StackPointer too large.\n", thrd_src );
    526528}
    527529
  • libcfa/src/concurrency/locks.hfa

    r4aba055 r2f19e03  
    2121#include "bits/weakso_locks.hfa"
    2222#include "containers/queueLockFree.hfa"
    23 
     23#include "limits.hfa"
    2424#include "thread.hfa"
    2525
     
    8585        bool tryP(BinaryBenaphore & this) {
    8686                ssize_t c = this.counter;
     87                /* paranoid */ verify( c > MIN );
    8788                return (c >= 1) && __atomic_compare_exchange_n(&this.counter, &c, c-1, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
    8889        }
     
    9293                ssize_t c = 0;
    9394                for () {
     95                        /* paranoid */ verify( this.counter < MAX );
    9496                        if (__atomic_compare_exchange_n(&this.counter, &c, c+1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    9597                                if (c == 0) return true;
  • libcfa/src/exception.c

    r4aba055 r2f19e03  
    2727#include "stdhdr/assert.h"
    2828#include "virtual.h"
    29 
    30 #if defined( __ARM_ARCH )
    31 #warning FIX ME: temporary hack to keep ARM build working
    32 #ifndef _URC_FATAL_PHASE1_ERROR
    33 #define _URC_FATAL_PHASE1_ERROR 3
    34 #endif // ! _URC_FATAL_PHASE1_ERROR
    35 #ifndef _URC_FATAL_PHASE2_ERROR
    36 #define _URC_FATAL_PHASE2_ERROR 2
    37 #endif // ! _URC_FATAL_PHASE2_ERROR
    38 #endif // __ARM_ARCH
    39 
    4029#include "lsda.h"
    4130
     
    301290}
    302291
    303 #if defined( __x86_64 ) || defined( __i386 )
     292#if defined( __x86_64 ) || defined( __i386 ) || defined( __ARM_ARCH )
    304293// This is our personality routine. For every stack frame annotated with
    305294// ".cfi_personality 0x3,__gcfa_personality_v0" this function will be called twice when unwinding.
     
    419408                                    _Unwind_GetCFA(unwind_context) + 24;
    420409#                               elif defined( __ARM_ARCH )
    421 #                                   warning FIX ME: check if anything needed for ARM
    422                                     42;
     410                                    _Unwind_GetCFA(unwind_context) + 40;
    423411#                               endif
    424412                                int (*matcher)(exception_t *) = *(int(**)(exception_t *))match_pos;
     
    537525        // HEADER
    538526        ".LFECFA1:\n"
     527#if defined( __x86_64 ) || defined( __i386 )
    539528        "       .globl  __gcfa_personality_v0\n"
     529#else // defined( __ARM_ARCH )
     530        "       .global __gcfa_personality_v0\n"
     531#endif
    540532        "       .section        .gcc_except_table,\"a\",@progbits\n"
    541533        // TABLE HEADER (important field is the BODY length at the end)
     
    569561        // No clue what this does specifically
    570562        "       .section        .data.rel.local.CFA.ref.__gcfa_personality_v0,\"awG\",@progbits,CFA.ref.__gcfa_personality_v0,comdat\n"
     563#if defined( __x86_64 ) || defined( __i386 )
    571564        "       .align 8\n"
     565#else // defined( __ARM_ARCH )
     566        "       .align 3\n"
     567#endif
    572568        "       .type CFA.ref.__gcfa_personality_v0, @object\n"
    573569        "       .size CFA.ref.__gcfa_personality_v0, 8\n"
     
    575571#if defined( __x86_64 )
    576572        "       .quad __gcfa_personality_v0\n"
    577 #else // then __i386
     573#elif defined( __i386 )
    578574        "       .long __gcfa_personality_v0\n"
     575#else // defined( __ARM_ARCH )
     576        "       .xword __gcfa_personality_v0\n"
    579577#endif
    580578);
     
    583581        // HEADER
    584582        ".LFECFA1:\n"
     583#if defined( __x86_64 ) || defined( __i386 )
    585584        "       .globl  __gcfa_personality_v0\n"
     585#else // defined( __ARM_ARCH )
     586        "       .global __gcfa_personality_v0\n"
     587#endif
    586588        "       .section        .gcc_except_table,\"a\",@progbits\n"
    587589        // TABLE HEADER (important field is the BODY length at the end)
     
    612614#pragma GCC pop_options
    613615
    614 #elif defined( __ARM_ARCH )
    615 _Unwind_Reason_Code __gcfa_personality_v0(
    616                 int version,
    617                 _Unwind_Action actions,
    618                 unsigned long long exception_class,
    619                 struct _Unwind_Exception * unwind_exception,
    620                 struct _Unwind_Context * unwind_context) {
    621         return _URC_CONTINUE_UNWIND;
    622 }
    623 
    624 __attribute__((noinline))
    625 void __cfaehm_try_terminate(void (*try_block)(),
    626                 void (*catch_block)(int index, exception_t * except),
    627                 __attribute__((unused)) int (*match_block)(exception_t * except)) {
    628 }
    629616#else
    630617        #error unsupported hardware architecture
    631 #endif // __x86_64 || __i386
     618#endif // __x86_64 || __i386 || __ARM_ARCH
  • libcfa/src/interpose.cfa

    r4aba055 r2f19e03  
    9595
    9696extern "C" {
    97         void __cfaabi_interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
    9897        void __cfaabi_interpose_startup( void ) {
    9998                const char *version = 0p;
  • libcfa/src/startup.cfa

    r4aba055 r2f19e03  
    2020
    2121extern "C" {
    22     void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));
    23     void __cfaabi_appready_startup( void ) {
     22        void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));
     23        void __cfaabi_appready_startup( void ) {
    2424                tzset();                                                                                // initialize time global variables
    2525                setlocale( LC_NUMERIC, getenv("LANG") );
     
    2828                heapAppStart();
    2929                #endif // __CFA_DEBUG__
    30     } // __cfaabi_appready_startup
     30        } // __cfaabi_appready_startup
    3131
    32     void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));
    33     void __cfaabi_appready_shutdown( void ) {
     32        void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));
     33        void __cfaabi_appready_shutdown( void ) {
    3434                #ifdef __CFA_DEBUG__
    3535                extern void heapAppStop();
    3636                heapAppStop();
    3737                #endif // __CFA_DEBUG__
    38     } // __cfaabi_appready_shutdown
     38        } // __cfaabi_appready_shutdown
    3939
    40     void disable_interrupts() __attribute__(( weak )) {}
    41     void enable_interrupts() __attribute__(( weak )) {}
     40        void disable_interrupts() __attribute__(( weak )) {}
     41        void enable_interrupts() __attribute__(( weak )) {}
     42
     43
     44        extern void __cfaabi_interpose_startup( void );
     45        extern void __cfaabi_device_startup   ( void );
     46        extern void __cfaabi_device_shutdown  ( void );
     47
     48        void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
     49        void __cfaabi_core_startup( void ) {
     50                __cfaabi_interpose_startup();
     51                __cfaabi_device_startup();
     52        } // __cfaabi_core_startup
     53
     54        void __cfaabi_core_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_CORE ) ));
     55        void __cfaabi_core_shutdown( void ) {
     56                __cfaabi_device_shutdown();
     57        } // __cfaabi_core_shutdown
    4258} // extern "C"
    4359
Note: See TracChangeset for help on using the changeset viewer.