|
@@ -144,6 +144,28 @@ wasm_get_defined_type_count(const wasm_module_t module);
|
|
|
WASM_RUNTIME_API_EXTERN wasm_defined_type_t
|
|
WASM_RUNTIME_API_EXTERN wasm_defined_type_t
|
|
|
wasm_get_defined_type(const wasm_module_t module, uint32_t index);
|
|
wasm_get_defined_type(const wasm_module_t module, uint32_t index);
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Get defined type of the GC managed object, the object must be struct,
|
|
|
|
|
+ * array or func.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param obj the object
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return defined type of the object.
|
|
|
|
|
+ */
|
|
|
|
|
+WASM_RUNTIME_API_EXTERN wasm_defined_type_t
|
|
|
|
|
+wasm_obj_get_defined_type(const wasm_obj_t obj);
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Get defined type index of the GC managed object, the object must be struct,
|
|
|
|
|
+ * array or func.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param obj the object
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return defined type index of the object.
|
|
|
|
|
+ */
|
|
|
|
|
+WASM_RUNTIME_API_EXTERN int32_t
|
|
|
|
|
+wasm_obj_get_defined_type_idx(const wasm_module_t module, const wasm_obj_t obj);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Check whether a defined type is a function type
|
|
* Check whether a defined type is a function type
|
|
|
*/
|
|
*/
|
|
@@ -368,6 +390,74 @@ wasm_func_obj_get_func_idx_bound(const wasm_func_obj_t func_obj);
|
|
|
WASM_RUNTIME_API_EXTERN wasm_func_type_t
|
|
WASM_RUNTIME_API_EXTERN wasm_func_type_t
|
|
|
wasm_func_obj_get_func_type(const wasm_func_obj_t func_obj);
|
|
wasm_func_obj_get_func_type(const wasm_func_obj_t func_obj);
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * Call the given WASM function object with arguments (bytecode and AoT).
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param exec_env the execution environment to call the function,
|
|
|
|
|
+ * which must be created from wasm_create_exec_env()
|
|
|
|
|
+ * @param func_obj the function object to call
|
|
|
|
|
+ * @param argc total cell number that the function parameters occupy,
|
|
|
|
|
+ * a cell is a slot of the uint32 array argv[], e.g. i32/f32 argument
|
|
|
|
|
+ * occupies one cell, i64/f64 argument occupies two cells, note that
|
|
|
|
|
+ * it might be different from the parameter number of the function
|
|
|
|
|
+ * @param argv the arguments. If the function has return value,
|
|
|
|
|
+ * the first (or first two in case 64-bit return value) element of
|
|
|
|
|
+ * argv stores the return value of the called WASM function after this
|
|
|
|
|
+ * function returns.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return true if success, false otherwise and exception will be thrown,
|
|
|
|
|
+ * the caller can call wasm_runtime_get_exception to get the exception
|
|
|
|
|
+ * info.
|
|
|
|
|
+ */
|
|
|
|
|
+WASM_RUNTIME_API_EXTERN bool
|
|
|
|
|
+wasm_runtime_call_func_ref(wasm_exec_env_t exec_env,
|
|
|
|
|
+ const wasm_func_obj_t func_obj, uint32_t argc,
|
|
|
|
|
+ uint32_t argv[]);
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Call the given WASM function object with provided results space
|
|
|
|
|
+ * and arguments (bytecode and AoT).
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param exec_env the execution environment to call the function,
|
|
|
|
|
+ * which must be created from wasm_create_exec_env()
|
|
|
|
|
+ * @param func_obj the function object to call
|
|
|
|
|
+ * @param num_results the number of results
|
|
|
|
|
+ * @param results the pre-alloced pointer to get the results
|
|
|
|
|
+ * @param num_args the number of arguments
|
|
|
|
|
+ * @param args the arguments
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return true if success, false otherwise and exception will be thrown,
|
|
|
|
|
+ * the caller can call wasm_runtime_get_exception to get the exception
|
|
|
|
|
+ * info.
|
|
|
|
|
+ */
|
|
|
|
|
+WASM_RUNTIME_API_EXTERN bool
|
|
|
|
|
+wasm_runtime_call_func_ref_a(wasm_exec_env_t exec_env,
|
|
|
|
|
+ const wasm_func_obj_t func_obj,
|
|
|
|
|
+ uint32_t num_results, wasm_val_t results[],
|
|
|
|
|
+ uint32_t num_args, wasm_val_t *args);
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Call the given WASM function object with provided results space and
|
|
|
|
|
+ * variant arguments (bytecode and AoT).
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param exec_env the execution environment to call the function,
|
|
|
|
|
+ * which must be created from wasm_create_exec_env()
|
|
|
|
|
+ * @param func_obj the function object to call
|
|
|
|
|
+ * @param num_results the number of results
|
|
|
|
|
+ * @param results the pre-alloced pointer to get the results
|
|
|
|
|
+ * @param num_args the number of arguments
|
|
|
|
|
+ * @param ... the variant arguments
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return true if success, false otherwise and exception will be thrown,
|
|
|
|
|
+ * the caller can call wasm_runtime_get_exception to get the exception
|
|
|
|
|
+ * info.
|
|
|
|
|
+ */
|
|
|
|
|
+WASM_RUNTIME_API_EXTERN bool
|
|
|
|
|
+wasm_runtime_call_func_ref_v(wasm_exec_env_t exec_env,
|
|
|
|
|
+ const wasm_func_obj_t func_obj,
|
|
|
|
|
+ uint32_t num_results, wasm_val_t results[],
|
|
|
|
|
+ uint32_t num_args, ...);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Create an externref object with host object
|
|
* Create an externref object with host object
|
|
|
*/
|
|
*/
|