WebAssembly Micro Runtime first version

This commit is contained in:
Wang Xin
2019-05-07 10:18:18 +08:00
parent 15aa50914b
commit a75a5f0f41
252 changed files with 33487 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _EXT_LIB_EXPORT_H_
#define _EXT_LIB_EXPORT_H_
#include "lib-export.h"
#ifdef __cplusplus
extern "C" {
#endif
int
get_ext_lib_export_apis(NativeSymbol **p_ext_lib_apis)
{
*p_ext_lib_apis = extended_native_symbol_defs;
return sizeof(extended_native_symbol_defs) / sizeof(NativeSymbol);
}
#ifdef __cplusplus
}
#endif
#endif /* end of _EXT_LIB_EXPORT_H_ */

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LIB_EXPORT_H_
#define _LIB_EXPORT_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct NativeSymbol {
const char *symbol;
void *func_ptr;
} NativeSymbol;
#define EXPORT_WASM_API(symbol) {#symbol, symbol}
#define EXPORT_WASM_API2(symbol) {#symbol, symbol##_wrapper}
/**
* Get the exported APIs of base lib
*
* @param p_base_lib_apis return the exported API array of base lib
*
* @return the number of the exported API
*/
int
get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
/**
* Get the exported APIs of extend lib
*
* @param p_base_lib_apis return the exported API array of extend lib
*
* @return the number of the exported API
*/
int
get_extend_lib_export_apis(NativeSymbol **p_base_lib_apis);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,421 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _WASM_EXPORT_H
#define _WASM_EXPORT_H
#include <inttypes.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Uninstantiated WASM module loaded from WASM binary file */
struct WASMModule;
typedef struct WASMModule *wasm_module_t;
/* Instantiated WASM module */
struct WASMModuleInstance;
typedef struct WASMModuleInstance *wasm_module_inst_t;
/* Function instance */
struct WASMFunctionInstance;
typedef struct WASMFunctionInstance *wasm_function_inst_t;
/* WASM section */
typedef struct wasm_section {
struct wasm_section *next;
/* section type */
int section_type;
/* section body, not include type and size */
uint8_t *section_body;
/* section body size */
uint32_t section_body_size;
} wasm_section_t, *wasm_section_list_t;
/* Execution environment, e.g. stack info */
typedef struct WASMExecEnv {
uint8_t *stack;
uint32_t stack_size;
} *wasm_exec_env_t;
/* Package Type */
typedef enum {
Wasm_Module_Bytecode = 0,
Wasm_Module_AoT,
Package_Type_Unknown = 0xFFFF
} package_type_t;
/**
* Initialize the WASM runtime environment.
*
* @return true if success, false otherwise
*/
bool
wasm_runtime_init();
/**
* Destroy the WASM runtime environment.
*/
void
wasm_runtime_destroy();
/**
* Get the package type of a buffer.
*
* @param buf the package buffer
* @param size the package buffer size
*
* @return the package type, return Package_Type_Unknown if the type is unknown
*/
package_type_t
get_package_type(const uint8_t *buf, uint32_t size);
/**
* Load a WASM module from a specified byte buffer.
*
* @param buf the byte buffer which contains the WASM binary data
* @param size the size of the buffer
* @param error_buf output of the exception info
* @param error_buf_size the size of the exception string
*
* @return return WASM module loaded, NULL if failed
*/
wasm_module_t
wasm_runtime_load(const uint8_t *buf, uint32_t size,
char *error_buf, uint32_t error_buf_size);
/**
* Load a WASM module from a specified WASM section list.
*
* @param section_list the section list which contains each section data
* @param error_buf output of the exception info
* @param error_buf_size the size of the exception string
*
* @return return WASM module loaded, NULL if failed
*/
wasm_module_t
wasm_runtime_load_from_sections(wasm_section_list_t section_list,
char *error_buf, uint32_t error_buf_size);
/**
* Unload a WASM module.
*
* @param module the module to be unloaded
*/
void
wasm_runtime_unload(wasm_module_t module);
/**
* Instantiate a WASM module.
*
* @param module the WASM module to instantiate
* @param stack_size the default stack size of the module instance, a stack
* will be created when function wasm_runtime_call_wasm() is called
* to run WASM function and the exec_env argument passed to
* wasm_runtime_call_wasm() is NULL. That means this parameter is
* ignored if exec_env is not NULL.
* @param heap_size the default heap size of the module instance, a heap will
* be created besides the app memory space. Both wasm app and native
* function can allocate memory from the heap. If heap_size is 0, the
* default heap size will be used.
* @param error_buf buffer to output the error info if failed
* @param error_buf_size the size of the error buffer
*
* @return return the instantiated WASM module instance, NULL if failed
*/
wasm_module_inst_t
wasm_runtime_instantiate(const wasm_module_t module,
uint32_t stack_size, uint32_t heap_size,
char *error_buf, uint32_t error_buf_size);
/**
* Deinstantiate a WASM module instance, destroy the resources.
*
* @param module_inst the WASM module instance to destroy
*/
void
wasm_runtime_deinstantiate(wasm_module_inst_t module_inst);
/**
* Load WASM module instance from AOT file.
*
* @param aot_file the AOT file of a WASM module
* @param aot_file_size the AOT file size
* @param heap_size the default heap size of the module instance, a heap will
* be created besides the app memory space. Both wasm app and native
* function can allocate memory from the heap. If heap_size is 0, the
* default heap size will be used.
* @param error_buf buffer to output the error info if failed
* @param error_buf_size the size of the error buffer
*
* @return the instantiated WASM module instance, NULL if failed
*/
wasm_module_inst_t
wasm_runtime_load_aot(uint8_t *aot_file, uint32_t aot_file_size,
uint32_t heap_size,
char *error_buf, uint32_t error_buf_size);
/**
* Lookup an exported function in the WASM module instance.
*
* @param module_inst the module instance
* @param name the name of the function
* @param signature the signature of the function, use "i32"/"i64"/"f32"/"f64"
* to represent the type of i32/i64/f32/f64, e.g. "(i32i64)" "(i32)f32"
*
* @return the function instance found, if the module instance is loaded from
* the AOT file, the return value is the function pointer
*/
wasm_function_inst_t
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
const char *name, const char *signature);
/**
* Create execution environment.
*
* @param stack_size the stack size to execute a WASM function
*
* @return the execution environment
*/
wasm_exec_env_t
wasm_runtime_create_exec_env(uint32_t stack_size);
/**
* Destroy the execution environment.
*
* @param env the execution environment to destroy
*/
void
wasm_runtime_destory_exec_env(wasm_exec_env_t env);
/**
* Call the given WASM function of a WASM module instance with
* arguments (bytecode and AoT).
*
* @param module_inst the WASM module instance which the function belongs to
* @param exec_env the execution environment to call the function. If the module
* instance is created by AoT mode, it is ignored and just set it to NULL.
* If the module instance is created by bytecode mode and it is NULL,
* a temporary env object will be created
* @param function the function to be called
* @param argc the number of arguments
* @param argv the arguments. If the function method 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 exception info.
*/
bool
wasm_runtime_call_wasm(wasm_module_inst_t module_inst,
wasm_exec_env_t exec_env,
wasm_function_inst_t function,
uint32_t argc, uint32_t argv[]);
/**
* Get exception info of the WASM module instance.
*
* @param module_inst the WASM module instance
*
* @return the exception string
*/
const char*
wasm_runtime_get_exception(wasm_module_inst_t module_inst);
/**
* Clear exception info of the WASM module instance.
*
* @param module_inst the WASM module instance
*/
void
wasm_runtime_clear_exception(wasm_module_inst_t module_inst);
/**
* Attach the current native thread to a WASM module instance.
* A native thread cannot be attached simultaneously to two WASM module
* instances. The WASM module instance will be attached to the native
* thread which it is instantiated in by default.
*
* @param module_inst the WASM module instance to attach
* @param thread_data the thread data that current native thread requires
* the WASM module instance to store
*
* @return true if SUCCESS, false otherwise
*/
bool
wasm_runtime_attach_current_thread(wasm_module_inst_t module_inst,
void *thread_data);
/**
* Detach the current native thread from a WASM module instance.
*
* @param module_inst the WASM module instance to detach
*/
void
wasm_runtime_detach_current_thread(wasm_module_inst_t module_inst);
/**
* Get the thread data that the current native thread requires the WASM
* module instance to store when attaching.
*
* @return the thread data stored when attaching
*/
void*
wasm_runtime_get_current_thread_data();
/**
* Get current WASM module instance of the current native thread
*
* @return current WASM module instance of the current native thread, NULL
* if not found
*/
wasm_module_inst_t
wasm_runtime_get_current_module_inst();
/**
* Allocate memory from the heap of WASM module instance
*
* @param module_inst the WASM module instance which contains heap
* @param size the size bytes to allocate
*
* @return the allocated memory address, which is a relative offset to the
* base address of the module instance's memory space, the value range
* is (-heap_size, 0). Note that it is not an absolute address.
* Return non-zero if success, zero if failed.
*/
int32_t
wasm_runtime_module_malloc(wasm_module_inst_t module_inst, uint32_t size);
/**
* Free memory to the heap of WASM module instance
*
* @param module_inst the WASM module instance which contains heap
* @param ptr the pointer to free
*/
void
wasm_runtime_module_free(wasm_module_inst_t module_inst, int32_t ptr);
/**
* Allocate memory from the heap of WASM module instance and initialize
* the memory with src
*
* @param module_inst the WASM module instance which contains heap
* @param src the source data to copy
* @param size the size of the source data
*
* @return the allocated memory address, which is a relative offset to the
* base address of the module instance's memory space, the value range
* is (-heap_size, 0). Note that it is not an absolute address.
* Return non-zero if success, zero if failed.
*/
int32_t
wasm_runtime_module_dup_data(wasm_module_inst_t module_inst,
const char *src, uint32_t size);
/**
* Validate the app address, check whether it belongs to WASM module
* instance's address space, or in its heap space or memory space.
*
* @param module_inst the WASM module instance
* @param app_offset the app address to validate, which is a relative address
* @param size the size bytes of the app address
*
* @return true if success, false otherwise. If failed, an exception will
* be thrown.
*/
bool
wasm_runtime_validate_app_addr(wasm_module_inst_t module_inst,
int32_t app_offset, uint32_t size);
/**
* Validate the native address, check whether it belongs to WASM module
* instance's address space, or in its heap space or memory space.
*
* @param module_inst the WASM module instance
* @param native_ptr the native address to validate, which is an absolute
* address
* @param size the size bytes of the app address
*
* @return true if success, false otherwise. If failed, an exception will
* be thrown.
*/
bool
wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
void *native_ptr, uint32_t size);
/**
* Convert app address(relative address) to native address(absolute address)
*
* @param module_inst the WASM module instance
* @param app_offset the app adress
*
* @return the native address converted
*/
void *
wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
int32_t app_offset);
/**
* Convert native address(absolute address) to app address(relative address)
*
* @param module_inst the WASM module instance
* @param native_ptr the native address
*
* @return the app address converted
*/
int32_t
wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
void *native_ptr);
/**
* Find the unique main function from a WASM module instance
* and execute that function.
*
* @param module_inst the WASM module instance
* @param argc the number of arguments
* @param argv the arguments array
*
* @return true if the main function is called, false otherwise.
*/
bool
wasm_application_execute_main(wasm_module_inst_t module_inst,
int argc, char *argv[]);
/**
* Find the specified function in argv[0] from WASM module of current instance
* and execute that function.
*
* @param module_inst the WASM module instance
* @param name the name of the function to execute
* @param argc the number of arguments
* @param argv the arguments array
*
* @return true if the specified function is called, false otherwise.
*/
bool
wasm_application_execute_func(wasm_module_inst_t module_inst,
const char *name, int argc, char *argv[]);
#ifdef __cplusplus
}
#endif
#endif /* end of _WASM_EXPORT_H */

View File

@ -0,0 +1,144 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WASM_HASHMAP_H
#define WASM_HASHMAP_H
#include "wasm_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Maximum initial size of hash map */
#define HASH_MAP_MAX_SIZE 65536
struct HashMap;
typedef struct HashMap HashMap;
/* Hash function: to get the hash value of key. */
typedef uint32 (*HashFunc)(const void *key);
/* Key equal function: to check whether two keys are equal. */
typedef bool (*KeyEqualFunc)(void *key1, void *key2);
/* Key destroy function: to destroy the key, auto called
when an hash element is removed. */
typedef void (*KeyDestroyFunc)(void *key);
/* Value destroy function: to destroy the value, auto called
when an hash element is removed. */
typedef void (*ValueDestroyFunc)(void *key);
/**
* Create a hash map.
*
* @param size: the initial size of the hash map
* @param use_lock whether to lock the hash map when operating on it
* @param hash_func hash function of the key, must be specified
* @param key_equal_func key equal function, check whether two keys
* are equal, must be specified
* @param key_destroy_func key destroy function, called when an hash element
* is removed if it is not NULL
* @param value_destroy_func value destroy function, called when an hash
* element is removed if it is not NULL
*
* @return the hash map created, NULL if failed
*/
HashMap*
wasm_hash_map_create(uint32 size, bool use_lock,
HashFunc hash_func,
KeyEqualFunc key_equal_func,
KeyDestroyFunc key_destroy_func,
ValueDestroyFunc value_destroy_func);
/**
* Insert an element to the hash map
*
* @param map the hash map to insert element
* @key the key of the element
* @value the value of the element
*
* @return true if success, false otherwise
* Note: fail if key is NULL or duplicated key exists in the hash map,
*/
bool
wasm_hash_map_insert(HashMap *map, void *key, void *value);
/**
* Find an element in the hash map
*
* @param map the hash map to find element
* @key the key of the element
*
* @return the value of the found element if success, NULL otherwise
*/
void*
wasm_hash_map_find(HashMap *map, void *key);
/**
* Update an element in the hash map with new value
*
* @param map the hash map to update element
* @key the key of the element
* @value the new value of the element
* @p_old_value if not NULL, copies the old value to it
*
* @return true if success, false otherwise
* Note: the old value won't be destroyed by value destory function,
* it will be copied to p_old_value for user to process.
*/
bool
wasm_hash_map_update(HashMap *map, void *key, void *value,
void **p_old_value);
/**
* Remove an element from the hash map
*
* @param map the hash map to remove element
* @key the key of the element
* @p_old_key if not NULL, copies the old key to it
* @p_old_value if not NULL, copies the old value to it
*
* @return true if success, false otherwise
* Note: the old key and old value won't be destroyed by key destroy
* function and value destroy function, they will be copied to
* p_old_key and p_old_value for user to process.
*/
bool
wasm_hash_map_remove(HashMap *map, void *key,
void **p_old_key, void **p_old_value);
/**
* Destroy the hashmap
*
* @param map the hash map to destroy
*
* @return true if success, false otherwise
* Note: the key destroy function and value destroy function will be
* called to destroy each element's key and value if they are
* not NULL.
*/
bool
wasm_hash_map_destroy(HashMap *map);
#ifdef __cplusplus
}
#endif
#endif /* endof WASM_HASHMAP_H */

