alexcrichton opened PR #8758 from alexcrichton:make-module-id-globally-unique
to bytecodealliance:main
:
Currently all instances of
wasmtime::Module
have a unique 64-bit id embedded into them. This ID was originally only used for affinity in the pooling allocator as a quick check of module equality. This use case only required engine-local ids so the initial implementation had an ID allocator per-engine.Later, however, this id was reused for
wasmtime::ModuleExport
which was intended to skip the string lookup for an export at runtime. This also stored a module id but it did not store an engine identifier. This meant that it's possible to mix these up and pass the wrong export to the wrong engine. This behavior can lead to a runtime panic in Wasmtime.This commit fixes this by making the module identifier be global per-process instead of per-engine. This mirrors how store IDs are allocated where they're per-process instead of per-engine. The same logic for why store IDs are unlikely to be exhausted applies here too where this 64-bit space of identifiers is unlikely to be exhausted.
<!--
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
-->
alexcrichton requested fitzgen for a review on PR #8758.
alexcrichton requested wasmtime-core-reviewers for a review on PR #8758.
pchickey submitted PR review.
alexcrichton updated PR #8758.
alexcrichton has enabled auto merge for PR #8758.
alexcrichton updated PR #8758.
alexcrichton merged PR #8758.
Last updated: Nov 22 2024 at 17:03 UTC