Ignore:
Timestamp:
May 11, 2011, 1:26:19 AM (7 years ago)
Author:
Sam Hocevar
Message:

lisp: count how deep the garbage collector and the evaluator recurse. The
values are unused for now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/lisp/lisp_gc.cpp

    r636 r637  
    1616#include <string.h>
    1717
     18#include "common.h"
     19
    1820#include "lisp.h"
    1921#include "lisp_gc.h"
     
    4042
    4143static uint8_t *cstart, *cend, *collected_start, *collected_end;
     44static int gcdepth, maxgcdepth;
    4245
    4346LArray *Lisp::CollectArray(LArray *x)
     
    8386{
    8487    LObject *ret = x;
     88
     89    maxgcdepth = Max(maxgcdepth, ++gcdepth);
    8590
    8691    if ((uint8_t *)x >= cstart && (uint8_t *)x < cend)
     
    169174    }
    170175
     176    --gcdepth;
    171177    return ret;
    172178}
     
    207213void Lisp::CollectSpace(LSpace *which_space, int grow)
    208214{
    209     LSpace *old_space = LSpace::Current;
     215    LSpace *sp = LSpace::Current;
     216
     217    maxgcdepth = gcdepth = 0;
     218
    210219    cstart = which_space->m_data;
    211220    cend = which_space->m_free;
    212 
    213221    LSpace::Gc.m_size = which_space->m_size;
    214222    if (grow)
     
    227235    CollectStacks();
    228236
    229     // for debuging clear it out
    230     memset(which_space->m_data, 0, which_space->m_size);
    231237    free(which_space->m_data);
    232 
    233238    which_space->m_data = new_data;
    234239    which_space->m_size = LSpace::Gc.m_size;
    235240    which_space->m_free = new_data + (LSpace::Gc.m_free - LSpace::Gc.m_data);
    236     LSpace::Current = old_space;
    237 }
    238 
     241
     242    LSpace::Current = sp;
     243}
     244
Note: See TracChangeset for help on using the changeset viewer.