Stream: git-wasmtime

Topic: wasmtime / PR #12805 Enable gc feature by default


view this post on Zulip Wasmtime GitHub notifications bot (Mar 19 2026 at 22:51):

tolumide-ng requested wasmtime-core-reviewers for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 19 2026 at 22:51):

tolumide-ng requested cfallin for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 19 2026 at 22:51):

tolumide-ng opened PR #12805 from tolumide-ng:fix/wasmtime-c-api-gc-update to bytecodealliance:main:

The c-api crate currently enables the gc feature on its wasmtime dependency, even though it exposes a gc feature to control this behaviour. This prevents downstream users from disabling gc, since Cargo.toml doesn't allow overriding it. However, structs like RootScope are only available when gc is enabled. Removing it from default features, without other options, would break internal implementations.

Changes

  1. Enable the gc feature via the wasmtime-c-api crate by default.
  2. Removes the explicitly set gc feature for the wasmtime dependency in c-api, thus enabling downstream users to specify this behaviour.

Closes https://github.com/bytecodealliance/wasmtime/issues/12783

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2026 at 02:32):

github-actions[bot] added the label wasmtime:c-api on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2026 at 05:41):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2026 at 05:41):

alexcrichton created PR review comment:

Oh for this the default feature lives here instead which includes gc, so I think it's reasonable to just from [dependencies]

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 00:13):

tolumide-ng requested wasmtime-default-reviewers for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 00:13):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 01:31):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 01:31):

tolumide-ng created PR review comment:

Thank you for your response @alexcrichton, I am missing part of your suggestion here. Do you mean removing gc as a default feature in' wasmtime/Cargo. toml' and adding #[cfg(feature = "gc")] to the affected parts?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 01:31):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2026 at 01:40):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 23 2026 at 12:09):

tolumide-ng requested alexcrichton for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2026 at 14:43):

alexcrichton created PR review comment:

We generally prefer to avoid having conditionally-noop functions like this, so this'll want some different treatment to handle the GC feature being disabled. The general shape of things is:

That way when the gc feature is disabled the functions "disappear" as opposed to being present but not actually doing anything (which can be confusing). Would you be up for refactoring in that style?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2026 at 14:43):

alexcrichton created PR review comment:

This is an example file where when gc is disabled the entire module may wish to disappear vs having lots of #[cfg] internally.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2026 at 14:43):

alexcrichton created PR review comment:

I feel it would be best to avoid the duplication here (and in a number of locations). Handling this will be a bit tricky though due to to_val wanting a RootScope. Thinking a bit about this, I think a way to thread this needle would be:

how's that sound?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2026 at 14:43):

alexcrichton submitted PR review:

Returning now from vacation, thanks for your patience @tolumide-ng. Also I'll apologize that the scope of this issue is broadening to be a bit larger than I had originally anticipated. I thought there would be some minor edits required to get the c-api building without GC, but there's a number of API design decisions to make here which affect how exactly this works. I'm happy to help guide through these, but if you feel this is getting too broad in scope that's also totally fine.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2026 at 21:32):

tolumide-ng commented on PR #12805:

Returning now from vacation, thanks for your patience @tolumide-ng. Also I'll apologize that the scope of this issue is broadening to be a bit larger than I had originally anticipated. I thought there would be some minor edits required to get the c-api building without GC, but there's a number of API design decisions to make here which affect how exactly this works. I'm happy to help guide through these, but if you feel this is getting too broad in scope that's also totally fine.

Welcome back from your holiday @alexcrichton, and thank you for the review.
I'm happy to continue with the expanded scope. It looks like an informative introduction to the codebase.
I'd definitely appreciate your guidance as questions come up.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 20:37):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 20:49):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 21:26):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:32):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:38):

tolumide-ng created PR review comment:

This makes sense. I'd do that

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:38):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:44):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:45):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 22:54):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2026 at 23:06):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2026 at 22:13):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2026 at 22:13):

tolumide-ng created PR review comment:

Yes, done. Thank you

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2026 at 22:21):

tolumide-ng created PR review comment:

I'm not exactly sure what you mean here. There are some functions where the gc feature does not apply, and some other modules depend on the macros. I'd be happy to retry with more clarification.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2026 at 22:21):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2026 at 22:22):

tolumide-ng requested alexcrichton for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton created PR review comment:

Similar to above, this entire AnyRef type is safe to go away when GC is disabled

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton created PR review comment:

For this the entire ExternRef type should be #define'd away when GC is disabled

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton created PR review comment:

This #ifdef should be fine to extend to this entire struct block as ExternRef will go away when GC is disabled.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton created PR review comment:

Ah what I mean is placing #![cfg(feature = "gc")] at the top of this file to avoid compiling the entire file when the gc feature is disabled. Everything in here looks GC-related so should be fine to omit when gc is disabled. What are the errors you're seeing though about other modules depending on this? Perhaps those dependencies should also be #[cfg]'d?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 16:21):

alexcrichton created PR review comment:

For this you can use one #ifdef for an entire group of functions, e.g. everything related to externref and anyref, and both of those types' functions should be entirely gone when the GC feature is disabled

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 20:41):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 20:54):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 21:55):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2026 at 21:55):

tolumide-ng created PR review comment:

Thank you for the clarification. The errors mostly emanate from:

  1. crates/c-api/src/table.rs:2:82 where it's mostly used as fn arguments or return types.
  2. crates/c-api/src/val.rs:3:43 where wasm_val_union has *mut wasm_ref_t in its fields.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 12:01):

tolumide-ng edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 12:02):

tolumide-ng requested alexcrichton for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 14:24):

alexcrichton submitted PR review:

It looks like some merge conflicts have cropped up as well, I'd recommend rebasing and seeing how to resolve those as well.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 14:24):

alexcrichton created PR review comment:

For table.rs that's ok to exclude those functions when GC is disabled, and for val.rs the union will have fewer fields when GC is disabled and that's ok, too.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 14:24):

alexcrichton created PR review comment:

Would it be possible to make the definition of wasmtime_{any,extern}ref_t conditional based on WASMTIME_FEATURE_GC?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 15:24):

tolumide-ng submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 15:24):

tolumide-ng created PR review comment:

I'd update this right away, thank you

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 18:12):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 18:29):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 19:02):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 19:39):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 20:06):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 20:16):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 20:33):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 21:06):

tolumide-ng updated PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2026 at 21:45):

tolumide-ng requested alexcrichton for a review on PR #12805.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2026 at 18:01):

alexcrichton submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2026 at 18:01):

alexcrichton added PR #12805 Enable gc feature by default to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2026 at 18:25):

github-merge-queue[bot] removed PR #12805 Enable gc feature by default from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2026 at 19:30):

tolumide-ng commented on PR #12805:

Thanks!

You're welcome. Thank you for the reviews and your patience.


Last updated: Apr 13 2026 at 00:25 UTC