Skip to content

Make RegisteredType hold a whole Engine#7920

Merged
fitzgen merged 1 commit intobytecodealliance:mainfrom
fitzgen:registry-in-engine-directly
Feb 12, 2024
Merged

Make RegisteredType hold a whole Engine#7920
fitzgen merged 1 commit intobytecodealliance:mainfrom
fitzgen:registry-in-engine-directly

Conversation

@fitzgen
Copy link
Member

@fitzgen fitzgen commented Feb 12, 2024

Rather than an Arc<RwLock<TypeRegistryInner>>.

This also removes the Arc inside TypeRegistry and we effectively reuse Engine's internal Arc instead.

Also, to avoid various TypeRegistry methods needing to take an Engine to construct their RegisteredType results, but then needing to assert that the given engine is this registry's engine, I turned the methods into TypeRegistry constructors. These constructors take just an &Engine and then access the underlying TypeRegistry as needed, effectively making that property hold statically.

This is a minor clean up on its own, but is a big help for follow up work I am doing for Wasm GC and typed function references, where being able to grab a reference to the engine that a FuncType is registered within will prevent needing to thread in additional engine parameters to various places and then assert that the engine is the engine that the type is registered within, and etc...

Rather than an `Arc<RwLock<TypeRegistryInner>>`.

This also removes the `Arc` inside `TypeRegistry` and we effectively reuse
`Engine`'s internal `Arc` instead.

Also, to avoid various `TypeRegistry` methods needing to take an `Engine` to
construct their `RegisteredType` results, but then needing to assert that the
given engine is this registry's engine, I turned the methods into `TypeRegistry`
constructors. These constructors take just an `&Engine` and then access the
underlying `TypeRegistry` as needed, effectively making that property hold
statically.

This is a minor clean up on its own, but is a big help for follow up work I am
doing for Wasm GC and typed function references, where being able to grab a
reference to the engine that a `FuncType` is registered within will prevent
needing to thread in additional engine parameters to various places and then
assert that the engine is the engine that the type is registered within, and
etc...
@fitzgen fitzgen requested a review from a team as a code owner February 12, 2024 19:32
@fitzgen fitzgen requested review from alexcrichton and removed request for a team February 12, 2024 19:32
@fitzgen fitzgen enabled auto-merge February 12, 2024 19:40
@fitzgen fitzgen added this pull request to the merge queue Feb 12, 2024
Merged via the queue into bytecodealliance:main with commit 9003f13 Feb 12, 2024
@fitzgen fitzgen deleted the registry-in-engine-directly branch February 12, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants