Changeset 34dcc474


Ignore:
Timestamp:
Apr 11, 2018, 4:24:06 PM (4 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
09a1ae6
Parents:
9f2012f
Message:

Fix one GC tracing bug

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/GC.cc

    r9f2012f r34dcc474  
    2222#include <algorithm>
    2323#include <cassert>
     24
     25// #include <csignal>
    2426
    2527GC& GC::get() {
     
    5557
    5658void GC::register_object(GC_Object* obj) {
     59        // if ( obj == (GC_Object*)0x60f00000e410ul ) std::raise( SIGTRAP );
    5760        (using_young ? young : old).push_back(obj);
    58         obj->mark = this->mark;
     61        obj->mark = ! this->mark;  // initialize as un-marked
    5962}
    6063
     
    105108        for ( GC_Object*& obj : old ) {
    106109                if ( obj->mark != mark ) {
     110                        // if ( obj == (GC_Object*)0x60f00000e410ul ) std::raise( SIGTRAP );
    107111                        delete obj;
    108112                        obj = nullptr;
  • src/SynTree/GcTracer.h

    r9f2012f r34dcc474  
    3434        GcTracer( const GC& gc ) : gc(gc) {}
    3535
     36        // mark node and children
     37
    3638        void previsit( BaseSyntaxNode * node ) {
    3739                // skip tree if already seen
     
    4547        }
    4648
     49        // add visits left out by PassVisitor
     50
    4751        void postvisit( Expression* expr ) {
    4852                maybeAccept( expr->env, *visitor );
     53        }
     54
     55        void postvisit( UntypedExpr* expr ) {
     56                postvisit( static_cast<Expression*>(expr) );
     57                maybeAccept( expr->function, *visitor );
    4958        }
    5059
Note: See TracChangeset for help on using the changeset viewer.