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

[instantiation linking] Create and import WASMGlobalInstance #3914

Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9c8fb32
[rebase confliction] Refactor: streamline global instance handling an…
lum1n0us Nov 17, 2024
f9a7b6d
Refactor: improve global instance handling
lum1n0us Nov 18, 2024
f81662d
llvm-jit can read global values from local inst and import inst
lum1n0us Nov 19, 2024
28c70c6
Refactor: streamline global instance structure and improve global val…
lum1n0us Nov 19, 2024
b5593e5
Refactor: remove unused global linking logic and clean up import hand…
lum1n0us Nov 19, 2024
673c005
Refactor: remove unused global offset calculations and simplify globa…
lum1n0us Nov 20, 2024
1f2f89b
Refactor: improve memory management in module deinstantiation and han…
lum1n0us Nov 21, 2024
32f276f
Refactor: enhance multi-module support for global imports and initial…
lum1n0us Nov 24, 2024
3242e32
Refactor: remove unused import functions and enhance global instance …
lum1n0us Nov 25, 2024
1f17245
Refactor: streamline WASI and spec test integration by consolidating …
lum1n0us Nov 26, 2024
6918aff
Refactor: rename native creation functions for spec and wasi test bui…
lum1n0us Nov 26, 2024
972466f
Refactor: enhance table initialization checks and improve spec test t…
lum1n0us Nov 26, 2024
be317ce
Refactor: conditionally compile extern instance destruction for spec …
lum1n0us Nov 26, 2024
26d8def
Refactor: simplify memory deinstantiation logic and improve extern in…
lum1n0us Dec 7, 2024
fd7dee5
a workaround to fix a compilation issue on Nuttx
lum1n0us Dec 7, 2024
36b8555
Add global definitions for spectest and test modules in libc_builtin_…
lum1n0us Dec 7, 2024
b1b6a32
Refactor: remove unused table deallocation logic in wasm_runtime_inst…
lum1n0us Dec 12, 2024
98333b6
format problem
lum1n0us Dec 12, 2024
9079012
Refactor: enhance global instance handling and add static assertions …
lum1n0us Dec 17, 2024
c36a203
Refactor: update static assertions for AOTGlobalInstance offsets and …
lum1n0us Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -2144,9 +2144,11 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
AOTImportGlobal *import_globals;
uint64 size;
uint32 i, data_offset = 0;
#if WASM_ENABLE_MULTI_MODULE != 0
#if WASM_ENABLE_LIBC_BUILTIN != 0
WASMGlobalImport tmp_global;
#endif
#endif /* WASM_ENABLE_MULTI_MODULE != 0 */

/* Allocate memory */
size = sizeof(AOTImportGlobal) * (uint64)module->import_global_count;
Expand All @@ -2167,6 +2169,7 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
return false;
}

#if WASM_ENABLE_MULTI_MODULE != 0
#if WASM_ENABLE_LIBC_BUILTIN != 0
if (wasm_native_lookup_libc_builtin_global(
import_globals[i].module_name, import_globals[i].global_name,
Expand All @@ -2182,9 +2185,12 @@ load_import_globals(const uint8 **p_buf, const uint8 *buf_end,
tmp_global.global_data_linked;
import_globals[i].is_linked = true;
}
#else
import_globals[i].is_linked = false;
else
#endif
#endif /* WASM_ENABLE_MULTI_MODULE != 0 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When multi-module isn't enabled and libc-builtin is enabled, the global isn't linked by default, is it expected? Or will the iwasm's main.c link the global when instantiating?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES. only apply wasm_native_lookup_libc_builtin_global() when executing loading linking. Otherwise, core/iwasm/libraries/libc-builtin/spec_test_builtin_wrapper.c will take over

{
import_globals[i].is_linked = false;
}

import_globals[i].size =
wasm_value_type_size(import_globals[i].type.val_type);
Expand Down
Loading
Loading