-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(swingset): replace queueToExport to queueToKref
The internal `kernel.queueToExport(vatID, vref, method, args)` method will inject a message onto the run-queue from outside of any particular vat. It is used by `initializeKernel.js` to enqueue the bootstrap message, and by the vatAdmin device to notify the vatAdmin vat about vats finishing creation (and being terminated). To specify the target, you give it a `vatID` and a vref, and it pretends that that vat had exported the vref, returning the kref to the caller. This change replaces `queueToExport` with `queueToKref(kref, method, args)`, which does not perform the pretend vat export. Instead, it requires the caller to provide a pre-translated kref. You should use it in conjunction with `kernel.addExport`, which does the same pretend export that `queueToExport` used to do. The benefit to splitting this up is that we want better control over the GC reference count of the target. `addExport` may add an artificial "reachable" count, to keep the target alive. But `queueToKref` will not. To support this, we must stash the kref of the vatAdminRoot in the DB during initialization (just after the vatAdmin vat is defined), so it will be available without the (vatNameToID, `addExport`) lookup at runtime. Instead, the kernel loads this kref from the DB during startup, and passes it through to the vat loader which needs it. A handful of vatLoader endowments are no longer necessary. (note that storing this kref is optional, in that unit tests which don't bother to define any vats won't have it, but any real usage of swingset will require it to be in the DB as soon as the first dynamic vat is created) The 'policy' argument tells the kernel what to do if/when the automatically-added result promise is resolved. I added a `none` mode to prevent the creation of a result promise at all, which should help declutter a few unit tests. We're slowly migrating our terminology from "kernelSlot" and "vatSlot" to "kref" and "vref". I updated the functions that were touched in this work.
- Loading branch information
Showing
6 changed files
with
98 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.