Skip to content

[instantiation linking] create and import WASMMemoryInstance for interp#3845

Merged
lum1n0us merged 27 commits intobytecodealliance:dev/instantiate_linkingfrom
lum1n0us:feat/inst_linking_memory
Nov 4, 2024
Merged

[instantiation linking] create and import WASMMemoryInstance for interp#3845
lum1n0us merged 27 commits intobytecodealliance:dev/instantiate_linkingfrom
lum1n0us:feat/inst_linking_memory

Conversation

@lum1n0us
Copy link
Contributor

@lum1n0us lum1n0us commented Oct 9, 2024

No description provided.

@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch 5 times, most recently from 62b7808 to 1821dfd Compare October 12, 2024 08:34
@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch 10 times, most recently from a1d2c27 to 7678f4d Compare October 21, 2024 14:36
@lum1n0us lum1n0us changed the base branch from main to dev/instantiate_linking October 22, 2024 11:47
TianlongLiang and others added 12 commits October 23, 2024 14:48
…ealliance#3871)

* exclude fuzz test for scoreboard scan

* ci ignore osv-scanner.toml file name inconsistency
including
- memory create and destroy
- instnace_new with imports
Besides, it is still an open question if a memory should be exported
This commit refactors the `memory_deinstantiate` function in the `wasm_runtime.c` file. It introduces a new helper function `memory_deinstantiate` to handle the destruction of memory instances. The function checks if the memory is shared and decrements the reference count before freeing the memory. It also destroys the heap handle and deallocates the linear memory.

Additionally, the commit fixes the `wasm_destroy_memory` function by calling the `memory_deinstantiate` function and freeing the memory instance.

These changes improve the memory management in the interpreter and ensure proper destruction of memory instances.
- Set CMAKE_BUILD_TYPE to Debug in CMakeLists.txt
- Add missing printf and fflush statements in import_memory.c
- Add assertion for memory data in import_memory.c
- Add assertion for memory growth in import_memory.c
Both `WASI_THREADS` and `THREAD_MGR` continue to use loader linking to keep a
separate memory instance for each thread they create.
@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch from f29a36e to 3a8b5a6 Compare October 29, 2024 13:29
@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch 2 times, most recently from 7c81eb8 to fbba2a3 Compare October 30, 2024 01:39
@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch from fbba2a3 to 00fec83 Compare October 30, 2024 02:01
@lum1n0us lum1n0us force-pushed the feat/inst_linking_memory branch from cc33703 to c3efbbb Compare November 1, 2024 05:44
Copy link
Collaborator

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

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

LGTM

@lum1n0us lum1n0us merged commit e030350 into bytecodealliance:dev/instantiate_linking Nov 4, 2024
@lum1n0us lum1n0us deleted the feat/inst_linking_memory branch November 4, 2024 07:38
lum1n0us added a commit to lum1n0us/wasm-micro-runtime that referenced this pull request Feb 19, 2025
…rp (bytecodealliance#3845)

APIs to create and import WASMMemoryInstance for Interp

- add a demo (sample/linking/raw) for APIs test
- new APIs for instances of spawned threads to build imports list from parents'
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

Successfully merging this pull request may close these issues.

4 participants