Branch: Tag:

2017-11-11

2017-11-11 16:35:01 by Tobias S. Josefowitz <tobij@tobij.de>

GC: Inline markers into datastructures

Initial work is done. This may have worse performance characteristics
for now. Futher work will use the block allocator provided iterator
instead of linked lists to visit all objects and potentially optimize
the memory layout of the marker struct.

662:    /* we mark the string as static here, to avoid double free if the    * allocations fail    */ + #ifdef PIKE_DEBUG +  gc_init_marker(&t->m); + #endif    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    t->alloc_type = STRING_ALLOC_STATIC;    t->struct_type = STRING_STRUCT_STRING;
688:    enum size_shift shift)   {    struct pike_string * t = ba_alloc(&string_allocator); -  + #ifdef PIKE_DEBUG +  gc_init_marker(&t->m); + #endif    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    t->size_shift = shift;    t->alloc_type = STRING_ALLOC_STATIC;
738:       if (!s) {    s = ba_alloc(&string_allocator); + #ifdef PIKE_DEBUG +  gc_init_marker(&s->m); + #endif       s->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    s->size_shift = shift;
1879:    return existing;    }    res = ba_alloc(&substring_allocator); + #ifdef PIKE_DEBUG +  gc_init_marker(&res->str.m); + #endif    res->parent = s;    s->flags |= STRING_IS_LOCKED; /* Make sure the string data isn't reallocated. */    add_ref(s);