Changeset 242a902 for src


Ignore:
Timestamp:
Jul 18, 2017, 4:35:52 PM (7 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:
f19339e
Parents:
795d450
Message:

Convert more library files to use references

Location:
src
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/alarm.c

    r795d450 r242a902  
    5656//=============================================================================================
    5757
    58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
    59         this->thrd = thrd;
    60         this->alarm = alarm;
    61         this->period = period;
    62         this->next = 0;
    63         this->set = false;
    64         this->kernel_alarm = false;
     58void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
     59        this.thrd = thrd;
     60        this.alarm = alarm;
     61        this.period = period;
     62        this.next = 0;
     63        this.set = false;
     64        this.kernel_alarm = false;
    6565}
    6666
    67 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
    68         this->proc = proc;
    69         this->alarm = alarm;
    70         this->period = period;
    71         this->next = 0;
    72         this->set = false;
    73         this->kernel_alarm = true;
     67void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
     68        this.proc = proc;
     69        this.alarm = alarm;
     70        this.period = period;
     71        this.next = 0;
     72        this.set = false;
     73        this.kernel_alarm = true;
    7474}
    7575
    76 void ^?{}( alarm_node_t * this ) {
    77         if( this->set ) {
    78                 unregister_self( this );
     76void ^?{}( alarm_node_t & this ) {
     77        if( this.set ) {
     78                unregister_self( &this );
    7979        }
    8080}
  • src/libcfa/concurrency/alarm.h

    r795d450 r242a902  
    5656typedef alarm_node_t ** __alarm_it_t;
    5757
    58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
    59 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
    60 void ^?{}( alarm_node_t * this );
     58void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
     59void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
     60void ^?{}( alarm_node_t & this );
    6161
    6262struct alarm_list_t {
     
    6565};
    6666
    67 static inline void ?{}( alarm_list_t * this ) {
    68         this->head = 0;
    69         this->tail = &this->head;
     67static inline void ?{}( alarm_list_t & this ) {
     68        this.head = 0;
     69        this.tail = &this.head;
    7070}
    7171
  • src/libcfa/concurrency/coroutine

    r795d450 r242a902  
    3434//-----------------------------------------------------------------------------
    3535// Ctors and dtors
    36 void ?{}(coStack_t * this);
    37 void ?{}(coroutine_desc * this);
    38 void ?{}(coroutine_desc * this, const char * name);
    39 void ^?{}(coStack_t * this);
    40 void ^?{}(coroutine_desc * this);
     36void ?{}(coStack_t & this);
     37void ?{}(coroutine_desc & this);
     38void ?{}(coroutine_desc & this, const char * name);
     39void ^?{}(coStack_t & this);
     40void ^?{}(coroutine_desc & this);
    4141
    4242//-----------------------------------------------------------------------------
  • src/libcfa/concurrency/coroutine.c

    r795d450 r242a902  
    4343//-----------------------------------------------------------------------------
    4444// Coroutine ctors and dtors
    45 void ?{}(coStack_t* this) {
    46         this->size              = 65000;        // size of stack
    47         this->storage   = NULL; // pointer to stack
    48         this->limit             = NULL; // stack grows towards stack limit
    49         this->base              = NULL; // base of stack
    50         this->context   = NULL; // address of cfa_context_t
    51         this->top               = NULL; // address of top of storage
    52         this->userStack = false;
     45void ?{}(coStack_t& this) {
     46        this.size               = 65000;        // size of stack
     47        this.storage    = NULL; // pointer to stack
     48        this.limit              = NULL; // stack grows towards stack limit
     49        this.base               = NULL; // base of stack
     50        this.context    = NULL; // address of cfa_context_t
     51        this.top                = NULL; // address of top of storage
     52        this.userStack  = false;
    5353}
    5454
    55 void ?{}(coStack_t* this, size_t size) {
     55void ?{}(coStack_t& this, size_t size) {
    5656        this{};
    57         this->size = size;
     57        this.size = size;
    5858
    59         create_stack(this, this->size);
     59        create_stack(&this, this.size);
    6060}
    6161
    62 void ?{}(coroutine_desc* this) {
     62void ?{}(coroutine_desc& this) {
    6363        this{ "Anonymous Coroutine" };
    6464}
    6565
    66 void ?{}(coroutine_desc* this, const char * name) {
    67         this->name = name;
    68         this->errno_ = 0;
    69         this->state = Start;
    70         this->starter = NULL;
    71         this->last = NULL;
     66void ?{}(coroutine_desc& this, const char * name) {
     67        this.name = name;
     68        this.errno_ = 0;
     69        this.state = Start;
     70        this.starter = NULL;
     71        this.last = NULL;
    7272}
    7373
    74 void ?{}(coroutine_desc* this, size_t size) {
     74void ?{}(coroutine_desc& this, size_t size) {
    7575        this{};
    76         (&this->stack){size};
     76        (this.stack){size};
    7777}
    7878
    79 void ^?{}(coStack_t* this) {
     79void ^?{}(coStack_t& this) {
    8080        if ( ! this->userStack ) {
    8181                LIB_DEBUG_DO(
    82                         if ( mprotect( this->storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
    83                                 abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", this, errno, strerror( errno ) );
     82                        if ( mprotect( this.storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
     83                                abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
    8484                        }
    8585                );
    86                 free( this->storage );
     86                free( this.storage );
    8787        }
    8888}
    8989
    90 void ^?{}(coroutine_desc* this) {}
     90void ^?{}(coroutine_desc& this) {}
    9191
    9292// Part of the Public API
  • src/libcfa/concurrency/invoke.h

    r795d450 r242a902  
    4848      #ifdef __CFORALL__
    4949      extern "Cforall" {
    50             void ?{}( struct __thread_queue_t * );
     50            void ?{}( struct __thread_queue_t & );
    5151            void append( struct __thread_queue_t *, struct thread_desc * );
    5252            struct thread_desc * pop_head( struct __thread_queue_t * );
    5353
    54             void ?{}( struct __condition_stack_t * );
     54            void ?{}( struct __condition_stack_t & );
    5555            void push( struct __condition_stack_t *, struct __condition_criterion_t * );
    5656            struct __condition_criterion_t * pop( struct __condition_stack_t * );
    5757
    58             void ?{}(spinlock * this);
    59             void ^?{}(spinlock * this);
     58            void ?{}(spinlock & this);
     59            void ^?{}(spinlock & this);
    6060      }
    6161      #endif
  • src/libcfa/concurrency/kernel

    r795d450 r242a902  
    3939};
    4040
    41 void  ?{}(semaphore * this, int count = 1);
    42 void ^?{}(semaphore * this);
     41void  ?{}(semaphore & this, int count = 1);
     42void ^?{}(semaphore & this);
    4343void P(semaphore * this);
    4444void V(semaphore * this);
     
    5252};
    5353
    54 void ?{}(cluster * this);
    55 void ^?{}(cluster * this);
     54void ?{}(cluster & this);
     55void ^?{}(cluster & this);
    5656
    5757//-----------------------------------------------------------------------------
     
    6969        unsigned short thrd_count;
    7070};
    71 static inline void ?{}(FinishAction * this) {
    72         this->action_code = No_Action;
    73         this->thrd = NULL;
    74         this->lock = NULL;
     71static inline void ?{}(FinishAction & this) {
     72        this.action_code = No_Action;
     73        this.thrd = NULL;
     74        this.lock = NULL;
    7575}
    76 static inline void ^?{}(FinishAction * this) {}
     76static inline void ^?{}(FinishAction & this) {}
    7777
    7878struct processor {
     
    9494};
    9595
    96 void ?{}(processor * this);
    97 void ?{}(processor * this, cluster * cltr);
    98 void ^?{}(processor * this);
     96void ?{}(processor & this);
     97void ?{}(processor & this, cluster * cltr);
     98void ^?{}(processor & this);
    9999
    100100#endif //KERNEL_H
  • src/libcfa/concurrency/kernel.c

    r795d450 r242a902  
    7575};
    7676
    77 void ?{}( current_stack_info_t * this ) {
    78         CtxGet( this->ctx );
    79         this->base = this->ctx.FP;
    80         this->storage = this->ctx.SP;
     77void ?{}( current_stack_info_t & this ) {
     78        CtxGet( this.ctx );
     79        this.base = this.ctx.FP;
     80        this.storage = this.ctx.SP;
    8181
    8282        rlimit r;
    8383        getrlimit( RLIMIT_STACK, &r);
    84         this->size = r.rlim_cur;
    85 
    86         this->limit = (void *)(((intptr_t)this->base) - this->size);
    87         this->context = &mainThreadCtxStorage;
    88         this->top = this->base;
    89 }
    90 
    91 void ?{}( coStack_t * this, current_stack_info_t * info) {
    92         this->size = info->size;
    93         this->storage = info->storage;
    94         this->limit = info->limit;
    95         this->base = info->base;
    96         this->context = info->context;
    97         this->top = info->top;
    98         this->userStack = true;
    99 }
    100 
    101 void ?{}( coroutine_desc * this, current_stack_info_t * info) {
    102         (&this->stack){ info };
    103         this->name = "Main Thread";
    104         this->errno_ = 0;
    105         this->state = Start;
    106 }
    107 
    108 void ?{}( thread_desc * this, current_stack_info_t * info) {
    109         (&this->cor){ info };
     84        this.size = r.rlim_cur;
     85
     86        this.limit = (void *)(((intptr_t)this.base) - this.size);
     87        this.context = &mainThreadCtxStorage;
     88        this.top = this.base;
     89}
     90
     91void ?{}( coStack_t & this, current_stack_info_t * info) {
     92        this.size = info->size;
     93        this.storage = info->storage;
     94        this.limit = info->limit;
     95        this.base = info->base;
     96        this.context = info->context;
     97        this.top = info->top;
     98        this.userStack = true;
     99}
     100
     101void ?{}( coroutine_desc & this, current_stack_info_t * info) {
     102        (this.stack){ info };
     103        this.name = "Main Thread";
     104        this.errno_ = 0;
     105        this.state = Start;
     106}
     107
     108void ?{}( thread_desc & this, current_stack_info_t * info) {
     109        (this.cor){ info };
    110110}
    111111
    112112//-----------------------------------------------------------------------------
    113113// Processor coroutine
    114 void ?{}(processorCtx_t * this, processor * proc) {
    115         (&this->__cor){ "Processor" };
    116         this->proc = proc;
    117         proc->runner = this;
    118 }
    119 
    120 void ?{}(processorCtx_t * this, processor * proc, current_stack_info_t * info) {
    121         (&this->__cor){ info };
    122         this->proc = proc;
    123         proc->runner = this;
    124 }
    125 
    126 void ?{}(processor * this) {
     114void ?{}(processorCtx_t & this, processor * proc) {
     115        (this.__cor){ "Processor" };
     116        this.proc = proc;
     117        proc->runner = &this;
     118}
     119
     120void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {
     121        (this.__cor){ info };
     122        this.proc = proc;
     123        proc->runner = &this;
     124}
     125
     126void ?{}(processor & this) {
    127127        this{ systemCluster };
    128128}
    129129
    130 void ?{}(processor * this, cluster * cltr) {
    131         this->cltr = cltr;
    132         (&this->terminated){ 0 };
    133         this->is_terminated = false;
    134         this->preemption_alarm = NULL;
    135         this->preemption = default_preemption();
    136         this->pending_preemption = false;
    137 
    138         start( this );
    139 }
    140 
    141 void ?{}(processor * this, cluster * cltr, processorCtx_t * runner) {
    142         this->cltr = cltr;
    143         (&this->terminated){ 0 };
    144         this->is_terminated = false;
    145         this->preemption_alarm = NULL;
    146         this->preemption = default_preemption();
    147         this->pending_preemption = false;
    148         this->kernel_thread = pthread_self();
    149 
    150         this->runner = runner;
     130void ?{}(processor & this, cluster * cltr) {
     131        this.cltr = cltr;
     132        (this.terminated){ 0 };
     133        this.is_terminated = false;
     134        this.preemption_alarm = NULL;
     135        this.preemption = default_preemption();
     136        this.pending_preemption = false;
     137
     138        start( &this );
     139}
     140
     141void ?{}(processor & this, cluster * cltr, processorCtx_t * runner) {
     142        this.cltr = cltr;
     143        (this.terminated){ 0 };
     144        this.is_terminated = false;
     145        this.preemption_alarm = NULL;
     146        this.preemption = default_preemption();
     147        this.pending_preemption = false;
     148        this.kernel_thread = pthread_self();
     149
     150        this.runner = runner;
    151151        LIB_DEBUG_PRINT_SAFE("Kernel : constructing system processor context %p\n", runner);
    152         runner{ this };
     152        (*runner){ &this };
    153153}
    154154
    155155LIB_DEBUG_DO( bool validate( alarm_list_t * this ); )
    156156
    157 void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) {
    158         (&this->alarms){};
    159         (&this->alarm_lock){};
    160         this->pending_alarm = false;
    161 
    162         (&this->proc){ cltr, runner };
    163 
    164         verify( validate( &this->alarms ) );
    165 }
    166 
    167 void ^?{}(processor * this) {
    168         if( ! this->is_terminated ) {
    169                 LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this);
    170                 this->is_terminated = true;
    171                 P( &this->terminated );
    172                 pthread_join( this->kernel_thread, NULL );
    173         }
    174 }
    175 
    176 void ?{}(cluster * this) {
    177         ( &this->ready_queue ){};
    178         ( &this->lock ){};
    179 }
    180 
    181 void ^?{}(cluster * this) {
     157void ?{}(system_proc_t & this, cluster * cltr, processorCtx_t * runner) {
     158        (this.alarms){};
     159        (this.alarm_lock){};
     160        this.pending_alarm = false;
     161
     162        (this.proc){ cltr, runner };
     163
     164        verify( validate( &this.alarms ) );
     165}
     166
     167void ^?{}(processor & this) {
     168        if( ! this.is_terminated ) {
     169                LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", &this);
     170                this.is_terminated = true;
     171                P( this.terminated );
     172                pthread_join( this.kernel_thread, NULL );
     173        }
     174}
     175
     176void ?{}(cluster & this) {
     177        ( this.ready_queue ){};
     178        ( this.lock ){};
     179}
     180
     181void ^?{}(cluster & this) {
    182182
    183183}
     
    582582//-----------------------------------------------------------------------------
    583583// Locks
    584 void ?{}( spinlock * this ) {
    585         this->lock = 0;
    586 }
    587 void ^?{}( spinlock * this ) {
     584void ?{}( spinlock & this ) {
     585        this.lock = 0;
     586}
     587void ^?{}( spinlock & this ) {
    588588
    589589}
     
    619619}
    620620
    621 void  ?{}( semaphore * this, int count = 1 ) {
    622         (&this->lock){};
    623         this->count = count;
    624         (&this->waiting){};
    625 }
    626 void ^?{}(semaphore * this) {}
     621void  ?{}( semaphore & this, int count = 1 ) {
     622        (this.lock){};
     623        this.count = count;
     624        (this.waiting){};
     625}
     626void ^?{}(semaphore & this) {}
    627627
    628628void P(semaphore * this) {
     
    658658//-----------------------------------------------------------------------------
    659659// Queues
    660 void ?{}( __thread_queue_t * this ) {
    661         this->head = NULL;
    662         this->tail = &this->head;
     660void ?{}( __thread_queue_t & this ) {
     661        this.head = NULL;
     662        this.tail = &this.head;
    663663}
    664664
     
    681681}
    682682
    683 void ?{}( __condition_stack_t * this ) {
    684         this->top = NULL;
     683void ?{}( __condition_stack_t & this ) {
     684        this.top = NULL;
    685685}
    686686
  • src/libcfa/concurrency/monitor

    r795d450 r242a902  
    2424#include "stdlib"
    2525
    26 static inline void ?{}(monitor_desc * this) {
    27         this->owner = NULL;
    28         this->recursion = 0;
     26static inline void ?{}(monitor_desc & this) {
     27        this.owner = NULL;
     28        this.recursion = 0;
    2929}
    3030
     
    4040}
    4141
    42 void ?{}( monitor_guard_t * this, monitor_desc ** m, int count );
    43 void ^?{}( monitor_guard_t * this );
     42void ?{}( monitor_guard_t & this, monitor_desc ** m, int count );
     43void ^?{}( monitor_guard_t & this );
    4444
    4545//-----------------------------------------------------------------------------
     
    6666};
    6767
    68 void ?{}( __condition_blocked_queue_t * );
     68void ?{}( __condition_blocked_queue_t & );
    6969void append( __condition_blocked_queue_t *, __condition_node_t * );
    7070__condition_node_t * pop_head( __condition_blocked_queue_t * );
     
    7676};
    7777
    78 static inline void ?{}( condition * this ) {
    79         this->monitors = NULL;
    80         this->monitor_count = 0;
     78static inline void ?{}( condition & this ) {
     79        this.monitors = NULL;
     80        this.monitor_count = 0;
    8181}
    8282
    83 static inline void ^?{}( condition * this ) {
    84         free( this->monitors );
     83static inline void ^?{}( condition & this ) {
     84        free( this.monitors );
    8585}
    8686
  • src/libcfa/concurrency/monitor.c

    r795d450 r242a902  
    140140}
    141141
    142 void ?{}( monitor_guard_t * this, monitor_desc ** m, int count ) {
    143         this->m = m;
    144         this->count = count;
    145         qsort(this->m, count);
    146         enter( this->m, this->count );
    147 
    148         this->prev_mntrs = this_thread->current_monitors;
    149         this->prev_count = this_thread->current_monitor_count;
     142void ?{}( monitor_guard_t & this, monitor_desc ** m, int count ) {
     143        this.m = m;
     144        this.count = count;
     145        qsort(this.m, count);
     146        enter( this.m, this.count );
     147
     148        this.prev_mntrs = this_thread->current_monitors;
     149        this.prev_count = this_thread->current_monitor_count;
    150150
    151151        this_thread->current_monitors      = m;
     
    153153}
    154154
    155 void ^?{}( monitor_guard_t * this ) {
    156         leave( this->m, this->count );
    157 
    158         this_thread->current_monitors      = this->prev_mntrs;
    159         this_thread->current_monitor_count = this->prev_count;
    160 }
    161 
    162 void ?{}(__condition_node_t * this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info ) {
    163         this->waiting_thread = waiting_thread;
    164         this->count = count;
    165         this->next = NULL;
    166         this->user_info = user_info;
    167 }
    168 
    169 void ?{}(__condition_criterion_t * this ) {
    170         this->ready  = false;
    171         this->target = NULL;
    172         this->owner  = NULL;
    173         this->next   = NULL;
    174 }
    175 
    176 void ?{}(__condition_criterion_t * this, monitor_desc * target, __condition_node_t * owner ) {
    177         this->ready  = false;
    178         this->target = target;
    179         this->owner  = owner;
    180         this->next   = NULL;
     155void ^?{}( monitor_guard_t & this ) {
     156        leave( this.m, this.count );
     157
     158        this_thread->current_monitors      = this.prev_mntrs;
     159        this_thread->current_monitor_count = this.prev_count;
     160}
     161
     162void ?{}(__condition_node_t & this, thread_desc * waiting_thread, unsigned short count, uintptr_t user_info ) {
     163        this.waiting_thread = waiting_thread;
     164        this.count = count;
     165        this.next = NULL;
     166        this.user_info = user_info;
     167}
     168
     169void ?{}(__condition_criterion_t & this ) {
     170        this.ready  = false;
     171        this.target = NULL;
     172        this.owner  = NULL;
     173        this.next   = NULL;
     174}
     175
     176void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner ) {
     177        this.ready  = false;
     178        this.target = target;
     179        this.owner  = owner;
     180        this.next   = NULL;
    181181}
    182182
     
    506506}
    507507
    508 void ?{}( __condition_blocked_queue_t * this ) {
    509         this->head = NULL;
    510         this->tail = &this->head;
     508void ?{}( __condition_blocked_queue_t & this ) {
     509        this.head = NULL;
     510        this.tail = &this.head;
    511511}
    512512
  • src/libcfa/concurrency/preemption.c

    r795d450 r242a902  
    230230}
    231231
    232 void ?{}( preemption_scope * this, processor * proc ) {
    233         (&this->alarm){ proc };
    234         this->proc = proc;
    235         this->proc->preemption_alarm = &this->alarm;
    236         update_preemption( this->proc, this->proc->preemption );
    237 }
    238 
    239 void ^?{}( preemption_scope * this ) {
     232void ?{}( preemption_scope & this, processor * proc ) {
     233        (this.alarm){ proc };
     234        this.proc = proc;
     235        this.proc->preemption_alarm = &this.alarm;
     236        update_preemption( this.proc, this.proc->preemption );
     237}
     238
     239void ^?{}( preemption_scope & this ) {
    240240        disable_interrupts();
    241241
    242         update_preemption( this->proc, 0 );
     242        update_preemption( this.proc, 0 );
    243243}
    244244
  • src/libcfa/concurrency/preemption.h

    r795d450 r242a902  
    3232};
    3333
    34 void ?{}( preemption_scope * this, processor * proc );
    35 void ^?{}( preemption_scope * this );
     34void ?{}( preemption_scope & this, processor * proc );
     35void ^?{}( preemption_scope & this );
    3636
    3737#endif //PREEMPTION_H
  • src/libcfa/concurrency/thread

    r795d450 r242a902  
    2929// Anything that is resumed is a coroutine.
    3030trait is_thread(dtype T) {
    31       void ^?{}(T* mutex this);
     31      void ^?{}(T& mutex this);
    3232      void main(T* this);
    3333      thread_desc* get_thread(T* this);
     
    6161//-----------------------------------------------------------------------------
    6262// Ctors and dtors
    63 void ?{}(thread_desc* this);
    64 void ^?{}(thread_desc* this);
     63void ?{}(thread_desc& this);
     64void ^?{}(thread_desc& this);
    6565
    6666//-----------------------------------------------------------------------------
     
    7272};
    7373
    74 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
    75 void ?{}( scoped(T)* this );
     74forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
     75void ?{}( scoped(T)& this );
    7676
    77 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
    78 void ?{}( scoped(T)* this, P params );
     77forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
     78void ?{}( scoped(T)& this, P params );
    7979
    8080forall( dtype T | sized(T) | is_thread(T) )
    81 void ^?{}( scoped(T)* this );
     81void ^?{}( scoped(T)& this );
    8282
    8383void yield();
  • src/libcfa/concurrency/thread.c

    r795d450 r242a902  
    3333// Thread ctors and dtors
    3434
    35 void ?{}(thread_desc* this) {
    36         (&this->cor){};
    37         this->cor.name = "Anonymous Coroutine";
    38         this->mon.owner = this;
    39         this->mon.recursion = 1;
    40         this->next = NULL;
     35void ?{}(thread_desc& this) {
     36        (this.cor){};
     37        this.cor.name = "Anonymous Coroutine";
     38        this.mon.owner = this;
     39        this.mon.recursion = 1;
     40        this.next = NULL;
    4141
    42         this->current_monitors      = &this->mon;
    43         this->current_monitor_count = 1;
     42        this.current_monitors      = &this.mon;
     43        this.current_monitor_count = 1;
    4444}
    4545
    46 void ^?{}(thread_desc* this) {
    47         ^(&this->cor){};
     46void ^?{}(thread_desc& this) {
     47        ^(this.cor){};
    4848}
    4949
    50 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
    51 void ?{}( scoped(T)* this ) {
    52         (&this->handle){};
    53         __thrd_start(&this->handle);
     50forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
     51void ?{}( scoped(T)& this ) {
     52        (this.handle){};
     53        __thrd_start(&this.handle);
    5454}
    5555
    56 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
    57 void ?{}( scoped(T)* this, P params ) {
    58         (&this->handle){ params };
    59         __thrd_start(&this->handle);
     56forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
     57void ?{}( scoped(T)& this, P params ) {
     58        (this.handle){ params };
     59        __thrd_start(&this.handle);
    6060}
    6161
    6262forall( dtype T | sized(T) | is_thread(T) )
    63 void ^?{}( scoped(T)* this ) {
    64         ^(&this->handle){};
     63void ^?{}( scoped(T)& this ) {
     64        ^(this.handle){};
    6565}
    6666
  • src/libcfa/containers/result

    r795d450 r242a902  
    3535
    3636forall(otype T, otype E)
    37 void ?{}(result(T, E) * this);
     37void ?{}(result(T, E) & this);
    3838
    3939forall(otype T, otype E)
    40 void ?{}(result(T, E) * this, one_t, T value);
     40void ?{}(result(T, E) & this, one_t, T value);
    4141
    4242forall(otype T, otype E)
    43 void ?{}(result(T, E) * this, zero_t, E error);
     43void ?{}(result(T, E) & this, zero_t, E error);
    4444
    4545forall(otype T, otype E)
    46 void ?{}(result(T, E) * this, result(T, E) other);
     46void ?{}(result(T, E) & this, result(T, E) other);
    4747
    4848forall(otype T, otype E)
    49 void ^?{}(result(T, E) * this);
     49void ^?{}(result(T, E) & this);
    5050
    5151forall(otype T, otype E)
    52 result(T, E) ?=?(result(T, E) * this, result(T, E) other);
     52result(T, E) ?=?(result(T, E) & this, result(T, E) other);
    5353
    5454forall(otype T, otype E)
  • src/libcfa/containers/result.c

    r795d450 r242a902  
    1919
    2020forall(otype T, otype E)
    21 void ?{}(result(T, E) * this) {
    22         this->has_value = false;
    23         (&this->error){};
     21void ?{}(result(T, E) & this) {
     22        this.has_value = false;
     23        (this.error){};
    2424}
    2525
    2626forall(otype T, otype E)
    27 void ?{}(result(T, E) * this, one_t, T value) {
    28         this->has_value = true;
    29         (&this->value){value};
     27void ?{}(result(T, E) & this, one_t, T value) {
     28        this.has_value = true;
     29        (this.value){value};
    3030}
    3131
    3232forall(otype T, otype E)
    33 void ?{}(result(T, E) * this, zero_t, E error) {
    34         this->has_value = false;
    35         (&this->error){error};
     33void ?{}(result(T, E) & this, zero_t, E error) {
     34        this.has_value = false;
     35        (this.error){error};
    3636}
    3737
    3838forall(otype T, otype E)
    39 void ?{}(result(T, E) * this, result(T, E) other) {
    40         this->has_value = other.has_value;
     39void ?{}(result(T, E) & this, result(T, E) other) {
     40        this.has_value = other.has_value;
    4141        if (other.has_value) {
    42                 (&this->value){other.value};
     42                (this.value){other.value};
    4343        } else {
    44                 (&this->error){other.error};
     44                (this.error){other.error};
    4545        }
    4646}
    4747
    4848forall(otype T, otype E)
    49 result(T, E) ?=?(result(T, E) * this, result(T, E) that) {
    50         if (this->has_value & that.has_value) {
    51                 this->value = that.value;
    52         } else if (this->has_value) {
    53                 ^(&this->value){};
    54                 this->has_value = false;
    55                 (&this->error){that.error};
     49result(T, E) ?=?(result(T, E) & this, result(T, E) that) {
     50        if (this.has_value & that.has_value) {
     51                this.value = that.value;
     52        } else if (this.has_value) {
     53                ^(this.value){};
     54                this.has_value = false;
     55                (this.error){that.error};
    5656        } else if (that.has_value) {
    57                 ^(&this->error){};
    58                 this->has_value = true;
    59                 (&this->value){that.value};
     57                ^(this.error){};
     58                this.has_value = true;
     59                (this.value){that.value};
    6060        } else {
    61                 this->error = that.error;
     61                this.error = that.error;
    6262        }
    6363}
    6464
    6565forall(otype T, otype E)
    66 void ^?{}(result(T, E) * this) {
    67         if (this->has_value) {
    68                 ^(&this->value){};
     66void ^?{}(result(T, E) & this) {
     67        if (this.has_value) {
     68                ^(this.value){};
    6969        } else {
    70                 ^(&this->error){};
     70                ^(this.error){};
    7171        }
    7272}
     
    109109                this->value = value;
    110110        } else {
    111                 ^(&this->error){};
     111                ^(this->error){};
    112112                this->has_value = true;
    113                 (&this->value){value};
     113                (this->value){value};
    114114        }
    115115}
     
    118118void set_error(result(T, E) * this, E error) {
    119119        if (this->has_value) {
    120                 ^(&this->value){};
     120                ^(this->value){};
    121121                this->has_value = false;
    122                 (&this->error){error};
     122                (this->error){error};
    123123        } else {
    124124                this->error = error;
  • src/tests/coroutine.c

    r795d450 r242a902  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // fibonacci.c -- 
    8 // 
     6//
     7// fibonacci.c --
     8//
    99// Author           : Thierry Delisle
    1010// Created On       : Thu Jun  8 07:29:37 2017
     
    1212// Last Modified On : Thu Jun  8 07:37:12 2017
    1313// Update Count     : 5
    14 // 
     14//
    1515
    1616#include <fstream>
     
    2121};
    2222
    23 void ?{}( Fibonacci * this ) {
    24         this->fn = 0;
     23void ?{}( Fibonacci & this ) {
     24        this.fn = 0;
    2525}
    2626
  • src/tests/monitor.c

    r795d450 r242a902  
    88};
    99
    10 void ?{}(global_t * this) {
    11         this->value = 0;
     10void ?{}(global_t & this) {
     11        this.value = 0;
    1212}
    1313
  • src/tests/thread.c

    r795d450 r242a902  
    77thread Second { semaphore* lock; };
    88
    9 void ?{}( First * this, semaphore* lock ) { this->lock = lock; }
    10 void ?{}( Second * this, semaphore* lock ) { this->lock = lock; }
     9void ?{}( First & this, semaphore* lock ) { this.lock = lock; }
     10void ?{}( Second & this, semaphore* lock ) { this.lock = lock; }
    1111
    1212void main(First* this) {
Note: See TracChangeset for help on using the changeset viewer.