Changes in / [b51e5fdb:e84382b]
- Location:
- doc
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
rb51e5fdb re84382b 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
rb51e5fdb re84382b 368 368 Hence, programmers can easily form local environments, adding and modifying appropriate functions, to maximize reuse of other existing functions and types. 369 369 370 Unconstruction is a mechanism to distribute @forall@ over related routines/types (see @stack@ examples in Section~\ref{sec:eval}): 371 \begin{cfa} 372 forall( otype T ) { $\C{// forall block}$ 373 struct stack { stack_node(T) * head; }; $\C{// generic type}$ 374 void push( stack(T) & s, T value ) ... $\C{// generic operations}$ 375 T pop( stack(T) & s ) ... 376 } 377 \end{cfa} 378 Each block declaration is prefixed with the initial @forall@ clause significantly reducing duplication. 379 370 380 371 381 \subsection{Traits} … … 836 846 % \end{cfa} 837 847 % 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.848 % These thunks are generated locally using gcc nested-functions, rather hoisting them to the external scope, so they can easily access local state. 839 849 840 850 … … 1167 1177 \lstMakeShortInline@% 1168 1178 \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;1179 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 1180 the target label may be case @default@. 1171 1181 … … 2155 2165 \begin{cfa} 2156 2166 struct W { 2157 2158 2159 2167 double stones; 2168 W() { stones = 0.0; } 2169 W( double w ) { stones = w; } 2160 2170 }; 2161 2171 W operator+( W l, W r ) { … … 2719 2729 2720 2730 \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.2731 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. 2732 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 2733 \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 2734 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 2735 2726 2736 There are several other C extension-languages with less usage and even more dramatic changes than \CC. … … 2728 2738 Other languages extend C with more focused features. 2729 2739 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.2740 such features have not yet been added to \CFA, but are easily incorporated within its design. 2741 Finally, some C extensions (or suggested extensions) attempt to provide a more memory-safe C~\cite{Boehm88,Rafkind09}; 2742 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 2743 2734 2744 … … 2841 2851 struct stack_node * n = s->head; 2842 2852 s->head = n->next; 2843 void * x= n->value;2853 void * v = n->value; 2844 2854 free( n ); 2845 return x;2855 return v; 2846 2856 } 2847 2857 \end{cfa} … … 2897 2907 \end{cfa} 2898 2908 2909 \begin{comment} 2910 forall( otype T ) { 2911 struct stack_node { 2912 T value; 2913 stack_node(T) * next; 2914 }; 2915 struct stack { stack_node(T) * head; }; 2916 void clear( stack(T) & s ) with( s ) { 2917 for ( stack_node(T) * next = head; next; ) { 2918 stack_node(T) * crnt = next; 2919 next = crnt->next; 2920 ^(*crnt){}; 2921 free(crnt); 2922 } 2923 head = 0; 2924 } 2925 void ?{}( stack(T) & s ) { (s.head){ 0 }; } 2926 void ?{}( stack(T) & s, stack(T) t ) { 2927 stack_node(T) ** crnt = &s.head; 2928 for ( stack_node(T) * next = t.head; next; next = next->next ) { 2929 *crnt = alloc(); 2930 ((*crnt)->value){ next->value }; 2931 crnt = &(*crnt)->next; 2932 } 2933 *crnt = 0; 2934 } 2935 stack(T) ?=?( stack(T) & s, stack(T) t ) { 2936 if ( s.head == t.head ) return s; 2937 clear( s ); 2938 s{ t }; 2939 return s; 2940 } 2941 void ^?{}( stack(T) & s) { clear( s ); } 2942 _Bool empty( const stack(T) & s ) { return s.head == 0; } 2943 void push( stack(T) & s, T value ) with( s ) { 2944 stack_node(T) * n = alloc(); 2945 (*n){ value, head }; 2946 head = n; 2947 } 2948 T pop( stack(T) & s ) with( s ) { 2949 stack_node(T) * n = head; 2950 head = n->next; 2951 T v = n->value; 2952 ^(*n){}; 2953 free( n ); 2954 return v; 2955 } 2956 } 2957 \end{comment} 2958 2899 2959 \medskip\noindent 2900 2960 \CC … … 2907 2967 }; 2908 2968 node * head; 2969 stack() : head( nullptr ) {} 2970 stack( const stack<T> & o) { copy( o ); } 2971 stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; } 2909 2972 void clear() { 2910 2973 for ( node * next = head; next; ) { … … 2923 2986 *crnt = nullptr; 2924 2987 } 2925 stack() : head( nullptr) {}2926 stack( const stack<T> & o ) { copy( o ); }2927 2988 ~stack() { clear(); } 2928 stack & operator= ( const stack<T> & o ) {2989 stack & operator= ( const stack<T> & o ) { 2929 2990 if ( this == &o ) return *this; 2930 2991 clear(); … … 2937 2998 node * n = head; 2938 2999 head = n->next; 2939 T x= std::move( n->value );3000 T v = std::move( n->value ); 2940 3001 delete n; 2941 return x;3002 return v; 2942 3003 } 2943 3004 }; … … 2950 3011 struct node { 2951 3012 ptr<object> value; 2952 node * next;2953 node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}3013 node * next; 3014 node( const object & v, node * n = nullptr ) : value( v.new_copy() ), next( n ) {} 2954 3015 }; 2955 node * head;3016 node * head; 2956 3017 void clear() { 2957 3018 for ( node * next = head; next; ) { … … 2972 3033 stack() : head( nullptr ) {} 2973 3034 stack( const stack & o ) { copy( o ); } 2974 3035 ~stack() { clear(); } 2975 3036 stack & operator= ( const stack & o ) { 2976 3037 if ( this == &o ) return *this; … … 2984 3045 node * n = head; 2985 3046 head = n->next; 2986 ptr<object> x= std::move( n->value );3047 ptr<object> v = std::move( n->value ); 2987 3048 delete n; 2988 return x;3049 return v; 2989 3050 } 2990 3051 }; -
doc/papers/general/evaluation/c-stack.c
rb51e5fdb re84382b 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 9 void clear_stack( struct stack * s, void (*free_el)( void * ) ) { 10 for ( struct stack_node * next = s->head; next; ) { 11 struct stack_node * crnt = next; 12 next = crnt->next; 13 free_el( crnt->value ); 14 free( crnt ); 15 } 16 s->head = NULL; 17 } 8 18 9 19 struct stack new_stack() { return (struct stack){ NULL }; /***/ } 10 20 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);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 } 18 28 *crnt = NULL; 19 29 } 20 21 struct stack* assign_stack(struct stack* s, const struct stack* t, 22 void* (*copy_el)(const void*), void (*free_el)(void*)) { 30 struct stack * assign_stack( struct stack * s, const struct stack * t, 31 void * (*copy_el)( const void * ), void (*free_el)( void * ) ) { 23 32 if ( s->head == t->head ) return s; 24 33 clear_stack( s, free_el ); /***/ … … 27 36 } 28 37 29 void clear_stack(struct stack* s, void (*free_el)(void*)) { 30 for ( struct stack_node* next = s->head; next; ) { 31 struct stack_node* crnt = next; 32 next = crnt->next; 33 free_el(crnt->value); 34 free(crnt); 35 } 36 s->head = NULL; 37 } 38 _Bool stack_empty( const struct stack * s ) { return s->head == NULL; } 38 39 39 _Bool stack_empty(const struct stack* s) { return s->head == NULL; } 40 41 void push_stack(struct stack* s, void* value) { 42 struct stack_node* n = malloc(sizeof(struct stack_node)); /***/ 40 void push_stack( struct stack * s, void * value ) { 41 struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/ 43 42 *n = (struct stack_node){ value, s->head }; /***/ 44 43 s->head = n; 45 44 } 46 45 47 void * pop_stack(struct stack* s) {48 struct stack_node * n = s->head;46 void * pop_stack( struct stack * s ) { 47 struct stack_node * n = s->head; 49 48 s->head = n->next; 50 void * x= n->value;51 free( n);52 return x;49 void * v = n->value; 50 free( n ); 51 return v; 53 52 } -
doc/papers/general/evaluation/cfa-stack.c
rb51e5fdb re84382b 6 6 stack_node(T) * next; 7 7 }; 8 9 forall( otype T ) void clear( stack(T) & s ) with( s ) { 10 for ( stack_node(T) * next = head; next; ) { 11 stack_node(T) * crnt = next; 12 next = crnt->next; 13 ^(*crnt){}; 14 free(crnt); 15 } 16 head = 0; 17 } 8 18 9 19 forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; } … … 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
rb51e5fdb re84382b 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 *crnt = new node{ next->value }; /***/17 crnt = &(*crnt)->next;18 }19 *crnt = nullptr;20 }21 public:22 16 void clear() { 23 for ( node* next = head; next; ) {24 node * crnt = next;17 for ( node * next = head; next; ) { 18 node * crnt = next; 25 19 next = crnt->next; 26 20 delete crnt; … … 29 23 } 30 24 31 stack() : head(nullptr) {} 32 stack(const stack<T>& o) { copy(o); } 25 void copy( const stack<T> & o ) { 26 node ** crnt = &head; 27 for ( node * next = o.head; next; next = next->next ) { 28 *crnt = new node{ next->value }; /***/ 29 crnt = &(*crnt)->next; 30 } 31 *crnt = nullptr; 32 } 33 33 34 ~stack() { clear(); } 34 35 35 stack & operator= (const stack<T>& o) {36 stack & operator= ( const stack<T> & o ) { 36 37 if ( this == &o ) return *this; 37 38 clear(); 38 copy( o);39 copy( o ); 39 40 return *this; 40 41 } … … 42 43 bool empty() const { return head == nullptr; } 43 44 44 void push( const T& value) { head = new node{ value, head }; /***/ }45 void push( const T & value ) { head = new node{ value, head }; /***/ } 45 46 46 47 T pop() { 47 node * n = head;48 node * n = head; 48 49 head = n->next; 49 T x = std::move(n->value);50 T v = std::move( n->value ); 50 51 delete n; 51 return x;52 return v; 52 53 } 53 54 }; -
doc/papers/general/evaluation/cpp-vstack.cpp
rb51e5fdb re84382b 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::clear() { 7 for ( node * next = head; next; ) { 8 node * crnt = next; 9 next = crnt->next; 10 delete crnt; 11 } 12 head = nullptr; 13 } 14 15 void stack::copy( const stack & o ) { 16 node ** crnt = &head; 17 for ( node * next = o.head; next; next = next->next ) { 9 18 *crnt = new node{ *next->value }; /***/ 10 19 crnt = &(*crnt)->next; … … 13 22 } 14 23 15 stack::stack() : head(nullptr) {} 16 stack::stack(const stack& o) { copy(o); } 24 stack::stack() : head( nullptr ) {} 25 stack::stack( const stack & o ) { copy( o ); } 26 stack::stack( stack && o ) : head( o.head ) { o.head = nullptr; } 17 27 stack::~stack() { clear(); } 18 28 19 stack & stack::operator= (const stack& o) {29 stack & stack::operator=( const stack & o ) { 20 30 if ( this == &o ) return *this; 21 31 clear(); 22 copy( o);32 copy( o ); 23 33 return *this; 24 34 } 25 35 26 void stack::clear() { 27 for ( node* next = head; next; ) { 28 node* crnt = next; 29 next = crnt->next; 30 delete crnt; 31 } 32 head = nullptr; 36 stack & stack::operator=( stack && o ) { 37 if ( this == &o ) return *this; 38 head = o.head; 39 o.head = nullptr; 40 return *this; 33 41 } 34 35 42 36 43 bool stack::empty() const { return head == nullptr; } 37 44 38 void stack::push( const object& value) { head = new node{ value, head }; /***/ }45 void stack::push( const object & value ) { head = new node{ value, head }; /***/ } 39 46 40 47 ptr<object> stack::pop() { 41 node * n = head;48 node * n = head; 42 49 head = n->next; 43 ptr<object> x = std::move(n->value);50 ptr<object> v = std::move( n->value ); 44 51 delete n; 45 return x;52 return v; 46 53 } -
doc/papers/general/evaluation/cpp-vstack.hpp
rb51e5fdb re84382b 2 2 #include "object.hpp" 3 3 4 classstack {4 struct stack { 5 5 struct node { 6 6 ptr<object> value; 7 node* next; 8 9 node( const object& v, node* n = nullptr ); 7 node * next; 8 node( const object & v, node * n = nullptr ); 10 9 }; 11 node* head; 12 13 void copy(const stack& o); 14 public: 15 stack(); 16 stack(const stack& o); 17 ~stack(); 18 stack& operator= (const stack& o); 10 node * head; 19 11 20 12 void clear(); 13 void copy( const stack & o ); 14 15 stack(); 16 stack( const stack & o ); 17 stack( stack && o ); 18 ~stack(); 19 stack & operator=( const stack& o ); 20 stack & operator=( stack && o ); 21 21 bool empty() const; 22 void push( const object& value);22 void push( const object & value ); 23 23 ptr<object> pop(); 24 24 };
Note: See TracChangeset
for help on using the changeset viewer.