Changeset 81e8ab0


Ignore:
Timestamp:
Mar 9, 2018, 9:30:47 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

more updates

Location:
doc
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • doc/bibliography/pl.bib

    r29db723 r81e8ab0  
    52055205    year        = 1984,
    52065206    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},
    52095208    summary     = {
    52105209        The principles of Procedural Abstraction, Data Type Completeness,
     
    52585257}
    52595258
    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},
    52685271}
    52695272
     
    53385341
    53395342@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},
    53425344    contributer = {gjditchfield@plg},
    53435345    author      = {Malcolm P. Atkinson and Ronald Morrison},
     
    53705372
    53715373@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},
    53745375    contributer = {akgoel@plg},
    53755376    author      = {Jan van den Bos and Chris Laffra},
     
    53835384    note        = {Proceedings of the OOPSLA'89 Conference, Oct. 1--6, 1989, New Orleans, Lousiana},
    53845385    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,
    53855396}
    53865397
     
    60756086
    60766087@inproceedings{Leissa14,
    6077     title       = {Sierra: a SIMD extension for C++},
     6088    title       = {{S}ierra: a {SIMD} extension for {C}++},
    60786089    author      = {Lei{\ss}a, Roland and Haffner, Immanuel and Hack, Sebastian},
    60796090    booktitle   = {Proceedings of the 2014 Workshop on Workshop on programming models for SIMD/Vector processing},
  • doc/papers/general/Paper.tex

    r29db723 r81e8ab0  
    836836% \end{cfa}
    837837% 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 hositing 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.
    839839
    840840
     
    11671167\lstMakeShortInline@%
    11681168\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 structor, \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 structure, \ie it must be at the same level as the @case@ clauses;
    11701170the target label may be case @default@.
    11711171
     
    27192719
    27202720\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 several cases.
    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.
     2721Specific 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.
     2722The 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.
    27232723\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 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.
    27252725
    27262726There are several other C extension-languages with less usage and even more dramatic changes than \CC.
     
    27282728Other languages extend C with more focused features.
    27292729CUDA~\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 the design.
    2731 Finaly, 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.
     2730such features have not yet been added to \CFA, but are easily incorporated within its design.
     2731Finally, some C extensions (or suggested extensions) attempt to provide a more memory-safe C~\cite{Boehm88,Rafkind09};
     2732type-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.
    27332733
    27342734
     
    28072807struct stack { struct stack_node* head; };
    28082808struct stack new_stack() { return (struct stack){ NULL }; /***/ }
     2809void 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}
    28092818void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) {
    28102819        struct stack_node ** crnt = &s->head;
     
    28252834        struct stack_node * n = s->head;
    28262835        s->head = n->next;
    2827         void * x = n->value;
     2836        void * v = n->value;
    28282837        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;
    28392839}
    28402840\end{cfa}
     
    28582858        *crnt = 0;
    28592859}
    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 }
    28812860forall( otype T ) void clear( stack(T) & s ) with( s ) {
    28822861        for ( stack_node(T) * next = head; next; ) {
     
    28882867        head = 0;
    28892868}
     2869forall( 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}
     2875forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); }
     2876forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; }
     2877forall( 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}
     2882forall( 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}
    28902890\end{cfa}
    28912891
     
    28972897                T value;
    28982898                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 ) {}
    29002900        };
    29012901        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 ) {
    29032906                node ** crnt = &head;
    2904                 for ( node * next = o.head;; next; next = next->next ) {
     2907                for ( node * next = o.head; next; next = next->next ) {
    29052908                        *crnt = new node{ next->value }; /***/
    29062909                        crnt = &(*crnt)->next;
    29072910                }
    29082911                *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;
    29342912        }
    29352913        void clear() {
     
    29412919                head = nullptr;
    29422920        }
     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        }
    29432943};
    29442944\end{cfa}
     
    29502950        struct node {
    29512951                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 ) {}
    29542954        };
    2955         node* head;
     2955        node * head;
    29562956        void copy( const stack & o ) {
    29572957                node ** crnt = &head;
     
    29622962                *crnt = nullptr;
    29632963        }
     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        }
    29642972        stack() : head( nullptr ) {}
    29652973        stack( const stack & o ) { copy( o ); }
    29662974        stack( stack && o ) : head( o.head ) { o.head = nullptr; }
    29672975        ~stack() { clear(); }
    2968         stack & operator= ( const stack & o ) {
     2976        stack & operator=( const stack & o ) {
    29692977                if ( this == &o ) return *this;
    29702978                clear();
     
    29722980                return *this;
    29732981        }
    2974         stack & operator= ( stack && o ) {
     2982        stack & operator=( stack && o ) {
    29752983                if ( this == &o ) return *this;
    29762984                head = o.head;
     
    29832991                node * n = head;
    29842992                head = n->next;
    2985                 ptr<object> x = std::move( n->value );
     2993                ptr<object> v = std::move( n->value );
    29862994                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;
    29962996        }
    29972997};
  • doc/papers/general/evaluation/c-stack.c

    r29db723 r81e8ab0  
    33
    44struct stack_node {
    5         void* value;
    6         struct stack_node* next;
     5        void * value;
     6        struct stack_node * next;
    77};
    88
    99struct stack new_stack() { return (struct stack){ NULL }; /***/ }
    1010
    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);
     11void 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
     21void 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 );
    1626                crnt = &(*crnt)->next;
    1727        }
     
    1929}
    2030
    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; }
    3032
    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)); /***/
     33void push_stack( struct stack * s, void * value ) {
     34        struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/
    3535        *n = (struct stack_node){ value, s->head }; /***/
    3636        s->head = n;
    3737}
    3838
    39 void* pop_stack(struct stack* s) {
    40         struct stack_node* n = s->head;
     39void * pop_stack( struct stack * s ) {
     40        struct stack_node * n = s->head;
    4141        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;
    4545}
  • doc/papers/general/evaluation/cfa-stack.c

    r29db723 r81e8ab0  
    1717        }
    1818        *crnt = 0;
     19}
     20
     21forall( 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;
    1929}
    2030
     
    4454        return v;
    4555}
    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  
    22#include <utility>
    33
    4 template<typename T> class stack {
     4template<typename T> struct stack {
    55        struct node {
    66                T value;
    7                 node* next;
     7                node * next;
     8                node( const T & v, node * n = nullptr ) : value( v ), next( n ) {}
     9        };
     10        node * head;
    811
    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; }
    1215
    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 ) {
    1619                        *crnt = new node{ next->value }; /***/
    1720                        crnt = &(*crnt)->next;
     
    1922                *crnt = nullptr;
    2023        }
    21 public:
     24
    2225        void clear() {
    23             for ( node* next = head; next; ) {
    24                         node* crnt = next;
     26                for ( node * next = head; next; ) {
     27                        node * crnt = next;
    2528                        next = crnt->next;
    2629                        delete crnt;
     
    2932        }
    3033
    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 x = std::move(n->value);
     57                T v = std::move( n->value );
    5858                delete n;
    59                 return x;
     59                return v;
    6060        }
    6161};
  • doc/papers/general/evaluation/cpp-vstack.cpp

    r29db723 r81e8ab0  
    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 ) {}
    55
    6 void stack::copy(const stack& o) {
    7         node** crnt = &head;
    8         for ( node* next = o.head; next; next = next->next ) {
     6void stack::copy( const stack & o ) {
     7        node ** crnt = &head;
     8        for ( node * next = o.head; next; next = next->next ) {
    99                *crnt = new node{ *next->value }; /***/
    1010                crnt = &(*crnt)->next;
     
    1313}
    1414
    15 stack::stack() : head(nullptr) {}
    16 stack::stack(const stack& o) { copy(o); }
    17 stack::stack(stack&& o) : head(o.head) { o.head = nullptr; }
     15void 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
     24stack::stack() : head( nullptr ) {}
     25stack::stack( const stack & o ) { copy( o ); }
     26stack::stack( stack && o ) : head( o.head ) { o.head = nullptr; }
    1827stack::~stack() { clear(); }
    1928
    20 stack& stack::operator= (const stack& o) {
     29stack & stack::operator=( const stack & o ) {
    2130        if ( this == &o ) return *this;
    2231        clear();
    23         copy(o);
     32        copy( o );
    2433        return *this;
    2534}
    2635
    27 stack& stack::operator= (stack&& o) {
     36stack & stack::operator=( stack && o ) {
    2837        if ( this == &o ) return *this;
    2938        head = o.head;
     
    3241}
    3342
    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 
    4343
    4444bool stack::empty() const { return head == nullptr; }
    4545
    46 void stack::push(const object& value) { head = new node{ value, head }; /***/ }
     46void stack::push( const object & value ) { head = new node{ value, head }; /***/ }
    4747
    4848ptr<object> stack::pop() {
    49         node* n = head;
     49        node * n = head;
    5050        head = n->next;
    51         ptr<object> x = std::move(n->value);
     51        ptr<object> v = std::move( n->value );
    5252        delete n;
    53         return x;
     53        return v;
    5454}
  • doc/papers/general/evaluation/cpp-vstack.hpp

    r29db723 r81e8ab0  
    22#include "object.hpp"
    33
    4 class stack {
     4struct stack {
    55        struct node {
    66                ptr<object> value;
    7                 node* next;
     7                node * next;
     8                node( const object & v, node * n = nullptr );
     9        };
     10        node * head;
    811
    9                 node( const object& v, node* n = nullptr );
    10         };
    11         node* head;
     12        void copy( const stack & o );
    1213
    13         void copy(const stack& o);
    14 public:
    1514        stack();
    16         stack(const stack& o);
    17         stack(stack&& o);
     15        stack( const stack & o );
     16        stack( stack && o );
    1817        ~stack();
    19         stack& operator= (const stack& o);
    20         stack& operator= (stack&& o);
     18        stack& operator=( const stack& o );
     19        stack& operator=( stack && o );
    2120
    2221        void clear();
    2322        bool empty() const;
    24         void push(const object& value);
     23        void push( const object & value );
    2524        ptr<object> pop();
    2625};
Note: See TracChangeset for help on using the changeset viewer.