Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use vatIndex, not vatName, to index internal vat tables #193

Closed
warner opened this issue Sep 13, 2019 · 2 comments · Fixed by Agoric/SwingSet#157
Closed

use vatIndex, not vatName, to index internal vat tables #193

warner opened this issue Sep 13, 2019 · 2 comments · Fixed by Agoric/SwingSet#157
Labels
SwingSet package: SwingSet

Comments

@warner
Copy link
Member

warner commented Sep 13, 2019

In the current kernel, we use a string vatName everywhere we need to refer to a Vat. This includes the "owner" in the ObjectTable, the "Decider" in the PromiseTable, and the field in Notify deliveries that say which vat should be notified.

We should switch all of these to use an integer vatIndex instead, and have a single table that maps from vatIndex to vatName for diagnostics and debug messages. The vatManager should know the name, for the various debug prints it does, but should not use it for functional purposes.

This will help with #24 (dynamically-added vats), as we should not require the new vats to have unique names. It should also improve the space-efficiency of #54, as we'll use the vatIndex in the storage keys instead of the full vat name (the keys can start with vNN.).

We can still require that the initial "genesis vats" have unique names, and use those names in the vats object that the bootstrap vat receives (I'd rather not have the bootstrap code have to guess the order in which the genesis vats are added, and reference those vats by number instead of by name).

Devices should do the same thing, although I'm not sure whether they should share the same numberspace as vats (devices and vats are basically the same, but with different translation layers, and different syscalls supported). We might need to clean up the differences between them first. All devices must be present at startup (they are all "genesis devices").

@warner
Copy link
Member Author

warner commented Sep 13, 2019

For now, we track device nodes in the Device Table, and objects in the Object Table, and the (perhaps bad) rule is that devices can only export device nodes, and vats can only export objects. So the Device Table maps kernel device nodes (kdNN) to the owning device name, and the Object Table maps kernel object nodes (koNN) to the owning vat name.

So we can change this to use device index and vat index. The Device Table will map kdNN to dNN, and the Object Table will map koNN to vNN. The Promise Table entries for unresolved promises will have a "decider" of vNN, and the queued Notify entries will point at a vNN (because devices do not participate in Promises yet, so they don't need to be Notified, so the entries don't need to point at dNN yet, only vNN).

warner referenced this issue in warner/SwingSet Sep 19, 2019
.. as the index for kernel state data structures, instead of user-provided
vatName/deviceName strings. This will make it easier to use key/value state
storage (#144), since the keys will be more uniform (and shorter, and not
vulnerable to people using the separator string in their vat name).

Also it will make adding dynamic Vats easier (#19), as we'll just increment a
counter instead of asking the user to discover a unique name.

closes #146
warner referenced this issue in warner/SwingSet Sep 19, 2019
.. as the index for kernel state data structures, instead of user-provided
vatName/deviceName strings. This will make it easier to use key/value state
storage (#144), since the keys will be more uniform (and shorter, and not
vulnerable to people using the separator string in their vat name).

Also it will make adding dynamic Vats easier (#19), as we'll just increment a
counter instead of asking the user to discover a unique name.

closes #146
@warner
Copy link
Member Author

warner commented Dec 4, 2019

in the old repo. this was SwingSet issue 146

@warner warner transferred this issue from Agoric/SwingSet Dec 4, 2019
@warner warner added the SwingSet package: SwingSet label Dec 4, 2019
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant