Ignore:
Timestamp:
Sep 16, 2016, 11:14:12 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:
bd34fc87
Parents:
fc4a0fa
Message:

now using proper ctor semantics for more objects in gc

Location:
src/examples/gc_no_raii/src/internal
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/examples/gc_no_raii/src/internal/card_table.h

    rfc4a0fa r24bc651  
    1818};
    1919
    20 static inline void ctor_card(card_table_t* const this)
     20static inline void ?{}(card_table_t* this)
    2121{
    2222        this->count = 0;
    2323}
    2424
    25 static inline void dtor_card(card_table_t* const this)
     25static inline void ^?{}(card_table_t* this)
    2626{
    2727
  • src/examples/gc_no_raii/src/internal/memory_pool.c

    rfc4a0fa r24bc651  
    1111const size_t gc_pool_header_size = (size_t)(  &(((gc_memory_pool*)NULL)->start_p) );
    1212
    13 void ctor(gc_memory_pool *const this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
     13void ?{}(gc_memory_pool* this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
    1414{
    1515        this->mirror = mirror;
     
    1717        this->type_code = type;
    1818
    19         card_table_t* new = (card_table_t*)malloc(sizeof(card_table_t));
    20         this->cards = new;
    21         ctor_card(this->cards);
     19        this->cards = ( (card_table_t*)malloc(sizeof(card_table_t)) ){};
    2220
    2321        this->end_p = ((uint8_t*)this) + size;
     
    2927}
    3028
    31 void dtor(gc_memory_pool *const this)
     29void ^?{}(gc_memory_pool* this)
    3230{
    33         dtor_card(this->cards);
     31        ^(&this->cards){};
    3432        free(this->cards);
    3533}
  • src/examples/gc_no_raii/src/internal/memory_pool.h

    rfc4a0fa r24bc651  
    2727};
    2828
    29 void ctor(      gc_memory_pool *const this,
     29void ?{}(       gc_memory_pool* this,
    3030                size_t size,
    3131                gc_memory_pool* next,
     
    3434        );
    3535
    36 void dtor(gc_memory_pool *const this);
     36void ^?{}(gc_memory_pool* this);
    3737
    3838struct gc_pool_object_iterator
  • src/examples/gc_no_raii/src/internal/state.c

    rfc4a0fa r24bc651  
    131131
    132132      this->from_space = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
    133       this->to_space = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
    134 
    135       ctor(this->from_space, POOL_SIZE_BYTES, old_from_space, this->to_space,   this->from_code);
    136       ctor(this->to_space,   POOL_SIZE_BYTES, old_to_space,   this->from_space, (~this->from_code) & 0x01);
     133      this->to_space   = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
     134
     135      this->from_space{ POOL_SIZE_BYTES, old_from_space, this->to_space,   this->from_code };
     136      this->to_space  { POOL_SIZE_BYTES, old_to_space,   this->from_space, (~this->from_code) & 0x01 };
    137137
    138138        this->total_space += gc_pool_size_used(this->from_space);
Note: See TracChangeset for help on using the changeset viewer.