コード例 #1
0
ファイル: gc.c プロジェクト: NoSuchProcess/phantomuserland
static int free_unmarked()
{
    void * start = get_pvm_object_space_start();
    void * end = get_pvm_object_space_end();
    void * curr;
    int freed = 0;
    for( curr = start; curr < end ; curr += ((pvm_object_storage_t *)curr)->_ah.exact_size )
    {
        pvm_object_storage_t * p = (pvm_object_storage_t *)curr;
        assert( p->_ah.object_start_marker == PVM_OBJECT_START_MARKER );

        if ( (p->_ah.gc_flags != gc_flags_last_generation) && ( p->_ah.alloc_flags != PVM_OBJECT_AH_ALLOCATOR_FLAG_FREE ) )  //touch not accessed but allocated objects
        {
            if( p->_flags & PHANTOM_OBJECT_STORAGE_FLAG_IS_FINALIZER )
            {
                // based on the assumption that finalizer is only valid for some internal childfree objects - is it correct?
                gc_finalizer_func_t  func = pvm_internal_classes[pvm_object_da( p->_class, class )->sys_table_id].finalizer;
                if (func != 0) func(p);
            }

            freed++;
            debug_catch_object("gc", p);
            p->_ah.refCount = 0;  // free now
            p->_ah.alloc_flags = PVM_OBJECT_AH_ALLOCATOR_FLAG_FREE; // free now
        }
    }
コード例 #2
0
ファイル: object.c プロジェクト: agileinsider/phantomuserland
static inline void verify_p( pvm_object_storage_t *p )
{
    debug_catch_object( "V", p );

    if( p && ! pvm_object_is_allocated_light(p))
    {
        dumpo((addr_t)p);
        //pvm_object_is_allocated_assert(p);
        panic("freed object accessed");
    }
}