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

Fix memory size not updating #2898

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Conversation

yagehu
Copy link
Contributor

@yagehu yagehu commented Dec 11, 2023

This commit fixes linear memory size not updating after growing. This causes memory.fill to throw an exception after memory.grow.

This commit fixes linear memory size not updating after growing.
@@ -2149,7 +2149,11 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
#if !defined(OS_ENABLE_HW_BOUND_CHECK) \
|| WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS == 0 \
|| WASM_ENABLE_BULK_MEMORY != 0
#if WASM_ENABLE_THREAD_MGR == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to be consistent with what we do at the beginning of the function:

#if WASM_ENABLE_THREAD_MGR == 0
linear_mem_size = memory->memory_data_size;
#else
linear_mem_size = GET_LINEAR_MEMORY_SIZE(memory);
#endif

Also, similar changes need to be made for wasm_interp_fast.c. See #2834

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. I just pushed another commit that makes the check consistent and applies the same fix to wasm_interp_fast.c.

@wenyongh wenyongh merged commit ef0cd22 into bytecodealliance:main Dec 12, 2023
393 checks passed
@yagehu yagehu deleted the yagehu/memory-grow branch April 14, 2024 00:38
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
…liance#2898)

This commit fixes linear memory size not updating after growing.
This causes `memory.fill` to throw an exception after `memory.grow`.
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.

None yet

3 participants