suprohub opened PR #11371 from suprohub:main to bytecodealliance:main:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->Crate
TargetIsahave methodcompile_function, what return type isCodegenResult<CompiledCodeStencil>.
CompiledCodeStencilis not public exported, so i just cant use this crate for custom external isa..
suprohub requested fitzgen for a review on PR #11371.
suprohub requested wasmtime-compiler-reviewers for a review on PR #11371.
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 avoidTargetIsaentirely.
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 avoidTargetIsaentirely.Yes, i actually need to implement
TargetIsa, and i need implement this externally.
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 avoidTargetIsaentirely.Yes, i actually need to implement
TargetIsa, and i need implement this externally.
&dyn TargetIsa often used in many places.
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 avoidTargetIsaentirely.Yes, i actually need to implement
TargetIsa, and i need implement this externally.
&dyn TargetIsa often used in many places. Also,Moduleneeds TargetIsa too.
suprohub updated PR #11371.
suprohub updated PR #11371.
suprohub updated PR #11371.
suprohub updated PR #11371.
suprohub updated PR #11371.
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.
bjorn3 commented on PR #11371:
Does the
[patch.crates-io]section inCargo.tomlfor 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.
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
suprohub commented on PR #11371:
Does the
[patch.crates-io]section inCargo.tomlfor 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
TargetIsaandMachInst
suprohub edited a comment on PR #11371:
Does the
[patch.crates-io]section inCargo.tomlfor 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
TargetIsaandMachInst.
I need use it as external crate, because i dont want all features from cranelift, only codegen api.
suprohub updated PR #11371.
suprohub edited a comment on PR #11371:
Does the
[patch.crates-io]section inCargo.tomlfor 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
TargetIsaand maybeMachInst.
I need use it as external crate, because i dont want all features from cranelift, only codegen api.
suprohub commented on PR #11371:
Ok, i make only one field public and export
CompiledCodeStencilfor implementTargetIsa
suprohub edited a comment on PR #11371:
Ok, i make only one field public and export
CompiledCodeStencilfor implementTargetIsa. But i very needMachBufferwhat requiresMachInstimplementation
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-codegenand export it as text, or factor it to a separate crate (which is much more awkward for work withincranelift-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.
cfallin closed without merge PR #11371.
Last updated: Dec 06 2025 at 06:05 UTC