Skip to content

Don't pass module into initialize_vmctx#12412

Merged
fitzgen merged 2 commits intobytecodealliance:mainfrom
fitzgen:dont-pass-module-to-initialize-vmctx
Jan 23, 2026
Merged

Don't pass module into initialize_vmctx#12412
fitzgen merged 2 commits intobytecodealliance:mainfrom
fitzgen:dont-pass-module-to-initialize-vmctx

Conversation

@fitzgen
Copy link
Copy Markdown
Member

@fitzgen fitzgen commented Jan 23, 2026

Get it from self, which means we can't ever pass in the wrong module.

Get it from `self`, which means we can't ever pass in the wrong module.
@fitzgen fitzgen requested a review from a team as a code owner January 23, 2026 20:24
@fitzgen fitzgen requested review from dicej and removed request for a team January 23, 2026 20:24
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this is to avoid the Arc::clone which can be pretty hotly contested here since if many threads instantiate the same module/component that'll cause lots of incs/decs on the same memory location. Historically I don't recall this being a problem here exactly, but we have at least one bug report showing a 30% slowdown in throughput for an optimized host function if we include an Arc::clone by accident.

Instead of a clone, however, how about something like what components do?

@fitzgen fitzgen requested a review from alexcrichton January 23, 2026 21:02
@fitzgen fitzgen added this pull request to the merge queue Jan 23, 2026
Merged via the queue into bytecodealliance:main with commit f1797bb Jan 23, 2026
45 checks passed
@fitzgen fitzgen deleted the dont-pass-module-to-initialize-vmctx branch January 23, 2026 22:00
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