bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.66k stars 576 forks source link

Add AOT running mode #3595

Closed bnason-nf closed 3 days ago

bnason-nf commented 5 days ago

This adds an enum to RunningMode to be able to determine if a module instance is using AOT. I'm not sure this is the best solution for that, if there's a better way please let me know.

wenyongh commented 4 days ago

@bnason-nf The aot file can only be executed with AOT mode, and whether an input buffer is an AOT file can be detected by the API exported in wasm_export.h:

https://github.com/bytecodealliance/wasm-micro-runtime/blob/1f94cd4ee506b063d0698d6b40bcff69d5d6f27f/core/iwasm/include/wasm_export.h#L419-L420

so we didn't add the AOT mode in the enum. Not sure whether it is good to you?

bnason-nf commented 3 days ago

so we didn't add the AOT mode in the enum. Not sure whether it is good to you?

Thanks @wenyongh, I hadn't noticed that API, I could use it if needed, but I made a new API in #3600 that is slightly better, since it doesn't require me to have the module data and doesn't do any extra memory comparison to get information it already knows. I hope it's ok with you.

Also, as a side note, the name of get_package_type() seems inconsistent with the rest of the APIs, maybe it would be nice to change in the future (even though that would be a breaking change).