Ah, one day i will find a way to charge employers for my sleeping hours.
Since they're often most productive.

I think I have found how to serialise the existing GC structures.

Each type has a RTTI method to serialise that type.
If there are pointers, it has to serialise them somehow too.

The deserialise method just unserialises the pointers.

So now, ignoring arrays, how to fix up the pointers?

The global serialise routine grabs pointers out of the
object and makes a record of their offsets and values.
The offsets are relative to the physically location in
a conceptually compacted store, i.e. if we serialise
three objects in a row, we just add the heap allocation
sizes of the prior objects.

So after adding the offset, pointer pairs to a list,
we call the actual serialisation function.

At the end we serialise the offset, pointer pairs list.

On decoding, we deserialise all the objects onto
the heap, and keep a list of "conceptual offset into
compacted store" and object pointer actually created
on the heap.

At the end we deserialise the old offset -> pointer mapping.

So now we have a bunch of objects on the heap, with all
the pointers at their old values, which are wrong.
So we run through all these new objects, looking at
the pointer offsets. For each object, we know the
"conceptual offset into compacted store".

The value is invariant: its the same for the same object
on serialisation and deserialisation. So now we can
find the new object identity, grab each of the old
pointers, look it up in the new mapping we created,
and replace the pointer with the new value.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to