Skip to content

feat: add wasm_memory_get_init_page_count()#4110

Closed
Jiax-cn wants to merge 1 commit intobytecodealliance:mainfrom
Jiax-cn:feature/get_init_page
Closed

feat: add wasm_memory_get_init_page_count()#4110
Jiax-cn wants to merge 1 commit intobytecodealliance:mainfrom
Jiax-cn:feature/get_init_page

Conversation

@Jiax-cn
Copy link
Contributor

@Jiax-cn Jiax-cn commented Feb 24, 2025

This API provides access to the initial memory size, as a supplement to #3786.

== 13 * sizeof(uint64) + 128 + 14 * sizeof(uint64));

bh_static_assert(sizeof(AOTMemoryInstance) == 120);
bh_static_assert(sizeof(AOTMemoryInstance) == 128);
Copy link
Contributor

Choose a reason for hiding this comment

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

this change makes me think whether we're not breaking the ABI here?

@lum1n0us
Copy link
Contributor

IMU, we can always obtain the initial page value from a memory type of a module rather than from the memory of an instance.

WASM_RUNTIME_API_EXTERN void
wasm_runtime_get_export_type(const wasm_module_t module, int32_t export_index,
                             wasm_export_t *export_type);

WASM_RUNTIME_API_EXTERN uint32_t
wasm_memory_type_get_init_page_count(const wasm_memory_type_t memory_type);

@Jiax-cn
Copy link
Contributor Author

Jiax-cn commented Feb 25, 2025

@lum1n0us This is useful, thank you.

@Jiax-cn Jiax-cn closed this Feb 25, 2025
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.

3 participants