Changeset 986dd36 for doc/papers
- Timestamp:
- Mar 2, 2018, 5:34:51 PM (7 years ago)
- 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:
- dd05e12
- Parents:
- 244b934
- git-author:
- Rob Schluntz <rschlunt@…> (03/02/18 09:47:18)
- git-committer:
- Rob Schluntz <rschlunt@…> (03/02/18 17:34:51)
- Location:
- doc/papers/general/evaluation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/cfa-bench.c
r244b934 r986dd36 10 10 stack(int) si, ti; 11 11 12 REPEAT_TIMED( "push_int", N, push( &si, vali ); )12 REPEAT_TIMED( "push_int", N, push( si, vali ); ) 13 13 TIMED( "copy_int", ti = si; ) 14 TIMED( "clear_int", clear( &si ); )15 REPEAT_TIMED( "pop_int", N, 16 int xi = pop( &ti );14 TIMED( "clear_int", clear( si ); ) 15 REPEAT_TIMED( "pop_int", N, 16 int xi = pop( ti ); 17 17 if ( xi > maxi ) { maxi = xi; } ) 18 18 REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); ) … … 21 21 stack(pair(_Bool, char)) sp, tp; 22 22 23 REPEAT_TIMED( "push_pair", N, push( &sp, valp ); )23 REPEAT_TIMED( "push_pair", N, push( sp, valp ); ) 24 24 TIMED( "copy_pair", tp = sp; ) 25 TIMED( "clear_pair", clear( &sp ); )26 REPEAT_TIMED( "pop_pair", N, 27 pair(_Bool, char) xp = pop( &tp );25 TIMED( "clear_pair", clear( sp ); ) 26 REPEAT_TIMED( "pop_pair", N, 27 pair(_Bool, char) xp = pop( tp ); 28 28 if ( xp > maxp ) { maxp = xp; } ) 29 29 REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); ) -
doc/papers/general/evaluation/cfa-stack.c
r244b934 r986dd36 7 7 }; 8 8 9 forall(otype T) void ?{}(stack(T) * s) { (&s->head){ 0 }; }9 forall(otype T) void ?{}(stack(T)& s) { (s.head){ 0 }; } 10 10 11 forall(otype T) void ?{}(stack(T) *s, stack(T) t) {12 stack_node(T)** crnt = &s ->head;11 forall(otype T) void ?{}(stack(T)& s, stack(T) t) { 12 stack_node(T)** crnt = &s.head; 13 13 for ( stack_node(T)* next = t.head; next; next = next->next ) { 14 *crnt = ((stack_node(T)*)malloc()){ next->value }; /***/ 14 // *crnt = &(*(stack_node(T)*)malloc()){ next->value }; /***/ 15 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 16 (*new_node){ next->value }; /***/ 17 *crnt = new_node; 18 15 19 stack_node(T)* acrnt = *crnt; 16 20 crnt = &acrnt->next; … … 19 23 } 20 24 21 forall(otype T) stack(T) ?=?(stack(T) *s, stack(T) t) {22 if ( s ->head == t.head ) return *s;25 forall(otype T) stack(T) ?=?(stack(T)& s, stack(T) t) { 26 if ( s.head == t.head ) return s; 23 27 clear(s); 24 28 s{ t }; 25 return *s;29 return s; 26 30 } 27 31 28 forall(otype T) void ^?{}(stack(T) *s) { clear(s); }32 forall(otype T) void ^?{}(stack(T)& s) { clear(s); } 29 33 30 forall(otype T) _Bool empty(const stack(T) * s) { return s->head == 0; }34 forall(otype T) _Bool empty(const stack(T)& s) { return s.head == 0; } 31 35 32 forall(otype T) void push(stack(T)* s, T value) { 33 s->head = ((stack_node(T)*)malloc()){ value, s->head }; /***/ 36 forall(otype T) void push(stack(T)& s, T value) { 37 // s.head = &(*(stack_node(T)*)malloc()){ value, s.head }; /***/ 38 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 39 (*new_node){ value, s.head }; /***/ 40 s.head = new_node; 34 41 } 35 42 36 forall(otype T) T pop(stack(T) *s) {37 stack_node(T)* n = s ->head;38 s ->head = n->next;43 forall(otype T) T pop(stack(T)& s) { 44 stack_node(T)* n = s.head; 45 s.head = n->next; 39 46 T x = n->value; 40 47 ^n{}; … … 43 50 } 44 51 45 forall(otype T) void clear(stack(T) *s) {46 for ( stack_node(T)* next = s ->head; next; ) {52 forall(otype T) void clear(stack(T)& s) { 53 for ( stack_node(T)* next = s.head; next; ) { 47 54 stack_node(T)* crnt = next; 48 55 next = crnt->next; 49 56 delete(crnt); 50 57 } 51 s ->head = 0;58 s.head = 0; 52 59 } -
doc/papers/general/evaluation/cfa-stack.h
r244b934 r986dd36 6 6 }; 7 7 8 forall(otype T) void ?{}(stack(T) *s);9 forall(otype T) void ?{}(stack(T) *s, stack(T) t);10 forall(otype T) stack(T) ?=?(stack(T) *s, stack(T) t);11 forall(otype T) void ^?{}(stack(T) *s);8 forall(otype T) void ?{}(stack(T)& s); 9 forall(otype T) void ?{}(stack(T)& s, stack(T) t); 10 forall(otype T) stack(T) ?=?(stack(T)& s, stack(T) t); 11 forall(otype T) void ^?{}(stack(T)& s); 12 12 13 forall(otype T) _Bool empty(const stack(T) *s);14 forall(otype T) void push(stack(T) *s, T value);15 forall(otype T) T pop(stack(T) *s);16 forall(otype T) void clear(stack(T) *s);13 forall(otype T) _Bool empty(const stack(T)& s); 14 forall(otype T) void push(stack(T)& s, T value); 15 forall(otype T) T pop(stack(T)& s); 16 forall(otype T) void clear(stack(T)& s);
Note: See TracChangeset
for help on using the changeset viewer.