Changes in / [8b001bd:e59f0bf]


Ignore:
Location:
doc
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • doc/bibliography/pl.bib

    r8b001bd re59f0bf  
    52055205    year        = 1984,
    52065206    series      = {Computers and their Applications},
    5207     address     = {Market Cross House, Cooper Street, Chichester, West Sussex, PO19 1EB, England},
     5207    address     = {Market Cross House, Cooper Street, Chichester, West Sussex,
     5208        PO19 1EB, England},
    52085209    summary     = {
    52095210        The principles of Procedural Abstraction, Data Type Completeness,
     
    52575258}
    52585259
    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},
     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,
    52715268}
    52725269
     
    53415338
    53425339@article{psa:persistence,
    5343     keywords    = {persistence, first-class procedures, closure, PS-Algol, Abstract Data Types},
     5340    keywords    = {persistence, first-class procedures, closure, PS-Algol,
     5341        Abstract Data Types},
    53445342    contributer = {gjditchfield@plg},
    53455343    author      = {Malcolm P. Atkinson and Ronald Morrison},
     
    53725370
    53735371@article{Procol89,
    5374     keywords    = {active objects, object-oriented languages, object-based languages, explicit per-object protocol},
     5372    keywords    = {active objects, object-oriented languages,
     5373        object-based languages, explicit per-object protocol},
    53755374    contributer = {akgoel@plg},
    53765375    author      = {Jan van den Bos and Chris Laffra},
     
    53845383    note        = {Proceedings of the OOPSLA'89 Conference, Oct. 1--6, 1989, New Orleans, Lousiana},
    53855384    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,
    53965385}
    53975386
     
    60866075
    60876076@inproceedings{Leissa14,
    6088     title       = {{S}ierra: a {SIMD} extension for {C}++},
     6077    title       = {Sierra: a SIMD extension for C++},
    60896078    author      = {Lei{\ss}a, Roland and Haffner, Immanuel and Hack, Sebastian},
    60906079    booktitle   = {Proceedings of the 2014 Workshop on Workshop on programming models for SIMD/Vector processing},
  • doc/papers/general/Paper.tex

    r8b001bd re59f0bf  
    368368Hence, programmers can easily form local environments, adding and modifying appropriate functions, to maximize reuse of other existing functions and types.
    369369
    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 
    380370
    381371\subsection{Traits}
     
    846836% \end{cfa}
    847837% so the thunk provides flattening and structuring conversions to inferred functions, improving the compatibility of tuples and polymorphism.
    848 % These thunks are generated locally using gcc nested-functions, rather hoisting them to the external scope, so they can easily access local state.
     838% These thunks are generated locally using gcc nested-functions, rather hositing them to the external scope, so they can easily access local state.
    849839
    850840
     
    11771167\lstMakeShortInline@%
    11781168\end{cquote}
    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;
     1169The target label must be below the @fallthrough@, \ie @fallthrough@ cannot form a loop, and the label may not be nested in a control structor, \ie it must be at the same level as the @case@ clauses;
    11801170the target label may be case @default@.
    11811171
     
    21652155\begin{cfa}
    21662156struct W {
    2167         double stones;
    2168         W() { stones = 0.0; }
    2169         W( double w ) { stones = w; }
     2157    double stones;
     2158    W() { stones = 0.0; }
     2159    W( double w ) { stones = w; }
    21702160};
    21712161W operator+( W l, W r ) {
     
    27292719
    27302720\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.
    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.
     2721Specific 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 several cases.
     2722The 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.
    27332723\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.
    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.
     2724As a result, \CC has a steep learning curve for even experienced C programmers, especially when attempting to maintain performance equivalent to C legacy code.
    27352725
    27362726There are several other C extension-languages with less usage and even more dramatic changes than \CC.
     
    27382728Other languages extend C with more focused features.
    27392729CUDA~\cite{Nickolls08}, ispc~\cite{Pharr12}, and Sierra~\cite{Leissa14} add data-parallel primitives to C or \CC;
    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.
     2730such features have not yet been added to \CFA, but are not precluded by the design.
     2731Finaly, some C extensions (or suggested extensions) attempt to provide a more memory-safe C~\cite{Boehm88};
     2732type-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.
    27432733
    27442734
     
    28512841        struct stack_node * n = s->head;
    28522842        s->head = n->next;
    2853         void * v = n->value;
     2843        void * x = n->value;
    28542844        free( n );
    2855         return v;
     2845        return x;
    28562846}
    28572847\end{cfa}
     
    29142904                T value;
    29152905                node * next;
    2916                 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {}
     2906                node( const T & v, node * n = nullptr ) : value( v), next( n) {}
    29172907        };
    29182908        node * head;
    2919         stack() : head( nullptr ) {}
    2920         stack( const stack<T> & o) { copy( o ); }
    2921         stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; }
    29222909        void clear() {
    29232910                for ( node * next = head; next; ) {
     
    29282915                head = nullptr;
    29292916        }
    2930         void copy( const stack<T> & o ) {
     2917        void copy( const stack<T> & o) {
    29312918                node ** crnt = &head;
    2932                 for ( node * next = o.head; next; next = next->next ) {
     2919                for ( node * next = o.head;; next; next = next->next ) {
    29332920                        *crnt = new node{ next->value }; /***/
    29342921                        crnt = &(*crnt)->next;
     
    29362923                *crnt = nullptr;
    29372924        }
     2925        stack() : head( nullptr) {}
     2926        stack( const stack<T> & o) { copy( o); }
     2927        stack( stack<T> && o) : head( o.head) { o.head = nullptr; }
    29382928        ~stack() { clear(); }
    2939         stack & operator= ( const stack<T> & o ) {
     2929        stack & operator= ( const stack<T> & o) {
    29402930                if ( this == &o ) return *this;
    29412931                clear();
    2942                 copy( o );
     2932                copy( o);
    29432933                return *this;
    29442934        }
    2945         stack & operator= ( stack<T> && o ) {
     2935        stack & operator= ( stack<T> && o) {
    29462936                if ( this == &o ) return *this;
    29472937                head = o.head;
     
    29502940        }
    29512941        bool empty() const { return head == nullptr; }
    2952         void push( const T & value ) { head = new node{ value, head };  /***/ }
     2942        void push( const T & value) { head = new node{ value, head };  /***/ }
    29532943        T pop() {
    29542944                node * n = head;
    29552945                head = n->next;
    2956                 T v = std::move( n->value );
     2946                T x = std::move( n->value);
    29572947                delete n;
    2958                 return v;
     2948                return x;
    29592949        }
    29602950};
     
    29672957        struct node {
    29682958                ptr<object> value;
    2969                 node * next;
    2970                 node( const object & v, node * n = nullptr ) : value( v.new_copy() ), next( n ) {}
     2959                node* next;
     2960                node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
    29712961        };
    2972         node * head;
     2962        node* head;
    29732963        void clear() {
    29742964                for ( node * next = head; next; ) {
     
    29912981        stack( stack && o ) : head( o.head ) { o.head = nullptr; }
    29922982        ~stack() { clear(); }
    2993         stack & operator=( const stack & o ) {
     2983        stack & operator= ( const stack & o ) {
    29942984                if ( this == &o ) return *this;
    29952985                clear();
     
    29972987                return *this;
    29982988        }
    2999         stack & operator=( stack && o ) {
     2989        stack & operator= ( stack && o ) {
    30002990                if ( this == &o ) return *this;
    30012991                head = o.head;
     
    30082998                node * n = head;
    30092999                head = n->next;
    3010                 ptr<object> v = std::move( n->value );
     3000                ptr<object> x = std::move( n->value );
    30113001                delete n;
    3012                 return v;
     3002                return x;
    30133003        }
    30143004};
  • doc/papers/general/evaluation/c-stack.c

    r8b001bd re59f0bf  
    33
    44struct stack_node {
    5         void * value;
    6         struct stack_node * next;
     5        void* value;
     6        struct stack_node* next;
    77};
    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 }
    188
    199struct stack new_stack() { return (struct stack){ NULL }; /***/ }
    2010
    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 );
     11void 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);
    2616                crnt = &(*crnt)->next;
    2717        }
    2818        *crnt = NULL;
    2919}
    30 struct stack * assign_stack( struct stack * s, const struct stack * t,
    31                 void * (*copy_el)( const void * ), void (*free_el)( void * ) ) {
     20
     21struct stack* assign_stack(struct stack* s, const struct stack* t,
     22                void* (*copy_el)(const void*), void (*free_el)(void*)) {
    3223        if ( s->head == t->head ) return s;
    3324        clear_stack( s, free_el ); /***/
     
    3627}
    3728
    38 _Bool stack_empty( const struct stack * s ) { return s->head == NULL; }
     29void 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}
    3938
    40 void push_stack( struct stack * s, void * value ) {
    41         struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/
     39_Bool stack_empty(const struct stack* s) { return s->head == NULL; }
     40
     41void push_stack(struct stack* s, void* value) {
     42        struct stack_node* n = malloc(sizeof(struct stack_node)); /***/
    4243        *n = (struct stack_node){ value, s->head }; /***/
    4344        s->head = n;
    4445}
    4546
    46 void * pop_stack( struct stack * s ) {
    47         struct stack_node * n = s->head;
     47void* pop_stack(struct stack* s) {
     48        struct stack_node* n = s->head;
    4849        s->head = n->next;
    49         void * v = n->value;
    50         free( n );
    51         return v;
     50        void* x = n->value;
     51        free(n);
     52        return x;
    5253}
  • doc/papers/general/evaluation/cfa-stack.c

    r8b001bd re59f0bf  
    66        stack_node(T) * next;
    77};
    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 }
    188
    199forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     
    5444        return v;
    5545}
     46
     47forall( 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

    r8b001bd re59f0bf  
    22#include <utility>
    33
    4 template<typename T> struct stack {
     4template<typename T> class stack {
    55        struct node {
    66                T value;
    7                 node * next;
    8                 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {}
     7                node* next;
     8
     9                node( const T& v, node* n = nullptr ) : value(v), next(n) {}
    910        };
    10         node * head;
     11        node* head;
    1112
    12         stack() : head( nullptr ) {}
    13         stack( const stack<T> & o) { copy( o ); }
    14         stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; }
    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        }
     21public:
    1622        void clear() {
    17                 for ( node * next = head; next; ) {
    18                         node * crnt = next;
     23            for ( node* next = head; next; ) {
     24                        node* crnt = next;
    1925                        next = crnt->next;
    2026                        delete crnt;
     
    2329        }
    2430
    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 
     31        stack() : head(nullptr) {}
     32        stack(const stack<T>& o) { copy(o); }
     33        stack(stack<T>&& o) : head(o.head) { o.head = nullptr; }
    3434        ~stack() { clear(); }
    3535
    36         stack & operator= ( const stack<T> & o ) {
     36        stack& operator= (const stack<T>& o) {
    3737                if ( this == &o ) return *this;
    3838                clear();
    39                 copy( o );
     39                copy(o);
    4040                return *this;
    4141        }
    4242
    43         stack & operator= ( stack<T> && o ) {
     43        stack& operator= (stack<T>&& o) {
    4444                if ( this == &o ) return *this;
    4545                head = o.head;
     
    5050        bool empty() const { return head == nullptr; }
    5151
    52         void push( const T & value ) { head = new node{ value, head };  /***/ }
     52        void push(const T& value) { head = new node{ value, head };  /***/ }
    5353
    5454        T pop() {
    55                 node * n = head;
     55                node* n = head;
    5656                head = n->next;
    57                 T v = std::move( n->value );
     57                T x = std::move(n->value);
    5858                delete n;
    59                 return v;
     59                return x;
    6060        }
    6161};
  • doc/papers/general/evaluation/cpp-vstack.cpp

    r8b001bd re59f0bf  
    22#include <utility>
    33
    4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     4stack::node::node( const object& v, node* n ) : value( v.new_copy() ), next( n ) {}
     5
     6void stack::copy(const stack& o) {
     7        node** crnt = &head;
     8        for ( node* next = o.head; next; next = next->next ) {
     9                *crnt = new node{ *next->value }; /***/
     10                crnt = &(*crnt)->next;
     11        }
     12        *crnt = nullptr;
     13}
     14
     15stack::stack() : head(nullptr) {}
     16stack::stack(const stack& o) { copy(o); }
     17stack::stack(stack&& o) : head(o.head) { o.head = nullptr; }
     18stack::~stack() { clear(); }
     19
     20stack& stack::operator= (const stack& o) {
     21        if ( this == &o ) return *this;
     22        clear();
     23        copy(o);
     24        return *this;
     25}
     26
     27stack& stack::operator= (stack&& o) {
     28        if ( this == &o ) return *this;
     29        head = o.head;
     30        o.head = nullptr;
     31        return *this;
     32}
    533
    634void stack::clear() {
    7         for ( node * next = head; next; ) {
    8                 node * crnt = next;
     35    for ( node* next = head; next; ) {
     36                node* crnt = next;
    937                next = crnt->next;
    1038                delete crnt;
     
    1341}
    1442
    15 void stack::copy( const stack & o ) {
    16         node ** crnt = &head;
    17         for ( node * next = o.head; next; next = next->next ) {
    18                 *crnt = new node{ *next->value }; /***/
    19                 crnt = &(*crnt)->next;
    20         }
    21         *crnt = 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; }
    27 stack::~stack() { clear(); }
    28 
    29 stack & stack::operator=( const stack & o ) {
    30         if ( this == &o ) return *this;
    31         clear();
    32         copy( o );
    33         return *this;
    34 }
    35 
    36 stack & stack::operator=( stack && o ) {
    37         if ( this == &o ) return *this;
    38         head = o.head;
    39         o.head = nullptr;
    40         return *this;
    41 }
    4243
    4344bool stack::empty() const { return head == nullptr; }
    4445
    45 void stack::push( const object & value ) { head = new node{ value, head }; /***/ }
     46void stack::push(const object& value) { head = new node{ value, head }; /***/ }
    4647
    4748ptr<object> stack::pop() {
    48         node * n = head;
     49        node* n = head;
    4950        head = n->next;
    50         ptr<object> v = std::move( n->value );
     51        ptr<object> x = std::move(n->value);
    5152        delete n;
    52         return v;
     53        return x;
    5354}
  • doc/papers/general/evaluation/cpp-vstack.hpp

    r8b001bd re59f0bf  
    22#include "object.hpp"
    33
    4 struct stack {
     4class stack {
    55        struct node {
    66                ptr<object> value;
    7                 node * next;
    8                 node( const object & v, node * n = nullptr );
     7                node* next;
     8
     9                node( const object& v, node* n = nullptr );
    910        };
    10         node * head;
     11        node* head;
     12
     13        void copy(const stack& o);
     14public:
     15        stack();
     16        stack(const stack& o);
     17        stack(stack&& o);
     18        ~stack();
     19        stack& operator= (const stack& o);
     20        stack& operator= (stack&& o);
    1121
    1222        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 
    2223        bool empty() const;
    23         void push( const object & value );
     24        void push(const object& value);
    2425        ptr<object> pop();
    2526};
Note: See TracChangeset for help on using the changeset viewer.