Stream: git-wasmtime

Topic: wasmtime / PR #9122 Improve codegen for enums with many c...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:17):

alexcrichton opened PR #9122 from alexcrichton:better-enum-codegen to bytecodealliance:main:

This commit improves the compile time of generating bindings for enums with many cases in them (e.g. 1000+). This is done by optimizing for enums specifically rather than handling them generically like other variants which can reduce the amount of code going into rustc to O(1) instead of O(N) with the number of cases. This in turn can greatly reduce compile time.

The tradeoff made in this commit is that enums are now required to have #[repr(...)] annotations along with no Rust-level discriminants specified. This enables the use of a transmute to lift a discriminant into Rust with a simple bounds check. Previously this was one large match statement.

Closes #9081

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:17):

alexcrichton requested pchickey for a review on PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:17):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:28):

alexcrichton updated PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:29):

pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:31):

alexcrichton updated PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 20:32):

alexcrichton has enabled auto merge for PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 21:00):

alexcrichton updated PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 21:00):

alexcrichton has enabled auto merge for PR #9122.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 12 2024 at 21:24):

alexcrichton merged PR #9122.


Last updated: Nov 22 2024 at 16:03 UTC