I am trying to add riscv64 backend to riscv64.
I have a null pointer issue at.
#0 0x00000040008a96e6 in wasmtime_runtime::component::transcode::trampolines::utf8_to_latin1 (src=0x40c3ac5000, len=27, dst=0x4043ab5000, _retptr=0x0)
at src/component/transcode.rs:88
#1 0x0000004043ab3064 in ?? ()
you can see _retptr
is null.
this bug is very wired to me.
I nerve find the code in wasmtime
that you want to call wasmtime_runtime::component::transcode::trampolines::utf8_to_latin1
.
I only saw you want to call wasmtime_cranelift::compiler::component::host::utf8_to_latin1
.
and the two function have differrent signature.
I think you are calling the wrong function???
xxxxxxxxxxxxxxxxxxx : Utf8ToLatin1 function u0:0(i64 vmctx, i64, i32, i32, i32) -> i32, i32 wasmtime_system_v {
sig0 = (i64, i64, i64) -> i64, i64 wasmtime_system_v
block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):
v5 = load.i64 notrap aligned v0+32
v6 = get_frame_pointer.i64
v7 = load.i64 notrap aligned v6
store notrap aligned v7, v5+24
v8 = get_return_address.i64
store notrap aligned v8, v5+32
v9 = load.i64 notrap aligned v0+8
v10 = load.i64 notrap aligned v9+64
v11 = load.i64 notrap aligned v0+144
v12 = load.i64 notrap aligned v11
v13 = load.i64 notrap aligned v0+152
v14 = load.i64 notrap aligned v13
v15 = uextend.i64 v2
v16 = iadd v12, v15
v17 = uextend.i64 v3
v18 = uextend.i64 v4
v19 = iadd v14, v18
v20, v21 = call_indirect sig0, v10(v16, v17, v19) // call to wasmtime_runtime::component::transcode::trampolines::utf8_to_latin1
v22 = ireduce.i32 v20
v23 = ireduce.i32 v21
return v22, v23
}
@yang yu The component-model stuff is pretty new; @Alex Crichton might have more specific insights or hints here?
ok , I just can't pass test on riscv64.
This most likely has to do with the multi-return and the wasmtime_system_v
ABI in use here. The "wasmtime flavor" of the systemv_abi
changes how multiple returns get represented. Has the riscv64 backend implemented this ABI? Are the other multi-value tests passing in Wasmtime yet (I would expect them not to be passing if this isn't passing)
No,riscv64 not implement wasmtime_system_v
abi at all.
I think I can't find the document about wasmtime_system_v-riscv64 abi.
I only find one document about riscv abi.
https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf
@yang yu the wasmtime_system_v
ABI is our own invention; there won't be any other docs about it. Basically what is needed is to support multivalue returns in a slightly different way that involves a stack return area. If you grep for WasmtimeSystemV
in x64/abi.rs you'll see how we handle it on x86-64; most of the details will be handled by the common ABI code
@Chris Fallin there is another detail I don't know.
wasmtime_system_v
abi only use one register store result.
image.png
yang yu has marked this topic as resolved.
yang yu has marked this topic as unresolved.
is that wasmtime_system_abi
is actual C
api, because C
only can return one value.
So only one register can be used for all register class to return value.
wasmtime_system_v is basically system_v except in case of returning multiple values it passes a pointer to write the return values to as last argument afaik.
@bjorn3 ok,I just have this question , I saw using wasmtime_system_v
to call C
code.
yang yu has marked this topic as resolved.
Last updated: Nov 22 2024 at 17:03 UTC