Changeset 04570c7 for src/Common/GC.h


Ignore:
Timestamp:
Apr 13, 2018, 4:39:28 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
6f81db3
Parents:
3205495
git-author:
Aaron Moss <a3moss@…> (04/13/18 16:27:11)
git-committer:
Aaron Moss <a3moss@…> (04/13/18 16:39:28)
Message:

First draft of arbitrarily-generational GC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/GC.h

    r3205495 r04570c7  
    3838        void register_static_root(BaseSyntaxNode*);
    3939
    40         /// Use young generation for subsequent new objects
     40        /// Start new generation for subsequent new objects
    4141        void new_generation();
    4242
     
    4444        void trace_static_roots();
    4545
    46         /// Collects the young generation, placing survivors in old generation.
    47         /// Old generation is used for subsequent new objects.
     46        /// Collects the youngest generation, placing survivors in previous generation.
     47        /// Young generation objects cannot be kept alive by pointers from older generation.
     48        /// Older generation is used for subsequent new objects.
    4849        void collect_young();
    4950
    50         /// Collects old generation; use old generation afterward.
    51         /// Error if currently using young generation
     51        /// Collects oldest generation; use oldest generation afterward.
     52        /// Error if currently using younger generation
    5253        void collect();
    5354
     
    5859        GC();
    5960
    60         bool mark;                 ///< The current collection's mark bit
    61         bool using_young;          ///< Is the young generation in use?
    62 
    6361        using Generation = std::vector<GC_Object*>;
    64         Generation old;            ///< Old generation
    65         Generation young;          ///< Young generation
     62        std::vector<Generation> gens;  ///< Set of generations; always at least one
    6663
    6764        using StaticRoots = std::vector<BaseSyntaxNode*>;
    68         StaticRoots static_roots;  ///< Set of static-lifetime roots
     65        StaticRoots static_roots;      ///< Set of static-lifetime roots
     66
     67        bool mark;                     ///< The current collection's mark bit
     68        unsigned g;                    ///< The current number generation in use
    6969};
    7070
Note: See TracChangeset for help on using the changeset viewer.