Currently pointers are stored in packed data as the offset from instance. This could be reworked to make patching a lot faster and simpler.
Currently patching is done by traversing the struct with stored type-info.
If the storeage instead was stored as x bits offset and y bits offset-to-next-pointer a simple loop as this could be used to patch pointers:
uint64 iter = instance->first_ptr;
while( iter & NEXT_MASK )
{
patch_pointer( iter, iter & OFFSET_MASK );
iter = iter + ( iter & NEXT_MASK );
}
this will however force instances to be less than 4GB on 64bit and less than 65kb on 32bit.
To begin with I'll save the old parse-code, set a flag in instance how the pointers is patched, and dispatch depending on that flag.
I guess that we could support a bit larger instances by shifting offset by 2 or 3 bits depending on ptr-size as offsets will always point to aligned data.
Still the instance-size on 32bit feel a bit small :/
Currently pointers are stored in packed data as the offset from instance. This could be reworked to make patching a lot faster and simpler. Currently patching is done by traversing the struct with stored type-info.
If the storeage instead was stored as x bits offset and y bits offset-to-next-pointer a simple loop as this could be used to patch pointers:
uint64 iter = instance->first_ptr; while( iter & NEXT_MASK ) { patch_pointer( iter, iter & OFFSET_MASK ); iter = iter + ( iter & NEXT_MASK ); }
this will however force instances to be less than 4GB on 64bit and less than 65kb on 32bit.
To begin with I'll save the old parse-code, set a flag in instance how the pointers is patched, and dispatch depending on that flag.