Skip to content

Comments

Debugging: add unique-within-store IDs for every entity.#12645

Merged
cfallin merged 1 commit intobytecodealliance:mainfrom
cfallin:debugging-entity-ids
Feb 24, 2026
Merged

Debugging: add unique-within-store IDs for every entity.#12645
cfallin merged 1 commit intobytecodealliance:mainfrom
cfallin:debugging-entity-ids

Conversation

@cfallin
Copy link
Member

@cfallin cfallin commented Feb 24, 2026

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.

@cfallin cfallin requested a review from alexcrichton February 24, 2026 04:36
@cfallin cfallin requested a review from a team as a code owner February 24, 2026 04:36
@cfallin
Copy link
Member Author

cfallin commented Feb 24, 2026

(I'll note as an aside that this is I believe the last PR I need to the wasmtime crate to build a functional debugger top-half; all the rest of my work is in the debugger crate and the guest debugger component. Thanks for all the reviews so far!)

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Feb 24, 2026
@cfallin cfallin force-pushed the debugging-entity-ids branch from e260312 to ef232a1 Compare February 24, 2026 17:38
@cfallin cfallin enabled auto-merge February 24, 2026 17:39
@cfallin cfallin force-pushed the debugging-entity-ids branch from ef232a1 to 340efb8 Compare February 24, 2026 17:40
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.
@cfallin cfallin force-pushed the debugging-entity-ids branch from 340efb8 to bedbb50 Compare February 24, 2026 17:41
@cfallin cfallin added this pull request to the merge queue Feb 24, 2026
@cfallin
Copy link
Member Author

cfallin commented Feb 24, 2026

Just to record CI breakage for the record: this job in the merge queue is failing with

2026-02-24T17:57:36.054084Z  WARN oci_client::token_cache: Invalid bearer token error=Error(InvalidToken)
Error: registry error: HTTP status server error (503 Egress is over the account limit.) 

when trying to fetch WITs from a registry. I'll retry and see if it's ephemeral or if the limit reached is real.

@cfallin cfallin removed this pull request from the merge queue due to a manual request Feb 24, 2026
@cfallin cfallin added this pull request to the merge queue Feb 24, 2026
@cfallin
Copy link
Member Author

cfallin commented Feb 24, 2026

It's failing again here -- cc @alexcrichton @pchickey, it looks like we have CI blocked (just after all the security releases merged fortunately?) from wkg hitting an account limit. Should we delete the check for now?

@alexcrichton
Copy link
Member

Keep throwing it at the queue, we'll deal with the root cause later.

Merged via the queue into bytecodealliance:main with commit 7051ab3 Feb 24, 2026
45 checks passed
@cfallin cfallin deleted the debugging-entity-ids branch February 24, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants