stopping and restarting the vm

This commit is contained in:
minjaesong
2022-12-14 21:02:14 +09:00
parent 45dd5be3f2
commit 77f0c77723
2 changed files with 24 additions and 10 deletions

View File

@@ -79,14 +79,22 @@ class VM(
contexts.clear()
}
/**
* Makes the VM stop suddenly without disposing of.
*/
fun park() {
killAllContexts()
startTime = -1
}
fun init() {
killAllContexts()
startTime = System.currentTimeMillis()
usermem.fillWith(0)
mallocMap.clear()
mallocSizes.clear()
allocatedBlockCount = 0
startTime = System.currentTimeMillis()
}
@@ -115,6 +123,7 @@ class VM(
disposed = true
}
/**
* To check if the VM has started, check if startTime >= 0
*/