-
Notifications
You must be signed in to change notification settings - Fork 693
Refactor interpreter/AOT module instance layout #1559
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactor layout of interpreter module instance, memory instance, table instance and so on. Create the interpreter module instance like aot module instance. Let LLVM JIT use the interpreter's data structures instead of aot's data structures, so as to make preparation for the next multi-tier JIT.
Merge main into dev/refactor_interp_module_inst
Unify the data structure of wasm module instance and aot module instance: - Use the same structure WASMModuleInstance for both interpreter and AOT - For the extra fields, store them into WASMModuleInstanceExtra structure and add a field `e` in module instance - For field which has different meaning for interpreter and AOT, use the structure of interpreter to define it, and convert it to actual type in AOT before using it Refer to #1384.
Make AOT module instance's tables member same as interpreter module instance's, so as to unify this field and prepare for the API unifying.
Decide to use the .aot content as the .wasm precompiled result: - `wasm_module_serialize(...)` will return it - `wasm_module_deserialize(...)` will load the precompiled content as normal .aot file
Refer to #1384. To unify the memory instantiate process for interpreter/AOT in the future.
Use a clone example to show - cold start and warm start - how to clone from wasm_module_t and bypass loading phase It turns out that there is a strong requirement of almost everything in wasm_instantiate() except funciton related if do a clone of wasm_instance_t. Since we tend to isolate user data in threads, it needs to malloc and initialie - global. WASMGlobalIntance and global data - memory. WAAMMemoryInstance, memory_data and heap - table. WASMTableInstance, table_data - exports. all global, memory and table
wenyongh
added a commit
to wenyongh/wasm-micro-runtime
that referenced
this pull request
Oct 18, 2022
Refactor interpreter/AOT module instance layout (bytecodealliance#1559)
vickiegpt
pushed a commit
to vickiegpt/wamr-aot-gc-checkpoint-restore
that referenced
this pull request
May 27, 2024
Refactor the layout of interpreter and AOT module instance: - Unify the interp/AOT module instance, use the same WASMModuleInstance/ WASMMemoryInstance/WASMTableInstance data structures for both interpreter and AOT - Make the offset of most fields the same in module instance for both interpreter and AOT, append memory instance structure, global data and table instances to the end of module instance for interpreter mode (like AOT mode) - For extra fields in WASM module instance, use WASMModuleInstanceExtra to create a field `e` for interpreter - Change the LLVM JIT module instance creating process, LLVM JIT uses the WASM module and module instance same as interpreter/Fast-JIT mode. So that Fast JIT and LLVM JIT can access the same data structures, and make it possible to implement the Multi-tier JIT (tier-up from Fast JIT to LLVM JIT) in the future - Unify some APIs: merge some APIs for module instance and memory instance's related operations (only implement one copy) Note that the AOT ABI is same, the AOT file format, AOT relocation types, how AOT code accesses the AOT module instance and so on are kept unchanged. Refer to: bytecodealliance#1384
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor the layout of interpreter and AOT module instance:
WASMMemoryInstance/WASMTableInstance data structures for both interpreter
and AOT
and AOT, append memory instance structure, global data and table instances to
the end of module instance for interpreter mode (like AOT mode)
create a field
e
for interpretermodule and module instance same as interpreter/Fast-JIT mode. So that Fast JIT
and LLVM JIT can access the same data structures, and make it possible to
implement the Multi-tier JIT (tier-up from Fast JIT to LLVM JIT) in the future
related operations (only implement one copy)
Note that the AOT ABI is same, the AOT file format, AOT relocation types, how AOT
code accesses the AOT module instance and so on are kept unchanged.
Refer to:
#1384