From 3ba9b917077763b468833d6d73b7dfcffec7820e Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 20 Feb 2023 15:08:00 +0900 Subject: [PATCH 1/2] BasicCABI.md: mention how function pointers look like --- BasicCABI.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BasicCABI.md b/BasicCABI.md index e8cc50e..75fae15 100644 --- a/BasicCABI.md +++ b/BasicCABI.md @@ -107,6 +107,15 @@ Bitfield type | Witdh *w* | Range `signed long long` | 1 to 64 | -2(w-1) to 2(w-1)-1 `long long`, `unsigned long long` | 1 to 64 | 0 to 2w-1 +**Function pointers** + +A pointer to a function is an index into the table 0 of the module. +The type of the table is funcref. +The table needs to be exported with the name `__indirect_function_table` +if the function pointer is possibly used from the outside of the module. +Eg. If the module passes a function pointer to a host function as +a callback. + **SIMD Vector types** The ABI for vector types is not stable and may change as new optimization opportunities are From bece83988bb1994142bc11e4b6a9d25bbfb8e637 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 14 Apr 2023 15:55:00 +0900 Subject: [PATCH 2/2] drop a table 0 assumption --- BasicCABI.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BasicCABI.md b/BasicCABI.md index 75fae15..af44afc 100644 --- a/BasicCABI.md +++ b/BasicCABI.md @@ -109,7 +109,7 @@ Bitfield type | Witdh *w* | Range **Function pointers** -A pointer to a function is an index into the table 0 of the module. +A pointer to a function is an index into a table of the module. The type of the table is funcref. The table needs to be exported with the name `__indirect_function_table` if the function pointer is possibly used from the outside of the module.