View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000048||LDMud 3.5||Runtime||public||2004-04-03 12:09||2009-01-08 08:10|
|Summary||0000048: Use Root-Pointer table to avoid swapping objects during GC.|
|Description||Install a root-pointer table (hashed over the pointer targets) in which every entry has a refcount and a pointer to the associated target.|
For every entity referenced from a swapped out object (strings, mappings, vectors) establish a root-pointer entry pointing to the entity. The refcount counts how many of such external references exist to the entity.
This way during a GC it is no longer necessary to swap in all objects just in order to count the references - reducing the time and memory needed, and reducing the fragility of the GC process.
|Tags||No tags attached.|
Instead of 'root pointer' this should be called 'proxy'.
The module would offer two main methods:
proxy_t * handoff_ref (void * entity, int entity_type)
Hand the ownership of the reference to <entity> over to the proxy table, and receives the pointer to the proxy responsible in return.
void * retrieve_ref (proxy_t * root_ptr)
Retrieve the ownership of the reference to <entity> from the named proxy. The returned pointer to the <entity> can be different from the pointer the proxy was created for.
For this to work, the proxy_t would have to store the hash index in the proxy table.
This approach offers another benefit: once the proxy holds the only remaining reference to the entity, the entity could be swapped out. This way the complexity of the variable swapping in the swapper could be reduced, and at the same time more data becomes eligible for swapping. This could even be generalized to the normal program swapping.
Problematic however would be mappings (object/closure keys can get stale or require resorting), and maybe alists. Such entities would have to have a flag or special type (T_MAPPING | T_MOD_REF) so that the GC knows that it would have to swap these entities back in in order to remove the references to destructed objects. Without entity-swapping this wouldn't be a problem as such entities would stay resident (the swapper refuses to swap them out even if there is just one ref left).
Things to check first, before implementing the swapability: how many proxies would there be in a normal mud, and how many of these would be eligible for swapping? Also, add a time measurement to the GC.
|In order to do this, the program structure should be split into two parts (header and dynamic data) - this is already a TODO in exec.h .|
|The proxy module should also keep condensed string_t* and struct_type_t* tables, referenced from program_t* structures, to keep track of function names (always tabled) and structure references from swapped-out programs. Using the generic proxy types for this would incur too much overhead.|
||Note Added: 0000045|
||Note Added: 0000059|
||Note Added: 0000060|
|2009-01-08 08:10||zesstra||Project||LDMud 3.3 => LDMud 3.5|