From 7bb3ad6e59e892b71b8fe63736b5b7e59db74ee3 Mon Sep 17 00:00:00 2001 From: Joe Polny Date: Mon, 27 Oct 2025 09:38:30 -0400 Subject: [PATCH 1/2] docs: clarify that * in signatures does address conversion It was non-obvious that `*` means the runtime does the app to native conversion automatically. With the current docstring, one might assume that the runtime only does boundary checks and not address conversion. Under this assumption, passing the already-native address to `wasm_runtime_addr_app_to_native` will lead to unexpected behavior --- core/iwasm/include/wasm_export.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index 0ab22f7112..b7c2aa3331 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -1740,7 +1740,9 @@ wasm_table_type_get_max_size(const wasm_table_type_t table_type); * auto check its boundary before calling the native function. * If it is followed by '~', the checked length of the pointer * is gotten from the following parameter, if not, the checked - * length of the pointer is 1. + * length of the pointer is 1. The runtime will also convert + * the app pointer to a native pointer, thus there is no need + * to manually call `wasm_runtime_addr_app_to_native`. * '~': the parameter is the pointer's length with i32 type, and must * follow after '*' * '$': the parameter is a string (i32 in WASM), and runtime will From b683a01c9709a57fdac842fb543b2ebf81e5072d Mon Sep 17 00:00:00 2001 From: Joe Polny Date: Tue, 28 Oct 2025 11:19:00 -0400 Subject: [PATCH 2/2] docs: document string address conversion --- core/iwasm/include/wasm_export.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index b7c2aa3331..fc46825c80 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -1746,7 +1746,9 @@ wasm_table_type_get_max_size(const wasm_table_type_t table_type); * '~': the parameter is the pointer's length with i32 type, and must * follow after '*' * '$': the parameter is a string (i32 in WASM), and runtime will - * auto check its boundary before calling the native function + * auto check its boundary before calling the native function. + * Like '*', the runtime will also convert the app pointer to a + * native pointer. * @param n_native_symbols specifies the number of native symbols in the array * * @return true if success, false otherwise