summaryrefslogtreecommitdiff
path: root/wasm2c/wasm-rt.h
diff options
context:
space:
mode:
Diffstat (limited to 'wasm2c/wasm-rt.h')
-rw-r--r--wasm2c/wasm-rt.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/wasm2c/wasm-rt.h b/wasm2c/wasm-rt.h
index bdeecd56..e6df7d09 100644
--- a/wasm2c/wasm-rt.h
+++ b/wasm2c/wasm-rt.h
@@ -246,6 +246,17 @@ typedef enum {
typedef void (*wasm_rt_function_ptr_t)(void);
/**
+ * A pointer to a "tail-callee" function, called by a tail-call
+ * trampoline or by another tail-callee function. (The definition uses a
+ * single-member struct to allow a recursive definition.)
+ */
+typedef struct wasm_rt_tailcallee_t {
+ void (*fn)(void** instance_ptr,
+ void* tail_call_stack,
+ struct wasm_rt_tailcallee_t* next);
+} wasm_rt_tailcallee_t;
+
+/**
* The type of a function (an arbitrary number of param and result types).
* This is represented as an opaque 256-bit ID.
*/
@@ -259,6 +270,8 @@ typedef struct {
/** The function. The embedder must know the actual C signature of the
* function and cast to it before calling. */
wasm_rt_function_ptr_t func;
+ /** An alternate version of the function to be used when tail-called. */
+ wasm_rt_tailcallee_t func_tailcallee;
/** A function instance is a closure of the function over an instance
* of the originating module. The module_instance element will be passed into
* the function at runtime. */
@@ -266,7 +279,7 @@ typedef struct {
} wasm_rt_funcref_t;
/** Default (null) value of a funcref */
-static const wasm_rt_funcref_t wasm_rt_funcref_null_value = {NULL, NULL, NULL};
+static const wasm_rt_funcref_t wasm_rt_funcref_null_value;
/** The type of an external reference (opaque to WebAssembly). */
typedef void* wasm_rt_externref_t;