Debugging: add unique-within-store IDs for every entity.#12645
Merged
cfallin merged 1 commit intobytecodealliance:mainfrom Feb 24, 2026
Merged
Debugging: add unique-within-store IDs for every entity.#12645cfallin merged 1 commit intobytecodealliance:mainfrom
cfallin merged 1 commit intobytecodealliance:mainfrom
Conversation
Member
Author
|
(I'll note as an aside that this is I believe the last PR I need to the |
alexcrichton
approved these changes
Feb 24, 2026
e260312 to
ef232a1
Compare
ef232a1 to
340efb8
Compare
When building an introspection API for use by a debugger, we need a way to expose *identity*: that is, to give some way of knowing that a given `Memory`, `Instance`, etc. is *this* one and not *that* one. Our handle types variously have either `Eq` implementations or e.g. `Module::same` for the ones that wrap an `Arc` under-the-covers; but that's not enough to allow a debugger to e.g. build a hashmap for whatever metadata that it might expose via whatever debugging protocol. For maximal generality and flexibility, we should expose the unique IDs that already more-or-less exist: for instances, that is their instance ID directly; for entities owned by instances, we can build a `u64` with the instance ID in the upper 32 bits and the defined-index in the lower 32 bits. IDs for all entities except modules are unique-within-a-Store (and this is all that is needed); IDs for modules happen to reuse the `CompiledModuleId` and so are unique-within-an-Engine. I've opted to name these `debug_index_within_store` to scope the feature and intended use-case clearly, but if there's a desire, I could easily rename them to simply `index`. I shied away from that here because I didn't want to give a notion that these indices are somehow canonical or correspond to some order or other.
340efb8 to
bedbb50
Compare
Member
Author
|
Just to record CI breakage for the record: this job in the merge queue is failing with when trying to fetch WITs from a registry. I'll retry and see if it's ephemeral or if the limit reached is real. |
Member
Author
|
It's failing again here -- cc @alexcrichton @pchickey, it looks like we have CI blocked (just after all the security releases merged fortunately?) from |
Member
|
Keep throwing it at the queue, we'll deal with the root cause later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When building an introspection API for use by a debugger, we need a way to expose identity: that is, to give some way of knowing that a given
Memory,Instance, etc. is this one and not that one. Our handle types variously have eitherEqimplementations or e.g.Module::samefor the ones that wrap anArcunder-the-covers; but that's not enough to allow a debugger to e.g. build a hashmap for whatever metadata that it might expose via whatever debugging protocol.For maximal generality and flexibility, we should expose the unique IDs that already more-or-less exist: for instances, that is their instance ID directly; for entities owned by instances, we can build a
u64with the instance ID in the upper 32 bits and the defined-index in the lower 32 bits. IDs for all entities except modules are unique-within-a-Store (and this is all that is needed); IDs for modules happen to reuse theCompiledModuleIdand so are unique-within-an-Engine.I've opted to name these
debug_index_within_storeto scope the feature and intended use-case clearly, but if there's a desire, I could easily rename them to simplyindex. I shied away from that here because I didn't want to give a notion that these indices are somehow canonical or correspond to some order or other.