Stream: git-wasmtime

Topic: wasmtime / Issue #2285 Define a textual representation of...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2020 at 12:26):

bjorn3 opened Issue #2285:

<!-- Please try to describe precisely what you would like to do in
Cranelift/Wasmtime and/or expect from it. You can answer the questions below if
they're relevant and delete this text before submitting. Thanks for opening an
issue! -->

Feature

Define a textual representation of a cranelift module that is like the current clir ir text form, but with added support for defining data objects, importing extern functions and data objects, defining linkage and giving everything a name that isn't limited to 16 characters ascii characters.

Benefit

This allows writing and reading a whole cranelift module as text file, making it easier to find problems with what you defined, making changes while debugging quicker and making cranelift easier to use from non-rust users. (https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/using.20cranelift.20as.20a.20backend.20for.20a.20non-rust.20compiler/near/212909451).

Implementation

Part of the serialization could be handled by ModuleDeclarations and the rest needs to be handled by a custom Module implementor. The deserialization needs to take an &mut impl Module as argument.

The textual representation could be like the following:

; declare: "puts" = import func0(i64) -> i32
; declare: "print_hello" = export func1()
; declare: "hello_str" = local data0() ro
; === the part above could be handled by `ModuleDeclarations` ===
; data: "hello_str" = "Hello World!\0"

function u0:1() system_v {
    sig0 = (i64) -> i32 system_v
    fn0 = u0:0 sig0
    gv0 = symbol u1:0

block0:
    v0 = global_value gv0
    call fn0(v0)
}

Alternatives

<!-- Have you considered alternative implementations? If so, how are they
better or worse than your proposal? -->


Last updated: Nov 22 2024 at 17:03 UTC