fitzgen opened PR #7969 from fitzgen:no-lock-to-clone-drop-registered-type
to bytecodealliance:main
:
By moving the registration count into the
Arc
, that is pulling theArc
outwards from containing just theWasmFuncType
to the registration count as well, and turning it into an atomic, we can manipulate the registration count without a write lock. Once that is done, we have the following:
RegisteredType::root
only needs a read lock, not a write lock.
RegisteredType::clone
, which used to need a write lock, doesn't need any locking anymore.
RegisteredType::drop
doesn't need any locking most of the time. The exception is when this is this drop that moves the refcount to zero, in which case grabbing a write lock is still necessary to remove the type from the registry.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested alexcrichton for a review on PR #7969.
fitzgen requested wasmtime-core-reviewers for a review on PR #7969.
fitzgen updated PR #7969.
alexcrichton submitted PR review.
alexcrichton merged PR #7969.
Last updated: Nov 22 2024 at 16:03 UTC