View File

@ -0,0 +1,94 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @brief This log system supports wrapping multiple outputs into one
* log message. This is useful for outputting variable-length logs
* without additional memory overhead (the buffer for concatenating
* the message), e.g. exception stack trace, which cannot be printed
* by a single log calling without the help of an additional buffer.
* Avoiding additional memory buffer is useful for resource-constraint
* systems. It can minimize the impact of log system on applications
* and logs can be printed even when no enough memory is available.
* Functions with prefix "_" are private functions. Only macros that
* are not start with "_" are exposed and can be used.
*/
#ifndef _WASM_LOG_H
#define _WASM_LOG_H
#include "wasm_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* The following functions are the primitive operations of this log system.
* A normal usage of the log system is to call wasm_log_begin and then call
* wasm_log_printf or wasm_log_vprintf one or multiple times and then call
* wasm_log_end to wrap (mark) the previous outputs into one log message.
* The wasm_log and macros LOG_ERROR etc. can be used to output log messages
* by one log calling.
*/
int _wasm_log_init (void);
void _wasm_log_set_verbose_level (int level);
bool _wasm_log_begin (int level);
void _wasm_log_printf (const char *fmt, ...);
void _wasm_log_vprintf (const char *fmt, va_list ap);
void _wasm_log_end (void);
void _wasm_log (int level, const char *file, int line,
const char *fmt, ...);
#if WASM_ENABLE_LOG != 0
# define wasm_log_init() _wasm_log_init ()
# define wasm_log_set_verbose_level(l) _wasm_log_set_verbose_level (l)
# define wasm_log_begin(l) _wasm_log_begin (l)
# define wasm_log_printf(...) _wasm_log_printf (__VA_ARGS__)
# define wasm_log_vprintf(...) _wasm_log_vprintf (__VA_ARGS__)
# define wasm_log_end() _wasm_log_end ()
# define wasm_log(...) _wasm_log (__VA_ARGS__)
#else /* WASM_ENABLE_LOG != 0 */
# define wasm_log_init() 0
# define wasm_log_set_verbose_level(l) (void)0
# define wasm_log_begin() false
# define wasm_log_printf(...) (void)0
# define wasm_log_vprintf(...) (void)0
# define wasm_log_end() (void)0
# define wasm_log(...) (void)0
#endif /* WASM_ENABLE_LOG != 0 */
#define LOG_ERROR(...) wasm_log (0, NULL, 0, __VA_ARGS__)
#define LOG_WARNING(...) wasm_log (1, NULL, 0, __VA_ARGS__)
#define LOG_VERBOSE(...) wasm_log (2, NULL, 0, __VA_ARGS__)
#if defined(WASM_DEBUG)
# define LOG_DEBUG(...) _wasm_log (1, __FILE__, __LINE__, __VA_ARGS__)
#else /* defined(WASM_DEBUG) */
# define LOG_DEBUG(...) (void)0
#endif /* defined(WASM_DEBUG) */
#define LOG_PROFILE_HEAP_GC(heap, size) \
LOG_VERBOSE("PROF.HEAP.GC: HEAP=%08X SIZE=%d", heap, size)
#ifdef __cplusplus
}
#endif
#endif /* _WASM_LOG_H */

