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

prepare for GC: several kernel refactorings #3225

Merged
merged 6 commits into from
Jun 3, 2021
Merged

Conversation

warner
Copy link
Member

@warner warner commented Jun 1, 2021

This refactors a number of kernel pieces in preparation for landing GC features. I recommend reviewing this one commit at a time.

  • tolerate missing result promise: don't decrementRefCount a message result promise if we know the value is undefined
  • factor out the parsing and creation of the "reachable+vatSlot" string used as the value of kernelDB c-list kernel-to-vat entries
  • improve addKernelObject for unit tests, and add deleteKernelObject
  • add an admittedly lazy+inefficient implementation of kernelKeeper.getImporters (add kernelKeeper index to efficiently track the importing vats of each kernel object #3223 is the plan to make it better, but I think with <30 vats it's probably sufficient for the next few weeks)
  • refactor kernel.run()/step() to use a new getNextMessage(), in preparation for executing GC actions before anything on the run-queue

refs #3106

@warner warner added the SwingSet package: SwingSet label Jun 1, 2021
@warner warner added this to the Testnet: Stress Test Phase milestone Jun 1, 2021
@warner warner requested a review from FUDCo June 1, 2021 05:56
@warner warner self-assigned this Jun 1, 2021
@warner warner force-pushed the log-vat-termination-problem branch from 5502caa to 5581286 Compare June 2, 2021 05:44
Copy link
Contributor

@FUDCo FUDCo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks reasonable.

To simplify kernelKeeper, I'm going to remove its tolerance for spurious
calls (when the `kref` argument it receives is `undefined`). To prepare, this
changes the two places that previously might have called it with `undefined`
to refrain from calling it all all in that case.

refs #2946
The c-list kernel-to-vat direction uses a value that holds a composite of a
"isReachable" flag and the actual vref. This refactors the handling of this
composite value to make it easier for upcoming code to query the isReachable
status.

refs #3108
The kernelKeeper `addKernelObject` method was updated to accept an `id=`
override, to simplify some upcoming unit tests. `deleteKernelObject` was
added, which isn't called yet but the upcoming GC changes will invoke it when
GC allows a kernel object to be deleted. It's also a placeholder for #2069
auxdata to be deleted.
This function takes an object kref and returns a list of vatIDs which have
imported that object. As mentioned in #3223, this would be more efficient
with an index.
Rather than going directly to the run-queue, this changes `kernel.step()` and
`kernel.run()` to use a new `getNextMessage()` function. This will give us a
clean place to sample the new (higher-priority) GC Actions queue before
inspecting the run-queue. For now, no behavior is changed.
Many operations that previously finished in a single crank will start to need
additional cranks soon, when we begin processing GC actions before servicing
the run-queue. This patch anticipates these new GC actions by changing
several tests to use `c.run()` (which drains both queues) instead of
`c.step()` which does just a single crank).
Base automatically changed from log-vat-termination-problem to master June 3, 2021 08:15
@warner warner merged commit b6712ac into master Jun 3, 2021
@warner warner deleted the 3109-prep-refactor branch June 3, 2021 08:47
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 this pull request may close these issues.

2 participants