Ignore:
Timestamp:
Aug 10, 2016, 2:29:44 PM (9 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
be0a9d8, ef42e764
Parents:
f18a711 (diff), a563f01 (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

Location:
src/examples/gc_no_raii
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/examples/gc_no_raii/src/gc.h

    rf18a711 r3078643  
    77static inline gcpointer(T) gcmalloc()
    88{
    9     gcpointer(T) ptr;
    10     void* address = gc_allocate(sizeof(T));
    11     (&ptr){ address };
    12     ctor(&ptr, address);
     9    gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
     10    ptr{};
    1311    gc_conditional_collect();
    1412    return ptr;
    1513}
     14
     15forall(otype T)
     16static inline void gcmalloc(gcpointer(T)* ptr)
     17{
     18        ptr{ gc_allocate(sizeof(T)) };
     19      (*ptr){};
     20      gc_conditional_collect();
     21}
  • src/examples/gc_no_raii/test/gctest.c

    rf18a711 r3078643  
    88        sout | "Bonjour au monde!\n";
    99
    10         gcpointer(int) anInt = gcmalloc();
     10        for(int i = 0; i < 1000000; i++) {
     11                gcpointer(int) anInt;
     12                gcmalloc(&anInt);
     13        }
    1114}
Note: See TracChangeset for help on using the changeset viewer.