View File

@ -0,0 +1,137 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _WASM_VECTOR_H
#define _WASM_VECTOR_H
#include "wasm_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_VECTOR_INIT_SIZE 8
typedef struct Vector {
/* size of each element */
uint32 size_elem;
/* max element number */
uint32 max_elements;
/* current element num */
uint32 num_elements;
/* vector data allocated */
uint8 *data;
} Vector;
/**
* Initialize vector
*
* @param vector the vector to init
* @param init_length the initial length of the vector
* @param size_elem size of each element
*
* @return true if success, false otherwise
*/
bool
wasm_vector_init(Vector *vector, uint32 init_length, uint32 size_elem);
/**
* Set element of vector
*
* @param vector the vector to set
* @param index the index of the element to set
* @param elem_buf the element buffer which stores the element data
*
* @return true if success, false otherwise
*/
bool
wasm_vector_set(Vector *vector, uint32 index, const void *elem_buf);
/**
* Get element of vector
*
* @param vector the vector to get
* @param index the index of the element to get
* @param elem_buf the element buffer to store the element data,
* whose length must be no less than element size
*
* @return true if success, false otherwise
*/
bool
wasm_vector_get(const Vector *vector, uint32 index, void *elem_buf);
/**
* Insert element of vector
*
* @param vector the vector to insert
* @param index the index of the element to insert
* @param elem_buf the element buffer which stores the element data
*
* @return true if success, false otherwise
*/
bool
wasm_vector_insert(Vector *vector, uint32 index, const void *elem_buf);
/**
* Append element to the end of vector
*
* @param vector the vector to append
* @param elem_buf the element buffer which stores the element data
*
* @return true if success, false otherwise
*/
bool
wasm_vector_append(Vector *vector, const void *elem_buf);
/**
* Remove element from vector
*
* @param vector the vector to remove element
* @param index the index of the element to remove
* @param old_elem_buf if not NULL, copies the element data to the buffer
*
* @return true if success, false otherwise
*/
bool
wasm_vector_remove(Vector *vector, uint32 index, void *old_elem_buf);
/**
* Return the size of the vector
*
* @param vector the vector to get size
*
* @return return the size of the vector
*/
uint32
wasm_vector_size(const Vector *vector);
/**
* Destroy the vector
*
* @param vector the vector to destroy
*
* @return true if success, false otherwise
*/
bool
wasm_vector_destroy(Vector *vector);
#ifdef __cplusplus
}
#endif
#endif /* endof _WASM_VECTOR_H */