Skip to content
Commit Detail

Commit 7b3f3ae

Author
Hood Chatham <roberthoodchatham@gmail.com> 2024-03-18 13:09:38 +0100
Parents
9d2956d
Tree
ebd29c2
Dedicated memory snapshots

This adds dedicated memory snapshots. It's pretty finicky how you load shared
libraries in a memory snapshot since their metadata needs to be allocated in the
same location whether starting from scratch or from the snapshot. The simplest
way to deal with it is to preload the libraries in a given order before the
runtime starts. This approach leaves us without a good way of figuring out which
ones are needed so we take a naive approach and preload all of them.

We then parse the user code into abstract syntax trees and look for import
nodes. We try to import all of these and catch and throw away if it fails.
Then we record which dynamic libraries have been dlopened and where the handles
are located. We put the handle data together with the heap snapshot.

This required pretty major surgery since some information about the packages is
needed much earlier than it was previously available. Some steps like
updating paths are not possible to do on the not-yet-initialized runtime and
have to be separated.

Files changed