alexcrichton opened PR #5683 from remove-store-from-instance-pre to main:
This commit relaxes a requirement of the
InstancePreAPI, notably its construction viaLinker::instantiate_pre. Previously this function required aStore<T>to be present to be able to perform type-checking on the contents of the linker, and now this requirement has been removed.Items stored within a linker are either a
HostFunc, which has type information inside of it, or anExtern, which doesn't have type information inside of it. Due to the usage ofExternthis is why aStorewas required during theInstancePreconstruction process, it's used to extract the type of anExtern. This commit implements a solution where the type information of anExternis stored alongside theExternitself, meaning that theInstancePreconstruction process no longer requires aStore<T>.One caveat of this implementation is that some items, such as tables and memories, technically have a "dynamic type" where during type checking their current size is consulted to match against the minimum size required of an import. This no longer works when using
Linker::instantiate_preas the current size used is the one when it was inserted into the linker rather than the one available at instantiation time. It's hoped, however, that this is a relatively esoteric use case that doesn't impact many real-world users.Additionally note that this is an API-breaking change. Not only is the
Storeargument removed fromLinker::instantiate_pre, but some other methods such asLinker::definegrew aStoreargument as the type needs to be extracted when an item is inserted into a linker.Closes #5675
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
alexcrichton requested pchickey for a review on PR #5683.
alexcrichton updated PR #5683 from remove-store-from-instance-pre to main.
alexcrichton closed without merge PR #5683.
alexcrichton reopened PR #5683 from remove-store-from-instance-pre to main.
alexcrichton updated PR #5683 from remove-store-from-instance-pre to main.
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
/// Note that providing a `store` here is not required for correctness
alexcrichton updated PR #5683 from remove-store-from-instance-pre to main.
pchickey submitted PR review.
alexcrichton merged PR #5683.
Last updated: Dec 06 2025 at 06:05 UTC