Ignore:
Timestamp:
Feb 1, 2021, 4:23:55 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
85871478
Parents:
f99f5ba
Message:

That should fix the memory module. Simply removed all the special features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/memory.hfa

    rf99f5ba r8be729f  
    1010// Created On       : Tue Jun  2 16:48:00 2020
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Jun  3 12:29:00 2020
    13 // Update Count     : 0
     12// Last Modified On : Fri Jan 29 15:52:00 2021
     13// Update Count     : 1
    1414//
    1515
     
    1717
    1818// Internal data object.
    19 forall(T & | sized(T)) {
    20         struct counter_data {
    21                 unsigned int counter;
    22                 T object;
    23         };
     19forall(T & | sized(T))
     20struct counter_data {
     21        unsigned int counter;
     22        T object;
     23};
    2424
    25         forall(Args... | { void ?{}(T &, Args); })
    26         void ?{}(counter_data(T) & this, Args args);
     25forall(T & | sized(T), Args... | { void ?{}(T &, Args); })
     26void ?{}(counter_data(T) & this, Args args);
    2727
    28         forall( | { void ^?{}(T &); })
    29         void ^?{}(counter_data(T) & this);
    30 }
     28forall(T & | sized(T) | { void ^?{}(T &); })
     29void ^?{}(counter_data(T) & this);
    3130
    3231// This is one of many pointers keeping this alive.
    33 forall(T & | sized(T)) {
    34         struct counter_ptr {
    35                 counter_data(T) * data;
    36         };
     32forall(T & | sized(T))
     33struct counter_ptr {
     34        counter_data(T) * data;
     35};
    3736
    38         void ?{}(counter_ptr(T) & this);
    39         void ?{}(counter_ptr(T) & this, zero_t);
    40         forall( | { void ^?{}(T &); })
    41         void ?{}(counter_ptr(T) & this, counter_ptr(T) that);
    42         forall(Args... | { void ?{}(T&, Args); })
    43         void ?{}(counter_ptr(T) & this, Args args);
     37forall(T & | sized(T))
     38void ?{}(counter_ptr(T) & this);
     39forall(T & | sized(T))
     40void ?{}(counter_ptr(T) & this, zero_t);
     41forall(T & | sized(T))
     42void ?{}(counter_ptr(T) & this, counter_ptr(T) that);
     43forall(T & | sized(T), Args... | { void ?{}(T&, Args); })
     44void ?{}(counter_ptr(T) & this, Args args);
    4445
    45         forall( | { void ^?{}(T &); })
    46         void ^?{}(counter_ptr(T) & this);
     46forall(T & | sized(T) | { void ^?{}(T &); })
     47void ^?{}(counter_ptr(T) & this);
    4748
    48         T & *?(counter_ptr(T) & this);
     49forall(T & | sized(T))
     50T & *?(counter_ptr(T) & this);
    4951
    50         forall( | { void ^?{}(T &); })
    51         void ?=?(counter_ptr(T) & this, counter_ptr(T) that);
    52         forall( | { void ^?{}(T &); })
    53         void ?=?(counter_ptr(T) & this, zero_t);
     52forall(T & | sized(T) | { void ^?{}(T &); })
     53void ?=?(counter_ptr(T) & this, counter_ptr(T) that);
     54forall(T & | sized(T) | { void ^?{}(T &); })
     55void ?=?(counter_ptr(T) & this, zero_t);
    5456
    55         int ?==?(counter_ptr(T) const & this, counter_ptr(T) const & that);
    56         int ?!=?(counter_ptr(T) const & this, counter_ptr(T) const & that);
    57         int ?==?(counter_ptr(T) const & this, zero_t);
    58         int ?!=?(counter_ptr(T) const & this, zero_t);
    59 }
     57forall(T & | sized(T))
     58int ?==?(counter_ptr(T) const & this, counter_ptr(T) const & that);
     59forall(T & | sized(T))
     60int ?!=?(counter_ptr(T) const & this, counter_ptr(T) const & that);
     61forall(T & | sized(T))
     62int ?==?(counter_ptr(T) const & this, zero_t);
     63forall(T & | sized(T))
     64int ?!=?(counter_ptr(T) const & this, zero_t);
    6065
    6166// This is the only pointer that keeps this alive.
    62 forall(T &) {
    63         struct unique_ptr {
    64                 T * data;
    65         };
     67forall(T &)
     68struct unique_ptr {
     69        T * data;
     70};
    6671
    67         void ?{}(unique_ptr(T) & this);
    68         void ?{}(unique_ptr(T) & this, zero_t);
    69         void ?{}(unique_ptr(T) & this, unique_ptr(T) that) = void;
    70         forall( | sized(T), Args... | { void ?{}(T &, Args); })
    71         void ?{}(unique_ptr(T) & this, Args args);
     72forall(T &)
     73void ?{}(unique_ptr(T) & this);
     74forall(T &)
     75void ?{}(unique_ptr(T) & this, zero_t);
     76forall(T &)
     77void ?{}(unique_ptr(T) & this, unique_ptr(T) that) = void;
     78forall(T & | sized(T), Args... | { void ?{}(T &, Args); })
     79void ?{}(unique_ptr(T) & this, Args args);
    7280
    73         forall( | { void ^?{}(T &); })
    74         void ^?{}(unique_ptr(T) & this);
     81forall(T & | { void ^?{}(T &); })
     82void ^?{}(unique_ptr(T) & this);
    7583
    76         T & *?(unique_ptr(T) & this);
     84forall(T & )
     85T & *?(unique_ptr(T) & this);
    7786
    78         void ?=?(unique_ptr(T) & this, unique_ptr(T) that) = void;
    79         forall( | { void ^?{}(T &); })
    80         void ?=?(unique_ptr(T) & this, zero_t);
     87forall(T &)
     88void ?=?(unique_ptr(T) & this, unique_ptr(T) that) = void;
     89forall(T & | { void ^?{}(T &); })
     90void ?=?(unique_ptr(T) & this, zero_t);
    8191
    82         forall( | { void ^?{}(T &); })
    83         void move(unique_ptr(T) & this, unique_ptr(T) & that);
     92forall(T & | { void ^?{}(T &); })
     93void move(unique_ptr(T) & this, unique_ptr(T) & that);
    8494
    85         int ?==?(unique_ptr(T) const & this, unique_ptr(T) const & that);
    86         int ?!=?(unique_ptr(T) const & this, unique_ptr(T) const & that);
    87         int ?==?(unique_ptr(T) const & this, zero_t);
    88         int ?!=?(unique_ptr(T) const & this, zero_t);
    89 }
     95forall(T &)
     96int ?==?(unique_ptr(T) const & this, unique_ptr(T) const & that);
     97forall(T &)
     98int ?!=?(unique_ptr(T) const & this, unique_ptr(T) const & that);
     99forall(T &)
     100int ?==?(unique_ptr(T) const & this, zero_t);
     101forall(T &)
     102int ?!=?(unique_ptr(T) const & this, zero_t);
Note: See TracChangeset for help on using the changeset viewer.