Stream: git-wasmtime

Topic: wasmtime / PR #11371 Add `CompiledCodeStencil` to public ...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 17:47):

suprohub opened PR #11371 from suprohub:main to bytecodealliance:main:

<!--
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
-->

Crate TargetIsa have method compile_function, what return type is CodegenResult<CompiledCodeStencil>.
CompiledCodeStencil is not public exported, so i just cant use this crate for custom external isa..

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 17:47):

suprohub requested fitzgen for a review on PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 17:47):

suprohub requested wasmtime-compiler-reviewers for a review on PR #11371.

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

bjorn3 commented on PR #11371:

Do you actually need to implement TargetIsa? Most of the backend framework is still private with this PR. So I think you did either want to fork Cranelift and use the backend framework, or you avoid TargetIsa entirely.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 18:19):

suprohub commented on PR #11371:

Do you actually need to implement TargetIsa? Most of the backend framework is still private with this PR. So I think you did either want to fork Cranelift and use the backend framework, or you avoid TargetIsa entirely.

Yes, i actually need to implement TargetIsa, and i need implement this externally.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 18:20):

suprohub edited a comment on PR #11371:

Do you actually need to implement TargetIsa? Most of the backend framework is still private with this PR. So I think you did either want to fork Cranelift and use the backend framework, or you avoid TargetIsa entirely.

Yes, i actually need to implement TargetIsa, and i need implement this externally.
&dyn TargetIsa often used in many places.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 18:20):

suprohub edited a comment on PR #11371:

Do you actually need to implement TargetIsa? Most of the backend framework is still private with this PR. So I think you did either want to fork Cranelift and use the backend framework, or you avoid TargetIsa entirely.

Yes, i actually need to implement TargetIsa, and i need implement this externally.
&dyn TargetIsa often used in many places. Also, Module needs TargetIsa too.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2025 at 18:31):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 08:15):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 08:20):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 11:08):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 11:14):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 11:20):

bjorn3 commented on PR #11371:

You are slowly exposing basically the entire backend framework to end users. The backend framework is highly unstable and should definitively not be re-exported in the root of the cranelift-codegen crate.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 11:21):

bjorn3 commented on PR #11371:

Does the [patch.crates-io] section in Cargo.toml for replacing cranelift-codegen with a version you patched yourself to include your extra backend not work? You are going to have to change your backend every Cranelift version anyway if you are depending on these unstable implementation details.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 11:58):

suprohub commented on PR #11371:

You are slowly exposing basically the entire backend framework to end users. The backend framework is highly unstable and should definitively not be re-exported in the root of the cranelift-codegen crate.

Yeah, you are right. This is not cool

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

suprohub commented on PR #11371:

Does the [patch.crates-io] section in Cargo.toml for replacing cranelift-codegen with a version you patched yourself to include your extra backend not work? You are going to have to change your backend every Cranelift version anyway if you are depending on these unstable implementation details.

But how i can use this unstable api? I very need custom implementation for TargetIsa and MachInst

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 12:01):

suprohub edited a comment on PR #11371:

Does the [patch.crates-io] section in Cargo.toml for replacing cranelift-codegen with a version you patched yourself to include your extra backend not work? You are going to have to change your backend every Cranelift version anyway if you are depending on these unstable implementation details.

But how i can use this unstable api? I very need custom implementation for TargetIsa and MachInst.
I need use it as external crate, because i dont want all features from cranelift, only codegen api.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 12:03):

suprohub updated PR #11371.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 12:04):

suprohub edited a comment on PR #11371:

Does the [patch.crates-io] section in Cargo.toml for replacing cranelift-codegen with a version you patched yourself to include your extra backend not work? You are going to have to change your backend every Cranelift version anyway if you are depending on these unstable implementation details.

But how i can use this unstable api? I very need custom implementation for TargetIsa and maybe MachInst.
I need use it as external crate, because i dont want all features from cranelift, only codegen api.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 12:05):

suprohub commented on PR #11371:

Ok, i make only one field public and export CompiledCodeStencil for implement TargetIsa

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

suprohub edited a comment on PR #11371:

Ok, i make only one field public and export CompiledCodeStencil for implement TargetIsa. But i very need MachBuffer what requires MachInst implementation

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 16:08):

cfallin commented on PR #11371:

@suprohub Thanks for the PR; unfortunately, as bjorn3 has said, these are all internal compiler implementation details and will not be exposed. Aside from the types you would need to export to make this work, there is the ISLE DSL, which doesn't have a cross-crate linking story right now; it uses libraries (the "prelude") via inclusion, so we would need to bundle the prelude source code in cranelift-codegen and export it as text, or factor it to a separate crate (which is much more awkward for work within cranelift-codegen), or something like that. But in general this is exposing a bunch of internals, and we don't make any public promises about the stability of those details across releases; nor do we make any promises about safety or correctness if they are used in the wrong way. Maintaining this freedom to refactor, this standard of correctness, and a clean coherent public interface, are all reasons why we have chosen not to expose these things.

If you want to maintain your own Cranelift backend, the canonical path is to fork; at some point if you would like to upstream a backend, if it is of general interest and the maintenance support is there, we could discuss it.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2025 at 16:08):

cfallin closed without merge PR #11371.


Last updated: Dec 06 2025 at 06:05 UTC