Stream: git-wasmtime

Topic: wasmtime / issue #7960 .wat generates questions


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

996ccs edited issue #7960:

I have a question. There are many .wats in the example, such as gcd.wat.
(module
(func $gcd (param i32 i32) (result i32)
(local i32)
block ;; label = @1
block ;; label = @2
local.get 0
br_if 0 (;@2;)
local.get 1
local.set 2
br 1 (;@1;)
end
loop ;; label = @2
local.get 1
local.get 0
local.tee 2
i32.rem_u
local.set 0
local.get 2
local.set 1
local.get 0
br_if 0 (;@2;)
end
end
local.get 2
)
(export "gcd" (func $gcd))
)

how is it generated? I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large. Running will also report an error

I use golang and rust to compile wasm
How can I generate a short and concise .wat code like gcd.wat?

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

996ccs edited issue #7960:

I have a question. There are many .wat file in the example, such as gcd.wat.
(module
(func $gcd (param i32 i32) (result i32)
(local i32)
block ;; label = @1
block ;; label = @2
local.get 0
br_if 0 (;@2;)
local.get 1
local.set 2
br 1 (;@1;)
end
loop ;; label = @2
local.get 1
local.get 0
local.tee 2
i32.rem_u
local.set 0
local.get 2
local.set 1
local.get 0
br_if 0 (;@2;)
end
end
local.get 2
)
(export "gcd" (func $gcd))
)

how is it generated? I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large. Running will also report an error

I use golang and rust to compile wasm
How can I generate a short and concise .wat code like gcd.wat?

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

996ccs edited issue #7960:

I have a question. There are many .wat file in the example, such as gcd.wat.
(module
(func $gcd (param i32 i32) (result i32)
(local i32)
block ;; label = @1
block ;; label = @2
local.get 0
br_if 0 (;@2;)
local.get 1
local.set 2
br 1 (;@1;)
end
loop ;; label = @2
local.get 1
local.get 0
local.tee 2
i32.rem_u
local.set 0
local.get 2
local.set 1
local.get 0
br_if 0 (;@2;)
end
end
local.get 2
)
(export "gcd" (func $gcd))
)

how is it generated? I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large. Running will also report an error

I use golang and rust to compile wasm
How can I generate a short and concise .wat code like gcd.wat?

```[tasklist]

Tasks

~~~

view this post on Zulip Wasmtime GitHub notifications bot (Feb 20 2024 at 13:45):

bjorn3 commented on issue #7960:

Based on https://github.com/bytecodealliance/wasmtime/pull/563/commits/c28e07fbeda3e9390ff704a62ffce78fa9927780 it looks like it was either entirely hand written or a manually cleaned up version of a wasm file originally compiled by rustc.

I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large.

Which wasm file?

Running will also report an error

What error?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 20 2024 at 13:45):

bjorn3 edited a comment on issue #7960:

Based on https://github.com/bytecodealliance/wasmtime/pull/563/commits/c28e07fbeda3e9390ff704a62ffce78fa9927780 it looks like gcd.wat was either entirely hand written or a manually cleaned up version of a wasm file originally compiled by rustc.

I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large.

Which wasm file?

Running will also report an error

What error?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 22 2024 at 03:13):

996ccs commented on issue #7960:

Based on c28e07f it looks like gcd.wat was either entirely hand written or a manually cleaned up version of a wasm file originally compiled by rustc.

I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large.

Which wasm file?

Running will also report an error

What error?

Thank you for your reply. The problem has been solved

view this post on Zulip Wasmtime GitHub notifications bot (Feb 22 2024 at 03:13):

996ccs closed issue #7960:

I have a question. There are many .wat file in the example, such as gcd.wat.
(module
(func $gcd (param i32 i32) (result i32)
(local i32)
block ;; label = @1
block ;; label = @2
local.get 0
br_if 0 (;@2;)
local.get 1
local.set 2
br 1 (;@1;)
end
loop ;; label = @2
local.get 1
local.get 0
local.tee 2
i32.rem_u
local.set 0
local.get 2
local.set 1
local.get 0
br_if 0 (;@2;)
end
end
local.get 2
)
(export "gcd" (func $gcd))
)

how is it generated? I tried to use the wasm file to convert it into a .wat file, but the content code of the converted .wat file was very long and large. Running will also report an error

I use golang and rust to compile wasm
How can I generate a short and concise .wat code like gcd.wat?

```[tasklist]

Tasks

~~~


Last updated: Dec 23 2024 at 12:05 UTC