Changeset 7a052e34 for src


Ignore:
Timestamp:
Feb 12, 2018, 3:49:04 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
54c9000
Parents:
1dcd52a3 (diff), ff2d1139 (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:/u/cforall/software/cfa/cfa-cc

Location:
src
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/Makefile.am

    r1dcd52a3 r7a052e34  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:54:01 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jul 26 14:15:00 2017
    14 ## Update Count     : 221
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Fri Feb  9 15:51:24 2018
     14## Update Count     : 223
    1515###############################################################################
    1616
     
    9292libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
    9393
    94 stdhdr = ${shell echo stdhdr/*}
     94stdhdr = ${shell find stdhdr -type f -printf "%p "}
    9595
    9696cfa_includedir = $(CFA_INCDIR)
  • src/libcfa/Makefile.in

    r1dcd52a3 r7a052e34  
    263263        containers/result containers/vector concurrency/coroutine \
    264264        concurrency/thread concurrency/kernel concurrency/monitor \
    265         ${shell echo stdhdr/*} math gmp bits/align.h bits/containers.h \
    266         bits/defs.h bits/debug.h bits/locks.h concurrency/invoke.h
     265        ${shell find stdhdr -type f -printf "%p "} math gmp \
     266        bits/align.h bits/containers.h bits/defs.h bits/debug.h \
     267        bits/locks.h concurrency/invoke.h
    267268HEADERS = $(nobase_cfa_include_HEADERS)
    268269am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    428429libcfa_d_a_SOURCES = ${libsrc}
    429430libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug
    430 stdhdr = ${shell echo stdhdr/*}
     431stdhdr = ${shell find stdhdr -type f -printf "%p "}
    431432cfa_includedir = $(CFA_INCDIR)
    432433nobase_cfa_include_HEADERS = \
  • src/libcfa/concurrency/alarm.c

    r1dcd52a3 r7a052e34  
    4141void ?{}( __cfa_time_t & this, zero_t zero ) { this.val = 0; }
    4242
    43 void ?{}( itimerval & this, __cfa_time_t * alarm ) {
    44         this.it_value.tv_sec = alarm->val / one_second;                 // seconds
    45         this.it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds
    46         this.it_interval.tv_sec = 0;
    47         this.it_interval.tv_usec = 0;
     43void ?{}( itimerval & this, __cfa_time_t * alarm ) with( this ) {
     44        it_value.tv_sec = alarm->val / one_second;                      // seconds
     45        it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds
     46        it_interval.tv_sec = 0;
     47        it_interval.tv_usec = 0;
    4848}
    4949
     
    8484//=============================================================================================
    8585
    86 void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
     86void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) with( this ) {
    8787        this.thrd = thrd;
    8888        this.alarm = alarm;
    8989        this.period = period;
    90         this.next = 0;
    91         this.set = false;
    92         this.kernel_alarm = false;
    93 }
    94 
    95 void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
     90        next = 0;
     91        set = false;
     92        kernel_alarm = false;
     93}
     94
     95void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) with( this ) {
    9696        this.proc = proc;
    9797        this.alarm = alarm;
    9898        this.period = period;
    99         this.next = 0;
    100         this.set = false;
    101         this.kernel_alarm = true;
     99        next = 0;
     100        set = false;
     101        kernel_alarm = true;
    102102}
    103103
  • src/libcfa/concurrency/alarm.h

    r1dcd52a3 r7a052e34  
    114114};
    115115
    116 static inline void ?{}( alarm_list_t & this ) {
    117         this.head = 0;
    118         this.tail = &this.head;
     116static inline void ?{}( alarm_list_t & this ) with( this ) {
     117        head = 0;
     118        tail = &head;
    119119}
    120120
  • src/libcfa/concurrency/coroutine.c

    r1dcd52a3 r7a052e34  
    3939//-----------------------------------------------------------------------------
    4040// Coroutine ctors and dtors
    41 void ?{}(coStack_t& this) {
    42         this.size               = 65000;        // size of stack
    43         this.storage    = NULL; // pointer to stack
    44         this.limit              = NULL; // stack grows towards stack limit
    45         this.base               = NULL; // base of stack
    46         this.context    = NULL; // address of cfa_context_t
    47         this.top                = NULL; // address of top of storage
    48         this.userStack  = false;
     41void ?{}(coStack_t& this) with( this ) {
     42        size            = 65000;        // size of stack
     43        storage = NULL; // pointer to stack
     44        limit           = NULL; // stack grows towards stack limit
     45        base            = NULL; // base of stack
     46        context = NULL; // address of cfa_context_t
     47        top             = NULL; // address of top of storage
     48        userStack       = false;
    4949}
    5050
     
    6060}
    6161
    62 void ?{}(coroutine_desc& this, const char * name) {
     62void ?{}(coroutine_desc& this, const char * name) with( this ) {
    6363        this.name = name;
    64         this.errno_ = 0;
    65         this.state = Start;
    66         this.starter = NULL;
    67         this.last = NULL;
     64        errno_ = 0;
     65        state = Start;
     66        starter = NULL;
     67        last = NULL;
    6868}
    6969
     
    9999// Wrapper for co
    100100void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    101         // THREAD_GETMEM( This )->disableInterrupts();
     101        disable_interrupts();
    102102
    103103        // set state of current coroutine to inactive
     
    115115        src->state = Active;
    116116
    117         // THREAD_GETMEM( This )->enableInterrupts();
     117        enable_interrupts( __cfaabi_dbg_ctx );
    118118} //ctxSwitchDirect
    119119
  • src/libcfa/concurrency/invoke.c

    r1dcd52a3 r7a052e34  
    1010// Created On       : Tue Jan 17 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  8 16:18:11 2018
    13 // Update Count     : 4
     12// Last Modified On : Fri Feb  9 16:37:42 2018
     13// Update Count     : 5
    1414//
    1515
     
    9393        struct coStack_t* stack = &get_coroutine( this )->stack;
    9494
    95 #if defined( __i386__ )
     95#if defined( __i386 )
    9696
    9797        struct FakeStack {
     
    114114        ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
    115115
    116 #elif defined( __x86_64__ )
     116#elif defined( __x86_64 )
    117117
    118118        struct FakeStack {
     
    150150        fs->arg[0] = this;
    151151        fs->arg[1] = invoke;
     152
    152153#else
    153         #error Only __i386__ and __x86_64__ is supported for threads in cfa
     154        #error uknown hardware architecture
    154155#endif
    155156}
  • src/libcfa/concurrency/invoke.h

    r1dcd52a3 r7a052e34  
    1010// Created On       : Tue Jan 17 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jan 23 14:55:46 2018
    13 // Update Count     : 3
     12// Last Modified On : Fri Feb  9 14:41:55 2018
     13// Update Count     : 6
    1414//
    1515
     
    202202        void CtxSwitch( void * from, void * to ) asm ("CtxSwitch");
    203203
    204         #if   defined( __x86_64__ )
     204        #if   defined( __i386 )
     205        #define CtxGet( ctx ) __asm__ ( \
     206                        "movl %%esp,%0\n"   \
     207                        "movl %%ebp,%1\n"   \
     208                : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     209        #elif defined( __x86_64 )
    205210        #define CtxGet( ctx ) __asm__ ( \
    206211                        "movq %%rsp,%0\n"   \
    207212                        "movq %%rbp,%1\n"   \
    208                 : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    209         #elif defined( __i386__ )
    210         #define CtxGet( ctx ) __asm__ ( \
    211                         "movl %%esp,%0\n"   \
    212                         "movl %%ebp,%1\n"   \
    213213                : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    214214        #elif defined( __ARM_ARCH )
     
    217217                        "mov %1,%%r11\n"   \
    218218                : "=rm" (ctx.SP), "=rm" (ctx.FP) )
     219        #else
     220                #error unknown hardware architecture
    219221        #endif
    220222
  • src/libcfa/concurrency/kernel.c

    r1dcd52a3 r7a052e34  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  6 21:51:26 2018
    13 // Update Count     : 4
     12// Last Modified On : Thu Feb  8 23:52:19 2018
     13// Update Count     : 5
    1414//
    1515
    1616//C Includes
    1717#include <stddef.h>
    18 #define ftype `ftype`
    1918extern "C" {
    2019#include <stdio.h>
     
    2423#include <unistd.h>
    2524}
    26 #undef ftype
    2725
    2826//CFA Includes
     
    144142}
    145143
    146 void ?{}(processor & this, cluster * cltr) {
     144void ?{}(processor & this, cluster * cltr) with( this ) {
    147145        this.cltr = cltr;
    148         this.terminated{ 0 };
    149         this.do_terminate = false;
    150         this.preemption_alarm = NULL;
    151         this.pending_preemption = false;
     146        terminated{ 0 };
     147        do_terminate = false;
     148        preemption_alarm = NULL;
     149        pending_preemption = false;
    152150
    153151        start( &this );
    154152}
    155153
    156 void ?{}(processor & this, cluster * cltr, processorCtx_t & runner) {
     154void ?{}(processor & this, cluster * cltr, processorCtx_t & runner) with( this ) {
    157155        this.cltr = cltr;
    158         this.terminated{ 0 };
    159         this.do_terminate = false;
    160         this.preemption_alarm = NULL;
    161         this.pending_preemption = false;
    162         this.kernel_thread = pthread_self();
     156        terminated{ 0 };
     157        do_terminate = false;
     158        preemption_alarm = NULL;
     159        pending_preemption = false;
     160        kernel_thread = pthread_self();
    163161
    164162        this.runner = &runner;
  • src/libcfa/concurrency/monitor

    r1dcd52a3 r7a052e34  
    2727};
    2828
    29 static inline void ?{}(monitor_desc & this) {
    30         (this.lock){};
    31         (this.entry_queue){};
    32         (this.signal_stack){};
    33         this.owner         = NULL;
    34         this.recursion     = 0;
    35         this.mask.accepted = NULL;
    36         this.mask.data     = NULL;
    37         this.mask.size     = 0;
    38         this.dtor_node     = NULL;
     29static inline void ?{}(monitor_desc & this) with( this ) {
     30        lock{};
     31        entry_queue{};
     32        signal_stack{};
     33        owner         = NULL;
     34        recursion     = 0;
     35        mask.accepted = NULL;
     36        mask.data     = NULL;
     37        mask.size     = 0;
     38        dtor_node     = NULL;
    3939}
    4040
  • src/libcfa/concurrency/monitor.c

    r1dcd52a3 r7a052e34  
    151151                        // We already have the monitor... but where about to destroy it so the nesting will fail
    152152                        // Abort!
    153                         abort( "Attempt to destroy monitor %p by thread \"%.256s\" (%p) in nested mutex." );
     153                        abort( "Attempt to destroy monitor %p by thread \"%.256s\" (%p) in nested mutex.", this, thrd->self_cor.name, thrd );
    154154                }
    155155
     
    358358}
    359359
    360 void ?{}(__condition_criterion_t & this ) {
    361         this.ready  = false;
    362         this.target = NULL;
    363         this.owner  = NULL;
    364         this.next   = NULL;
     360void ?{}(__condition_criterion_t & this ) with( this ) {
     361        ready  = false;
     362        target = NULL;
     363        owner  = NULL;
     364        next   = NULL;
    365365}
    366366
     
    427427                thread_desc * this_thrd = this_thread;
    428428                if ( this.monitor_count != this_thrd->monitors.size ) {
    429                         abort( "Signal on condition %p made with different number of monitor(s), expected %i got %i", &this, this.monitor_count, this_thrd->monitors.size );
     429                        abort( "Signal on condition %p made with different number of monitor(s), expected %li got %li", &this, this.monitor_count, this_thrd->monitors.size );
    430430                }
    431431
    432432                for(int i = 0; i < this.monitor_count; i++) {
    433433                        if ( this.monitors[i] != this_thrd->monitors[i] ) {
    434                                 abort( "Signal on condition %p made with different monitor, expected %p got %i", &this, this.monitors[i], this_thrd->monitors[i] );
     434                                abort( "Signal on condition %p made with different monitor, expected %p got %p", &this, this.monitors[i], this_thrd->monitors[i] );
    435435                        }
    436436                }
  • src/libcfa/concurrency/preemption.c

    r1dcd52a3 r7a052e34  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  8 17:01:56 2018
    13 // Update Count     : 13
     12// Last Modified On : Fri Feb  9 16:38:13 2018
     13// Update Count     : 14
    1414//
    1515
    1616#include "preemption.h"
    1717
    18 #define ftype `ftype`
    1918extern "C" {
    2019#include <errno.h>
     
    2322#include <unistd.h>
    2423}
    25 #undef ftype
    2624
    2725#include "bits/signal.h"
     
    5048
    5149// Machine specific register name
    52 #if   defined(__x86_64__)
     50#if   defined( __i386 )
     51#define CFA_REG_IP gregs[REG_EIP]
     52#elif defined( __x86_64 )
    5353#define CFA_REG_IP gregs[REG_RIP]
    54 #elif defined(__i386__)
    55 #define CFA_REG_IP gregs[REG_EIP]
    56 #elif defined(__ARM_ARCH__)
     54#elif defined( __ARM_ARCH )
    5755#define CFA_REG_IP arm_pc
     56#else
     57#error unknown hardware architecture
    5858#endif
    5959
  • src/libcfa/exception.c

    r1dcd52a3 r7a052e34  
    99// Author           : Andrew Beach
    1010// Created On       : Mon Jun 26 15:13:00 2017
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 15:45:00 2017
    13 // Update Count     : 7
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Feb  9 14:41:55 2018
     13// Update Count     : 8
    1414//
    1515
     
    453453// match, which is no way generic.  Some more works need to be done if we want to have a single call to the try routine.
    454454
    455 #if defined( __x86_64__ ) || defined( __i386__ )
     455#if defined( __i386 ) || defined( __x86_64 )
    456456asm (
    457457        //HEADER
     
    476476//      "       .section        .note.GNU-stack,\"x\",@progbits\n"
    477477);
    478 #endif // __x86_64__ || __i386__
     478#endif // __i386 || __x86_64
  • src/tests/preempt_longrun/Makefile.am

    r1dcd52a3 r7a052e34  
    1818max_time=600
    1919preempt=1_000ul
     20debug=-debug
    2021
    2122REPEAT = ${abs_top_srcdir}/tools/repeat
    2223TIME = /usr/bin/time -f "%E"
    2324
    24 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
     25BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt}
    2526CFLAGS = ${BUILD_FLAGS}
    2627CC = @CFA_BINDIR@/@CFA_NAME@
    2728
    28 TESTS = block create disjoint enter enter3 processor stack wait yield
     29TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
    2930
    3031.INTERMEDIATE: ${TESTS}
     
    3637
    3738% : %.c ${CC}
    38         ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}
     39        ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@}
    3940
    4041%.run : % ${REPEAT}
  • src/tests/preempt_longrun/Makefile.in

    r1dcd52a3 r7a052e34  
    451451max_time = 600
    452452preempt = 1_000ul
     453debug = -debug
    453454REPEAT = ${abs_top_srcdir}/tools/repeat
    454455TIME = /usr/bin/time -f "%E"
    455 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
    456 TESTS = block create disjoint enter enter3 processor stack wait yield
     456BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt}
     457TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
    457458all: all-am
    458459
     
    643644        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    644645        "$$tst" $(AM_TESTS_FD_REDIRECT)
     646coroutine.log: coroutine
     647        @p='coroutine'; \
     648        b='coroutine'; \
     649        $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
     650        --log-file $$b.log --trs-file $$b.trs \
     651        $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
     652        "$$tst" $(AM_TESTS_FD_REDIRECT)
    645653create.log: create
    646654        @p='create'; \
     
    873881
    874882% : %.c ${CC}
    875         ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}
     883        ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@}
    876884
    877885%.run : % ${REPEAT}
Note: See TracChangeset for help on using the changeset viewer.