Changeset b4b63e8


Ignore:
Timestamp:
Oct 1, 2020, 2:41:30 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
dd53f75
Parents:
e235429
Message:

Fixed missing changes to park/unpark.
Added canary to threads to check when the thread was destroyed

Location:
libcfa/src/concurrency
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    re235429 rb4b63e8  
    190190                } node;
    191191
    192                 #ifdef __CFA_DEBUG__
     192                #if defined( __CFA_WITH_VERIFY__ )
    193193                        unsigned long long canary;
    194194                #endif
  • libcfa/src/concurrency/io.cfa

    re235429 rb4b63e8  
    9797
    9898                if(nextt) {
    99                         unpark( nextt __cfaabi_dbg_ctx2 );
     99                        unpark( nextt );
    100100                        enable_interrupts( __cfaabi_dbg_ctx );
    101101                        return true;
  • libcfa/src/concurrency/kernel.cfa

    re235429 rb4b63e8  
    251251                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    252252                /* paranoid */ verify( kernelTLS.this_thread == thrd_dst );
     253                /* paranoid */ verify( thrd_dst->context.SP );
    253254                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor
    254255                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor
     256                /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_dst->canary );
     257
    255258
    256259
    257260                // set context switch to the thread that the processor is executing
    258                 verify( thrd_dst->context.SP );
    259261                __cfactx_switch( &proc_cor->context, &thrd_dst->context );
    260262                // when __cfactx_switch returns we are back in the processor coroutine
    261263
     264                /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_dst->canary );
    262265                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst );
    263266                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst );
     267                /* paranoid */ verify( thrd_dst->context.SP );
    264268                /* paranoid */ verify( kernelTLS.this_thread == thrd_dst );
    265269                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
     
    330334                        __x87_store;
    331335                #endif
    332                 verify( proc_cor->context.SP );
     336                /* paranoid */ verify( proc_cor->context.SP );
     337                /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_src->canary );
    333338                __cfactx_switch( &thrd_src->context, &proc_cor->context );
     339                /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_src->canary );
    334340                #if defined( __i386 ) || defined( __x86_64 )
    335341                        __x87_load;
     
    363369        /* paranoid */ #endif
    364370        /* paranoid */ verifyf( thrd->link.next == 0p, "Expected null got %p", thrd->link.next );
     371        /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd->canary );
     372
    365373
    366374        if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready;
  • libcfa/src/concurrency/kernel/startup.cfa

    re235429 rb4b63e8  
    451451        link.next = 0p;
    452452        link.prev = 0p;
     453        #if defined( __CFA_WITH_VERIFY__ )
     454                canary = 0x0D15EA5E0D15EA5E;
     455        #endif
    453456
    454457        node.next = 0p;
  • libcfa/src/concurrency/thread.cfa

    re235429 rb4b63e8  
    3939        link.prev = 0p;
    4040        link.preferred = -1;
     41        #if defined( __CFA_WITH_VERIFY__ )
     42                canary = 0x0D15EA5E0D15EA5E;
     43        #endif
    4144
    4245        node.next = 0p;
     
    4851
    4952void ^?{}($thread& this) with( this ) {
     53        #if defined( __CFA_WITH_VERIFY__ )
     54                canary = 0xDEADDEADDEADDEAD;
     55        #endif
    5056        unregister(curr_cluster, this);
    5157        ^self_cor{};
Note: See TracChangeset for help on using the changeset viewer.