Changes in / [8da7421f:d5631b3]


Ignore:
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r8da7421f rd5631b3  
    127127                        }
    128128
    129                         ast = Settings.NewAST ? "--enable-new-ast" : "--disable-new-ast"
    130 
    131                         sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} ${ast} --quiet --prefix=${BuildDir}"
     129                        sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} --quiet --prefix=${BuildDir}"
    132130
    133131                        // Configure libcfa
     
    361359        public final CC_Desc Compiler
    362360        public final Arch_Desc Architecture
    363         public final Boolean NewAST
    364361        public final Boolean RunAllTests
    365362        public final Boolean RunBenchmark
     
    413410
    414411                this.IsSandbox          = (branch == "jenkins-sandbox")
    415                 this.NewAST             = param.NewAST
    416412                this.RunAllTests        = param.RunAllTests
    417413                this.RunBenchmark       = param.RunBenchmark
     
    474470                                ],                                                                                              \
    475471                                [$class: 'BooleanParameterDefinition',                                                  \
    476                                         description: 'If true, build compiler using new AST',           \
    477                                         name: 'NewAST',                                                                         \
    478                                         defaultValue: false,                                                            \
    479                                 ],                                                                                              \
    480                                 [$class: 'BooleanParameterDefinition',                                                  \
    481472                                        description: 'If false, only the quick test suite is ran',              \
    482473                                        name: 'RunAllTests',                                                            \
    483474                                        defaultValue: false,                                                            \
    484                                 ],
     475                                ],                                                                                              \
    485476                                [$class: 'BooleanParameterDefinition',                                                  \
    486477                                        description: 'If true, jenkins also runs benchmarks',           \
  • libcfa/src/concurrency/kernel.cfa

    r8da7421f rd5631b3  
    252252                /* paranoid */ verify( kernelTLS.this_thread == thrd_dst );
    253253                /* paranoid */ verify( thrd_dst->context.SP );
    254                 /* paranoid */ verify( thrd_dst->state != Halted );
    255254                /* 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
    256255                /* 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
     
    288287                if(unlikely(thrd_dst->state == Halted)) {
    289288                        // The thread has halted, it should never be scheduled/run again
    290                         // finish the thread
    291                         __thread_finish( thrd_dst );
     289                        // We may need to wake someone up here since
     290                        unpark( this->destroyer );
     291                        this->destroyer = 0p;
    292292                        break RUNNING;
    293293                }
     
    448448}
    449449
    450 extern "C" {
    451         // Leave the thread monitor
    452         // last routine called by a thread.
    453         // Should never return
    454         void __cfactx_thrd_leave() {
    455                 $thread * thrd = TL_GET( this_thread );
    456                 $monitor * this = &thrd->self_mon;
    457 
    458                 // Lock the monitor now
    459                 lock( this->lock __cfaabi_dbg_ctx2 );
    460 
    461                 disable_interrupts();
    462 
    463                 thrd->state = Halted;
    464 
    465                 if( thrd != this->owner || this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); }
    466 
    467                 // Leave the thread
    468                 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    469                 returnToKernel();
    470                 abort();
    471 
    472                 // Control flow should never reach here!
    473         }
     450// KERNEL ONLY
     451void __leave_thread() {
     452        /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
     453        returnToKernel();
     454        abort();
    474455}
    475456
  • libcfa/src/concurrency/kernel.hfa

    r8da7421f rd5631b3  
    7979        // Handle to pthreads
    8080        pthread_t kernel_thread;
     81
     82        // RunThread data
     83        // Action to do after a thread is ran
     84        $thread * destroyer;
    8185
    8286        // Preemption data
  • libcfa/src/concurrency/kernel/startup.cfa

    r8da7421f rd5631b3  
    474474        this.cltr = &_cltr;
    475475        full_proc = true;
     476        destroyer = 0p;
    476477        do_terminate = false;
    477478        preemption_alarm = 0p;
  • libcfa/src/concurrency/kernel_private.hfa

    r8da7421f rd5631b3  
    3939;
    4040
    41 //release/wake-up the following resources
    42 void __thread_finish( $thread * thrd );
     41//Block current thread and release/wake-up the following resources
     42void __leave_thread() __attribute__((noreturn));
    4343
    4444//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/monitor.cfa

    r8da7421f rd5631b3  
    281281}
    282282
    283 void __thread_finish( $thread * thrd ) {
    284         $monitor * this = &thrd->self_mon;
    285 
    286         // Lock the monitor now
    287         /* paranoid */ verify( this->lock.lock );
    288         /* paranoid */ verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", thrd, this->owner, this->recursion, this );
    289         /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    290         /* paranoid */ verify( thrd->state == Halted );
    291         /* paranoid */ verify( this->recursion == 1 );
    292 
    293         // Leaving a recursion level, decrement the counter
    294         this->recursion -= 1;
    295         this->owner = 0p;
    296 
    297         // Fetch the next thread, can be null
    298         $thread * new_owner = next_thread( this );
    299 
    300         // Release the monitor lock
    301         unlock( this->lock );
    302 
    303         // Unpark the next owner if needed
    304         /* paranoid */ verifyf( !new_owner || new_owner == this->owner, "Expected owner to be %p, got %p (m: %p)", new_owner, this->owner, this );
    305         /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    306         /* paranoid */ verify( thrd->state == Halted );
    307         unpark( new_owner );
     283extern "C" {
     284        // Leave the thread monitor
     285        // last routine called by a thread.
     286        // Should never return
     287        void __cfactx_thrd_leave() {
     288                $thread * thrd = TL_GET( this_thread );
     289                $monitor * this = &thrd->self_mon;
     290
     291                // Lock the monitor now
     292                lock( this->lock __cfaabi_dbg_ctx2 );
     293
     294                disable_interrupts();
     295
     296                thrd->state = Halted;
     297
     298                /* paranoid */ verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", thrd, this->owner, this->recursion, this );
     299
     300                // Leaving a recursion level, decrement the counter
     301                this->recursion -= 1;
     302
     303                // If we haven't left the last level of recursion
     304                // it must mean there is an error
     305                if( this->recursion != 0) { abort( "Thread internal monitor has unbalanced recursion" ); }
     306
     307                // Fetch the next thread, can be null
     308                $thread * new_owner = next_thread( this );
     309
     310                // Release the monitor lock
     311                unlock( this->lock );
     312
     313                // Unpark the next owner if needed
     314                /* paranoid */ verifyf( !new_owner || new_owner == this->owner, "Expected owner to be %p, got %p (m: %p)", new_owner, this->owner, this );
     315                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
     316                /* paranoid */ verify( ! kernelTLS.this_processor->destroyer );
     317                /* paranoid */ verify( thrd->state == Halted );
     318
     319                kernelTLS.this_processor->destroyer = new_owner;
     320
     321                // Leave the thread
     322                __leave_thread();
     323
     324                // Control flow should never reach here!
     325        }
    308326}
    309327
Note: See TracChangeset for help on using the changeset viewer.