コード例 #1
0
ファイル: gc.c プロジェクト: Han40/spamOSEK
void mark (Object *obj)
{
    if (obj == JNULL)
        return;

#ifdef VERIFY_GC
    assert (is_allocated (obj), GC0);
#endif

    if (is_gc_marked (obj))
        return;
    set_gc_marked (obj);
    if (is_array (obj))
    {
        if (get_element_type (obj) == T_REFERENCE)
        {
            unsigned short i;
            unsigned short length = get_array_length (obj);
            REFERENCE *refarr = ref_array (obj);

            for (i = 0; i < length; i++)
                mark (refarr[i]);
        }
    }
    else
    {
        ClassRecord *classRecord;
        byte classIndex;

        classIndex = get_na_class_index (obj);
        for (;;)
        {
            classRecord = get_class_record (classIndex);
            // Mark fields of type REFERENCE.
            mark_reference_fields (obj, classRecord);
            if (classIndex == JAVA_LANG_OBJECT)
                break;
            classIndex = classRecord -> parentClass;
        }
    }
}
コード例 #2
0
inline void oopDesc::follow_contents() {
  assert (is_gc_marked(), "should be marked");
  blueprint()->oop_follow_contents(this);
}