Changeset f1f8e55


Ignore:
Timestamp:
Mar 8, 2018, 11:21:52 AM (6 years ago)
Author:
Aaron Moss <a3moss@…>
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:
fb2ce27
Parents:
6dba9f99
Message:

Cleanups to CFA benchmark

Location:
doc/papers/general/evaluation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/evaluation/cfa-bench.c

    r6dba9f99 rf1f8e55  
    88
    99        REPEAT_TIMED( "push_int", N, push( si, val ); )
    10         TIMED( "copy_int", ti = si; )
     10        TIMED( "copy_int", ti{ si }; )
    1111        TIMED( "clear_int", clear( si ); )
    1212        REPEAT_TIMED( "pop_int", N,
    1313                int x = pop( ti ); if ( x > max ) max = x; )
    1414
    15         pair( _Bool, char ) max = { (_Bool)0 /***/, '\0' }, val = { (_Bool)1 /***/, 'a' };
    16         stack( pair( _Bool, char ) ) sp, tp;
     15        pair( short, char ) max = { 0h, '\0' }, val = { 42h, 'a' };
     16        stack( pair( short, char ) ) sp, tp;
    1717
    1818        REPEAT_TIMED( "push_pair", N, push( sp, val ); )
    19         TIMED( "copy_pair", tp = sp; )
     19        TIMED( "copy_pair", tp{ sp }; )
    2020        TIMED( "clear_pair", clear( sp ); )
    2121        REPEAT_TIMED( "pop_pair", N,
    22                 pair(_Bool, char) x = pop( tp ); if ( x > max ) max = x; )
     22                pair(short, char) x = pop( tp ); if ( x > max ) max = x; )
    2323}
  • doc/papers/general/evaluation/cfa-stack.c

    r6dba9f99 rf1f8e55  
    1212        stack_node(T) ** crnt = &s.head;
    1313        for ( stack_node(T) * next = t.head; next; next = next->next ) {
    14                 stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/
    15                 (*new_node){ next->value };
    16                 *crnt = new_node;
     14                *crnt = malloc();
     15                ((*crnt)->value){ next->value };
    1716                crnt = &(*crnt)->next;
    1817        }
     
    3130forall(otype T) _Bool empty( const stack(T) & s ) { return s.head == 0; }
    3231
    33 forall(otype T) void push( stack(T) & s, T value ) {
    34         stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/
    35         (*new_node){ value, s.head };
    36         s.head = new_node;
     32forall(otype T) void push( stack(T) & s, T value ) with( s ) {
     33        stack_node(T)* new_node = malloc();
     34        (*new_node){ value, head };
     35        head = new_node;
    3736}
    3837
    39 forall(otype T) T pop( stack(T) & s ) {
    40         stack_node(T) * n = s.head;
    41         s.head = n->next;
     38forall(otype T) T pop( stack(T) & s ) with( s ) {
     39        stack_node(T) * n = head;
     40        head = n->next;
    4241        T v = n->value;
    4342        ^(*n){};
     
    4645}
    4746
    48 forall(otype T) void clear( stack(T) & s ) {
    49         for ( stack_node(T) * next = s.head; next; ) {
     47forall(otype T) void clear( stack(T) & s ) with( s ) {
     48        for ( stack_node(T) * next = head; next; ) {
    5049                stack_node(T) * crnt = next;
    5150                next = crnt->next;
Note: See TracChangeset for help on using the changeset viewer.