Changeset bd06384 for src/Common/GC.cc


Ignore:
Timestamp:
Mar 22, 2018, 4:49:53 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
dbc2c2c
Parents:
7e4b44db
Message:

Add static roots to GC; fix some static GC_Objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/GC.cc

    r7e4b44db rbd06384  
    1616#include "GC.h"
    1717
     18#include "Common/PassVisitor.h"
     19
     20#include "SynTree/GcTracer.h"
     21
    1822#include <algorithm>
    1923#include <cassert>
     
    2428}
    2529
    26 GC::GC() : mark(false), old(), young(), using_young(false) {
     30GC::GC() : mark(false), using_young(false), old(), young(), static_roots() {
    2731        old.reserve(70000);
    2832}
     
    5559}
    5660
     61void GC::register_static_root(BaseSyntaxNode* root) {
     62        static_roots.push_back(root);
     63}
     64
    5765void GC::new_generation() {
    5866        using_young = true;
     67}
     68
     69void GC::trace_static_roots() {
     70        PassVisitor<GcTracer> tracer{ *this };
     71        for ( BaseSyntaxNode* root : static_roots ) {
     72                root->accept( tracer );
     73        }
    5974}
    6075
Note: See TracChangeset for help on using the changeset viewer.