LuaSnap is now working based on eris (at least superficially).

This commit is contained in:
2021-03-01 18:10:40 -05:00
parent efebe39e08
commit 49df7b4895
3 changed files with 67 additions and 15 deletions

View File

@@ -6,17 +6,8 @@
// possible to roll the entire interpreter back to a previously-snapshotted
// state.
//
// To accomplish this, we take advantage of the 'allocf' parameter to
// lua_newstate. This lets us hook the lua allocator, which in turn lets us
// find every block of memory currently in use by lua. To snapshot, we 'memcpy'
// every block of memory that lua is using into a buffer. To rollback, we just
// 'memcpy' the data back.
//
// The current implementation is a proof-of-concept. It's quite wasteful of
// memory, roughly doubling the amount of RAM that LUA uses. It's also not
// super-fast, since it allocates tons of tiny blocks. But it totally
// works, so it demonstrate that this method of snapshot and rollback is
// feasible.
// To accomplish this, we use eris serialization. This is messy and not
// very modular, but it does work.
//
/////////////////////////////////////////////////////////////////////////////