Ignore:
Timestamp:
Aug 25, 2017, 10:38:34 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
800d275
Parents:
af08051 (diff), 3eab308c (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:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    raf08051 r28e58fd  
    4040//-----------------------------------------------------------------------------
    4141// Coroutine ctors and dtors
    42 void ?{}(coStack_t* this) {
    43         this->size              = 65000;        // size of stack
    44         this->storage   = NULL; // pointer to stack
    45         this->limit             = NULL; // stack grows towards stack limit
    46         this->base              = NULL; // base of stack
    47         this->context   = NULL; // address of cfa_context_t
    48         this->top               = NULL; // address of top of storage
    49         this->userStack = false;
     42void ?{}(coStack_t& this) {
     43        this.size               = 65000;        // size of stack
     44        this.storage    = NULL; // pointer to stack
     45        this.limit              = NULL; // stack grows towards stack limit
     46        this.base               = NULL; // base of stack
     47        this.context    = NULL; // address of cfa_context_t
     48        this.top                = NULL; // address of top of storage
     49        this.userStack  = false;
    5050}
    5151
    52 void ?{}(coStack_t* this, size_t size) {
     52void ?{}(coStack_t& this, size_t size) {
    5353        this{};
    54         this->size = size;
     54        this.size = size;
    5555
    56         create_stack(this, this->size);
     56        create_stack(&this, this.size);
    5757}
    5858
    59 void ?{}(coroutine_desc* this) {
     59void ?{}(coroutine_desc& this) {
    6060        this{ "Anonymous Coroutine" };
    6161}
    6262
    63 void ?{}(coroutine_desc* this, const char * name) {
    64         this->name = name;
    65         this->errno_ = 0;
    66         this->state = Start;
    67         this->starter = NULL;
    68         this->last = NULL;
     63void ?{}(coroutine_desc& this, const char * name) {
     64        this.name = name;
     65        this.errno_ = 0;
     66        this.state = Start;
     67        this.starter = NULL;
     68        this.last = NULL;
    6969}
    7070
    71 void ?{}(coroutine_desc* this, size_t size) {
     71void ?{}(coroutine_desc& this, size_t size) {
    7272        this{};
    73         (&this->stack){size};
     73        (this.stack){size};
    7474}
    7575
    76 void ^?{}(coStack_t* this) {
    77         if ( ! this->userStack ) {
     76void ^?{}(coStack_t& this) {
     77        if ( ! this.userStack ) {
    7878                LIB_DEBUG_DO(
    79                         if ( mprotect( this->storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
    80                                 abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", this, errno, strerror( errno ) );
     79                        if ( mprotect( this.storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
     80                                abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
    8181                        }
    8282                );
    83                 free( this->storage );
     83                free( this.storage );
    8484        }
    8585}
    8686
    87 void ^?{}(coroutine_desc* this) {}
     87void ^?{}(coroutine_desc& this) {}
    8888
    8989// Part of the Public API
    9090// Not inline since only ever called once per coroutine
    9191forall(dtype T | is_coroutine(T))
    92 void prime(T* cor) {
     92void prime(T& cor) {
    9393        coroutine_desc* this = get_coroutine(cor);
    9494        assert(this->state == Start);
Note: See TracChangeset for help on using the changeset viewer.