Changeset 81e8ab0
- Timestamp:
- Mar 9, 2018, 9:30:47 AM (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:
- 8b001bd
- Parents:
- 29db723
- Location:
- doc
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r29db723 r81e8ab0 5205 5205 year = 1984, 5206 5206 series = {Computers and their Applications}, 5207 address = {Market Cross House, Cooper Street, Chichester, West Sussex, 5208 PO19 1EB, England}, 5207 address = {Market Cross House, Cooper Street, Chichester, West Sussex, PO19 1EB, England}, 5209 5208 summary = { 5210 5209 The principles of Procedural Abstraction, Data Type Completeness, … … 5258 5257 } 5259 5258 5260 @book{PowerPC, 5261 key = {PowerPC processor}, 5262 title = {Programming Environments Manual for 32-Bit Implementations of the PowerPC ArchitectureARM Architecture}, 5263 publisher = {Freescale Semiconductor}, 5264 volume = {MPCFPE32B}, 5265 edition = {Rev. 3}, 5266 month = 9, 5267 year = 2005, 5259 @inproceedings{Rafkind09, 5260 keywords = {accurate, C programming language, conservative, garbage collection, precise}, 5261 contributer = {pabuhr@plg}, 5262 author = {Rafkind, Jon and Wick, Adam and Regehr, John and Flatt, Matthew}, 5263 title = {Precise Garbage Collection for C}, 5264 booktitle = {Proceedings of the 2009 International Symposium on Memory Management}, 5265 series = {ISMM '09}, 5266 year = {2009}, 5267 location = {Dublin, Ireland}, 5268 pages = {39-48}, 5269 publisher = {ACM}, 5270 address = {New York, NY, USA}, 5268 5271 } 5269 5272 … … 5338 5341 5339 5342 @article{psa:persistence, 5340 keywords = {persistence, first-class procedures, closure, PS-Algol, 5341 Abstract Data Types}, 5343 keywords = {persistence, first-class procedures, closure, PS-Algol, Abstract Data Types}, 5342 5344 contributer = {gjditchfield@plg}, 5343 5345 author = {Malcolm P. Atkinson and Ronald Morrison}, … … 5370 5372 5371 5373 @article{Procol89, 5372 keywords = {active objects, object-oriented languages, 5373 object-based languages, explicit per-object protocol}, 5374 keywords = {active objects, object-oriented languages, object-based languages, explicit per-object protocol}, 5374 5375 contributer = {akgoel@plg}, 5375 5376 author = {Jan van den Bos and Chris Laffra}, … … 5383 5384 note = {Proceedings of the OOPSLA'89 Conference, Oct. 1--6, 1989, New Orleans, Lousiana}, 5384 5385 abstract = {}, 5386 } 5387 5388 @book{PowerPC, 5389 key = {PowerPC processor}, 5390 title = {Programming Environments Manual for 32-Bit Implementations of the PowerPC ArchitectureARM Architecture}, 5391 publisher = {Freescale Semiconductor}, 5392 volume = {MPCFPE32B}, 5393 edition = {Rev. 3}, 5394 month = 9, 5395 year = 2005, 5385 5396 } 5386 5397 … … 6075 6086 6076 6087 @inproceedings{Leissa14, 6077 title = { Sierra: a SIMD extension for C++},6088 title = {{S}ierra: a {SIMD} extension for {C}++}, 6078 6089 author = {Lei{\ss}a, Roland and Haffner, Immanuel and Hack, Sebastian}, 6079 6090 booktitle = {Proceedings of the 2014 Workshop on Workshop on programming models for SIMD/Vector processing}, -
doc/papers/general/Paper.tex
r29db723 r81e8ab0 836 836 % \end{cfa} 837 837 % so the thunk provides flattening and structuring conversions to inferred functions, improving the compatibility of tuples and polymorphism. 838 % These thunks are generated locally using gcc nested-functions, rather ho siting them to the external scope, so they can easily access local state.838 % These thunks are generated locally using gcc nested-functions, rather hoisting them to the external scope, so they can easily access local state. 839 839 840 840 … … 1167 1167 \lstMakeShortInline@% 1168 1168 \end{cquote} 1169 The target label must be below the @fallthrough@, \ie @fallthrough@ cannot form a loop, and the label may not be nested in a control struct or, \ie it must be at the same level as the @case@ clauses;1169 The target label must be below the @fallthrough@, \ie @fallthrough@ cannot form a loop, and the label may not be nested in a control structure, \ie it must be at the same level as the @case@ clauses; 1170 1170 the target label may be case @default@. 1171 1171 … … 2719 2719 2720 2720 \CC is the best known C-based language, and is similar to \CFA in that both are extensions to C with source and runtime backwards compatibility. 2721 Specific difference between \CFA and \CC have been identified in prior sections, with a final observation that \CFA has equal or few tokens to express the same notion in severalcases.2722 The key difference between design philosophies is that \CFA is easier for C programmers to understand,by maintaining a procedural paradigm and avoiding complex interactions among extensions.2721 Specific difference between \CFA and \CC have been identified in prior sections, with a final observation that \CFA has equal or fewer tokens to express the same notion in many cases. 2722 The key difference in design philosophies is that \CFA is easier for C programmers to understand by maintaining a procedural paradigm and avoiding complex interactions among extensions. 2723 2723 \CC, on the other hand, has multiple overlapping features (such as the three forms of polymorphism), many of which have complex interactions with its object-oriented design. 2724 As a result, \CC has a steep learning curve for even experienced C programmers, especially when attempting to maintain performance equivalent to C legacy 2724 As a result, \CC has a steep learning curve for even experienced C programmers, especially when attempting to maintain performance equivalent to C legacy-code. 2725 2725 2726 2726 There are several other C extension-languages with less usage and even more dramatic changes than \CC. … … 2728 2728 Other languages extend C with more focused features. 2729 2729 CUDA~\cite{Nickolls08}, ispc~\cite{Pharr12}, and Sierra~\cite{Leissa14} add data-parallel primitives to C or \CC; 2730 such features have not yet been added to \CFA, but are not precluded by thedesign.2731 Final y, some C extensions (or suggested extensions) attempt to provide a more memory-safe C~\cite{Boehm88};2732 type-checked polymorphism in \CFA covers several of C's memory-safety holes, but more aggressive approaches such as annotating all pointer types with their nullability are contradictory to \CFA's backwards compatibility goals.2730 such features have not yet been added to \CFA, but are easily incorporated within its design. 2731 Finally, some C extensions (or suggested extensions) attempt to provide a more memory-safe C~\cite{Boehm88,Rafkind09}; 2732 type-checked polymorphism in \CFA covers several of C's memory-safety issues, but more aggressive approaches such as annotating all pointer types with their nullability are contradictory to \CFA's backwards compatibility goals. 2733 2733 2734 2734 … … 2807 2807 struct stack { struct stack_node* head; }; 2808 2808 struct stack new_stack() { return (struct stack){ NULL }; /***/ } 2809 void clear_stack( struct stack * s, void (*free_el)( void * ) ) { 2810 for ( struct stack_node * next = s->head; next; ) { 2811 struct stack_node * crnt = next; 2812 next = crnt->next; 2813 free_el( crnt->value ); 2814 free( crnt ); 2815 } 2816 s->head = NULL; 2817 } 2809 2818 void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) { 2810 2819 struct stack_node ** crnt = &s->head; … … 2825 2834 struct stack_node * n = s->head; 2826 2835 s->head = n->next; 2827 void * x= n->value;2836 void * v = n->value; 2828 2837 free( n ); 2829 return x; 2830 } 2831 void clear_stack( struct stack * s, void (*free_el)( void * ) ) { 2832 for ( struct stack_node * next = s->head; next; ) { 2833 struct stack_node * crnt = next; 2834 next = crnt->next; 2835 free_el( crnt->value ); 2836 free( crnt ); 2837 } 2838 s->head = NULL; 2838 return v; 2839 2839 } 2840 2840 \end{cfa} … … 2858 2858 *crnt = 0; 2859 2859 } 2860 forall( otype T ) stack(T) ?=?( stack(T) & s, stack(T) t ) {2861 if ( s.head == t.head ) return s;2862 clear( s );2863 s{ t };2864 return s;2865 }2866 forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); }2867 forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; }2868 forall( otype T ) void push( stack(T) & s, T value ) with( s ) {2869 stack_node(T) * n = alloc();2870 (*n){ value, head };2871 head = n;2872 }2873 forall( otype T ) T pop( stack(T) & s ) with( s ) {2874 stack_node(T) * n = head;2875 head = n->next;2876 T v = n->value;2877 ^(*n){};2878 free( n );2879 return v;2880 }2881 2860 forall( otype T ) void clear( stack(T) & s ) with( s ) { 2882 2861 for ( stack_node(T) * next = head; next; ) { … … 2888 2867 head = 0; 2889 2868 } 2869 forall( otype T ) stack(T) ?=?( stack(T) & s, stack(T) t ) { 2870 if ( s.head == t.head ) return s; 2871 clear( s ); 2872 s{ t }; 2873 return s; 2874 } 2875 forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); } 2876 forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; } 2877 forall( otype T ) void push( stack(T) & s, T value ) with( s ) { 2878 stack_node(T) * n = alloc(); 2879 (*n){ value, head }; 2880 head = n; 2881 } 2882 forall( otype T ) T pop( stack(T) & s ) with( s ) { 2883 stack_node(T) * n = head; 2884 head = n->next; 2885 T v = n->value; 2886 ^(*n){}; 2887 free( n ); 2888 return v; 2889 } 2890 2890 \end{cfa} 2891 2891 … … 2897 2897 T value; 2898 2898 node * next; 2899 node( const T & v, node * n = nullptr ) : value( v ), next( n) {}2899 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {} 2900 2900 }; 2901 2901 node * head; 2902 void copy( const stack<T> & o) { 2902 stack() : head( nullptr ) {} 2903 stack( const stack<T> & o) { copy( o ); } 2904 stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; } 2905 void copy( const stack<T> & o ) { 2903 2906 node ** crnt = &head; 2904 for ( node * next = o.head; ;next; next = next->next ) {2907 for ( node * next = o.head; next; next = next->next ) { 2905 2908 *crnt = new node{ next->value }; /***/ 2906 2909 crnt = &(*crnt)->next; 2907 2910 } 2908 2911 *crnt = nullptr; 2909 }2910 stack() : head( nullptr) {}2911 stack( const stack<T> & o) { copy( o); }2912 stack( stack<T> && o) : head( o.head) { o.head = nullptr; }2913 ~stack() { clear(); }2914 stack & operator= ( const stack<T> & o) {2915 if ( this == &o ) return *this;2916 clear();2917 copy( o);2918 return *this;2919 }2920 stack & operator= ( stack<T> && o) {2921 if ( this == &o ) return *this;2922 head = o.head;2923 o.head = nullptr;2924 return *this;2925 }2926 bool empty() const { return head == nullptr; }2927 void push( const T & value) { head = new node{ value, head }; /***/ }2928 T pop() {2929 node * n = head;2930 head = n->next;2931 T x = std::move( n->value);2932 delete n;2933 return x;2934 2912 } 2935 2913 void clear() { … … 2941 2919 head = nullptr; 2942 2920 } 2921 ~stack() { clear(); } 2922 stack & operator= ( const stack<T> & o ) { 2923 if ( this == &o ) return *this; 2924 clear(); 2925 copy( o ); 2926 return *this; 2927 } 2928 stack & operator= ( stack<T> && o ) { 2929 if ( this == &o ) return *this; 2930 head = o.head; 2931 o.head = nullptr; 2932 return *this; 2933 } 2934 bool empty() const { return head == nullptr; } 2935 void push( const T & value ) { head = new node{ value, head }; /***/ } 2936 T pop() { 2937 node * n = head; 2938 head = n->next; 2939 T v = std::move( n->value ); 2940 delete n; 2941 return v; 2942 } 2943 2943 }; 2944 2944 \end{cfa} … … 2950 2950 struct node { 2951 2951 ptr<object> value; 2952 node * next;2953 node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}2952 node * next; 2953 node( const object & v, node * n = nullptr ) : value( v.new_copy() ), next( n ) {} 2954 2954 }; 2955 node * head;2955 node * head; 2956 2956 void copy( const stack & o ) { 2957 2957 node ** crnt = &head; … … 2962 2962 *crnt = nullptr; 2963 2963 } 2964 void clear() { 2965 for ( node * next = head; next; ) { 2966 node * crnt = next; 2967 next = crnt->next; 2968 delete crnt; 2969 } 2970 head = nullptr; 2971 } 2964 2972 stack() : head( nullptr ) {} 2965 2973 stack( const stack & o ) { copy( o ); } 2966 2974 stack( stack && o ) : head( o.head ) { o.head = nullptr; } 2967 2975 ~stack() { clear(); } 2968 stack & operator= 2976 stack & operator=( const stack & o ) { 2969 2977 if ( this == &o ) return *this; 2970 2978 clear(); … … 2972 2980 return *this; 2973 2981 } 2974 stack & operator= 2982 stack & operator=( stack && o ) { 2975 2983 if ( this == &o ) return *this; 2976 2984 head = o.head; … … 2983 2991 node * n = head; 2984 2992 head = n->next; 2985 ptr<object> x= std::move( n->value );2993 ptr<object> v = std::move( n->value ); 2986 2994 delete n; 2987 return x; 2988 } 2989 void clear() { 2990 for ( node * next = head; next; ) { 2991 node * crnt = next; 2992 next = crnt->next; 2993 delete crnt; 2994 } 2995 head = nullptr; 2995 return v; 2996 2996 } 2997 2997 }; -
doc/papers/general/evaluation/c-stack.c
r29db723 r81e8ab0 3 3 4 4 struct stack_node { 5 void * value;6 struct stack_node * next;5 void * value; 6 struct stack_node * next; 7 7 }; 8 8 9 9 struct stack new_stack() { return (struct stack){ NULL }; /***/ } 10 10 11 void copy_stack(struct stack* s, const struct stack* t, void* (*copy)(const void*)) { 12 struct stack_node** crnt = &s->head; 13 for ( struct stack_node* next = t->head; next; next = next->next ) { 14 *crnt = malloc(sizeof(struct stack_node)); /***/ 15 (*crnt)->value = copy(next->value); 11 void clear_stack( struct stack * s, void (*free_el)( void * ) ) { 12 for ( struct stack_node * next = s->head; next; ) { 13 struct stack_node * crnt = next; 14 next = crnt->next; 15 free_el( crnt->value ); 16 free( crnt ); 17 } 18 s->head = NULL; 19 } 20 21 void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) { 22 struct stack_node ** crnt = &s->head; 23 for ( struct stack_node * next = t->head; next; next = next->next ) { 24 *crnt = malloc( sizeof(struct stack_node) ); /***/ 25 (*crnt)->value = copy( next->value ); 16 26 crnt = &(*crnt)->next; 17 27 } … … 19 29 } 20 30 21 void clear_stack(struct stack* s, void (*free_el)(void*)) { 22 for ( struct stack_node* next = s->head; next; ) { 23 struct stack_node* crnt = next; 24 next = crnt->next; 25 free_el(crnt->value); 26 free(crnt); 27 } 28 s->head = NULL; 29 } 31 _Bool stack_empty( const struct stack * s ) { return s->head == NULL; } 30 32 31 _Bool stack_empty(const struct stack* s) { return s->head == NULL; } 32 33 void push_stack(struct stack* s, void* value) { 34 struct stack_node* n = malloc(sizeof(struct stack_node)); /***/ 33 void push_stack( struct stack * s, void * value ) { 34 struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/ 35 35 *n = (struct stack_node){ value, s->head }; /***/ 36 36 s->head = n; 37 37 } 38 38 39 void * pop_stack(struct stack* s) {40 struct stack_node * n = s->head;39 void * pop_stack( struct stack * s ) { 40 struct stack_node * n = s->head; 41 41 s->head = n->next; 42 void * x= n->value;43 free( n);44 return x;42 void * v = n->value; 43 free( n ); 44 return v; 45 45 } -
doc/papers/general/evaluation/cfa-stack.c
r29db723 r81e8ab0 17 17 } 18 18 *crnt = 0; 19 } 20 21 forall( otype T ) void clear( stack(T) & s ) with( s ) { 22 for ( stack_node(T) * next = head; next; ) { 23 stack_node(T) * crnt = next; 24 next = crnt->next; 25 ^(*crnt){}; 26 free(crnt); 27 } 28 head = 0; 19 29 } 20 30 … … 44 54 return v; 45 55 } 46 47 forall( otype T ) void clear( stack(T) & s ) with( s ) {48 for ( stack_node(T) * next = head; next; ) {49 stack_node(T) * crnt = next;50 next = crnt->next;51 ^(*crnt){};52 free(crnt);53 }54 head = 0;55 } -
doc/papers/general/evaluation/cpp-stack.hpp
r29db723 r81e8ab0 2 2 #include <utility> 3 3 4 template<typename T> classstack {4 template<typename T> struct stack { 5 5 struct node { 6 6 T value; 7 node* next; 7 node * next; 8 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {} 9 }; 10 node * head; 8 11 9 node( const T& v, node* n = nullptr ) : value(v), next(n) {}10 };11 node* head;12 stack() : head( nullptr ) {} 13 stack( const stack<T> & o) { copy( o ); } 14 stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; } 12 15 13 void copy( const stack<T>& o) {14 node ** crnt = &head;15 for ( node * next = o.head; next; next = next->next ) {16 void copy( const stack<T> & o ) { 17 node ** crnt = &head; 18 for ( node * next = o.head; next; next = next->next ) { 16 19 *crnt = new node{ next->value }; /***/ 17 20 crnt = &(*crnt)->next; … … 19 22 *crnt = nullptr; 20 23 } 21 public: 24 22 25 void clear() { 23 for ( node* next = head; next; ) {24 node * crnt = next;26 for ( node * next = head; next; ) { 27 node * crnt = next; 25 28 next = crnt->next; 26 29 delete crnt; … … 29 32 } 30 33 31 stack() : head(nullptr) {}32 stack(const stack<T>& o) { copy(o); }33 stack(stack<T>&& o) : head(o.head) { o.head = nullptr; }34 34 ~stack() { clear(); } 35 35 36 stack & operator= (const stack<T>& o) {36 stack & operator= ( const stack<T> & o ) { 37 37 if ( this == &o ) return *this; 38 38 clear(); 39 copy( o);39 copy( o ); 40 40 return *this; 41 41 } 42 42 43 stack & operator= (stack<T>&& o) {43 stack & operator= ( stack<T> && o ) { 44 44 if ( this == &o ) return *this; 45 45 head = o.head; … … 50 50 bool empty() const { return head == nullptr; } 51 51 52 void push( const T& value) { head = new node{ value, head }; /***/ }52 void push( const T & value ) { head = new node{ value, head }; /***/ } 53 53 54 54 T pop() { 55 node * n = head;55 node * n = head; 56 56 head = n->next; 57 T x = std::move(n->value);57 T v = std::move( n->value ); 58 58 delete n; 59 return x;59 return v; 60 60 } 61 61 }; -
doc/papers/general/evaluation/cpp-vstack.cpp
r29db723 r81e8ab0 2 2 #include <utility> 3 3 4 stack::node::node( const object & v, node* n ) : value( v.new_copy() ), next( n ) {}4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {} 5 5 6 void stack::copy( const stack& o) {7 node ** crnt = &head;8 for ( node * next = o.head; next; next = next->next ) {6 void stack::copy( const stack & o ) { 7 node ** crnt = &head; 8 for ( node * next = o.head; next; next = next->next ) { 9 9 *crnt = new node{ *next->value }; /***/ 10 10 crnt = &(*crnt)->next; … … 13 13 } 14 14 15 stack::stack() : head(nullptr) {} 16 stack::stack(const stack& o) { copy(o); } 17 stack::stack(stack&& o) : head(o.head) { o.head = nullptr; } 15 void stack::clear() { 16 for ( node * next = head; next; ) { 17 node * crnt = next; 18 next = crnt->next; 19 delete crnt; 20 } 21 head = nullptr; 22 } 23 24 stack::stack() : head( nullptr ) {} 25 stack::stack( const stack & o ) { copy( o ); } 26 stack::stack( stack && o ) : head( o.head ) { o.head = nullptr; } 18 27 stack::~stack() { clear(); } 19 28 20 stack & stack::operator= (const stack& o) {29 stack & stack::operator=( const stack & o ) { 21 30 if ( this == &o ) return *this; 22 31 clear(); 23 copy( o);32 copy( o ); 24 33 return *this; 25 34 } 26 35 27 stack & stack::operator= (stack&& o) {36 stack & stack::operator=( stack && o ) { 28 37 if ( this == &o ) return *this; 29 38 head = o.head; … … 32 41 } 33 42 34 void stack::clear() {35 for ( node* next = head; next; ) {36 node* crnt = next;37 next = crnt->next;38 delete crnt;39 }40 head = nullptr;41 }42 43 43 44 44 bool stack::empty() const { return head == nullptr; } 45 45 46 void stack::push( const object& value) { head = new node{ value, head }; /***/ }46 void stack::push( const object & value ) { head = new node{ value, head }; /***/ } 47 47 48 48 ptr<object> stack::pop() { 49 node * n = head;49 node * n = head; 50 50 head = n->next; 51 ptr<object> x = std::move(n->value);51 ptr<object> v = std::move( n->value ); 52 52 delete n; 53 return x;53 return v; 54 54 } -
doc/papers/general/evaluation/cpp-vstack.hpp
r29db723 r81e8ab0 2 2 #include "object.hpp" 3 3 4 classstack {4 struct stack { 5 5 struct node { 6 6 ptr<object> value; 7 node* next; 7 node * next; 8 node( const object & v, node * n = nullptr ); 9 }; 10 node * head; 8 11 9 node( const object& v, node* n = nullptr ); 10 }; 11 node* head; 12 void copy( const stack & o ); 12 13 13 void copy(const stack& o);14 public:15 14 stack(); 16 stack( const stack& o);17 stack( stack&& o);15 stack( const stack & o ); 16 stack( stack && o ); 18 17 ~stack(); 19 stack& operator= (const stack& o);20 stack& operator= (stack&& o);18 stack& operator=( const stack& o ); 19 stack& operator=( stack && o ); 21 20 22 21 void clear(); 23 22 bool empty() const; 24 void push( const object& value);23 void push( const object & value ); 25 24 ptr<object> pop(); 26 25 };
Note: See TracChangeset
for help on using the changeset viewer.