Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For AOT,If enable gc, the reference_type will disable,Why ? #4097

Open
chenliuyang1989 opened this issue Feb 21, 2025 · 13 comments
Open

For AOT,If enable gc, the reference_type will disable,Why ? #4097

chenliuyang1989 opened this issue Feb 21, 2025 · 13 comments

Comments

@chenliuyang1989
Copy link
Contributor

Image

@TianlongLiang
Copy link
Collaborator

TianlongLiang commented Feb 21, 2025

The AOT option here: ref types here refer to wasm ref types proposal which became core wasm spec, gc refer to gc proposal. As those two proposals specified, some opcodes(for example, call indirect) and function reference have different definition and need different implementations, therefore the flag control here

@chenliuyang1989
Copy link
Contributor Author

chenliuyang1989 commented Feb 21, 2025

Thank you for your explanation. I'm in a hurry to let aot work. But unfortunately there have been problems。

If i enable gc proposal. so ref types is diabled,what the compiler do if find reference-types

my wasm file is build from Kotlin,but it has ref types。 if the refTypes is disabled,how can my aot work well?

@chenliuyang1989
Copy link
Contributor Author

Here's how I do it

First:build aot

./wamrc --enable-gc -o --bounds-checks=1 aqaraSys.aot aqaraSys-wasm-wasi.wasm

Second:run aot
./iwasm -f test aqaraSys.aot

third:meet error
./iwasm -f test aqaraSys.aot
Exception: null function reference

if i run wasm with classic interpret,it work well

@TianlongLiang
Copy link
Collaborator

It's not disabled but redefine the ref types to conform to the GC proposal definition, there shouldn't be any error. Could you please attach the WASM file?

@chenliuyang1989
Copy link
Contributor Author

ok.please help check the file ,thanks . the entry function is test

压缩.zip

@chenliuyang1989
Copy link
Contributor Author

add aot file

aotfile.zip

@ericCHensssssssss
Copy link

ericCHensssssssss commented Feb 23, 2025

I write one simple test,If i use println method in Kotlin , it will produce null function reference。
The kotlin println will use wasi_snapshot_preview1 in wasm。
@WasmImport("wasi_snapshot_preview1", "fd_write")

The one use println :will produce null function reference。

Image

remove println ,no error

Image

@chenliuyang1989
Copy link
Contributor Author

@TianlongLiang any updates? Very eager to get it up and running。thanks!!

@TianlongLiang
Copy link
Collaborator

No luck yet, I was busy with some other things the last few days. I tried your wasm file in LLVM JIT running mode which is fine, and in aot the latest commit will core dump, I think maybe a bug in the aot emitting type info. I will try the simple test to see where was wrong. Keep you posted

@chenliuyang1989
Copy link
Contributor Author

Thanks,

I'm stuck here now, and I need to get to a conclusion as soon as possible

when i update the latest main branch codes。 i find the same segment error, but did not find the root case .a a a

@chenliuyang1989
Copy link
Contributor Author

@TianlongLiang would you help have a look this week? i really need it

@chenliuyang1989
Copy link
Contributor Author

[

simplestWasm&wat.zip

]

This is the simple and small wasm file to product the error。
There are two export functions myTest(segment error) and myTest2

Image

@chenliuyang1989
Copy link
Contributor Author

would you help have a look ?please
i need it work。but i really can not find the root case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants