Objects on the V8 heap use raw pointers to refer to other objects. When you 
restore the heap to memory addresses different than the original, you will 
have to update those references. V8 does have a snapshot mechanism that 
serializes the heap, but it has some limitations, e.g. for code objects.

Yang


On Wednesday, November 7, 2012 3:55:17 PM UTC+1, Gillis Van Ginderachter 
wrote:
>
> Hi,
>
> We're currently working on a project making the V8 engine persistent. So 
> the point of this project is that when your program (that uses V8 engine) 
> crashes, it will continue from the last saved checkpoint.
>
> To make this possible we make use of the Ken library (see 
> http://ai.eecs.umich.edu/~tpkelly/Ken/). The Ken library provides 
> abstractions for the presistent heap. So instead of using malloc and free, 
> the Ken library provides ken_malloc and ken_free to store memory on the 
> persistent heap.
>
> We've been digging in de V8 code already and examined how V8 does memory 
> management. Based on those examinations we've ported the code to use the 
> Ken library:
>
>    - the class VirtualMemory now uses the Ken back-end instead of mmap
>    - the new/delete operators also use the Ken back-end
>    - all malloc/free have been replaced with ken_malloc/ken_free
>
> So the whole V8 now uses the Ken back-end.
>
> There is one problem though. When the program restores from a crash the 
> default Isolate is restored together with the global object and the global 
> context. After that restore, variables are changed. So if I declared "a=1" 
> in the initial state, then crash the program and restart it, "a" suddenly 
> is a string. So restoring doesn't really work...
>
> This being said, we need your help. Is there a better way to make the V8 
> engine persistent? Something like persisting only the VirtualMemory, and 
> when restoring we rebuild the heap/gc or something?
>
> Thanks in advance,
> Gillis
>
> PS: the current code can be found on GitHub (see 
> https://github.com/supergillis/v8-ken)
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to