diff --git a/ci/generate_checked_functions.py b/ci/generate_checked_functions.py index 4243202ed..faa8a275e 100644 --- a/ci/generate_checked_functions.py +++ b/ci/generate_checked_functions.py @@ -268,12 +268,14 @@ def generate_checked_headers(header_paths): for node in ast.ext if isinstance(node, c_ast.Decl) and isinstance(node.type, c_ast.FuncDecl) ] + functions = sorted(functions, key=lambda f: f.name) return_types = { " ".join(func.type.type.type.names) for func in functions if isinstance(func.type.type, c_ast.TypeDecl) } + return_types = sorted(return_types) result_struct = generate_result_struct(return_types) write_checked_header(output_path, result_struct, functions, typedefs) diff --git a/core/iwasm/include/aot_export_checked.h b/core/iwasm/include/aot_export_checked.h index 7dfab1152..03c2dc9d1 100644 --- a/core/iwasm/include/aot_export_checked.h +++ b/core/iwasm/include/aot_export_checked.h @@ -19,11 +19,11 @@ typedef struct { int error_code; // Error code (0 for success, non-zero for errors) union { - uint32_t uint32_t_value; _Bool _Bool_value; - aot_obj_data_t aot_obj_data_t_value; - aot_comp_data_t aot_comp_data_t_value; aot_comp_context_t aot_comp_context_t_value; + aot_comp_data_t aot_comp_data_t_value; + aot_obj_data_t aot_obj_data_t_value; + uint32_t uint32_t_value; // Add other types as needed } value; } Result; @@ -44,6 +44,60 @@ aot_call_stack_features_init_default_checked(void *features) return res; } +static inline Result +aot_compile_wasm_checked(aot_comp_context_t comp_ctx) +{ + Result res; + // Execute the original function + _Bool original_result = aot_compile_wasm(comp_ctx); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +aot_compiler_destroy_checked(void) +{ + Result res; + // Execute the original function + aot_compiler_destroy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +aot_compiler_init_checked(void) +{ + Result res; + // Execute the original function + _Bool original_result = aot_compiler_init(); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +aot_create_comp_context_checked(aot_comp_data_t comp_data, + aot_comp_option_t option) +{ + Result res; + // Execute the original function + aot_comp_context_t original_result = + aot_create_comp_context(comp_data, option); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.aot_comp_context_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result aot_create_comp_data_checked(void *wasm_module, void *target_arch, _Bool gc_enabled) @@ -74,58 +128,21 @@ aot_create_comp_data_checked(void *wasm_module, void *target_arch, } static inline Result -aot_destroy_comp_data_checked(aot_comp_data_t comp_data) +aot_destroy_aot_file_checked(void *aot_file) { Result res; + // Check for null pointer parameter: aot_file + if (aot_file == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - aot_destroy_comp_data(comp_data); + aot_destroy_aot_file(aot_file); // Assign return value and error code res.error_code = 0; return res; } -static inline Result -aot_compiler_init_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = aot_compiler_init(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -aot_compiler_destroy_checked(void) -{ - Result res; - // Execute the original function - aot_compiler_destroy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -aot_create_comp_context_checked(aot_comp_data_t comp_data, - aot_comp_option_t option) -{ - Result res; - // Execute the original function - aot_comp_context_t original_result = - aot_create_comp_context(comp_data, option); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.aot_comp_context_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result aot_destroy_comp_context_checked(aot_comp_context_t comp_ctx) { @@ -138,62 +155,31 @@ aot_destroy_comp_context_checked(aot_comp_context_t comp_ctx) } static inline Result -aot_compile_wasm_checked(aot_comp_context_t comp_ctx) +aot_destroy_comp_data_checked(aot_comp_data_t comp_data) { Result res; // Execute the original function - _Bool original_result = aot_compile_wasm(comp_ctx); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -aot_obj_data_create_checked(aot_comp_context_t comp_ctx) -{ - Result res; - // Execute the original function - aot_obj_data_t original_result = aot_obj_data_create(comp_ctx); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.aot_obj_data_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -aot_obj_data_destroy_checked(aot_obj_data_t obj_data) -{ - Result res; - // Execute the original function - aot_obj_data_destroy(obj_data); + aot_destroy_comp_data(comp_data); // Assign return value and error code res.error_code = 0; return res; } static inline Result -aot_get_aot_file_size_checked(aot_comp_context_t comp_ctx, - aot_comp_data_t comp_data, - aot_obj_data_t obj_data) +aot_emit_aot_file_checked(aot_comp_context_t comp_ctx, + aot_comp_data_t comp_data, void *file_name) { Result res; + // Check for null pointer parameter: file_name + if (file_name == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - uint32_t original_result = - aot_get_aot_file_size(comp_ctx, comp_data, obj_data); + _Bool original_result = aot_emit_aot_file(comp_ctx, comp_data, file_name); // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } @@ -270,36 +256,22 @@ aot_emit_object_file_checked(aot_comp_context_t comp_ctx, void *file_name) } static inline Result -aot_emit_aot_file_checked(aot_comp_context_t comp_ctx, - aot_comp_data_t comp_data, void *file_name) +aot_get_aot_file_size_checked(aot_comp_context_t comp_ctx, + aot_comp_data_t comp_data, + aot_obj_data_t obj_data) { Result res; - // Check for null pointer parameter: file_name - if (file_name == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - _Bool original_result = aot_emit_aot_file(comp_ctx, comp_data, file_name); + uint32_t original_result = + aot_get_aot_file_size(comp_ctx, comp_data, obj_data); // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -aot_destroy_aot_file_checked(void *aot_file) -{ - Result res; - // Check for null pointer parameter: aot_file - if (aot_file == NULL) { - res.error_code = -1; - return res; + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; } - // Execute the original function - aot_destroy_aot_file(aot_file); - // Assign return value and error code - res.error_code = 0; return res; } @@ -331,4 +303,32 @@ aot_get_plt_table_size_checked(void) return res; } +static inline Result +aot_obj_data_create_checked(aot_comp_context_t comp_ctx) +{ + Result res; + // Execute the original function + aot_obj_data_t original_result = aot_obj_data_create(comp_ctx); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.aot_obj_data_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +aot_obj_data_destroy_checked(aot_obj_data_t obj_data) +{ + Result res; + // Execute the original function + aot_obj_data_destroy(obj_data); + // Assign return value and error code + res.error_code = 0; + return res; +} + #endif // AOT_EXPORT_CHECKED_H diff --git a/core/iwasm/include/gc_export_checked.h b/core/iwasm/include/gc_export_checked.h index 4c584de14..47b651bd2 100644 --- a/core/iwasm/include/gc_export_checked.h +++ b/core/iwasm/include/gc_export_checked.h @@ -19,30 +19,30 @@ typedef struct { int error_code; // Error code (0 for success, non-zero for errors) union { - wasm_array_obj_t wasm_array_obj_t_value; - wasm_struct_obj_t wasm_struct_obj_t_value; - wasm_exec_env_t wasm_exec_env_t_value; - wasm_func_type_t wasm_func_type_t_value; - wasm_memory_inst_t wasm_memory_inst_t_value; - wasm_module_t wasm_module_t_value; - wasm_defined_type_t wasm_defined_type_t_value; - wasm_function_inst_t wasm_function_inst_t_value; - wasm_externref_obj_t wasm_externref_obj_t_value; - package_type_t package_type_t_value; - wasm_i31_obj_t wasm_i31_obj_t_value; - wasm_ref_type_t wasm_ref_type_t_value; - wasm_module_inst_t wasm_module_inst_t_value; + RunningMode RunningMode_value; _Bool _Bool_value; double double_value; - wasm_func_obj_t wasm_func_obj_t_value; - wasm_obj_t wasm_obj_t_value; - uint64_t uint64_t_value; - wasm_shared_heap_t wasm_shared_heap_t_value; - RunningMode RunningMode_value; int32_t int32_t_value; - wasm_valkind_t wasm_valkind_t_value; + package_type_t package_type_t_value; uint32_t uint32_t_value; + uint64_t uint64_t_value; wasm_anyref_obj_t wasm_anyref_obj_t_value; + wasm_array_obj_t wasm_array_obj_t_value; + wasm_defined_type_t wasm_defined_type_t_value; + wasm_exec_env_t wasm_exec_env_t_value; + wasm_externref_obj_t wasm_externref_obj_t_value; + wasm_func_obj_t wasm_func_obj_t_value; + wasm_func_type_t wasm_func_type_t_value; + wasm_function_inst_t wasm_function_inst_t_value; + wasm_i31_obj_t wasm_i31_obj_t_value; + wasm_memory_inst_t wasm_memory_inst_t_value; + wasm_module_inst_t wasm_module_inst_t_value; + wasm_module_t wasm_module_t_value; + wasm_obj_t wasm_obj_t_value; + wasm_ref_type_t wasm_ref_type_t_value; + wasm_shared_heap_t wasm_shared_heap_t_value; + wasm_struct_obj_t wasm_struct_obj_t_value; + wasm_valkind_t wasm_valkind_t_value; // Add other types as needed } value; } Result; @@ -69,142 +69,6 @@ get_base_lib_export_apis_checked(void *p_base_lib_apis) return res; } -static inline Result -wasm_runtime_init_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_init(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_full_init_checked(void *init_args) -{ - Result res; - // Check for null pointer parameter: init_args - if (init_args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_full_init(init_args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_log_level_checked(log_level_t level) -{ - Result res; - // Execute the original function - wasm_runtime_set_log_level(level); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_running_mode_supported_checked(RunningMode running_mode) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_is_running_mode_supported(running_mode); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_default_running_mode_checked(RunningMode running_mode) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_set_default_running_mode(running_mode); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_destroy_checked(void) -{ - Result res; - // Execute the original function - wasm_runtime_destroy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_malloc_checked(unsigned int size) -{ - Result res; - // Execute the original function - wasm_runtime_malloc(size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_realloc_checked(void *ptr, unsigned int size) -{ - Result res; - // Check for null pointer parameter: ptr - if (ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_realloc(ptr, size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_free_checked(void *ptr) -{ - Result res; - // Check for null pointer parameter: ptr - if (ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_free(ptr); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_mem_alloc_info_checked(void *mem_alloc_info) -{ - Result res; - // Check for null pointer parameter: mem_alloc_info - if (mem_alloc_info == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_get_mem_alloc_info(mem_alloc_info); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - static inline Result get_package_type_checked(void *buf, uint32_t size) { @@ -227,6 +91,2068 @@ get_package_type_checked(void *buf, uint32_t size) return res; } +static inline Result +wasm_anyref_obj_get_value_checked(wasm_anyref_obj_t anyref_obj) +{ + Result res; + // Execute the original function + wasm_anyref_obj_get_value(anyref_obj); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_anyref_obj_new_checked(wasm_exec_env_t exec_env, void *host_obj) +{ + Result res; + // Check for null pointer parameter: host_obj + if (host_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_anyref_obj_t original_result = wasm_anyref_obj_new(exec_env, host_obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_anyref_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_application_execute_func_checked(wasm_module_inst_t module_inst, + void *name, int32_t argc, void *argv) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_application_execute_func(module_inst, name, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_application_execute_main_checked(wasm_module_inst_t module_inst, + int32_t argc, void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_application_execute_main(module_inst, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_array_obj_copy_checked(wasm_array_obj_t dst_obj, uint32_t dst_idx, + wasm_array_obj_t src_obj, uint32_t src_idx, + uint32_t len) +{ + Result res; + // Execute the original function + wasm_array_obj_copy(dst_obj, dst_idx, src_obj, src_idx, len); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_array_obj_elem_addr_checked(wasm_array_obj_t array_obj, uint32_t elem_idx) +{ + Result res; + // Execute the original function + wasm_array_obj_elem_addr(array_obj, elem_idx); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_array_obj_first_elem_addr_checked(wasm_array_obj_t array_obj) +{ + Result res; + // Execute the original function + wasm_array_obj_first_elem_addr(array_obj); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_array_obj_get_elem_checked(wasm_array_obj_t array_obj, uint32_t elem_idx, + _Bool sign_extend, void *value) +{ + Result res; + // Check for null pointer parameter: value + if (value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_array_obj_get_elem(array_obj, elem_idx, sign_extend, value); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_array_obj_length_checked(wasm_array_obj_t array_obj) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_array_obj_length(array_obj); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_array_obj_new_with_type_checked(wasm_exec_env_t exec_env, + wasm_array_type_t type, uint32_t length, + void *init_value) +{ + Result res; + // Check for null pointer parameter: init_value + if (init_value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_array_obj_t original_result = + wasm_array_obj_new_with_type(exec_env, type, length, init_value); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_array_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_array_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, + uint32_t type_idx, uint32_t length, + void *init_value) +{ + Result res; + // Check for null pointer parameter: init_value + if (init_value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_array_obj_t original_result = + wasm_array_obj_new_with_typeidx(exec_env, type_idx, length, init_value); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_array_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_array_obj_set_elem_checked(wasm_array_obj_t array_obj, uint32_t elem_idx, + void *value) +{ + Result res; + // Check for null pointer parameter: value + if (value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_array_obj_set_elem(array_obj, elem_idx, value); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_array_type_get_elem_type_checked(wasm_array_type_t array_type, + void *p_is_mutable) +{ + Result res; + // Check for null pointer parameter: p_is_mutable + if (p_is_mutable == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_type_t original_result = + wasm_array_type_get_elem_type(array_type, p_is_mutable); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_ref_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_copy_callstack_checked(wasm_exec_env_t exec_env, void *buffer, + uint32_t length, uint32_t skip_n, void *error_buf, + uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: buffer + if (buffer == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = wasm_copy_callstack( + exec_env, buffer, length, skip_n, error_buf, error_buf_size); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_defined_type_equal_checked(wasm_defined_type_t def_type1, + wasm_defined_type_t def_type2, + wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_defined_type_equal(def_type1, def_type2, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_defined_type_is_array_type_checked(wasm_defined_type_t def_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_defined_type_is_array_type(def_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_defined_type_is_func_type_checked(wasm_defined_type_t def_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_defined_type_is_func_type(def_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_defined_type_is_struct_type_checked(wasm_defined_type_t def_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_defined_type_is_struct_type(def_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_defined_type_is_subtype_of_checked(wasm_defined_type_t def_type1, + wasm_defined_type_t def_type2, + wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_defined_type_is_subtype_of(def_type1, def_type2, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_obj2ref_checked(wasm_module_inst_t module_inst, void *extern_obj, + void *p_externref_idx) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_externref_idx + if (p_externref_idx == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_externref_obj2ref(module_inst, extern_obj, p_externref_idx); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_obj_get_value_checked(wasm_externref_obj_t externref_obj) +{ + Result res; + // Execute the original function + wasm_externref_obj_get_value(externref_obj); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externref_obj_new_checked(wasm_exec_env_t exec_env, void *host_obj) +{ + Result res; + // Check for null pointer parameter: host_obj + if (host_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externref_obj_t original_result = + wasm_externref_obj_new(exec_env, host_obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_externref_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_externref_obj_to_internal_obj_checked(wasm_externref_obj_t externref_obj) +{ + Result res; + // Execute the original function + wasm_obj_t original_result = + wasm_externref_obj_to_internal_obj(externref_obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_externref_objdel_checked(wasm_module_inst_t module_inst, void *extern_obj) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_externref_objdel(module_inst, extern_obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_ref2obj_checked(uint32_t externref_idx, void *p_extern_obj) +{ + Result res; + // Check for null pointer parameter: p_extern_obj + if (p_extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_externref_ref2obj(externref_idx, p_extern_obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_retain_checked(uint32_t externref_idx) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_externref_retain(externref_idx); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_set_cleanup_checked(wasm_module_inst_t module_inst, + void *extern_obj, void *extern_obj_cleanup) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: extern_obj_cleanup + if (extern_obj_cleanup == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_externref_set_cleanup(module_inst, extern_obj, extern_obj_cleanup); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_func_get_param_count_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_func_get_param_count(func_inst, module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_get_param_types_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst, + void *param_types) +{ + Result res; + // Check for null pointer parameter: param_types + if (param_types == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_get_param_types(func_inst, module_inst, param_types); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_get_result_count_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_func_get_result_count(func_inst, module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_get_result_types_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst, + void *result_types) +{ + Result res; + // Check for null pointer parameter: result_types + if (result_types == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_get_result_types(func_inst, module_inst, result_types); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_obj_get_func_idx_bound_checked(wasm_func_obj_t func_obj) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_func_obj_get_func_idx_bound(func_obj); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_obj_get_func_type_checked(wasm_func_obj_t func_obj) +{ + Result res; + // Execute the original function + wasm_func_type_t original_result = wasm_func_obj_get_func_type(func_obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_func_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_obj_new_with_type_checked(wasm_exec_env_t exec_env, + wasm_func_type_t type, + uint32_t func_idx_bound) +{ + Result res; + // Execute the original function + wasm_func_obj_t original_result = + wasm_func_obj_new_with_type(exec_env, type, func_idx_bound); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_func_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, + uint32_t type_idx, + uint32_t func_idx_bound) +{ + Result res; + // Execute the original function + wasm_func_obj_t original_result = + wasm_func_obj_new_with_typeidx(exec_env, type_idx, func_idx_bound); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_func_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_param_count_checked(wasm_func_type_t func_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_func_type_get_param_count(func_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_param_type_checked(wasm_func_type_t func_type, + uint32_t param_idx) +{ + Result res; + // Execute the original function + wasm_ref_type_t original_result = + wasm_func_type_get_param_type(func_type, param_idx); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_ref_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_param_valkind_checked(wasm_func_type_t func_type, + uint32_t param_index) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = + wasm_func_type_get_param_valkind(func_type, param_index); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_result_count_checked(wasm_func_type_t func_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_func_type_get_result_count(func_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_result_type_checked(wasm_func_type_t func_type, + uint32_t result_idx) +{ + Result res; + // Execute the original function + wasm_ref_type_t original_result = + wasm_func_type_get_result_type(func_type, result_idx); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_ref_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_result_valkind_checked(wasm_func_type_t func_type, + uint32_t result_index) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = + wasm_func_type_get_result_valkind(func_type, result_index); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_get_defined_type_checked(wasm_module_t module, uint32_t index) +{ + Result res; + // Execute the original function + wasm_defined_type_t original_result = wasm_get_defined_type(module, index); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_defined_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_get_defined_type_count_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_get_defined_type_count(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_global_type_get_mutable_checked(wasm_global_type_t global_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_global_type_get_mutable(global_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_global_type_get_valkind_checked(wasm_global_type_t global_type) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = wasm_global_type_get_valkind(global_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_i31_obj_get_value_checked(wasm_i31_obj_t i31_obj, _Bool sign_extend) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_i31_obj_get_value(i31_obj, sign_extend); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_i31_obj_new_checked(uint32_t i31_value) +{ + Result res; + // Execute the original function + wasm_i31_obj_t original_result = wasm_i31_obj_new(i31_value); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_i31_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_internal_obj_to_externref_obj_checked(wasm_exec_env_t exec_env, + wasm_obj_t internal_obj) +{ + Result res; + // Execute the original function + wasm_externref_obj_t original_result = + wasm_internal_obj_to_externref_obj(exec_env, internal_obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_externref_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_enlarge_checked(wasm_memory_inst_t memory_inst, + uint64_t inc_page_count) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_enlarge(memory_inst, inc_page_count); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_get_base_address_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + wasm_memory_get_base_address(memory_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_get_bytes_per_page_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_bytes_per_page(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_cur_page_count_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_cur_page_count(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_max_page_count_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_max_page_count(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_shared_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_get_shared(memory_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_type_get_init_page_count_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_memory_type_get_init_page_count(memory_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_type_get_max_page_count_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_memory_type_get_max_page_count(memory_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_type_get_shared_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_type_get_shared(memory_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_get_defined_type_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + wasm_defined_type_t original_result = wasm_obj_get_defined_type(obj); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_defined_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_obj_get_defined_type_idx_checked(wasm_module_t module, wasm_obj_t obj) +{ + Result res; + // Execute the original function + int32_t original_result = wasm_obj_get_defined_type_idx(module, obj); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_obj_is_anyref_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_anyref_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_array_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_array_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_eq_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_eq_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_externref_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_externref_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_func_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_func_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_i31_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_i31_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_instance_of_defined_type_checked(wasm_obj_t obj, + wasm_defined_type_t defined_type, + wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_obj_is_instance_of_defined_type(obj, defined_type, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_instance_of_ref_type_checked(wasm_obj_t obj, void *ref_type) +{ + Result res; + // Check for null pointer parameter: ref_type + if (ref_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_obj_is_instance_of_ref_type(obj, ref_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_instance_of_type_idx_checked(wasm_obj_t obj, uint32_t type_idx, + wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_obj_is_instance_of_type_idx(obj, type_idx, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_internal_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_internal_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_is_struct_obj_checked(wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_obj_is_struct_obj(obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_set_gc_finalizer_checked(wasm_exec_env_t exec_env, wasm_obj_t obj, + wasm_obj_finalizer_t cb, void *data) +{ + Result res; + // Check for null pointer parameter: data + if (data == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_obj_set_gc_finalizer(exec_env, obj, cb, data); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_obj_unset_gc_finalizer_checked(wasm_exec_env_t exec_env, void *obj) +{ + Result res; + // Check for null pointer parameter: obj + if (obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_obj_unset_gc_finalizer(exec_env, obj); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_type_equal_checked(void *ref_type1, void *ref_type2, + wasm_module_t module) +{ + Result res; + // Check for null pointer parameter: ref_type1 + if (ref_type1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: ref_type2 + if (ref_type2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_ref_type_equal(ref_type1, ref_type2, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_ref_type_is_subtype_of_checked(void *ref_type1, void *ref_type2, + wasm_module_t module) +{ + Result res; + // Check for null pointer parameter: ref_type1 + if (ref_type1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: ref_type2 + if (ref_type2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_ref_type_is_subtype_of(ref_type1, ref_type2, module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_ref_type_set_heap_type_checked(void *ref_type, _Bool nullable, + int32_t heap_type) +{ + Result res; + // Check for null pointer parameter: ref_type + if (ref_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_type_set_heap_type(ref_type, nullable, heap_type); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_type_set_type_idx_checked(void *ref_type, _Bool nullable, + int32_t type_idx) +{ + Result res; + // Check for null pointer parameter: ref_type + if (ref_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_type_set_type_idx(ref_type, nullable, type_idx); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_addr_app_to_native_checked(wasm_module_inst_t module_inst, + uint64_t app_offset) +{ + Result res; + // Execute the original function + wasm_runtime_addr_app_to_native(module_inst, app_offset); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, + void *native_ptr) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint64_t original_result = + wasm_runtime_addr_native_to_app(module_inst, native_ptr); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, + wasm_shared_heap_t shared_heap) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_attach_shared_heap(module_inst, shared_heap); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_begin_blocking_op(exec_env); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_func_ref_checked(wasm_exec_env_t exec_env, + wasm_func_obj_t func_obj, uint32_t argc, + void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_call_func_ref(exec_env, func_obj, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_func_ref_a_checked(wasm_exec_env_t exec_env, + wasm_func_obj_t func_obj, + uint32_t num_results, void *results, + uint32_t num_args, void *args) +{ + Result res; + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_call_func_ref_a( + exec_env, func_obj, num_results, results, num_args, args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_func_ref_v_checked(wasm_exec_env_t exec_env, + wasm_func_obj_t func_obj, + uint32_t num_results, void *results, + uint32_t num_args, ...) +{ + Result res; + va_list args; + // Execute the original function + va_start(args, num_args); + _Bool original_result = wasm_runtime_call_func_ref_v( + exec_env, func_obj, num_results, results, num_args, args); + va_end(args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_indirect_checked(wasm_exec_env_t exec_env, + uint32_t element_index, uint32_t argc, + void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_call_indirect(exec_env, element_index, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, uint32_t argc, + void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_call_wasm(exec_env, function, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_a_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, + uint32_t num_results, void *results, + uint32_t num_args, void *args) +{ + Result res; + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_call_wasm_a( + exec_env, function, num_results, results, num_args, args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_v_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, + uint32_t num_results, void *results, + uint32_t num_args, ...) +{ + Result res; + va_list args; + // Execute the original function + va_start(args, num_args); + _Bool original_result = wasm_runtime_call_wasm_v( + exec_env, function, num_results, results, num_args, args); + va_end(args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_chain_shared_heaps_checked(wasm_shared_heap_t head, + wasm_shared_heap_t body) +{ + Result res; + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_chain_shared_heaps(head, body); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_clear_exception_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_clear_exception(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_create_context_key_checked(void *dtor) +{ + Result res; + // Check for null pointer parameter: dtor + if (dtor == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_create_context_key(dtor); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_create_exec_env_checked(wasm_module_inst_t module_inst, + uint32_t stack_size) +{ + Result res; + // Execute the original function + wasm_exec_env_t original_result = + wasm_runtime_create_exec_env(module_inst, stack_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_exec_env_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_create_shared_heap_checked(void *init_args) +{ + Result res; + // Check for null pointer parameter: init_args + if (init_args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_create_shared_heap(init_args); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_deinstantiate_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_deinstantiate(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_checked(void) +{ + Result res; + // Execute the original function + wasm_runtime_destroy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_context_key_checked(void *key) +{ + Result res; + // Check for null pointer parameter: key + if (key == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_destroy_context_key(key); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_exec_env_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_exec_env(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_spawned_exec_env_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_spawned_exec_env(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_thread_env_checked(void) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_thread_env(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_detach_shared_heap_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_detach_shared_heap(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_detect_native_stack_overflow_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_detect_native_stack_overflow(exec_env); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_detect_native_stack_overflow_size_checked(wasm_exec_env_t exec_env, + uint32_t required_size) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_detect_native_stack_overflow_size(exec_env, required_size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_dump_call_stack_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_dump_call_stack(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_call_stack_to_buf_checked(wasm_exec_env_t exec_env, void *buf, + uint32_t len) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = + wasm_runtime_dump_call_stack_to_buf(exec_env, buf, len); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_dump_mem_consumption_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_dump_mem_consumption(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_perf_profiling_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_dump_perf_profiling(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_pgo_prof_data_to_buf_checked(wasm_module_inst_t module_inst, + void *buf, uint32_t len) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = + wasm_runtime_dump_pgo_prof_data_to_buf(module_inst, buf, len); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_end_blocking_op_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_end_blocking_op(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_enlarge_memory_checked(wasm_module_inst_t module_inst, + uint64_t inc_page_count) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_enlarge_memory(module_inst, inc_page_count); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_find_module_registered_checked(void *module_name) +{ + Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = + wasm_runtime_find_module_registered(module_name); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_free_checked(void *ptr) +{ + Result res; + // Check for null pointer parameter: ptr + if (ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_free(ptr); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_full_init_checked(void *init_args) +{ + Result res; + // Check for null pointer parameter: init_args + if (init_args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_full_init(init_args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_app_addr_range_checked(wasm_module_inst_t module_inst, + uint64_t app_offset, + void *p_app_start_offset, + void *p_app_end_offset) +{ + Result res; + // Check for null pointer parameter: p_app_start_offset + if (p_app_start_offset == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_app_end_offset + if (p_app_end_offset == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_app_addr_range( + module_inst, app_offset, p_app_start_offset, p_app_end_offset); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_call_stack_buf_size_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_runtime_get_call_stack_buf_size(exec_env); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_context_checked(wasm_module_inst_t inst, void *key) +{ + Result res; + // Check for null pointer parameter: key + if (key == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_context(inst, key); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_cur_local_obj_ref_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_get_cur_local_obj_ref(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_current_package_version_checked(package_type_t package_type) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_runtime_get_current_package_version(package_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_custom_data_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_get_custom_data(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_custom_section_checked(wasm_module_t module_comm, void *name, + void *len) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: len + if (len == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_custom_section(module_comm, name, len); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_memory_inst_t original_result = + wasm_runtime_get_default_memory(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_memory_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_exception_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_get_exception(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_exec_env_singleton_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_exec_env_t original_result = + wasm_runtime_get_exec_env_singleton(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_exec_env_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_export_count_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + int32_t original_result = wasm_runtime_get_export_count(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_export_global_inst_checked(wasm_module_inst_t module_inst, + void *name, void *global_inst) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: global_inst + if (global_inst == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_get_export_global_inst(module_inst, name, global_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_export_table_inst_checked(wasm_module_inst_t module_inst, + void *name, void *table_inst) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: table_inst + if (table_inst == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_get_export_table_inst(module_inst, name, table_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_export_type_checked(wasm_module_t module, int32_t export_index, + void *export_type) +{ + Result res; + // Check for null pointer parameter: export_type + if (export_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_export_type(module, export_index, export_type); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result wasm_runtime_get_file_package_type_checked(void *buf, uint32_t size) { @@ -250,24 +2176,6 @@ wasm_runtime_get_file_package_type_checked(void *buf, uint32_t size) return res; } -static inline Result -wasm_runtime_get_module_package_type_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - package_type_t original_result = - wasm_runtime_get_module_package_type(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.package_type_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result wasm_runtime_get_file_package_version_checked(void *buf, uint32_t size) { @@ -290,6 +2198,160 @@ wasm_runtime_get_file_package_version_checked(void *buf, uint32_t size) return res; } +static inline Result +wasm_runtime_get_function_attachment_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_get_function_attachment(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_import_count_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + int32_t original_result = wasm_runtime_get_import_count(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_import_type_checked(wasm_module_t module, int32_t import_index, + void *import_type) +{ + Result res; + // Check for null pointer parameter: import_type + if (import_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_import_type(module, import_index, import_type); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_mem_alloc_info_checked(void *mem_alloc_info) +{ + Result res; + // Check for null pointer parameter: mem_alloc_info + if (mem_alloc_info == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_mem_alloc_info(mem_alloc_info); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_memory_checked(wasm_module_inst_t module_inst, uint32_t index) +{ + Result res; + // Execute the original function + wasm_memory_inst_t original_result = + wasm_runtime_get_memory(module_inst, index); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_memory_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_module_t original_result = wasm_runtime_get_module(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_hash_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_get_module_hash(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_module_inst_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_module_inst_t original_result = wasm_runtime_get_module_inst(exec_env); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_name_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_get_module_name(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_module_package_type_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + package_type_t original_result = + wasm_runtime_get_module_package_type(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.package_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result wasm_runtime_get_module_package_version_checked(wasm_module_t module) { @@ -308,12 +2370,42 @@ wasm_runtime_get_module_package_version_checked(wasm_module_t module) } static inline Result -wasm_runtime_get_current_package_version_checked(package_type_t package_type) +wasm_runtime_get_native_addr_range_checked(wasm_module_inst_t module_inst, + void *native_ptr, + void *p_native_start_addr, + void *p_native_end_addr) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_native_start_addr + if (p_native_start_addr == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_native_end_addr + if (p_native_end_addr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_native_addr_range( + module_inst, native_ptr, p_native_start_addr, p_native_end_addr); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_pgo_prof_data_size_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - uint32_t original_result = - wasm_runtime_get_current_package_version(package_type); + uint32_t original_result = wasm_runtime_get_pgo_prof_data_size(module_inst); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -326,16 +2418,106 @@ wasm_runtime_get_current_package_version_checked(package_type_t package_type) } static inline Result -wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) +wasm_runtime_get_running_mode_checked(wasm_module_inst_t module_inst) { Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { + // Execute the original function + RunningMode original_result = wasm_runtime_get_running_mode(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.RunningMode_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_user_data_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_get_user_data(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_version_checked(void *major, void *minor, void *patch) +{ + Result res; + // Check for null pointer parameter: major + if (major == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: minor + if (minor == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: patch + if (patch == NULL) { res.error_code = -1; return res; } // Execute the original function - _Bool original_result = wasm_runtime_is_xip_file(buf, size); + wasm_runtime_get_version(major, minor, patch); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_wasi_exit_code_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_runtime_get_wasi_exit_code(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_wasm_func_exec_time_checked(wasm_module_inst_t inst, + void *func_name) +{ + Result res; + // Check for null pointer parameter: func_name + if (func_name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + double original_result = + wasm_runtime_get_wasm_func_exec_time(inst, func_name); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.double_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_init_checked(void) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_init(); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -343,245 +2525,17 @@ wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) } static inline Result -wasm_runtime_set_module_reader_checked(module_reader reader, - module_destroyer destroyer) +wasm_runtime_init_thread_env_checked(void) { Result res; // Execute the original function - wasm_runtime_set_module_reader(reader, destroyer); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_register_module_checked(void *module_name, wasm_module_t module, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_register_module( - module_name, module, error_buf, error_buf_size); + _Bool original_result = wasm_runtime_init_thread_env(); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; return res; } -static inline Result -wasm_runtime_find_module_registered_checked(void *module_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_find_module_registered(module_name); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_load_checked(void *buf, uint32_t size, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_load(buf, size, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_load_ex_checked(void *buf, uint32_t size, void *args, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_load_ex(buf, size, args, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_resolve_symbols_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_resolve_symbols(module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_load_from_sections_checked(wasm_section_list_t section_list, - _Bool is_aot, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = wasm_runtime_load_from_sections( - section_list, is_aot, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_unload_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - wasm_runtime_unload(module); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_module_hash_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - wasm_runtime_get_module_hash(module); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_args_ex_checked(wasm_module_t module, void *dir_list, - uint32_t dir_count, void *map_dir_list, - uint32_t map_dir_count, void *env, - uint32_t env_count, void *argv, int argc, - int64_t stdinfd, int64_t stdoutfd, - int64_t stderrfd) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_args_ex(module, dir_list, dir_count, map_dir_list, - map_dir_count, env, env_count, argv, argc, - stdinfd, stdoutfd, stderrfd); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_args_checked(wasm_module_t module, void *dir_list, - uint32_t dir_count, void *map_dir_list, - uint32_t map_dir_count, void *env, - uint32_t env_count, void *argv, int argc) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_args(module, dir_list, dir_count, map_dir_list, - map_dir_count, env, env_count, argv, argc); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_addr_pool_checked(wasm_module_t module, void *addr_pool, - uint32_t addr_pool_size) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_addr_pool(module, addr_pool, addr_pool_size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_ns_lookup_pool_checked(wasm_module_t module, - void *ns_lookup_pool, - uint32_t ns_lookup_pool_size) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_ns_lookup_pool(module, ns_lookup_pool, - ns_lookup_pool_size); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_runtime_instantiate_checked(wasm_module_t module, uint32_t default_stack_size, @@ -638,6 +2592,35 @@ wasm_runtime_instantiate_ex_checked(wasm_module_t module, void *args, return res; } +static inline Result +wasm_runtime_instantiate_ex2_checked(wasm_module_t module, void *args, + void *error_buf, uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_inst_t original_result = + wasm_runtime_instantiate_ex2(module, args, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result wasm_runtime_instantiation_args_create_checked(void *p) { @@ -723,42 +2706,11 @@ wasm_runtime_instantiation_args_set_max_memory_pages_checked(void *p, } static inline Result -wasm_runtime_instantiate_ex2_checked(wasm_module_t module, void *args, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_inst_t original_result = - wasm_runtime_instantiate_ex2(module, args, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, - RunningMode running_mode) +wasm_runtime_is_bounds_checks_enabled_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - _Bool original_result = - wasm_runtime_set_running_mode(module_inst, running_mode); + _Bool original_result = wasm_runtime_is_bounds_checks_enabled(module_inst); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -766,47 +2718,74 @@ wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_get_running_mode_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_import_func_linked_checked(void *module_name, void *func_name) { Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: func_name + if (func_name == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - RunningMode original_result = wasm_runtime_get_running_mode(module_inst); + _Bool original_result = + wasm_runtime_is_import_func_linked(module_name, func_name); // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.RunningMode_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } static inline Result -wasm_runtime_deinstantiate_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_import_global_linked_checked(void *module_name, + void *global_name) { Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: global_name + if (global_name == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_runtime_deinstantiate(module_inst); + _Bool original_result = + wasm_runtime_is_import_global_linked(module_name, global_name); // Assign return value and error code - res.error_code = 0; + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } static inline Result -wasm_runtime_get_module_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_running_mode_supported_checked(RunningMode running_mode) { Result res; // Execute the original function - wasm_module_t original_result = wasm_runtime_get_module(module_inst); + _Bool original_result = + wasm_runtime_is_running_mode_supported(running_mode); // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_is_underlying_binary_freeable_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_is_underlying_binary_freeable(module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } @@ -823,16 +2802,37 @@ wasm_runtime_is_wasi_mode_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) { Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_function_inst_t original_result = - wasm_runtime_lookup_wasi_start_function(module_inst); + _Bool original_result = wasm_runtime_is_xip_file(buf, size); // Assign return value and error code - if (original_result != NULL) { + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_join_thread_checked(wasm_thread_t tid, void *retval) +{ + Result res; + // Check for null pointer parameter: retval + if (retval == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int32_t original_result = wasm_runtime_join_thread(tid, retval); + // Assign return value and error code + if (original_result == 0) { res.error_code = 0; - res.value.wasm_function_inst_t_value = original_result; + res.value.int32_t_value = original_result; } else { res.error_code = -2; @@ -841,15 +2841,86 @@ wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_get_wasi_exit_code_checked(wasm_module_inst_t module_inst) +wasm_runtime_load_checked(void *buf, uint32_t size, void *error_buf, + uint32_t error_buf_size) { Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - uint32_t original_result = wasm_runtime_get_wasi_exit_code(module_inst); + wasm_module_t original_result = + wasm_runtime_load(buf, size, error_buf, error_buf_size); // Assign return value and error code - if (original_result == 0) { + if (original_result != NULL) { res.error_code = 0; - res.value.uint32_t_value = original_result; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_load_ex_checked(void *buf, uint32_t size, void *args, + void *error_buf, uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = + wasm_runtime_load_ex(buf, size, args, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_load_from_sections_checked(wasm_section_list_t section_list, + _Bool is_aot, void *error_buf, + uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = wasm_runtime_load_from_sections( + section_list, is_aot, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; } else { res.error_code = -2; @@ -880,258 +2951,6 @@ wasm_runtime_lookup_function_checked(wasm_module_inst_t module_inst, void *name) return res; } -static inline Result -wasm_func_get_param_count_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_func_get_param_count(func_inst, module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_get_result_count_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_func_get_result_count(func_inst, module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_get_param_types_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst, - void *param_types) -{ - Result res; - // Check for null pointer parameter: param_types - if (param_types == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_get_param_types(func_inst, module_inst, param_types); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_get_result_types_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst, - void *result_types) -{ - Result res; - // Check for null pointer parameter: result_types - if (result_types == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_get_result_types(func_inst, module_inst, result_types); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_create_exec_env_checked(wasm_module_inst_t module_inst, - uint32_t stack_size) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = - wasm_runtime_create_exec_env(module_inst, stack_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_destroy_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_exec_env(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_copy_callstack_checked(wasm_exec_env_t exec_env, void *buffer, - uint32_t length, uint32_t skip_n, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buffer - if (buffer == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = wasm_copy_callstack( - exec_env, buffer, length, skip_n, error_buf, error_buf_size); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_exec_env_singleton_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = - wasm_runtime_get_exec_env_singleton(module_inst); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_start_debug_instance_with_port_checked(wasm_exec_env_t exec_env, - int32_t port) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_runtime_start_debug_instance_with_port(exec_env, port); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_start_debug_instance_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_start_debug_instance(exec_env); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_init_thread_env_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_init_thread_env(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_destroy_thread_env_checked(void) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_thread_env(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_thread_env_inited_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_thread_env_inited(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_module_inst_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_module_inst_t original_result = wasm_runtime_get_module_inst(exec_env); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_module_inst_checked(wasm_exec_env_t exec_env, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_set_module_inst(exec_env, module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_runtime_lookup_memory_checked(wasm_module_inst_t module_inst, void *name) { @@ -1156,16 +2975,16 @@ wasm_runtime_lookup_memory_checked(wasm_module_inst_t module_inst, void *name) } static inline Result -wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) +wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - wasm_memory_inst_t original_result = - wasm_runtime_get_default_memory(module_inst); + wasm_function_inst_t original_result = + wasm_runtime_lookup_wasi_start_function(module_inst); // Assign return value and error code if (original_result != NULL) { res.error_code = 0; - res.value.wasm_memory_inst_t_value = original_result; + res.value.wasm_function_inst_t_value = original_result; } else { res.error_code = -2; @@ -1174,345 +2993,11 @@ wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_get_memory_checked(wasm_module_inst_t module_inst, uint32_t index) +wasm_runtime_malloc_checked(unsigned int size) { Result res; // Execute the original function - wasm_memory_inst_t original_result = - wasm_runtime_get_memory(module_inst, index); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_memory_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_cur_page_count_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_cur_page_count(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_max_page_count_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_max_page_count(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_bytes_per_page_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_bytes_per_page(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_shared_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_get_shared(memory_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_get_base_address_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - wasm_memory_get_base_address(memory_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_enlarge_checked(wasm_memory_inst_t memory_inst, - uint64_t inc_page_count) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_enlarge(memory_inst, inc_page_count); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, uint32_t argc, - void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_call_wasm(exec_env, function, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_a_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, - uint32_t num_results, void *results, - uint32_t num_args, void *args) -{ - Result res; - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_call_wasm_a( - exec_env, function, num_results, results, num_args, args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_v_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, - uint32_t num_results, void *results, - uint32_t num_args, ...) -{ - Result res; - va_list args; - // Execute the original function - va_start(args, num_args); - _Bool original_result = wasm_runtime_call_wasm_v( - exec_env, function, num_results, results, num_args, args); - va_end(args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_indirect_checked(wasm_exec_env_t exec_env, - uint32_t element_index, uint32_t argc, - void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_call_indirect(exec_env, element_index, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_application_execute_main_checked(wasm_module_inst_t module_inst, - int32_t argc, void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_application_execute_main(module_inst, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_application_execute_func_checked(wasm_module_inst_t module_inst, - void *name, int32_t argc, void *argv) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_application_execute_func(module_inst, name, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_exception_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_get_exception(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_exception_checked(wasm_module_inst_t module_inst, - void *exception) -{ - Result res; - // Check for null pointer parameter: exception - if (exception == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_exception(module_inst, exception); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_clear_exception_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_clear_exception(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_terminate_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_terminate(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_custom_data_checked(wasm_module_inst_t module_inst, - void *custom_data) -{ - Result res; - // Check for null pointer parameter: custom_data - if (custom_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_custom_data(module_inst, custom_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_custom_data_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_get_custom_data(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_bounds_checks_checked(wasm_module_inst_t module_inst, - _Bool enable) -{ - Result res; - // Execute the original function - wasm_runtime_set_bounds_checks(module_inst, enable); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_bounds_checks_enabled_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_is_bounds_checks_enabled(module_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_module_malloc_checked(wasm_module_inst_t module_inst, - uint64_t size, void *p_native_addr) -{ - Result res; - // Check for null pointer parameter: p_native_addr - if (p_native_addr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint64_t original_result = - wasm_runtime_module_malloc(module_inst, size, p_native_addr); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_module_free_checked(wasm_module_inst_t module_inst, uint64_t ptr) -{ - Result res; - // Execute the original function - wasm_runtime_module_free(module_inst, ptr); + wasm_runtime_malloc(size); // Assign return value and error code res.error_code = 0; return res; @@ -1543,77 +3028,29 @@ wasm_runtime_module_dup_data_checked(wasm_module_inst_t module_inst, void *src, } static inline Result -wasm_runtime_validate_app_addr_checked(wasm_module_inst_t module_inst, - uint64_t app_offset, uint64_t size) +wasm_runtime_module_free_checked(wasm_module_inst_t module_inst, uint64_t ptr) { Result res; // Execute the original function - _Bool original_result = - wasm_runtime_validate_app_addr(module_inst, app_offset, size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_validate_app_str_addr_checked(wasm_module_inst_t module_inst, - uint64_t app_str_offset) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_validate_app_str_addr(module_inst, app_str_offset); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_validate_native_addr_checked(wasm_module_inst_t module_inst, - void *native_ptr, uint64_t size) -{ - Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_validate_native_addr(module_inst, native_ptr, size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_addr_app_to_native_checked(wasm_module_inst_t module_inst, - uint64_t app_offset) -{ - Result res; - // Execute the original function - wasm_runtime_addr_app_to_native(module_inst, app_offset); + wasm_runtime_module_free(module_inst, ptr); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, - void *native_ptr) +wasm_runtime_module_malloc_checked(wasm_module_inst_t module_inst, + uint64_t size, void *p_native_addr) { Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { + // Check for null pointer parameter: p_native_addr + if (p_native_addr == NULL) { res.error_code = -1; return res; } // Execute the original function uint64_t original_result = - wasm_runtime_addr_native_to_app(module_inst, native_ptr); + wasm_runtime_module_malloc(module_inst, size, p_native_addr); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -1626,25 +3063,11 @@ wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_get_app_addr_range_checked(wasm_module_inst_t module_inst, - uint64_t app_offset, - void *p_app_start_offset, - void *p_app_end_offset) +wasm_runtime_pin_object_checked(wasm_exec_env_t exec_env, wasm_obj_t obj) { Result res; - // Check for null pointer parameter: p_app_start_offset - if (p_app_start_offset == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_app_end_offset - if (p_app_end_offset == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - _Bool original_result = wasm_runtime_get_app_addr_range( - module_inst, app_offset, p_app_start_offset, p_app_end_offset); + _Bool original_result = wasm_runtime_pin_object(exec_env, obj); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -1652,315 +3075,84 @@ wasm_runtime_get_app_addr_range_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_get_native_addr_range_checked(wasm_module_inst_t module_inst, - void *native_ptr, - void *p_native_start_addr, - void *p_native_end_addr) -{ - Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_native_start_addr - if (p_native_start_addr == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_native_end_addr - if (p_native_end_addr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_get_native_addr_range( - module_inst, native_ptr, p_native_start_addr, p_native_end_addr); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_import_count_checked(wasm_module_t module) +wasm_runtime_pop_local_obj_ref_checked(wasm_exec_env_t exec_env) { Result res; // Execute the original function - int32_t original_result = wasm_runtime_get_import_count(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_import_type_checked(wasm_module_t module, int32_t import_index, - void *import_type) -{ - Result res; - // Check for null pointer parameter: import_type - if (import_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_import_type(module, import_index, import_type); + wasm_runtime_pop_local_obj_ref(exec_env); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_get_export_count_checked(wasm_module_t module) +wasm_runtime_pop_local_obj_refs_checked(wasm_exec_env_t exec_env, uint32_t n) { Result res; // Execute the original function - int32_t original_result = wasm_runtime_get_export_count(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_export_type_checked(wasm_module_t module, int32_t export_index, - void *export_type) -{ - Result res; - // Check for null pointer parameter: export_type - if (export_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_export_type(module, export_index, export_type); + wasm_runtime_pop_local_obj_refs(exec_env, n); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_func_type_get_param_count_checked(wasm_func_type_t func_type) +wasm_runtime_push_local_obj_ref_checked(wasm_exec_env_t exec_env, + void *local_obj_ref) { Result res; + // Check for null pointer parameter: local_obj_ref + if (local_obj_ref == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - uint32_t original_result = wasm_func_type_get_param_count(func_type); + wasm_runtime_push_local_obj_ref(exec_env, local_obj_ref); // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = 0; return res; } static inline Result -wasm_func_type_get_param_valkind_checked(wasm_func_type_t func_type, - uint32_t param_index) +wasm_runtime_realloc_checked(void *ptr, unsigned int size) { Result res; + // Check for null pointer parameter: ptr + if (ptr == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_valkind_t original_result = - wasm_func_type_get_param_valkind(func_type, param_index); + wasm_runtime_realloc(ptr, size); // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = 0; return res; } static inline Result -wasm_func_type_get_result_count_checked(wasm_func_type_t func_type) +wasm_runtime_register_module_checked(void *module_name, wasm_module_t module, + void *error_buf, uint32_t error_buf_size) { Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - uint32_t original_result = wasm_func_type_get_result_count(func_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_type_get_result_valkind_checked(wasm_func_type_t func_type, - uint32_t result_index) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = - wasm_func_type_get_result_valkind(func_type, result_index); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_global_type_get_valkind_checked(wasm_global_type_t global_type) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = wasm_global_type_get_valkind(global_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_global_type_get_mutable_checked(wasm_global_type_t global_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_global_type_get_mutable(global_type); + _Bool original_result = wasm_runtime_register_module( + module_name, module, error_buf, error_buf_size); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; return res; } -static inline Result -wasm_memory_type_get_shared_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_type_get_shared(memory_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_type_get_init_page_count_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_memory_type_get_init_page_count(memory_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_type_get_max_page_count_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_memory_type_get_max_page_count(memory_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_elem_kind_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = wasm_table_type_get_elem_kind(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_shared_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_table_type_get_shared(table_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_type_get_init_size_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_table_type_get_init_size(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_max_size_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_table_type_get_max_size(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result wasm_runtime_register_natives_checked(void *module_name, void *native_symbols, uint32_t n_native_symbols) @@ -2011,22 +3203,11 @@ wasm_runtime_register_natives_raw_checked(void *module_name, } static inline Result -wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) +wasm_runtime_resolve_symbols_checked(wasm_module_t module) { Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: native_symbols - if (native_symbols == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - _Bool original_result = - wasm_runtime_unregister_natives(module_name, native_symbols); + _Bool original_result = wasm_runtime_resolve_symbols(module); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2034,637 +3215,12 @@ wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) } static inline Result -wasm_runtime_get_export_global_inst_checked(wasm_module_inst_t module_inst, - void *name, void *global_inst) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: global_inst - if (global_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_get_export_global_inst(module_inst, name, global_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_export_table_inst_checked(wasm_module_inst_t module_inst, - void *name, void *table_inst) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: table_inst - if (table_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_get_export_table_inst(module_inst, name, table_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_get_func_inst_checked(wasm_module_inst_t module_inst, - void *table_inst, uint32_t idx) -{ - Result res; - // Check for null pointer parameter: table_inst - if (table_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_function_inst_t original_result = - wasm_table_get_func_inst(module_inst, table_inst, idx); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_function_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_function_attachment_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_bounds_checks_checked(wasm_module_inst_t module_inst, + _Bool enable) { Result res; // Execute the original function - wasm_runtime_get_function_attachment(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_user_data_checked(wasm_exec_env_t exec_env, void *user_data) -{ - Result res; - // Check for null pointer parameter: user_data - if (user_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_user_data(exec_env, user_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_user_data_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_get_user_data(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_native_stack_boundary_checked(wasm_exec_env_t exec_env, - void *native_stack_boundary) -{ - Result res; - // Check for null pointer parameter: native_stack_boundary - if (native_stack_boundary == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_native_stack_boundary(exec_env, native_stack_boundary); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_instruction_count_limit_checked(wasm_exec_env_t exec_env, - int instruction_count) -{ - Result res; - // Execute the original function - wasm_runtime_set_instruction_count_limit(exec_env, instruction_count); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_dump_mem_consumption_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_dump_mem_consumption(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_dump_perf_profiling_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_dump_perf_profiling(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_sum_wasm_exec_time_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - double original_result = wasm_runtime_sum_wasm_exec_time(module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.double_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_wasm_func_exec_time_checked(wasm_module_inst_t inst, - void *func_name) -{ - Result res; - // Check for null pointer parameter: func_name - if (func_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - double original_result = - wasm_runtime_get_wasm_func_exec_time(inst, func_name); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.double_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_max_thread_num_checked(uint32_t num) -{ - Result res; - // Execute the original function - wasm_runtime_set_max_thread_num(num); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_spawn_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = wasm_runtime_spawn_exec_env(exec_env); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_destroy_spawned_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_spawned_exec_env(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_spawn_thread_checked(wasm_exec_env_t exec_env, void *tid, - wasm_thread_callback_t callback, void *arg) -{ - Result res; - // Check for null pointer parameter: tid - if (tid == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: arg - if (arg == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int32_t original_result = - wasm_runtime_spawn_thread(exec_env, tid, callback, arg); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_join_thread_checked(wasm_thread_t tid, void *retval) -{ - Result res; - // Check for null pointer parameter: retval - if (retval == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int32_t original_result = wasm_runtime_join_thread(tid, retval); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_externref_obj2ref_checked(wasm_module_inst_t module_inst, void *extern_obj, - void *p_externref_idx) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_externref_idx - if (p_externref_idx == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_externref_obj2ref(module_inst, extern_obj, p_externref_idx); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_objdel_checked(wasm_module_inst_t module_inst, void *extern_obj) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_externref_objdel(module_inst, extern_obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_set_cleanup_checked(wasm_module_inst_t module_inst, - void *extern_obj, void *extern_obj_cleanup) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: extern_obj_cleanup - if (extern_obj_cleanup == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_externref_set_cleanup(module_inst, extern_obj, extern_obj_cleanup); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_ref2obj_checked(uint32_t externref_idx, void *p_extern_obj) -{ - Result res; - // Check for null pointer parameter: p_extern_obj - if (p_extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_externref_ref2obj(externref_idx, p_extern_obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_retain_checked(uint32_t externref_idx) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_externref_retain(externref_idx); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_dump_call_stack_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_dump_call_stack(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_call_stack_buf_size_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_get_call_stack_buf_size(exec_env); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_dump_call_stack_to_buf_checked(wasm_exec_env_t exec_env, void *buf, - uint32_t len) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = - wasm_runtime_dump_call_stack_to_buf(exec_env, buf, len); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_pgo_prof_data_size_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_get_pgo_prof_data_size(module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_dump_pgo_prof_data_to_buf_checked(wasm_module_inst_t module_inst, - void *buf, uint32_t len) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = - wasm_runtime_dump_pgo_prof_data_to_buf(module_inst, buf, len); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_custom_section_checked(wasm_module_t module_comm, void *name, - void *len) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: len - if (len == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_custom_section(module_comm, name, len); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_version_checked(void *major, void *minor, void *patch) -{ - Result res; - // Check for null pointer parameter: major - if (major == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: minor - if (minor == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: patch - if (patch == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_version(major, minor, patch); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_import_func_linked_checked(void *module_name, void *func_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: func_name - if (func_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_is_import_func_linked(module_name, func_name); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_is_import_global_linked_checked(void *module_name, - void *global_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: global_name - if (global_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_is_import_global_linked(module_name, global_name); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_enlarge_memory_checked(wasm_module_inst_t module_inst, - uint64_t inc_page_count) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_enlarge_memory(module_inst, inc_page_count); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_enlarge_mem_error_callback_checked( - enlarge_memory_error_callback_t callback, void *user_data) -{ - Result res; - // Check for null pointer parameter: user_data - if (user_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_enlarge_mem_error_callback(callback, user_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_create_context_key_checked(void *dtor) -{ - Result res; - // Check for null pointer parameter: dtor - if (dtor == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_create_context_key(dtor); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_destroy_context_key_checked(void *key) -{ - Result res; - // Check for null pointer parameter: key - if (key == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_destroy_context_key(key); + wasm_runtime_set_bounds_checks(module_inst, enable); // Assign return value and error code res.error_code = 0; return res; @@ -2714,27 +3270,28 @@ wasm_runtime_set_context_spread_checked(wasm_module_inst_t inst, void *key, } static inline Result -wasm_runtime_get_context_checked(wasm_module_inst_t inst, void *key) +wasm_runtime_set_custom_data_checked(wasm_module_inst_t module_inst, + void *custom_data) { Result res; - // Check for null pointer parameter: key - if (key == NULL) { + // Check for null pointer parameter: custom_data + if (custom_data == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_runtime_get_context(inst, key); + wasm_runtime_set_custom_data(module_inst, custom_data); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_default_running_mode_checked(RunningMode running_mode) { Result res; // Execute the original function - _Bool original_result = wasm_runtime_begin_blocking_op(exec_env); + _Bool original_result = wasm_runtime_set_default_running_mode(running_mode); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2742,11 +3299,80 @@ wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) } static inline Result -wasm_runtime_end_blocking_op_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_enlarge_mem_error_callback_checked( + enlarge_memory_error_callback_t callback, void *user_data) +{ + Result res; + // Check for null pointer parameter: user_data + if (user_data == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_enlarge_mem_error_callback(callback, user_data); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_exception_checked(wasm_module_inst_t module_inst, + void *exception) +{ + Result res; + // Check for null pointer parameter: exception + if (exception == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_exception(module_inst, exception); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_instruction_count_limit_checked(wasm_exec_env_t exec_env, + int instruction_count) { Result res; // Execute the original function - wasm_runtime_end_blocking_op(exec_env); + wasm_runtime_set_instruction_count_limit(exec_env, instruction_count); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_log_level_checked(log_level_t level) +{ + Result res; + // Execute the original function + wasm_runtime_set_log_level(level); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_max_thread_num_checked(uint32_t num) +{ + Result res; + // Execute the original function + wasm_runtime_set_max_thread_num(num); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_module_inst_checked(wasm_exec_env_t exec_env, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_set_module_inst(exec_env, module_inst); // Assign return value and error code res.error_code = 0; return res; @@ -2777,123 +3403,42 @@ wasm_runtime_set_module_name_checked(wasm_module_t module, void *name, } static inline Result -wasm_runtime_get_module_name_checked(wasm_module_t module) +wasm_runtime_set_module_reader_checked(module_reader reader, + module_destroyer destroyer) { Result res; // Execute the original function - wasm_runtime_get_module_name(module); + wasm_runtime_set_module_reader(reader, destroyer); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_detect_native_stack_overflow_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_native_stack_boundary_checked(wasm_exec_env_t exec_env, + void *native_stack_boundary) { Result res; - // Execute the original function - _Bool original_result = wasm_runtime_detect_native_stack_overflow(exec_env); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_detect_native_stack_overflow_size_checked(wasm_exec_env_t exec_env, - uint32_t required_size) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_detect_native_stack_overflow_size(exec_env, required_size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_is_underlying_binary_freeable_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_is_underlying_binary_freeable(module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_create_shared_heap_checked(void *init_args) -{ - Result res; - // Check for null pointer parameter: init_args - if (init_args == NULL) { + // Check for null pointer parameter: native_stack_boundary + if (native_stack_boundary == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_create_shared_heap(init_args); + wasm_runtime_set_native_stack_boundary(exec_env, native_stack_boundary); // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = 0; return res; } static inline Result -wasm_runtime_chain_shared_heaps_checked(wasm_shared_heap_t head, - wasm_shared_heap_t body) -{ - Result res; - // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_chain_shared_heaps(head, body); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_unchain_shared_heaps_checked(wasm_shared_heap_t head, - _Bool entire_chain) -{ - Result res; - // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_unchain_shared_heaps(head, entire_chain); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, - wasm_shared_heap_t shared_heap) +wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, + RunningMode running_mode) { Result res; // Execute the original function _Bool original_result = - wasm_runtime_attach_shared_heap(module_inst, shared_heap); + wasm_runtime_set_running_mode(module_inst, running_mode); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2901,11 +3446,87 @@ wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_detach_shared_heap_checked(wasm_module_inst_t module_inst) +wasm_runtime_set_user_data_checked(wasm_exec_env_t exec_env, void *user_data) +{ + Result res; + // Check for null pointer parameter: user_data + if (user_data == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_user_data(exec_env, user_data); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_addr_pool_checked(wasm_module_t module, void *addr_pool, + uint32_t addr_pool_size) { Result res; // Execute the original function - wasm_runtime_detach_shared_heap(module_inst); + wasm_runtime_set_wasi_addr_pool(module, addr_pool, addr_pool_size); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_args_checked(wasm_module_t module, void *dir_list, + uint32_t dir_count, void *map_dir_list, + uint32_t map_dir_count, void *env, + uint32_t env_count, void *argv, int argc) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_args(module, dir_list, dir_count, map_dir_list, + map_dir_count, env, env_count, argv, argc); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_args_ex_checked(wasm_module_t module, void *dir_list, + uint32_t dir_count, void *map_dir_list, + uint32_t map_dir_count, void *env, + uint32_t env_count, void *argv, int argc, + int64_t stdinfd, int64_t stdoutfd, + int64_t stderrfd) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_args_ex(module, dir_list, dir_count, map_dir_list, + map_dir_count, env, env_count, argv, argc, + stdinfd, stdoutfd, stderrfd); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_ns_lookup_pool_checked(wasm_module_t module, + void *ns_lookup_pool, + uint32_t ns_lookup_pool_size) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_ns_lookup_pool(module, ns_lookup_pool, + ns_lookup_pool_size); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_shared_heap_free_checked(wasm_module_inst_t module_inst, + uint64_t ptr) +{ + Result res; + // Execute the original function + wasm_runtime_shared_heap_free(module_inst, ptr); // Assign return value and error code res.error_code = 0; return res; @@ -2936,44 +3557,15 @@ wasm_runtime_shared_heap_malloc_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_shared_heap_free_checked(wasm_module_inst_t module_inst, - uint64_t ptr) +wasm_runtime_spawn_exec_env_checked(wasm_exec_env_t exec_env) { Result res; // Execute the original function - wasm_runtime_shared_heap_free(module_inst, ptr); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_get_defined_type_count_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_get_defined_type_count(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_get_defined_type_checked(wasm_module_t module, uint32_t index) -{ - Result res; - // Execute the original function - wasm_defined_type_t original_result = wasm_get_defined_type(module, index); + wasm_exec_env_t original_result = wasm_runtime_spawn_exec_env(exec_env); // Assign return value and error code if (original_result != NULL) { res.error_code = 0; - res.value.wasm_defined_type_t_value = original_result; + res.value.wasm_exec_env_t_value = original_result; } else { res.error_code = -2; @@ -2982,28 +3574,23 @@ wasm_get_defined_type_checked(wasm_module_t module, uint32_t index) } static inline Result -wasm_obj_get_defined_type_checked(wasm_obj_t obj) +wasm_runtime_spawn_thread_checked(wasm_exec_env_t exec_env, void *tid, + wasm_thread_callback_t callback, void *arg) { Result res; - // Execute the original function - wasm_defined_type_t original_result = wasm_obj_get_defined_type(obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_defined_type_t_value = original_result; + // Check for null pointer parameter: tid + if (tid == NULL) { + res.error_code = -1; + return res; } - else { - res.error_code = -2; + // Check for null pointer parameter: arg + if (arg == NULL) { + res.error_code = -1; + return res; } - return res; -} - -static inline Result -wasm_obj_get_defined_type_idx_checked(wasm_module_t module, wasm_obj_t obj) -{ - Result res; // Execute the original function - int32_t original_result = wasm_obj_get_defined_type_idx(module, obj); + int32_t original_result = + wasm_runtime_spawn_thread(exec_env, tid, callback, arg); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -3016,53 +3603,15 @@ wasm_obj_get_defined_type_idx_checked(wasm_module_t module, wasm_obj_t obj) } static inline Result -wasm_defined_type_is_func_type_checked(wasm_defined_type_t def_type) +wasm_runtime_start_debug_instance_checked(wasm_exec_env_t exec_env) { Result res; // Execute the original function - _Bool original_result = wasm_defined_type_is_func_type(def_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_defined_type_is_struct_type_checked(wasm_defined_type_t def_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_defined_type_is_struct_type(def_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_defined_type_is_array_type_checked(wasm_defined_type_t def_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_defined_type_is_array_type(def_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_func_type_get_param_type_checked(wasm_func_type_t func_type, - uint32_t param_idx) -{ - Result res; - // Execute the original function - wasm_ref_type_t original_result = - wasm_func_type_get_param_type(func_type, param_idx); + uint32_t original_result = wasm_runtime_start_debug_instance(exec_env); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.wasm_ref_type_t_value = original_result; + res.value.uint32_t_value = original_result; } else { res.error_code = -2; @@ -3071,17 +3620,17 @@ wasm_func_type_get_param_type_checked(wasm_func_type_t func_type, } static inline Result -wasm_func_type_get_result_type_checked(wasm_func_type_t func_type, - uint32_t result_idx) +wasm_runtime_start_debug_instance_with_port_checked(wasm_exec_env_t exec_env, + int32_t port) { Result res; // Execute the original function - wasm_ref_type_t original_result = - wasm_func_type_get_result_type(func_type, result_idx); + uint32_t original_result = + wasm_runtime_start_debug_instance_with_port(exec_env, port); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.wasm_ref_type_t_value = original_result; + res.value.uint32_t_value = original_result; } else { res.error_code = -2; @@ -3089,6 +3638,247 @@ wasm_func_type_get_result_type_checked(wasm_func_type_t func_type, return res; } +static inline Result +wasm_runtime_sum_wasm_exec_time_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + double original_result = wasm_runtime_sum_wasm_exec_time(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.double_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_terminate_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_terminate(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_thread_env_inited_checked(void) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_thread_env_inited(); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_unchain_shared_heaps_checked(wasm_shared_heap_t head, + _Bool entire_chain) +{ + Result res; + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_unchain_shared_heaps(head, entire_chain); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_unload_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_unload(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_unpin_object_checked(wasm_exec_env_t exec_env, wasm_obj_t obj) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_unpin_object(exec_env, obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) +{ + Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: native_symbols + if (native_symbols == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_unregister_natives(module_name, native_symbols); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_app_addr_checked(wasm_module_inst_t module_inst, + uint64_t app_offset, uint64_t size) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_validate_app_addr(module_inst, app_offset, size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_app_str_addr_checked(wasm_module_inst_t module_inst, + uint64_t app_str_offset) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_validate_app_str_addr(module_inst, app_str_offset); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_native_addr_checked(wasm_module_inst_t module_inst, + void *native_ptr, uint64_t size) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_validate_native_addr(module_inst, native_ptr, size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_struct_obj_get_field_checked(wasm_struct_obj_t obj, uint32_t field_idx, + _Bool sign_extend, void *value) +{ + Result res; + // Check for null pointer parameter: value + if (value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_struct_obj_get_field(obj, field_idx, sign_extend, value); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_struct_obj_get_field_count_checked(wasm_struct_obj_t obj) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_struct_obj_get_field_count(obj); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_struct_obj_new_with_type_checked(wasm_exec_env_t exec_env, + wasm_struct_type_t type) +{ + Result res; + // Execute the original function + wasm_struct_obj_t original_result = + wasm_struct_obj_new_with_type(exec_env, type); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_struct_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_struct_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, + uint32_t type_idx) +{ + Result res; + // Execute the original function + wasm_struct_obj_t original_result = + wasm_struct_obj_new_with_typeidx(exec_env, type_idx); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_struct_obj_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_struct_obj_set_field_checked(wasm_struct_obj_t obj, uint32_t field_idx, + void *value) +{ + Result res; + // Check for null pointer parameter: value + if (value == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_struct_obj_set_field(obj, field_idx, value); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result wasm_struct_type_get_field_count_checked(wasm_struct_type_t struct_type) { @@ -3131,22 +3921,39 @@ wasm_struct_type_get_field_type_checked(wasm_struct_type_t struct_type, } static inline Result -wasm_array_type_get_elem_type_checked(wasm_array_type_t array_type, - void *p_is_mutable) +wasm_table_get_func_inst_checked(wasm_module_inst_t module_inst, + void *table_inst, uint32_t idx) { Result res; - // Check for null pointer parameter: p_is_mutable - if (p_is_mutable == NULL) { + // Check for null pointer parameter: table_inst + if (table_inst == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_ref_type_t original_result = - wasm_array_type_get_elem_type(array_type, p_is_mutable); + wasm_function_inst_t original_result = + wasm_table_get_func_inst(module_inst, table_inst, idx); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_function_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_get_elem_kind_checked(wasm_table_type_t table_type) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = wasm_table_type_get_elem_kind(table_type); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.wasm_ref_type_t_value = original_result; + res.value.wasm_valkind_t_value = original_result; } else { res.error_code = -2; @@ -3155,194 +3962,11 @@ wasm_array_type_get_elem_type_checked(wasm_array_type_t array_type, } static inline Result -wasm_defined_type_equal_checked(wasm_defined_type_t def_type1, - wasm_defined_type_t def_type2, - wasm_module_t module) +wasm_table_type_get_init_size_checked(wasm_table_type_t table_type) { Result res; // Execute the original function - _Bool original_result = - wasm_defined_type_equal(def_type1, def_type2, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_defined_type_is_subtype_of_checked(wasm_defined_type_t def_type1, - wasm_defined_type_t def_type2, - wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_defined_type_is_subtype_of(def_type1, def_type2, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_ref_type_set_type_idx_checked(void *ref_type, _Bool nullable, - int32_t type_idx) -{ - Result res; - // Check for null pointer parameter: ref_type - if (ref_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_type_set_type_idx(ref_type, nullable, type_idx); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_type_set_heap_type_checked(void *ref_type, _Bool nullable, - int32_t heap_type) -{ - Result res; - // Check for null pointer parameter: ref_type - if (ref_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_type_set_heap_type(ref_type, nullable, heap_type); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_type_equal_checked(void *ref_type1, void *ref_type2, - wasm_module_t module) -{ - Result res; - // Check for null pointer parameter: ref_type1 - if (ref_type1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: ref_type2 - if (ref_type2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_ref_type_equal(ref_type1, ref_type2, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_ref_type_is_subtype_of_checked(void *ref_type1, void *ref_type2, - wasm_module_t module) -{ - Result res; - // Check for null pointer parameter: ref_type1 - if (ref_type1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: ref_type2 - if (ref_type2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_ref_type_is_subtype_of(ref_type1, ref_type2, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_struct_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, - uint32_t type_idx) -{ - Result res; - // Execute the original function - wasm_struct_obj_t original_result = - wasm_struct_obj_new_with_typeidx(exec_env, type_idx); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_struct_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_struct_obj_new_with_type_checked(wasm_exec_env_t exec_env, - wasm_struct_type_t type) -{ - Result res; - // Execute the original function - wasm_struct_obj_t original_result = - wasm_struct_obj_new_with_type(exec_env, type); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_struct_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_struct_obj_set_field_checked(wasm_struct_obj_t obj, uint32_t field_idx, - void *value) -{ - Result res; - // Check for null pointer parameter: value - if (value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_struct_obj_set_field(obj, field_idx, value); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_struct_obj_get_field_checked(wasm_struct_obj_t obj, uint32_t field_idx, - _Bool sign_extend, void *value) -{ - Result res; - // Check for null pointer parameter: value - if (value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_struct_obj_get_field(obj, field_idx, sign_extend, value); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_struct_obj_get_field_count_checked(wasm_struct_obj_t obj) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_struct_obj_get_field_count(obj); + uint32_t original_result = wasm_table_type_get_init_size(table_type); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -3355,108 +3979,11 @@ wasm_struct_obj_get_field_count_checked(wasm_struct_obj_t obj) } static inline Result -wasm_array_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, - uint32_t type_idx, uint32_t length, - void *init_value) -{ - Result res; - // Check for null pointer parameter: init_value - if (init_value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_array_obj_t original_result = - wasm_array_obj_new_with_typeidx(exec_env, type_idx, length, init_value); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_array_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_array_obj_new_with_type_checked(wasm_exec_env_t exec_env, - wasm_array_type_t type, uint32_t length, - void *init_value) -{ - Result res; - // Check for null pointer parameter: init_value - if (init_value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_array_obj_t original_result = - wasm_array_obj_new_with_type(exec_env, type, length, init_value); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_array_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_array_obj_set_elem_checked(wasm_array_obj_t array_obj, uint32_t elem_idx, - void *value) -{ - Result res; - // Check for null pointer parameter: value - if (value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_array_obj_set_elem(array_obj, elem_idx, value); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_array_obj_get_elem_checked(wasm_array_obj_t array_obj, uint32_t elem_idx, - _Bool sign_extend, void *value) -{ - Result res; - // Check for null pointer parameter: value - if (value == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_array_obj_get_elem(array_obj, elem_idx, sign_extend, value); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_array_obj_copy_checked(wasm_array_obj_t dst_obj, uint32_t dst_idx, - wasm_array_obj_t src_obj, uint32_t src_idx, - uint32_t len) +wasm_table_type_get_max_size_checked(wasm_table_type_t table_type) { Result res; // Execute the original function - wasm_array_obj_copy(dst_obj, dst_idx, src_obj, src_idx, len); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_array_obj_length_checked(wasm_array_obj_t array_obj) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_array_obj_length(array_obj); + uint32_t original_result = wasm_table_type_get_max_size(table_type); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -3469,542 +3996,15 @@ wasm_array_obj_length_checked(wasm_array_obj_t array_obj) } static inline Result -wasm_array_obj_first_elem_addr_checked(wasm_array_obj_t array_obj) +wasm_table_type_get_shared_checked(wasm_table_type_t table_type) { Result res; // Execute the original function - wasm_array_obj_first_elem_addr(array_obj); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_array_obj_elem_addr_checked(wasm_array_obj_t array_obj, uint32_t elem_idx) -{ - Result res; - // Execute the original function - wasm_array_obj_elem_addr(array_obj, elem_idx); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_obj_new_with_typeidx_checked(wasm_exec_env_t exec_env, - uint32_t type_idx, - uint32_t func_idx_bound) -{ - Result res; - // Execute the original function - wasm_func_obj_t original_result = - wasm_func_obj_new_with_typeidx(exec_env, type_idx, func_idx_bound); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_func_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_obj_new_with_type_checked(wasm_exec_env_t exec_env, - wasm_func_type_t type, - uint32_t func_idx_bound) -{ - Result res; - // Execute the original function - wasm_func_obj_t original_result = - wasm_func_obj_new_with_type(exec_env, type, func_idx_bound); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_func_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_obj_get_func_idx_bound_checked(wasm_func_obj_t func_obj) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_func_obj_get_func_idx_bound(func_obj); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_obj_get_func_type_checked(wasm_func_obj_t func_obj) -{ - Result res; - // Execute the original function - wasm_func_type_t original_result = wasm_func_obj_get_func_type(func_obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_func_type_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_call_func_ref_checked(wasm_exec_env_t exec_env, - wasm_func_obj_t func_obj, uint32_t argc, - void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_call_func_ref(exec_env, func_obj, argc, argv); + _Bool original_result = wasm_table_type_get_shared(table_type); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; return res; } -static inline Result -wasm_runtime_call_func_ref_a_checked(wasm_exec_env_t exec_env, - wasm_func_obj_t func_obj, - uint32_t num_results, void *results, - uint32_t num_args, void *args) -{ - Result res; - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_call_func_ref_a( - exec_env, func_obj, num_results, results, num_args, args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_func_ref_v_checked(wasm_exec_env_t exec_env, - wasm_func_obj_t func_obj, - uint32_t num_results, void *results, - uint32_t num_args, ...) -{ - Result res; - va_list args; - // Execute the original function - va_start(args, num_args); - _Bool original_result = wasm_runtime_call_func_ref_v( - exec_env, func_obj, num_results, results, num_args, args); - va_end(args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_obj_new_checked(wasm_exec_env_t exec_env, void *host_obj) -{ - Result res; - // Check for null pointer parameter: host_obj - if (host_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externref_obj_t original_result = - wasm_externref_obj_new(exec_env, host_obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_externref_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_externref_obj_get_value_checked(wasm_externref_obj_t externref_obj) -{ - Result res; - // Execute the original function - wasm_externref_obj_get_value(externref_obj); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_anyref_obj_new_checked(wasm_exec_env_t exec_env, void *host_obj) -{ - Result res; - // Check for null pointer parameter: host_obj - if (host_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_anyref_obj_t original_result = wasm_anyref_obj_new(exec_env, host_obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_anyref_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_anyref_obj_get_value_checked(wasm_anyref_obj_t anyref_obj) -{ - Result res; - // Execute the original function - wasm_anyref_obj_get_value(anyref_obj); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externref_obj_to_internal_obj_checked(wasm_externref_obj_t externref_obj) -{ - Result res; - // Execute the original function - wasm_obj_t original_result = - wasm_externref_obj_to_internal_obj(externref_obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_internal_obj_to_externref_obj_checked(wasm_exec_env_t exec_env, - wasm_obj_t internal_obj) -{ - Result res; - // Execute the original function - wasm_externref_obj_t original_result = - wasm_internal_obj_to_externref_obj(exec_env, internal_obj); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_externref_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_i31_obj_new_checked(uint32_t i31_value) -{ - Result res; - // Execute the original function - wasm_i31_obj_t original_result = wasm_i31_obj_new(i31_value); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_i31_obj_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_i31_obj_get_value_checked(wasm_i31_obj_t i31_obj, _Bool sign_extend) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_i31_obj_get_value(i31_obj, sign_extend); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_pin_object_checked(wasm_exec_env_t exec_env, wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_pin_object(exec_env, obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_unpin_object_checked(wasm_exec_env_t exec_env, wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_unpin_object(exec_env, obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_struct_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_struct_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_array_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_array_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_func_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_func_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_i31_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_i31_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_externref_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_externref_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_anyref_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_anyref_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_internal_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_internal_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_eq_obj_checked(wasm_obj_t obj) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_obj_is_eq_obj(obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_instance_of_defined_type_checked(wasm_obj_t obj, - wasm_defined_type_t defined_type, - wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_obj_is_instance_of_defined_type(obj, defined_type, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_instance_of_type_idx_checked(wasm_obj_t obj, uint32_t type_idx, - wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_obj_is_instance_of_type_idx(obj, type_idx, module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_is_instance_of_ref_type_checked(wasm_obj_t obj, void *ref_type) -{ - Result res; - // Check for null pointer parameter: ref_type - if (ref_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_obj_is_instance_of_ref_type(obj, ref_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_push_local_obj_ref_checked(wasm_exec_env_t exec_env, - void *local_obj_ref) -{ - Result res; - // Check for null pointer parameter: local_obj_ref - if (local_obj_ref == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_push_local_obj_ref(exec_env, local_obj_ref); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_pop_local_obj_ref_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_pop_local_obj_ref(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_pop_local_obj_refs_checked(wasm_exec_env_t exec_env, uint32_t n) -{ - Result res; - // Execute the original function - wasm_runtime_pop_local_obj_refs(exec_env, n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_cur_local_obj_ref_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_get_cur_local_obj_ref(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_obj_set_gc_finalizer_checked(wasm_exec_env_t exec_env, wasm_obj_t obj, - wasm_obj_finalizer_t cb, void *data) -{ - Result res; - // Check for null pointer parameter: data - if (data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_obj_set_gc_finalizer(exec_env, obj, cb, data); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_obj_unset_gc_finalizer_checked(wasm_exec_env_t exec_env, void *obj) -{ - Result res; - // Check for null pointer parameter: obj - if (obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_obj_unset_gc_finalizer(exec_env, obj); - // Assign return value and error code - res.error_code = 0; - return res; -} - #endif // GC_EXPORT_CHECKED_H diff --git a/core/iwasm/include/wasm_c_api_checked.h b/core/iwasm/include/wasm_c_api_checked.h index b6aa24b74..05a758243 100644 --- a/core/iwasm/include/wasm_c_api_checked.h +++ b/core/iwasm/include/wasm_c_api_checked.h @@ -19,126 +19,90 @@ typedef struct { int error_code; // Error code (0 for success, non-zero for errors) union { - wasm_valkind_t wasm_valkind_t_value; - wasm_mutability_t wasm_mutability_t_value; - uint32_t uint32_t_value; - wasm_table_size_t wasm_table_size_t_value; _Bool _Bool_value; double double_value; - wasm_externkind_t wasm_externkind_t_value; - wasm_memory_pages_t wasm_memory_pages_t_value; int int_value; size_t size_t_value; + uint32_t uint32_t_value; + wasm_externkind_t wasm_externkind_t_value; + wasm_memory_pages_t wasm_memory_pages_t_value; + wasm_mutability_t wasm_mutability_t_value; + wasm_table_size_t wasm_table_size_t_value; + wasm_valkind_t wasm_valkind_t_value; // Add other types as needed } value; } Result; static inline Result -memcpy_checked(void *__dest, void *__src, size_t __n) +__assert_checked(void *__assertion, void *__file, int __line) { Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { + // Check for null pointer parameter: __assertion + if (__assertion == NULL) { res.error_code = -1; return res; } - // Check for null pointer parameter: __src - if (__src == NULL) { + // Check for null pointer parameter: __file + if (__file == NULL) { res.error_code = -1; return res; } // Execute the original function - memcpy(__dest, __src, __n); + __assert(__assertion, __file, __line); // Assign return value and error code res.error_code = 0; return res; } static inline Result -memmove_checked(void *__dest, void *__src, size_t __n) +__assert_fail_checked(void *__assertion, void *__file, unsigned int __line, + void *__function) { Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { + // Check for null pointer parameter: __assertion + if (__assertion == NULL) { res.error_code = -1; return res; } - // Check for null pointer parameter: __src - if (__src == NULL) { + // Check for null pointer parameter: __file + if (__file == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __function + if (__function == NULL) { res.error_code = -1; return res; } // Execute the original function - memmove(__dest, __src, __n); + __assert_fail(__assertion, __file, __line, __function); // Assign return value and error code res.error_code = 0; return res; } static inline Result -memccpy_checked(void *__dest, void *__src, int __c, size_t __n) +__assert_perror_fail_checked(int __errnum, void *__file, unsigned int __line, + void *__function) { Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { + // Check for null pointer parameter: __file + if (__file == NULL) { res.error_code = -1; return res; } - // Check for null pointer parameter: __src - if (__src == NULL) { + // Check for null pointer parameter: __function + if (__function == NULL) { res.error_code = -1; return res; } // Execute the original function - memccpy(__dest, __src, __c, __n); + __assert_perror_fail(__errnum, __file, __line, __function); // Assign return value and error code res.error_code = 0; return res; } -static inline Result -memset_checked(void *__s, int __c, size_t __n) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - memset(__s, __c, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -memcmp_checked(void *__s1, void *__s2, size_t __n) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = memcmp(__s1, __s2, __n); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result __memcmpeq_checked(void *__s1, void *__s2, size_t __n) { @@ -167,23 +131,7 @@ __memcmpeq_checked(void *__s1, void *__s2, size_t __n) } static inline Result -memchr_checked(void *__s, int __c, size_t __n) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - memchr(__s, __c, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strcpy_checked(void *__dest, void *__src) +__stpcpy_checked(void *__dest, void *__src) { Result res; // Check for null pointer parameter: __dest @@ -197,14 +145,14 @@ strcpy_checked(void *__dest, void *__src) return res; } // Execute the original function - strcpy(__dest, __src); + __stpcpy(__dest, __src); // Assign return value and error code res.error_code = 0; return res; } static inline Result -strncpy_checked(void *__dest, void *__src, size_t __n) +__stpncpy_checked(void *__dest, void *__src, size_t __n) { Result res; // Check for null pointer parameter: __dest @@ -218,392 +166,7 @@ strncpy_checked(void *__dest, void *__src, size_t __n) return res; } // Execute the original function - strncpy(__dest, __src, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strcat_checked(void *__dest, void *__src) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strcat(__dest, __src); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strncat_checked(void *__dest, void *__src, size_t __n) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strncat(__dest, __src, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strcmp_checked(void *__s1, void *__s2) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strcmp(__s1, __s2); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strncmp_checked(void *__s1, void *__s2, size_t __n) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strncmp(__s1, __s2, __n); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strcoll_checked(void *__s1, void *__s2) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strcoll(__s1, __s2); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strxfrm_checked(void *__dest, void *__src, size_t __n) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strxfrm(__dest, __src, __n); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strcoll_l_checked(void *__s1, void *__s2, locale_t __l) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strcoll_l(__s1, __s2, __l); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strxfrm_l_checked(void *__dest, void *__src, size_t __n, locale_t __l) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strxfrm_l(__dest, __src, __n, __l); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strdup_checked(void *__s) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strdup(__s); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strndup_checked(void *__string, size_t __n) -{ - Result res; - // Check for null pointer parameter: __string - if (__string == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strndup(__string, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strchr_checked(void *__s, int __c) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strchr(__s, __c); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strrchr_checked(void *__s, int __c) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strrchr(__s, __c); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strcspn_checked(void *__s, void *__reject) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __reject - if (__reject == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strcspn(__s, __reject); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strspn_checked(void *__s, void *__accept) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __accept - if (__accept == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strspn(__s, __accept); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strpbrk_checked(void *__s, void *__accept) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __accept - if (__accept == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strpbrk(__s, __accept); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strstr_checked(void *__haystack, void *__needle) -{ - Result res; - // Check for null pointer parameter: __haystack - if (__haystack == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __needle - if (__needle == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strstr(__haystack, __needle); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strtok_checked(void *__s, void *__delim) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __delim - if (__delim == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strtok(__s, __delim); + __stpncpy(__dest, __src, __n); // Assign return value and error code res.error_code = 0; return res; @@ -635,120 +198,6 @@ __strtok_r_checked(void *__s, void *__delim, void *__save_ptr) return res; } -static inline Result -strtok_r_checked(void *__s, void *__delim, void *__save_ptr) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __delim - if (__delim == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __save_ptr - if (__save_ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - strtok_r(__s, __delim, __save_ptr); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strlen_checked(void *__s) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strlen(__s); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strnlen_checked(void *__string, size_t __maxlen) -{ - Result res; - // Check for null pointer parameter: __string - if (__string == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = strnlen(__string, __maxlen); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strerror_checked(int __errnum) -{ - Result res; - // Execute the original function - strerror(__errnum); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -strerror_r_checked(int __errnum, void *__buf, size_t __buflen) -{ - Result res; - // Check for null pointer parameter: __buf - if (__buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strerror_r(__errnum, __buf, __buflen); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -strerror_l_checked(int __errnum, locale_t __l) -{ - Result res; - // Execute the original function - strerror_l(__errnum, __l); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result bcmp_checked(void *__s1, void *__s2, size_t __n) { @@ -814,7 +263,7 @@ bzero_checked(void *__s, size_t __n) } static inline Result -index_checked(void *__s, int __c) +explicit_bzero_checked(void *__s, size_t __n) { Result res; // Check for null pointer parameter: __s @@ -823,23 +272,7 @@ index_checked(void *__s, int __c) return res; } // Execute the original function - index(__s, __c); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -rindex_checked(void *__s, int __c) -{ - Result res; - // Check for null pointer parameter: __s - if (__s == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - rindex(__s, __c); + explicit_bzero(__s, __n); // Assign return value and error code res.error_code = 0; return res; @@ -896,6 +329,202 @@ ffsll_checked(long long int __ll) return res; } +static inline Result +index_checked(void *__s, int __c) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + index(__s, __c); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +memccpy_checked(void *__dest, void *__src, int __c, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + memccpy(__dest, __src, __c, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +memchr_checked(void *__s, int __c, size_t __n) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + memchr(__s, __c, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +memcmp_checked(void *__s1, void *__s2, size_t __n) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = memcmp(__s1, __s2, __n); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +memcpy_checked(void *__dest, void *__src, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + memcpy(__dest, __src, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +memmove_checked(void *__dest, void *__src, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + memmove(__dest, __src, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +memset_checked(void *__s, int __c, size_t __n) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + memset(__s, __c, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +rindex_checked(void *__s, int __c) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + rindex(__s, __c); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +stpcpy_checked(void *__dest, void *__src) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + stpcpy(__dest, __src); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +stpncpy_checked(void *__dest, void *__src, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + stpncpy(__dest, __src, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result strcasecmp_checked(void *__s1, void *__s2) { @@ -923,33 +552,6 @@ strcasecmp_checked(void *__s1, void *__s2) return res; } -static inline Result -strncasecmp_checked(void *__s1, void *__s2, size_t __n) -{ - Result res; - // Check for null pointer parameter: __s1 - if (__s1 == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __s2 - if (__s2 == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int original_result = strncasecmp(__s1, __s2, __n); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result strcasecmp_l_checked(void *__s1, void *__s2, locale_t __loc) { @@ -977,6 +579,281 @@ strcasecmp_l_checked(void *__s1, void *__s2, locale_t __loc) return res; } +static inline Result +strcat_checked(void *__dest, void *__src) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strcat(__dest, __src); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strchr_checked(void *__s, int __c) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strchr(__s, __c); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strcmp_checked(void *__s1, void *__s2) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strcmp(__s1, __s2); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strcoll_checked(void *__s1, void *__s2) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strcoll(__s1, __s2); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strcoll_l_checked(void *__s1, void *__s2, locale_t __l) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strcoll_l(__s1, __s2, __l); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strcpy_checked(void *__dest, void *__src) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strcpy(__dest, __src); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strcspn_checked(void *__s, void *__reject) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __reject + if (__reject == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = strcspn(__s, __reject); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strdup_checked(void *__s) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strdup(__s); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strerror_checked(int __errnum) +{ + Result res; + // Execute the original function + strerror(__errnum); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strerror_l_checked(int __errnum, locale_t __l) +{ + Result res; + // Execute the original function + strerror_l(__errnum, __l); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strerror_r_checked(int __errnum, void *__buf, size_t __buflen) +{ + Result res; + // Check for null pointer parameter: __buf + if (__buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strerror_r(__errnum, __buf, __buflen); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strlen_checked(void *__s) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = strlen(__s); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strncasecmp_checked(void *__s1, void *__s2, size_t __n) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strncasecmp(__s1, __s2, __n); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result strncasecmp_l_checked(void *__s1, void *__s2, size_t __n, locale_t __loc) { @@ -1005,7 +882,135 @@ strncasecmp_l_checked(void *__s1, void *__s2, size_t __n, locale_t __loc) } static inline Result -explicit_bzero_checked(void *__s, size_t __n) +strncat_checked(void *__dest, void *__src, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strncat(__dest, __src, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strncmp_checked(void *__s1, void *__s2, size_t __n) +{ + Result res; + // Check for null pointer parameter: __s1 + if (__s1 == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __s2 + if (__s2 == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int original_result = strncmp(__s1, __s2, __n); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strncpy_checked(void *__dest, void *__src, size_t __n) +{ + Result res; + // Check for null pointer parameter: __dest + if (__dest == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __src + if (__src == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strncpy(__dest, __src, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strndup_checked(void *__string, size_t __n) +{ + Result res; + // Check for null pointer parameter: __string + if (__string == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strndup(__string, __n); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strnlen_checked(void *__string, size_t __maxlen) +{ + Result res; + // Check for null pointer parameter: __string + if (__string == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = strnlen(__string, __maxlen); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strpbrk_checked(void *__s, void *__accept) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __accept + if (__accept == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strpbrk(__s, __accept); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strrchr_checked(void *__s, int __c) { Result res; // Check for null pointer parameter: __s @@ -1014,7 +1019,7 @@ explicit_bzero_checked(void *__s, size_t __n) return res; } // Execute the original function - explicit_bzero(__s, __n); + strrchr(__s, __c); // Assign return value and error code res.error_code = 0; return res; @@ -1053,7 +1058,102 @@ strsignal_checked(int __sig) } static inline Result -__stpcpy_checked(void *__dest, void *__src) +strspn_checked(void *__s, void *__accept) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __accept + if (__accept == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = strspn(__s, __accept); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +strstr_checked(void *__haystack, void *__needle) +{ + Result res; + // Check for null pointer parameter: __haystack + if (__haystack == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __needle + if (__needle == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strstr(__haystack, __needle); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strtok_checked(void *__s, void *__delim) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __delim + if (__delim == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strtok(__s, __delim); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strtok_r_checked(void *__s, void *__delim, void *__save_ptr) +{ + Result res; + // Check for null pointer parameter: __s + if (__s == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __delim + if (__delim == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: __save_ptr + if (__save_ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + strtok_r(__s, __delim, __save_ptr); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +strxfrm_checked(void *__dest, void *__src, size_t __n) { Result res; // Check for null pointer parameter: __dest @@ -1067,14 +1167,20 @@ __stpcpy_checked(void *__dest, void *__src) return res; } // Execute the original function - __stpcpy(__dest, __src); + size_t original_result = strxfrm(__dest, __src, __n); // Assign return value and error code - res.error_code = 0; + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } return res; } static inline Result -stpcpy_checked(void *__dest, void *__src) +strxfrm_l_checked(void *__dest, void *__src, size_t __n, locale_t __l) { Result res; // Check for null pointer parameter: __dest @@ -1088,169 +1194,15 @@ stpcpy_checked(void *__dest, void *__src) return res; } // Execute the original function - stpcpy(__dest, __src); + size_t original_result = strxfrm_l(__dest, __src, __n, __l); // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -__stpncpy_checked(void *__dest, void *__src, size_t __n) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; + else { + res.error_code = -2; } - // Execute the original function - __stpncpy(__dest, __src, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -stpncpy_checked(void *__dest, void *__src, size_t __n) -{ - Result res; - // Check for null pointer parameter: __dest - if (__dest == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __src - if (__src == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - stpncpy(__dest, __src, __n); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -__assert_fail_checked(void *__assertion, void *__file, unsigned int __line, - void *__function) -{ - Result res; - // Check for null pointer parameter: __assertion - if (__assertion == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __file - if (__file == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __function - if (__function == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - __assert_fail(__assertion, __file, __line, __function); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -__assert_perror_fail_checked(int __errnum, void *__file, unsigned int __line, - void *__function) -{ - Result res; - // Check for null pointer parameter: __file - if (__file == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __function - if (__function == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - __assert_perror_fail(__errnum, __file, __line, __function); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -__assert_checked(void *__assertion, void *__file, int __line) -{ - Result res; - // Check for null pointer parameter: __assertion - if (__assertion == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: __file - if (__file == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - __assert(__assertion, __file, __line); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_byte_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_byte_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_byte_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_byte_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_byte_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_byte_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; return res; } @@ -1291,6 +1243,54 @@ wasm_byte_vec_delete_checked(void *) return res; } +static inline Result +wasm_byte_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_byte_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_byte_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_byte_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_byte_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_byte_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result wasm_config_delete_checked(void *) { @@ -1318,6 +1318,22 @@ wasm_config_new_checked(void) return res; } +static inline Result +wasm_config_set_linux_perf_opt_checked(void *, _Bool) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_config_set_linux_perf_opt(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result wasm_config_set_mem_alloc_opt_checked(void *, mem_alloc_type_t, void *) { @@ -1339,22 +1355,6 @@ wasm_config_set_mem_alloc_opt_checked(void *, mem_alloc_type_t, void *) return res; } -static inline Result -wasm_config_set_linux_perf_opt_checked(void *, _Bool) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_config_set_linux_perf_opt(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_config_set_segue_flags_checked(void *config, uint32_t segue_flags) { @@ -1398,22 +1398,6 @@ wasm_engine_new_checked(void) return res; } -static inline Result -wasm_engine_new_with_config_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_engine_new_with_config(); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_engine_new_with_args_checked(mem_alloc_type_t type, void *opts) { @@ -1431,7 +1415,7 @@ wasm_engine_new_with_args_checked(mem_alloc_type_t type, void *opts) } static inline Result -wasm_store_delete_checked(void *) +wasm_engine_new_with_config_checked(void *) { Result res; // Check for null pointer parameter: None @@ -1440,14 +1424,14 @@ wasm_store_delete_checked(void *) return res; } // Execute the original function - wasm_store_delete(); + wasm_engine_new_with_config(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_store_new_checked(void *) +wasm_exporttype_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -1456,1425 +1440,12 @@ wasm_store_new_checked(void *) return res; } // Execute the original function - wasm_store_new(); + wasm_exporttype_copy(); // Assign return value and error code res.error_code = 0; return res; } -static inline Result -wasm_valtype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valtype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_new_checked(wasm_valkind_t) -{ - Result res; - // Execute the original function - wasm_valtype_new(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_valtype_kind_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_valkind_t original_result = wasm_valtype_kind(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_functype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_new_checked(void *params, void *results) -{ - Result res; - // Check for null pointer parameter: params - if (params == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: results - if (results == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_new(params, results); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_params_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_params(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_results_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_results(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_new_checked(void *, wasm_mutability_t) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_new(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_content_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_content(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_mutability_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_mutability_t original_result = wasm_globaltype_mutability(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_mutability_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_tabletype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_new_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_new(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_element_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_element(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_limits_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_limits(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_new_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_new(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_limits_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_limits(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_kind_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externkind_t original_result = wasm_externtype_kind(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_externkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_functype_as_externtype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_as_externtype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_as_externtype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_as_externtype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_as_externtype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_as_externtype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_as_externtype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_as_externtype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_functype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_functype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_globaltype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_globaltype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_tabletype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_tabletype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_memorytype_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_memorytype(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_functype_as_externtype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_functype_as_externtype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_globaltype_as_externtype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_globaltype_as_externtype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_tabletype_as_externtype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_tabletype_as_externtype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memorytype_as_externtype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memorytype_as_externtype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_functype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_functype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_globaltype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_globaltype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_tabletype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_tabletype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_externtype_as_memorytype_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_externtype_as_memorytype_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_vec_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_vec_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_new_checked(void *module, void *name, void *) -{ - Result res; - // Check for null pointer parameter: module - if (module == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_new(module, name, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_module_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_module(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_name_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_name(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_importtype_type(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_importtype_is_linked_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_importtype_is_linked(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - static inline Result wasm_exporttype_delete_checked(void *) { @@ -2892,48 +1463,53 @@ wasm_exporttype_delete_checked(void *) } static inline Result -wasm_exporttype_vec_new_empty_checked(void *out) +wasm_exporttype_name_checked(void *) { Result res; - // Check for null pointer parameter: out - if (out == NULL) { + // Check for null pointer parameter: None + if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_exporttype_vec_new_empty(out); + wasm_exporttype_name(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_exporttype_vec_new_uninitialized_checked(void *out, size_t) +wasm_exporttype_new_checked(void *, void *) { Result res; - // Check for null pointer parameter: out - if (out == NULL) { + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_exporttype_vec_new_uninitialized(out, ); + wasm_exporttype_new(, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_exporttype_vec_new_checked(void *out, size_t, void *) +wasm_exporttype_type_checked(void *) { Result res; - // Check for null pointer parameter: out - if (out == NULL) { + // Check for null pointer parameter: None + if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_exporttype_vec_new(out, , ); + wasm_exporttype_type(); // Assign return value and error code res.error_code = 0; return res; @@ -2977,113 +1553,7 @@ wasm_exporttype_vec_delete_checked(void *) } static inline Result -wasm_exporttype_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_exporttype_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_exporttype_new_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_exporttype_new(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_exporttype_name_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_exporttype_name(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_exporttype_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_exporttype_type(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_val_delete_checked(void *v) -{ - Result res; - // Check for null pointer parameter: v - if (v == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_val_delete(v); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_val_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_val_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_val_vec_new_empty_checked(void *out) +wasm_exporttype_vec_new_checked(void *out, size_t, void *) { Result res; // Check for null pointer parameter: out @@ -3092,14 +1562,14 @@ wasm_val_vec_new_empty_checked(void *out) return res; } // Execute the original function - wasm_val_vec_new_empty(out); + wasm_exporttype_vec_new(out, , ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_val_vec_new_uninitialized_checked(void *out, size_t) +wasm_exporttype_vec_new_empty_checked(void *out) { Result res; // Check for null pointer parameter: out @@ -3108,14 +1578,14 @@ wasm_val_vec_new_uninitialized_checked(void *out, size_t) return res; } // Execute the original function - wasm_val_vec_new_uninitialized(out, ); + wasm_exporttype_vec_new_empty(out); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_val_vec_new_checked(void *out, size_t, void *) +wasm_exporttype_vec_new_uninitialized_checked(void *out, size_t) { Result res; // Check for null pointer parameter: out @@ -3124,35 +1594,14 @@ wasm_val_vec_new_checked(void *out, size_t, void *) return res; } // Execute the original function - wasm_val_vec_new(out, , ); + wasm_exporttype_vec_new_uninitialized(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_val_vec_copy_checked(void *out, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_val_vec_copy(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_val_vec_delete_checked(void *) +wasm_extern_as_func_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3161,14 +1610,14 @@ wasm_val_vec_delete_checked(void *) return res; } // Execute the original function - wasm_val_vec_delete(); + wasm_extern_as_func(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_delete_checked(void *) +wasm_extern_as_func_const_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3177,14 +1626,14 @@ wasm_ref_delete_checked(void *) return res; } // Execute the original function - wasm_ref_delete(); + wasm_extern_as_func_const(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_copy_checked(void *) +wasm_extern_as_global_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3193,14 +1642,212 @@ wasm_ref_copy_checked(void *) return res; } // Execute the original function - wasm_ref_copy(); + wasm_extern_as_global(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_same_checked(void *, void *) +wasm_extern_as_global_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_global_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_memory_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_memory(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_memory_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_memory_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_table_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_table(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_as_table_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_as_table_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_kind_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externkind_t original_result = wasm_extern_kind(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_externkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_extern_new_empty_checked(void *, wasm_externkind_t) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_new_empty(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_same_checked(void *, void *) { Result res; // Check for null pointer parameter: None @@ -3214,7 +1861,7 @@ wasm_ref_same_checked(void *, void *) return res; } // Execute the original function - _Bool original_result = wasm_ref_same(, ); + _Bool original_result = wasm_extern_same(, ); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -3222,23 +1869,7 @@ wasm_ref_same_checked(void *, void *) } static inline Result -wasm_ref_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_set_host_info_checked(void *, void *) +wasm_extern_set_host_info_checked(void *, void *) { Result res; // Check for null pointer parameter: None @@ -3252,14 +1883,14 @@ wasm_ref_set_host_info_checked(void *, void *) return res; } // Execute the original function - wasm_ref_set_host_info(, ); + wasm_extern_set_host_info(, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_set_host_info_with_finalizer_checked(void *, void *, void *) +wasm_extern_set_host_info_with_finalizer_checked(void *, void *, void *) { Result res; // Check for null pointer parameter: None @@ -3278,14 +1909,14 @@ wasm_ref_set_host_info_with_finalizer_checked(void *, void *, void *) return res; } // Execute the original function - wasm_ref_set_host_info_with_finalizer(, , ); + wasm_extern_set_host_info_with_finalizer(, , ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_delete_checked(void *) +wasm_extern_type_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3294,62 +1925,14 @@ wasm_frame_delete_checked(void *) return res; } // Execute the original function - wasm_frame_delete(); + wasm_extern_type(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_frame_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_frame_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_frame_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_frame_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_frame_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_frame_vec_copy_checked(void *out, void *) +wasm_extern_vec_copy_checked(void *out, void *) { Result res; // Check for null pointer parameter: out @@ -3363,14 +1946,14 @@ wasm_frame_vec_copy_checked(void *out, void *) return res; } // Execute the original function - wasm_frame_vec_copy(out, ); + wasm_extern_vec_copy(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_vec_delete_checked(void *) +wasm_extern_vec_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3379,14 +1962,62 @@ wasm_frame_vec_delete_checked(void *) return res; } // Execute the original function - wasm_frame_vec_delete(); + wasm_extern_vec_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_copy_checked(void *) +wasm_extern_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_extern_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_extern_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_functype_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3395,14 +2026,14 @@ wasm_frame_copy_checked(void *) return res; } // Execute the original function - wasm_frame_copy(); + wasm_externtype_as_functype(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_instance_checked(void *) +wasm_externtype_as_functype_const_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3411,14 +2042,14 @@ wasm_frame_instance_checked(void *) return res; } // Execute the original function - wasm_frame_instance(); + wasm_externtype_as_functype_const(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_frame_func_index_checked(void *) +wasm_externtype_as_globaltype_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3427,11 +2058,139 @@ wasm_frame_func_index_checked(void *) return res; } // Execute the original function - uint32_t original_result = wasm_frame_func_index(); + wasm_externtype_as_globaltype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_globaltype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_as_globaltype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_memorytype_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_as_memorytype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_memorytype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_as_memorytype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_tabletype_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_as_tabletype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_as_tabletype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_as_tabletype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_kind_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externkind_t original_result = wasm_externtype_kind(); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.uint32_t_value = original_result; + res.value.wasm_externkind_t_value = original_result; } else { res.error_code = -2; @@ -3440,67 +2199,28 @@ wasm_frame_func_index_checked(void *) } static inline Result -wasm_frame_func_offset_checked(void *) +wasm_externtype_vec_copy_checked(void *out, void *) { Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } // Check for null pointer parameter: None if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - size_t original_result = wasm_frame_func_offset(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_frame_module_offset_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = wasm_frame_module_offset(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_trap_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_delete(); + wasm_externtype_vec_copy(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_trap_copy_checked(void *) +wasm_externtype_vec_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3509,235 +2229,103 @@ wasm_trap_copy_checked(void *) return res; } // Execute the original function - wasm_trap_copy(); + wasm_externtype_vec_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_trap_same_checked(void *, void *) +wasm_externtype_vec_new_checked(void *out, size_t, void *) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_trap_same(, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_trap_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_set_host_info_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_set_host_info(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_set_host_info_with_finalizer_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_set_host_info_with_finalizer(, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_as_ref_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_as_ref(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_trap_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_trap(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_as_ref_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_as_ref_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_trap_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_trap_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_new_checked(void *store, void *) -{ - Result res; - // Check for null pointer parameter: store - if (store == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_new(store, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_message_checked(void *, void *out) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Check for null pointer parameter: out if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_trap_message(, out); + wasm_externtype_vec_new(out, , ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_trap_origin_checked(void *) +wasm_externtype_vec_new_empty_checked(void *out) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_trap_origin(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_trap_trace_checked(void *, void *out) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Check for null pointer parameter: out if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_trap_trace(, out); + wasm_externtype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_externtype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_externtype_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_foreign_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_foreign_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_foreign_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_foreign_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_foreign_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_foreign_copy(); // Assign return value and error code res.error_code = 0; return res; @@ -3760,7 +2348,7 @@ wasm_foreign_delete_checked(void *) } static inline Result -wasm_foreign_copy_checked(void *) +wasm_foreign_get_host_info_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3769,7 +2357,23 @@ wasm_foreign_copy_checked(void *) return res; } // Execute the original function - wasm_foreign_copy(); + wasm_foreign_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_foreign_new_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_foreign_new(); // Assign return value and error code res.error_code = 0; return res; @@ -3797,22 +2401,6 @@ wasm_foreign_same_checked(void *, void *) return res; } -static inline Result -wasm_foreign_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_foreign_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_foreign_set_host_info_checked(void *, void *) { @@ -3861,7 +2449,7 @@ wasm_foreign_set_host_info_with_finalizer_checked(void *, void *, void *) } static inline Result -wasm_foreign_as_ref_checked(void *) +wasm_frame_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3870,14 +2458,14 @@ wasm_foreign_as_ref_checked(void *) return res; } // Execute the original function - wasm_foreign_as_ref(); + wasm_frame_copy(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_as_foreign_checked(void *) +wasm_frame_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3886,14 +2474,14 @@ wasm_ref_as_foreign_checked(void *) return res; } // Execute the original function - wasm_ref_as_foreign(); + wasm_frame_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_foreign_as_ref_const_checked(void *) +wasm_frame_func_index_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3902,14 +2490,58 @@ wasm_foreign_as_ref_const_checked(void *) return res; } // Execute the original function - wasm_foreign_as_ref_const(); + uint32_t original_result = wasm_frame_func_index(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_frame_func_offset_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = wasm_frame_func_offset(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_frame_instance_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_frame_instance(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_ref_as_foreign_const_checked(void *) +wasm_frame_module_offset_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3918,14 +2550,41 @@ wasm_ref_as_foreign_const_checked(void *) return res; } // Execute the original function - wasm_ref_as_foreign_const(); + size_t original_result = wasm_frame_module_offset(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_frame_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_frame_vec_copy(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_foreign_new_checked(void *) +wasm_frame_vec_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -3934,162 +2593,62 @@ wasm_foreign_new_checked(void *) return res; } // Execute the original function - wasm_foreign_new(); + wasm_frame_vec_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_module_new_checked(void *, void *binary) +wasm_frame_vec_new_checked(void *out, size_t, void *) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: binary - if (binary == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_new(, binary); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_new_ex_checked(void *, void *binary, void *args) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: binary - if (binary == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_new_ex(, binary, args); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_validate_checked(void *, void *binary) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: binary - if (binary == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_module_validate(, binary); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_module_imports_checked(void *, void *out) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Check for null pointer parameter: out if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_module_imports(, out); + wasm_frame_vec_new(out, , ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_module_exports_checked(void *, void *out) +wasm_frame_vec_new_empty_checked(void *out) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Check for null pointer parameter: out if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_module_exports(, out); + wasm_frame_vec_new_empty(out); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_module_serialize_checked(void *, void *out) +wasm_frame_vec_new_uninitialized_checked(void *out, size_t) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Check for null pointer parameter: out if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_module_serialize(, out); + wasm_frame_vec_new_uninitialized(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_module_deserialize_checked(void *, void *) +wasm_func_as_extern_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4097,20 +2656,15 @@ wasm_module_deserialize_checked(void *, void *) res.error_code = -1; return res; } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - wasm_module_deserialize(, ); + wasm_func_as_extern(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_module_share_checked(void *) +wasm_func_as_extern_const_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4119,216 +2673,7 @@ wasm_module_share_checked(void *) return res; } // Execute the original function - wasm_module_share(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_obtain_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_obtain(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_shared_module_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_shared_module_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_set_name_checked(void *, void *name) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_module_set_name(, name); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_module_get_name_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_get_name(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_module_is_underlying_binary_freeable_checked(void *module) -{ - Result res; - // Check for null pointer parameter: module - if (module == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_module_is_underlying_binary_freeable(module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_func_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_same_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_func_same(, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_func_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_set_host_info_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_set_host_info(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_set_host_info_with_finalizer_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_set_host_info_with_finalizer(, , ); + wasm_func_as_extern_const(); // Assign return value and error code res.error_code = 0; return res; @@ -4350,22 +2695,6 @@ wasm_func_as_ref_checked(void *) return res; } -static inline Result -wasm_ref_as_func_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_func(); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_func_as_ref_const_checked(void *) { @@ -4383,7 +2712,33 @@ wasm_func_as_ref_const_checked(void *) } static inline Result -wasm_ref_as_func_const_checked(void *) +wasm_func_call_checked(void *, void *args, void *results) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: results + if (results == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_call(, args, results); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4392,7 +2747,39 @@ wasm_ref_as_func_const_checked(void *) return res; } // Execute the original function - wasm_ref_as_func_const(); + wasm_func_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_get_host_info(); // Assign return value and error code res.error_code = 0; return res; @@ -4452,22 +2839,6 @@ wasm_func_new_with_env_checked(void *, void *type, return res; } -static inline Result -wasm_func_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_type(); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_func_param_arity_checked(void *) { @@ -4513,7 +2884,7 @@ wasm_func_result_arity_checked(void *) } static inline Result -wasm_func_call_checked(void *, void *args, void *results) +wasm_func_same_checked(void *, void *) { Result res; // Check for null pointer parameter: None @@ -4521,8 +2892,152 @@ wasm_func_call_checked(void *, void *args, void *results) res.error_code = -1; return res; } - // Check for null pointer parameter: args - if (args == NULL) { + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_func_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_func_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_set_host_info_with_finalizer(, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_type_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_type(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_as_externtype_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_as_externtype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_as_externtype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_as_externtype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_new_checked(void *params, void *results) +{ + Result res; + // Check for null pointer parameter: params + if (params == NULL) { res.error_code = -1; return res; } @@ -4532,7 +3047,204 @@ wasm_func_call_checked(void *, void *args, void *results) return res; } // Execute the original function - wasm_func_call(, args, results); + wasm_functype_new(params, results); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_params_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_params(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_results_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_results(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_functype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_functype_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_as_extern_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_as_extern(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_as_extern_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_as_extern_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_copy(); // Assign return value and error code res.error_code = 0; return res; @@ -4555,7 +3267,28 @@ wasm_global_delete_checked(void *) } static inline Result -wasm_global_copy_checked(void *) +wasm_global_get_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_get(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_get_host_info_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4564,7 +3297,33 @@ wasm_global_copy_checked(void *) return res; } // Execute the original function - wasm_global_copy(); + wasm_global_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_global_new_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_global_new(, , ); // Assign return value and error code res.error_code = 0; return res; @@ -4593,7 +3352,7 @@ wasm_global_same_checked(void *, void *) } static inline Result -wasm_global_get_host_info_checked(void *) +wasm_global_set_checked(void *, void *) { Result res; // Check for null pointer parameter: None @@ -4601,8 +3360,13 @@ wasm_global_get_host_info_checked(void *) res.error_code = -1; return res; } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_global_get_host_info(); + wasm_global_set(, ); // Assign return value and error code res.error_code = 0; return res; @@ -4655,96 +3419,6 @@ wasm_global_set_host_info_with_finalizer_checked(void *, void *, void *) return res; } -static inline Result -wasm_global_as_ref_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_global_as_ref(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_global_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_global(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_global_as_ref_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_global_as_ref_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_global_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_global_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_global_new_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_global_new(, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_global_type_checked(void *) { @@ -4762,7 +3436,7 @@ wasm_global_type_checked(void *) } static inline Result -wasm_global_get_checked(void *, void *out) +wasm_globaltype_as_externtype_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4770,20 +3444,15 @@ wasm_global_get_checked(void *, void *out) res.error_code = -1; return res; } - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - wasm_global_get(, out); + wasm_globaltype_as_externtype(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_global_set_checked(void *, void *) +wasm_globaltype_as_externtype_const_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4791,20 +3460,15 @@ wasm_global_set_checked(void *, void *) res.error_code = -1; return res; } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - wasm_global_set(, ); + wasm_globaltype_as_externtype_const(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_table_delete_checked(void *) +wasm_globaltype_content_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4813,14 +3477,14 @@ wasm_table_delete_checked(void *) return res; } // Execute the original function - wasm_table_delete(); + wasm_globaltype_content(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_table_copy_checked(void *) +wasm_globaltype_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4829,36 +3493,14 @@ wasm_table_copy_checked(void *) return res; } // Execute the original function - wasm_table_copy(); + wasm_globaltype_copy(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_table_same_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_table_same(, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_get_host_info_checked(void *) +wasm_globaltype_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4867,61 +3509,14 @@ wasm_table_get_host_info_checked(void *) return res; } // Execute the original function - wasm_table_get_host_info(); + wasm_globaltype_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_table_set_host_info_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_set_host_info(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_set_host_info_with_finalizer_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_set_host_info_with_finalizer(, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_as_ref_checked(void *) +wasm_globaltype_mutability_checked(void *) { Result res; // Check for null pointer parameter: None @@ -4930,155 +3525,11 @@ wasm_table_as_ref_checked(void *) return res; } // Execute the original function - wasm_table_as_ref(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_table_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_table(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_as_ref_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_as_ref_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_table_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_table_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_new_checked(void *, void *, void *init) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: init - if (init == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_new(, , init); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_type(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_get_checked(void *, wasm_table_size_t index) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_get(, index); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_set_checked(void *, wasm_table_size_t index, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_table_set(, index, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_size_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_size_t original_result = wasm_table_size(); + wasm_mutability_t original_result = wasm_globaltype_mutability(); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.wasm_table_size_t_value = original_result; + res.value.wasm_mutability_t_value = original_result; } else { res.error_code = -2; @@ -5087,29 +3538,7 @@ wasm_table_size_checked(void *) } static inline Result -wasm_table_grow_checked(void *, wasm_table_size_t delta, void *init) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: init - if (init == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_table_grow(, delta, init); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_delete_checked(void *) +wasm_globaltype_new_checked(void *, wasm_mutability_t) { Result res; // Check for null pointer parameter: None @@ -5118,522 +3547,14 @@ wasm_memory_delete_checked(void *) return res; } // Execute the original function - wasm_memory_delete(); + wasm_globaltype_new(, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_memory_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_same_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_memory_same(, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_set_host_info_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_set_host_info(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_set_host_info_with_finalizer_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_set_host_info_with_finalizer(, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_as_ref_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_as_ref(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_memory_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_memory(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_as_ref_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_as_ref_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_memory_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_memory_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_new_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_new(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_type(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_data_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_data(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_data_size_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - size_t original_result = wasm_memory_data_size(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.size_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_size_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_pages_t original_result = wasm_memory_size(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_memory_pages_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_grow_checked(void *, wasm_memory_pages_t delta) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_memory_grow(, delta); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_extern_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_same_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_extern_same(, ); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_extern_get_host_info_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_get_host_info(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_set_host_info_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_set_host_info(, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_set_host_info_with_finalizer_checked(void *, void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_set_host_info_with_finalizer(, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_ref_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_ref(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_extern_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_extern(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_ref_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_ref_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_ref_as_extern_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_extern_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_vec_new_empty_checked(void *out) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_vec_new_empty(out); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_vec_new_uninitialized_checked(void *out, size_t) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_vec_new_uninitialized(out, ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_vec_new_checked(void *out, size_t, void *) -{ - Result res; - // Check for null pointer parameter: out - if (out == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_vec_new(out, , ); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_vec_copy_checked(void *out, void *) +wasm_globaltype_vec_copy_checked(void *out, void *) { Result res; // Check for null pointer parameter: out @@ -5647,14 +3568,14 @@ wasm_extern_vec_copy_checked(void *out, void *) return res; } // Execute the original function - wasm_extern_vec_copy(out, ); + wasm_globaltype_vec_copy(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_extern_vec_delete_checked(void *) +wasm_globaltype_vec_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -5663,84 +3584,62 @@ wasm_extern_vec_delete_checked(void *) return res; } // Execute the original function - wasm_extern_vec_delete(); + wasm_globaltype_vec_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_extern_kind_checked(void *) +wasm_globaltype_vec_new_checked(void *out, size_t, void *) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { + // Check for null pointer parameter: out + if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_externkind_t original_result = wasm_extern_kind(); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_externkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_extern_type_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_type(); + wasm_globaltype_vec_new(out, , ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_func_as_extern_checked(void *) +wasm_globaltype_vec_new_empty_checked(void *out) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { + // Check for null pointer parameter: out + if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_func_as_extern(); + wasm_globaltype_vec_new_empty(out); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_global_as_extern_checked(void *) +wasm_globaltype_vec_new_uninitialized_checked(void *out, size_t) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { + // Check for null pointer parameter: out + if (out == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_global_as_extern(); + wasm_globaltype_vec_new_uninitialized(out, ); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_table_as_extern_checked(void *) +wasm_importtype_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -5749,14 +3648,14 @@ wasm_table_as_extern_checked(void *) return res; } // Execute the original function - wasm_table_as_extern(); + wasm_importtype_copy(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_memory_as_extern_checked(void *) +wasm_importtype_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -5765,14 +3664,14 @@ wasm_memory_as_extern_checked(void *) return res; } // Execute the original function - wasm_memory_as_extern(); + wasm_importtype_delete(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_extern_as_func_checked(void *) +wasm_importtype_is_linked_checked(void *) { Result res; // Check for null pointer parameter: None @@ -5781,236 +3680,7 @@ wasm_extern_as_func_checked(void *) return res; } // Execute the original function - wasm_extern_as_func(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_global_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_global(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_table_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_table(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_memory_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_memory(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_as_extern_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_as_extern_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_global_as_extern_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_global_as_extern_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_table_as_extern_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_table_as_extern_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_as_extern_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_memory_as_extern_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_func_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_func_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_global_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_global_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_table_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_table_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_extern_as_memory_const_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_extern_as_memory_const(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_instance_delete_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_instance_delete(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_instance_copy_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_instance_copy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_instance_same_checked(void *, void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_instance_same(, ); + _Bool original_result = wasm_importtype_is_linked(); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -6018,7 +3688,7 @@ wasm_instance_same_checked(void *, void *) } static inline Result -wasm_instance_get_host_info_checked(void *) +wasm_importtype_module_checked(void *) { Result res; // Check for null pointer parameter: None @@ -6027,14 +3697,14 @@ wasm_instance_get_host_info_checked(void *) return res; } // Execute the original function - wasm_instance_get_host_info(); + wasm_importtype_module(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_instance_set_host_info_checked(void *, void *) +wasm_importtype_name_checked(void *) { Result res; // Check for null pointer parameter: None @@ -6042,29 +3712,24 @@ wasm_instance_set_host_info_checked(void *, void *) res.error_code = -1; return res; } - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - wasm_instance_set_host_info(, ); + wasm_importtype_name(); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_instance_set_host_info_with_finalizer_checked(void *, void *, void *) +wasm_importtype_new_checked(void *module, void *name, void *) { Result res; - // Check for null pointer parameter: None - if (None == NULL) { + // Check for null pointer parameter: module + if (module == NULL) { res.error_code = -1; return res; } - // Check for null pointer parameter: None - if (None == NULL) { + // Check for null pointer parameter: name + if (name == NULL) { res.error_code = -1; return res; } @@ -6074,7 +3739,108 @@ wasm_instance_set_host_info_with_finalizer_checked(void *, void *, void *) return res; } // Execute the original function - wasm_instance_set_host_info_with_finalizer(, , ); + wasm_importtype_new(module, name, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_type_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_type(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_importtype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_importtype_vec_new_uninitialized(out, ); // Assign return value and error code res.error_code = 0; return res; @@ -6096,22 +3862,6 @@ wasm_instance_as_ref_checked(void *) return res; } -static inline Result -wasm_ref_as_instance_checked(void *) -{ - Result res; - // Check for null pointer parameter: None - if (None == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_ref_as_instance(); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_instance_as_ref_const_checked(void *) { @@ -6129,7 +3879,7 @@ wasm_instance_as_ref_const_checked(void *) } static inline Result -wasm_ref_as_instance_const_checked(void *) +wasm_instance_copy_checked(void *) { Result res; // Check for null pointer parameter: None @@ -6138,12 +3888,92 @@ wasm_ref_as_instance_const_checked(void *) return res; } // Execute the original function - wasm_ref_as_instance_const(); + wasm_instance_copy(); // Assign return value and error code res.error_code = 0; return res; } +static inline Result +wasm_instance_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_instance_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_instance_exports_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_instance_exports(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_instance_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_instance_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_instance_get_wasm_func_exec_time_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + double original_result = wasm_instance_get_wasm_func_exec_time(, ); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.double_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result wasm_instance_new_checked(void *, void *, void *imports, void *trap) { @@ -6245,7 +4075,7 @@ wasm_instance_new_with_args_ex_checked(void *, void *, void *imports, } static inline Result -wasm_instance_exports_checked(void *, void *out) +wasm_instance_same_checked(void *, void *) { Result res; // Check for null pointer parameter: None @@ -6253,13 +4083,61 @@ wasm_instance_exports_checked(void *, void *out) res.error_code = -1; return res; } - // Check for null pointer parameter: out - if (out == NULL) { + // Check for null pointer parameter: None + if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_instance_exports(, out); + _Bool original_result = wasm_instance_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_instance_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_instance_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_instance_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_instance_set_host_info_with_finalizer(, , ); // Assign return value and error code res.error_code = 0; return res; @@ -6288,7 +4166,7 @@ wasm_instance_sum_wasm_exec_time_checked(void *) } static inline Result -wasm_instance_get_wasm_func_exec_time_checked(void *, void *) +wasm_memory_as_extern_checked(void *) { Result res; // Check for null pointer parameter: None @@ -6296,17 +4174,108 @@ wasm_instance_get_wasm_func_exec_time_checked(void *, void *) res.error_code = -1; return res; } + // Execute the original function + wasm_memory_as_extern(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_as_extern_const_checked(void *) +{ + Result res; // Check for null pointer parameter: None if (None == NULL) { res.error_code = -1; return res; } // Execute the original function - double original_result = wasm_instance_get_wasm_func_exec_time(, ); + wasm_memory_as_extern_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_data_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_data(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_data_size_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + size_t original_result = wasm_memory_data_size(); // Assign return value and error code if (original_result == 0) { res.error_code = 0; - res.value.double_value = original_result; + res.value.size_t_value = original_result; } else { res.error_code = -2; @@ -6315,7 +4284,7 @@ wasm_instance_get_wasm_func_exec_time_checked(void *, void *) } static inline Result -wasm_extern_new_empty_checked(void *, wasm_externkind_t) +wasm_memory_delete_checked(void *) { Result res; // Check for null pointer parameter: None @@ -6324,7 +4293,2038 @@ wasm_extern_new_empty_checked(void *, wasm_externkind_t) return res; } // Execute the original function - wasm_extern_new_empty(, ); + wasm_memory_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_grow_checked(void *, wasm_memory_pages_t delta) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_memory_grow(, delta); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_new_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_new(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_same_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_memory_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_set_host_info_with_finalizer(, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_size_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_pages_t original_result = wasm_memory_size(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_memory_pages_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_type_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memory_type(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_as_externtype_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_as_externtype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_as_externtype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_as_externtype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_limits_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_limits(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_new_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_new(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memorytype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_memorytype_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_deserialize_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_deserialize(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_exports_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_exports(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_get_name_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_get_name(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_imports_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_imports(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_is_underlying_binary_freeable_checked(void *module) +{ + Result res; + // Check for null pointer parameter: module + if (module == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_module_is_underlying_binary_freeable(module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_module_new_checked(void *, void *binary) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: binary + if (binary == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_new(, binary); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_new_ex_checked(void *, void *binary, void *args) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: binary + if (binary == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_new_ex(, binary, args); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_obtain_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_obtain(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_serialize_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_serialize(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_set_name_checked(void *, void *name) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_module_set_name(, name); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_module_share_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_share(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_module_validate_checked(void *, void *binary) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: binary + if (binary == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_module_validate(, binary); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_ref_as_extern_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_extern(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_extern_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_extern_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_foreign_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_foreign(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_foreign_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_foreign_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_func_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_func(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_func_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_func_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_global_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_global(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_global_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_global_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_instance_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_instance(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_instance_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_instance_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_memory_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_memory(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_memory_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_memory_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_table_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_table(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_table_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_table_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_trap_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_trap(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_as_trap_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_as_trap_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_same_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_ref_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_ref_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_ref_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_ref_set_host_info_with_finalizer(, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_shared_module_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_shared_module_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_store_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_store_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_store_new_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_store_new(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_as_extern_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_as_extern(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_as_extern_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_as_extern_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_get_checked(void *, wasm_table_size_t index) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_get(, index); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_grow_checked(void *, wasm_table_size_t delta, void *init) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: init + if (init == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_table_grow(, delta, init); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_table_new_checked(void *, void *, void *init) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: init + if (init == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_new(, , init); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_same_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_table_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_table_set_checked(void *, wasm_table_size_t index, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_table_set(, index, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_table_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_set_host_info_with_finalizer(, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_table_size_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_size_t original_result = wasm_table_size(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_table_size_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_table_type(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_as_externtype_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_as_externtype(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_as_externtype_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_as_externtype_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_element_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_element(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_limits_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_limits(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_new_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_new(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_tabletype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_tabletype_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_as_ref_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_as_ref(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_as_ref_const_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_as_ref_const(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_get_host_info_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_get_host_info(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_message_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_message(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_new_checked(void *store, void *) +{ + Result res; + // Check for null pointer parameter: store + if (store == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_new(store, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_origin_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_origin(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_same_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_trap_same(, ); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_trap_set_host_info_checked(void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_set_host_info(, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_set_host_info_with_finalizer_checked(void *, void *, void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_set_host_info_with_finalizer(, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_trap_trace_checked(void *, void *out) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_trap_trace(, out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_delete_checked(void *v) +{ + Result res; + // Check for null pointer parameter: v + if (v == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_delete(v); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_val_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_val_vec_new_uninitialized(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_copy_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_copy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_kind_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valkind_t original_result = wasm_valtype_kind(); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_valtype_new_checked(wasm_valkind_t) +{ + Result res; + // Execute the original function + wasm_valtype_new(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_vec_copy_checked(void *out, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_vec_copy(out, ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_vec_delete_checked(void *) +{ + Result res; + // Check for null pointer parameter: None + if (None == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_vec_delete(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_vec_new_checked(void *out, size_t, void *) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_vec_new(out, , ); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_vec_new_empty_checked(void *out) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_vec_new_empty(out); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_valtype_vec_new_uninitialized_checked(void *out, size_t) +{ + Result res; + // Check for null pointer parameter: out + if (out == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_valtype_vec_new_uninitialized(out, ); // Assign return value and error code res.error_code = 0; return res; diff --git a/core/iwasm/include/wasm_export_checked.h b/core/iwasm/include/wasm_export_checked.h index 2a8b2fea2..c7610079e 100644 --- a/core/iwasm/include/wasm_export_checked.h +++ b/core/iwasm/include/wasm_export_checked.h @@ -19,20 +19,20 @@ typedef struct { int error_code; // Error code (0 for success, non-zero for errors) union { - wasm_valkind_t wasm_valkind_t_value; - wasm_module_t wasm_module_t_value; - uint32_t uint32_t_value; RunningMode RunningMode_value; _Bool _Bool_value; - wasm_function_inst_t wasm_function_inst_t_value; double double_value; - package_type_t package_type_t_value; - wasm_exec_env_t wasm_exec_env_t_value; - wasm_memory_inst_t wasm_memory_inst_t_value; - uint64_t uint64_t_value; - wasm_shared_heap_t wasm_shared_heap_t_value; int32_t int32_t_value; + package_type_t package_type_t_value; + uint32_t uint32_t_value; + uint64_t uint64_t_value; + wasm_exec_env_t wasm_exec_env_t_value; + wasm_function_inst_t wasm_function_inst_t_value; + wasm_memory_inst_t wasm_memory_inst_t_value; wasm_module_inst_t wasm_module_inst_t_value; + wasm_module_t wasm_module_t_value; + wasm_shared_heap_t wasm_shared_heap_t_value; + wasm_valkind_t wasm_valkind_t_value; // Add other types as needed } value; } Result; @@ -59,142 +59,6 @@ get_base_lib_export_apis_checked(void *p_base_lib_apis) return res; } -static inline Result -wasm_runtime_init_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_init(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_full_init_checked(void *init_args) -{ - Result res; - // Check for null pointer parameter: init_args - if (init_args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_full_init(init_args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_log_level_checked(log_level_t level) -{ - Result res; - // Execute the original function - wasm_runtime_set_log_level(level); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_running_mode_supported_checked(RunningMode running_mode) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_is_running_mode_supported(running_mode); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_default_running_mode_checked(RunningMode running_mode) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_set_default_running_mode(running_mode); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_destroy_checked(void) -{ - Result res; - // Execute the original function - wasm_runtime_destroy(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_malloc_checked(unsigned int size) -{ - Result res; - // Execute the original function - wasm_runtime_malloc(size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_realloc_checked(void *ptr, unsigned int size) -{ - Result res; - // Check for null pointer parameter: ptr - if (ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_realloc(ptr, size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_free_checked(void *ptr) -{ - Result res; - // Check for null pointer parameter: ptr - if (ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_free(ptr); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_mem_alloc_info_checked(void *mem_alloc_info) -{ - Result res; - // Check for null pointer parameter: mem_alloc_info - if (mem_alloc_info == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_get_mem_alloc_info(mem_alloc_info); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - static inline Result get_package_type_checked(void *buf, uint32_t size) { @@ -217,6 +81,1201 @@ get_package_type_checked(void *buf, uint32_t size) return res; } +static inline Result +wasm_application_execute_func_checked(wasm_module_inst_t module_inst, + void *name, int32_t argc, void *argv) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_application_execute_func(module_inst, name, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_application_execute_main_checked(wasm_module_inst_t module_inst, + int32_t argc, void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_application_execute_main(module_inst, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_copy_callstack_checked(wasm_exec_env_t exec_env, void *buffer, + uint32_t length, uint32_t skip_n, void *error_buf, + uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: buffer + if (buffer == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = wasm_copy_callstack( + exec_env, buffer, length, skip_n, error_buf, error_buf_size); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_externref_obj2ref_checked(wasm_module_inst_t module_inst, void *extern_obj, + void *p_externref_idx) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_externref_idx + if (p_externref_idx == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_externref_obj2ref(module_inst, extern_obj, p_externref_idx); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_objdel_checked(wasm_module_inst_t module_inst, void *extern_obj) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_externref_objdel(module_inst, extern_obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_ref2obj_checked(uint32_t externref_idx, void *p_extern_obj) +{ + Result res; + // Check for null pointer parameter: p_extern_obj + if (p_extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_externref_ref2obj(externref_idx, p_extern_obj); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_retain_checked(uint32_t externref_idx) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_externref_retain(externref_idx); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_externref_set_cleanup_checked(wasm_module_inst_t module_inst, + void *extern_obj, void *extern_obj_cleanup) +{ + Result res; + // Check for null pointer parameter: extern_obj + if (extern_obj == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: extern_obj_cleanup + if (extern_obj_cleanup == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_externref_set_cleanup(module_inst, extern_obj, extern_obj_cleanup); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_func_get_param_count_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_func_get_param_count(func_inst, module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_get_param_types_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst, + void *param_types) +{ + Result res; + // Check for null pointer parameter: param_types + if (param_types == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_get_param_types(func_inst, module_inst, param_types); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_get_result_count_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_func_get_result_count(func_inst, module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_get_result_types_checked(wasm_function_inst_t func_inst, + wasm_module_inst_t module_inst, + void *result_types) +{ + Result res; + // Check for null pointer parameter: result_types + if (result_types == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_func_get_result_types(func_inst, module_inst, result_types); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_func_type_get_param_count_checked(wasm_func_type_t func_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_func_type_get_param_count(func_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_param_valkind_checked(wasm_func_type_t func_type, + uint32_t param_index) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = + wasm_func_type_get_param_valkind(func_type, param_index); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_result_count_checked(wasm_func_type_t func_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_func_type_get_result_count(func_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_func_type_get_result_valkind_checked(wasm_func_type_t func_type, + uint32_t result_index) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = + wasm_func_type_get_result_valkind(func_type, result_index); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_global_type_get_mutable_checked(wasm_global_type_t global_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_global_type_get_mutable(global_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_global_type_get_valkind_checked(wasm_global_type_t global_type) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = wasm_global_type_get_valkind(global_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_enlarge_checked(wasm_memory_inst_t memory_inst, + uint64_t inc_page_count) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_enlarge(memory_inst, inc_page_count); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_get_base_address_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + wasm_memory_get_base_address(memory_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_memory_get_bytes_per_page_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_bytes_per_page(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_cur_page_count_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_cur_page_count(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_max_page_count_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + uint64_t original_result = wasm_memory_get_max_page_count(memory_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_get_shared_checked(wasm_memory_inst_t memory_inst) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_get_shared(memory_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_memory_type_get_init_page_count_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_memory_type_get_init_page_count(memory_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_type_get_max_page_count_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_memory_type_get_max_page_count(memory_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_memory_type_get_shared_checked(wasm_memory_type_t memory_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_memory_type_get_shared(memory_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_addr_app_to_native_checked(wasm_module_inst_t module_inst, + uint64_t app_offset) +{ + Result res; + // Execute the original function + wasm_runtime_addr_app_to_native(module_inst, app_offset); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, + void *native_ptr) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint64_t original_result = + wasm_runtime_addr_native_to_app(module_inst, native_ptr); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint64_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, + wasm_shared_heap_t shared_heap) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_attach_shared_heap(module_inst, shared_heap); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_begin_blocking_op(exec_env); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_indirect_checked(wasm_exec_env_t exec_env, + uint32_t element_index, uint32_t argc, + void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_call_indirect(exec_env, element_index, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, uint32_t argc, + void *argv) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_call_wasm(exec_env, function, argc, argv); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_a_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, + uint32_t num_results, void *results, + uint32_t num_args, void *args) +{ + Result res; + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_call_wasm_a( + exec_env, function, num_results, results, num_args, args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_call_wasm_v_checked(wasm_exec_env_t exec_env, + wasm_function_inst_t function, + uint32_t num_results, void *results, + uint32_t num_args, ...) +{ + Result res; + va_list args; + // Execute the original function + va_start(args, num_args); + _Bool original_result = wasm_runtime_call_wasm_v( + exec_env, function, num_results, results, num_args, args); + va_end(args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_chain_shared_heaps_checked(wasm_shared_heap_t head, + wasm_shared_heap_t body) +{ + Result res; + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_chain_shared_heaps(head, body); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_clear_exception_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_clear_exception(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_create_context_key_checked(void *dtor) +{ + Result res; + // Check for null pointer parameter: dtor + if (dtor == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_create_context_key(dtor); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_create_exec_env_checked(wasm_module_inst_t module_inst, + uint32_t stack_size) +{ + Result res; + // Execute the original function + wasm_exec_env_t original_result = + wasm_runtime_create_exec_env(module_inst, stack_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_exec_env_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_create_shared_heap_checked(void *init_args) +{ + Result res; + // Check for null pointer parameter: init_args + if (init_args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_create_shared_heap(init_args); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_deinstantiate_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_deinstantiate(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_checked(void) +{ + Result res; + // Execute the original function + wasm_runtime_destroy(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_context_key_checked(void *key) +{ + Result res; + // Check for null pointer parameter: key + if (key == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_destroy_context_key(key); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_exec_env_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_exec_env(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_spawned_exec_env_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_spawned_exec_env(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_destroy_thread_env_checked(void) +{ + Result res; + // Execute the original function + wasm_runtime_destroy_thread_env(); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_detach_shared_heap_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_detach_shared_heap(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_detect_native_stack_overflow_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_detect_native_stack_overflow(exec_env); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_detect_native_stack_overflow_size_checked(wasm_exec_env_t exec_env, + uint32_t required_size) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_detect_native_stack_overflow_size(exec_env, required_size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_dump_call_stack_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_dump_call_stack(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_call_stack_to_buf_checked(wasm_exec_env_t exec_env, void *buf, + uint32_t len) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = + wasm_runtime_dump_call_stack_to_buf(exec_env, buf, len); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_dump_mem_consumption_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_dump_mem_consumption(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_perf_profiling_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_dump_perf_profiling(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_dump_pgo_prof_data_to_buf_checked(wasm_module_inst_t module_inst, + void *buf, uint32_t len) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + uint32_t original_result = + wasm_runtime_dump_pgo_prof_data_to_buf(module_inst, buf, len); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_end_blocking_op_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_end_blocking_op(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_enlarge_memory_checked(wasm_module_inst_t module_inst, + uint64_t inc_page_count) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_enlarge_memory(module_inst, inc_page_count); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_find_module_registered_checked(void *module_name) +{ + Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = + wasm_runtime_find_module_registered(module_name); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_free_checked(void *ptr) +{ + Result res; + // Check for null pointer parameter: ptr + if (ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_free(ptr); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_full_init_checked(void *init_args) +{ + Result res; + // Check for null pointer parameter: init_args + if (init_args == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_full_init(init_args); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_app_addr_range_checked(wasm_module_inst_t module_inst, + uint64_t app_offset, + void *p_app_start_offset, + void *p_app_end_offset) +{ + Result res; + // Check for null pointer parameter: p_app_start_offset + if (p_app_start_offset == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_app_end_offset + if (p_app_end_offset == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_app_addr_range( + module_inst, app_offset, p_app_start_offset, p_app_end_offset); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_call_stack_buf_size_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_runtime_get_call_stack_buf_size(exec_env); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_context_checked(wasm_module_inst_t inst, void *key) +{ + Result res; + // Check for null pointer parameter: key + if (key == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_context(inst, key); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_current_package_version_checked(package_type_t package_type) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_runtime_get_current_package_version(package_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_custom_data_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_get_custom_data(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_custom_section_checked(wasm_module_t module_comm, void *name, + void *len) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: len + if (len == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_custom_section(module_comm, name, len); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_memory_inst_t original_result = + wasm_runtime_get_default_memory(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_memory_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_exception_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_get_exception(module_inst); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_exec_env_singleton_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_exec_env_t original_result = + wasm_runtime_get_exec_env_singleton(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_exec_env_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_export_count_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + int32_t original_result = wasm_runtime_get_export_count(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_export_global_inst_checked(wasm_module_inst_t module_inst, + void *name, void *global_inst) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: global_inst + if (global_inst == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_get_export_global_inst(module_inst, name, global_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_export_table_inst_checked(wasm_module_inst_t module_inst, + void *name, void *table_inst) +{ + Result res; + // Check for null pointer parameter: name + if (name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: table_inst + if (table_inst == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_get_export_table_inst(module_inst, name, table_inst); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_export_type_checked(wasm_module_t module, int32_t export_index, + void *export_type) +{ + Result res; + // Check for null pointer parameter: export_type + if (export_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_export_type(module, export_index, export_type); + // Assign return value and error code + res.error_code = 0; + return res; +} + static inline Result wasm_runtime_get_file_package_type_checked(void *buf, uint32_t size) { @@ -240,24 +1299,6 @@ wasm_runtime_get_file_package_type_checked(void *buf, uint32_t size) return res; } -static inline Result -wasm_runtime_get_module_package_type_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - package_type_t original_result = - wasm_runtime_get_module_package_type(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.package_type_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result wasm_runtime_get_file_package_version_checked(void *buf, uint32_t size) { @@ -280,6 +1321,160 @@ wasm_runtime_get_file_package_version_checked(void *buf, uint32_t size) return res; } +static inline Result +wasm_runtime_get_function_attachment_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_get_function_attachment(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_import_count_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + int32_t original_result = wasm_runtime_get_import_count(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_import_type_checked(wasm_module_t module, int32_t import_index, + void *import_type) +{ + Result res; + // Check for null pointer parameter: import_type + if (import_type == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_get_import_type(module, import_index, import_type); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_mem_alloc_info_checked(void *mem_alloc_info) +{ + Result res; + // Check for null pointer parameter: mem_alloc_info + if (mem_alloc_info == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_mem_alloc_info(mem_alloc_info); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_memory_checked(wasm_module_inst_t module_inst, uint32_t index) +{ + Result res; + // Execute the original function + wasm_memory_inst_t original_result = + wasm_runtime_get_memory(module_inst, index); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_memory_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_module_t original_result = wasm_runtime_get_module(module_inst); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_hash_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_get_module_hash(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_module_inst_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_module_inst_t original_result = wasm_runtime_get_module_inst(exec_env); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_module_name_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_get_module_name(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_module_package_type_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + package_type_t original_result = + wasm_runtime_get_module_package_type(module); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.package_type_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result wasm_runtime_get_module_package_version_checked(wasm_module_t module) { @@ -298,12 +1493,42 @@ wasm_runtime_get_module_package_version_checked(wasm_module_t module) } static inline Result -wasm_runtime_get_current_package_version_checked(package_type_t package_type) +wasm_runtime_get_native_addr_range_checked(wasm_module_inst_t module_inst, + void *native_ptr, + void *p_native_start_addr, + void *p_native_end_addr) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_native_start_addr + if (p_native_start_addr == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: p_native_end_addr + if (p_native_end_addr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = wasm_runtime_get_native_addr_range( + module_inst, native_ptr, p_native_start_addr, p_native_end_addr); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_get_pgo_prof_data_size_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - uint32_t original_result = - wasm_runtime_get_current_package_version(package_type); + uint32_t original_result = wasm_runtime_get_pgo_prof_data_size(module_inst); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -316,16 +1541,106 @@ wasm_runtime_get_current_package_version_checked(package_type_t package_type) } static inline Result -wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) +wasm_runtime_get_running_mode_checked(wasm_module_inst_t module_inst) { Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { + // Execute the original function + RunningMode original_result = wasm_runtime_get_running_mode(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.RunningMode_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_user_data_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + wasm_runtime_get_user_data(exec_env); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_version_checked(void *major, void *minor, void *patch) +{ + Result res; + // Check for null pointer parameter: major + if (major == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: minor + if (minor == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: patch + if (patch == NULL) { res.error_code = -1; return res; } // Execute the original function - _Bool original_result = wasm_runtime_is_xip_file(buf, size); + wasm_runtime_get_version(major, minor, patch); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_get_wasi_exit_code_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_runtime_get_wasi_exit_code(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_get_wasm_func_exec_time_checked(wasm_module_inst_t inst, + void *func_name) +{ + Result res; + // Check for null pointer parameter: func_name + if (func_name == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + double original_result = + wasm_runtime_get_wasm_func_exec_time(inst, func_name); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.double_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_init_checked(void) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_init(); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -333,245 +1648,17 @@ wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) } static inline Result -wasm_runtime_set_module_reader_checked(module_reader reader, - module_destroyer destroyer) +wasm_runtime_init_thread_env_checked(void) { Result res; // Execute the original function - wasm_runtime_set_module_reader(reader, destroyer); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_register_module_checked(void *module_name, wasm_module_t module, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_register_module( - module_name, module, error_buf, error_buf_size); + _Bool original_result = wasm_runtime_init_thread_env(); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; return res; } -static inline Result -wasm_runtime_find_module_registered_checked(void *module_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_find_module_registered(module_name); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_load_checked(void *buf, uint32_t size, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_load(buf, size, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_load_ex_checked(void *buf, uint32_t size, void *args, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = - wasm_runtime_load_ex(buf, size, args, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_resolve_symbols_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_resolve_symbols(module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_load_from_sections_checked(wasm_section_list_t section_list, - _Bool is_aot, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_t original_result = wasm_runtime_load_from_sections( - section_list, is_aot, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_unload_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - wasm_runtime_unload(module); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_module_hash_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - wasm_runtime_get_module_hash(module); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_args_ex_checked(wasm_module_t module, void *dir_list, - uint32_t dir_count, void *map_dir_list, - uint32_t map_dir_count, void *env, - uint32_t env_count, void *argv, int argc, - int64_t stdinfd, int64_t stdoutfd, - int64_t stderrfd) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_args_ex(module, dir_list, dir_count, map_dir_list, - map_dir_count, env, env_count, argv, argc, - stdinfd, stdoutfd, stderrfd); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_args_checked(wasm_module_t module, void *dir_list, - uint32_t dir_count, void *map_dir_list, - uint32_t map_dir_count, void *env, - uint32_t env_count, void *argv, int argc) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_args(module, dir_list, dir_count, map_dir_list, - map_dir_count, env, env_count, argv, argc); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_addr_pool_checked(wasm_module_t module, void *addr_pool, - uint32_t addr_pool_size) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_addr_pool(module, addr_pool, addr_pool_size); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_wasi_ns_lookup_pool_checked(wasm_module_t module, - void *ns_lookup_pool, - uint32_t ns_lookup_pool_size) -{ - Result res; - // Execute the original function - wasm_runtime_set_wasi_ns_lookup_pool(module, ns_lookup_pool, - ns_lookup_pool_size); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_runtime_instantiate_checked(wasm_module_t module, uint32_t default_stack_size, @@ -628,6 +1715,35 @@ wasm_runtime_instantiate_ex_checked(wasm_module_t module, void *args, return res; } +static inline Result +wasm_runtime_instantiate_ex2_checked(wasm_module_t module, void *args, + void *error_buf, uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_inst_t original_result = + wasm_runtime_instantiate_ex2(module, args, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + static inline Result wasm_runtime_instantiation_args_create_checked(void *p) { @@ -713,42 +1829,11 @@ wasm_runtime_instantiation_args_set_max_memory_pages_checked(void *p, } static inline Result -wasm_runtime_instantiate_ex2_checked(wasm_module_t module, void *args, - void *error_buf, uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_module_inst_t original_result = - wasm_runtime_instantiate_ex2(module, args, error_buf, error_buf_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, - RunningMode running_mode) +wasm_runtime_is_bounds_checks_enabled_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - _Bool original_result = - wasm_runtime_set_running_mode(module_inst, running_mode); + _Bool original_result = wasm_runtime_is_bounds_checks_enabled(module_inst); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -756,47 +1841,74 @@ wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_get_running_mode_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_import_func_linked_checked(void *module_name, void *func_name) { Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: func_name + if (func_name == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - RunningMode original_result = wasm_runtime_get_running_mode(module_inst); + _Bool original_result = + wasm_runtime_is_import_func_linked(module_name, func_name); // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.RunningMode_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } static inline Result -wasm_runtime_deinstantiate_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_import_global_linked_checked(void *module_name, + void *global_name) { Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: global_name + if (global_name == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_runtime_deinstantiate(module_inst); + _Bool original_result = + wasm_runtime_is_import_global_linked(module_name, global_name); // Assign return value and error code - res.error_code = 0; + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } static inline Result -wasm_runtime_get_module_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_running_mode_supported_checked(RunningMode running_mode) { Result res; // Execute the original function - wasm_module_t original_result = wasm_runtime_get_module(module_inst); + _Bool original_result = + wasm_runtime_is_running_mode_supported(running_mode); // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_is_underlying_binary_freeable_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_is_underlying_binary_freeable(module); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; return res; } @@ -813,16 +1925,37 @@ wasm_runtime_is_wasi_mode_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) +wasm_runtime_is_xip_file_checked(void *buf, uint32_t size) { Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - wasm_function_inst_t original_result = - wasm_runtime_lookup_wasi_start_function(module_inst); + _Bool original_result = wasm_runtime_is_xip_file(buf, size); // Assign return value and error code - if (original_result != NULL) { + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_join_thread_checked(wasm_thread_t tid, void *retval) +{ + Result res; + // Check for null pointer parameter: retval + if (retval == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int32_t original_result = wasm_runtime_join_thread(tid, retval); + // Assign return value and error code + if (original_result == 0) { res.error_code = 0; - res.value.wasm_function_inst_t_value = original_result; + res.value.int32_t_value = original_result; } else { res.error_code = -2; @@ -831,15 +1964,86 @@ wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_get_wasi_exit_code_checked(wasm_module_inst_t module_inst) +wasm_runtime_load_checked(void *buf, uint32_t size, void *error_buf, + uint32_t error_buf_size) { Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } // Execute the original function - uint32_t original_result = wasm_runtime_get_wasi_exit_code(module_inst); + wasm_module_t original_result = + wasm_runtime_load(buf, size, error_buf, error_buf_size); // Assign return value and error code - if (original_result == 0) { + if (original_result != NULL) { res.error_code = 0; - res.value.uint32_t_value = original_result; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_load_ex_checked(void *buf, uint32_t size, void *args, + void *error_buf, uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: buf + if (buf == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: args + if (args == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = + wasm_runtime_load_ex(buf, size, args, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_load_from_sections_checked(wasm_section_list_t section_list, + _Bool is_aot, void *error_buf, + uint32_t error_buf_size) +{ + Result res; + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_module_t original_result = wasm_runtime_load_from_sections( + section_list, is_aot, error_buf, error_buf_size); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_module_t_value = original_result; } else { res.error_code = -2; @@ -870,258 +2074,6 @@ wasm_runtime_lookup_function_checked(wasm_module_inst_t module_inst, void *name) return res; } -static inline Result -wasm_func_get_param_count_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_func_get_param_count(func_inst, module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_get_result_count_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_func_get_result_count(func_inst, module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_get_param_types_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst, - void *param_types) -{ - Result res; - // Check for null pointer parameter: param_types - if (param_types == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_get_param_types(func_inst, module_inst, param_types); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_get_result_types_checked(wasm_function_inst_t func_inst, - wasm_module_inst_t module_inst, - void *result_types) -{ - Result res; - // Check for null pointer parameter: result_types - if (result_types == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_func_get_result_types(func_inst, module_inst, result_types); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_create_exec_env_checked(wasm_module_inst_t module_inst, - uint32_t stack_size) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = - wasm_runtime_create_exec_env(module_inst, stack_size); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_destroy_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_exec_env(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_copy_callstack_checked(wasm_exec_env_t exec_env, void *buffer, - uint32_t length, uint32_t skip_n, void *error_buf, - uint32_t error_buf_size) -{ - Result res; - // Check for null pointer parameter: buffer - if (buffer == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: error_buf - if (error_buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = wasm_copy_callstack( - exec_env, buffer, length, skip_n, error_buf, error_buf_size); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_exec_env_singleton_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = - wasm_runtime_get_exec_env_singleton(module_inst); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_start_debug_instance_with_port_checked(wasm_exec_env_t exec_env, - int32_t port) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_runtime_start_debug_instance_with_port(exec_env, port); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_start_debug_instance_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_start_debug_instance(exec_env); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_init_thread_env_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_init_thread_env(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_destroy_thread_env_checked(void) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_thread_env(); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_thread_env_inited_checked(void) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_thread_env_inited(); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_module_inst_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_module_inst_t original_result = wasm_runtime_get_module_inst(exec_env); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_module_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_module_inst_checked(wasm_exec_env_t exec_env, - wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_set_module_inst(exec_env, module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - static inline Result wasm_runtime_lookup_memory_checked(wasm_module_inst_t module_inst, void *name) { @@ -1146,16 +2098,16 @@ wasm_runtime_lookup_memory_checked(wasm_module_inst_t module_inst, void *name) } static inline Result -wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) +wasm_runtime_lookup_wasi_start_function_checked(wasm_module_inst_t module_inst) { Result res; // Execute the original function - wasm_memory_inst_t original_result = - wasm_runtime_get_default_memory(module_inst); + wasm_function_inst_t original_result = + wasm_runtime_lookup_wasi_start_function(module_inst); // Assign return value and error code if (original_result != NULL) { res.error_code = 0; - res.value.wasm_memory_inst_t_value = original_result; + res.value.wasm_function_inst_t_value = original_result; } else { res.error_code = -2; @@ -1164,345 +2116,11 @@ wasm_runtime_get_default_memory_checked(wasm_module_inst_t module_inst) } static inline Result -wasm_runtime_get_memory_checked(wasm_module_inst_t module_inst, uint32_t index) +wasm_runtime_malloc_checked(unsigned int size) { Result res; // Execute the original function - wasm_memory_inst_t original_result = - wasm_runtime_get_memory(module_inst, index); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_memory_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_cur_page_count_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_cur_page_count(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_max_page_count_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_max_page_count(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_bytes_per_page_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - uint64_t original_result = wasm_memory_get_bytes_per_page(memory_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_get_shared_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_get_shared(memory_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_get_base_address_checked(wasm_memory_inst_t memory_inst) -{ - Result res; - // Execute the original function - wasm_memory_get_base_address(memory_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_memory_enlarge_checked(wasm_memory_inst_t memory_inst, - uint64_t inc_page_count) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_enlarge(memory_inst, inc_page_count); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, uint32_t argc, - void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_call_wasm(exec_env, function, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_a_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, - uint32_t num_results, void *results, - uint32_t num_args, void *args) -{ - Result res; - // Check for null pointer parameter: args - if (args == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_call_wasm_a( - exec_env, function, num_results, results, num_args, args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_wasm_v_checked(wasm_exec_env_t exec_env, - wasm_function_inst_t function, - uint32_t num_results, void *results, - uint32_t num_args, ...) -{ - Result res; - va_list args; - // Execute the original function - va_start(args, num_args); - _Bool original_result = wasm_runtime_call_wasm_v( - exec_env, function, num_results, results, num_args, args); - va_end(args); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_call_indirect_checked(wasm_exec_env_t exec_env, - uint32_t element_index, uint32_t argc, - void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_call_indirect(exec_env, element_index, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_application_execute_main_checked(wasm_module_inst_t module_inst, - int32_t argc, void *argv) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_application_execute_main(module_inst, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_application_execute_func_checked(wasm_module_inst_t module_inst, - void *name, int32_t argc, void *argv) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_application_execute_func(module_inst, name, argc, argv); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_exception_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_get_exception(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_exception_checked(wasm_module_inst_t module_inst, - void *exception) -{ - Result res; - // Check for null pointer parameter: exception - if (exception == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_exception(module_inst, exception); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_clear_exception_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_clear_exception(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_terminate_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_terminate(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_custom_data_checked(wasm_module_inst_t module_inst, - void *custom_data) -{ - Result res; - // Check for null pointer parameter: custom_data - if (custom_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_custom_data(module_inst, custom_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_custom_data_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_get_custom_data(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_bounds_checks_checked(wasm_module_inst_t module_inst, - _Bool enable) -{ - Result res; - // Execute the original function - wasm_runtime_set_bounds_checks(module_inst, enable); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_bounds_checks_enabled_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_is_bounds_checks_enabled(module_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_module_malloc_checked(wasm_module_inst_t module_inst, - uint64_t size, void *p_native_addr) -{ - Result res; - // Check for null pointer parameter: p_native_addr - if (p_native_addr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint64_t original_result = - wasm_runtime_module_malloc(module_inst, size, p_native_addr); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint64_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_module_free_checked(wasm_module_inst_t module_inst, uint64_t ptr) -{ - Result res; - // Execute the original function - wasm_runtime_module_free(module_inst, ptr); + wasm_runtime_malloc(size); // Assign return value and error code res.error_code = 0; return res; @@ -1533,77 +2151,29 @@ wasm_runtime_module_dup_data_checked(wasm_module_inst_t module_inst, void *src, } static inline Result -wasm_runtime_validate_app_addr_checked(wasm_module_inst_t module_inst, - uint64_t app_offset, uint64_t size) +wasm_runtime_module_free_checked(wasm_module_inst_t module_inst, uint64_t ptr) { Result res; // Execute the original function - _Bool original_result = - wasm_runtime_validate_app_addr(module_inst, app_offset, size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_validate_app_str_addr_checked(wasm_module_inst_t module_inst, - uint64_t app_str_offset) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_validate_app_str_addr(module_inst, app_str_offset); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_validate_native_addr_checked(wasm_module_inst_t module_inst, - void *native_ptr, uint64_t size) -{ - Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_validate_native_addr(module_inst, native_ptr, size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_addr_app_to_native_checked(wasm_module_inst_t module_inst, - uint64_t app_offset) -{ - Result res; - // Execute the original function - wasm_runtime_addr_app_to_native(module_inst, app_offset); + wasm_runtime_module_free(module_inst, ptr); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, - void *native_ptr) +wasm_runtime_module_malloc_checked(wasm_module_inst_t module_inst, + uint64_t size, void *p_native_addr) { Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { + // Check for null pointer parameter: p_native_addr + if (p_native_addr == NULL) { res.error_code = -1; return res; } // Execute the original function uint64_t original_result = - wasm_runtime_addr_native_to_app(module_inst, native_ptr); + wasm_runtime_module_malloc(module_inst, size, p_native_addr); // Assign return value and error code if (original_result == 0) { res.error_code = 0; @@ -1616,341 +2186,45 @@ wasm_runtime_addr_native_to_app_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_get_app_addr_range_checked(wasm_module_inst_t module_inst, - uint64_t app_offset, - void *p_app_start_offset, - void *p_app_end_offset) +wasm_runtime_realloc_checked(void *ptr, unsigned int size) { Result res; - // Check for null pointer parameter: p_app_start_offset - if (p_app_start_offset == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_app_end_offset - if (p_app_end_offset == NULL) { + // Check for null pointer parameter: ptr + if (ptr == NULL) { res.error_code = -1; return res; } // Execute the original function - _Bool original_result = wasm_runtime_get_app_addr_range( - module_inst, app_offset, p_app_start_offset, p_app_end_offset); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_native_addr_range_checked(wasm_module_inst_t module_inst, - void *native_ptr, - void *p_native_start_addr, - void *p_native_end_addr) -{ - Result res; - // Check for null pointer parameter: native_ptr - if (native_ptr == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_native_start_addr - if (p_native_start_addr == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_native_end_addr - if (p_native_end_addr == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_runtime_get_native_addr_range( - module_inst, native_ptr, p_native_start_addr, p_native_end_addr); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_import_count_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - int32_t original_result = wasm_runtime_get_import_count(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_import_type_checked(wasm_module_t module, int32_t import_index, - void *import_type) -{ - Result res; - // Check for null pointer parameter: import_type - if (import_type == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_import_type(module, import_index, import_type); + wasm_runtime_realloc(ptr, size); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_get_export_count_checked(wasm_module_t module) +wasm_runtime_register_module_checked(void *module_name, wasm_module_t module, + void *error_buf, uint32_t error_buf_size) { Result res; - // Execute the original function - int32_t original_result = wasm_runtime_get_export_count(module); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_export_type_checked(wasm_module_t module, int32_t export_index, - void *export_type) -{ - Result res; - // Check for null pointer parameter: export_type - if (export_type == NULL) { + // Check for null pointer parameter: error_buf + if (error_buf == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_runtime_get_export_type(module, export_index, export_type); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_func_type_get_param_count_checked(wasm_func_type_t func_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_func_type_get_param_count(func_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_type_get_param_valkind_checked(wasm_func_type_t func_type, - uint32_t param_index) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = - wasm_func_type_get_param_valkind(func_type, param_index); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_type_get_result_count_checked(wasm_func_type_t func_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_func_type_get_result_count(func_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_func_type_get_result_valkind_checked(wasm_func_type_t func_type, - uint32_t result_index) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = - wasm_func_type_get_result_valkind(func_type, result_index); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_global_type_get_valkind_checked(wasm_global_type_t global_type) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = wasm_global_type_get_valkind(global_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_global_type_get_mutable_checked(wasm_global_type_t global_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_global_type_get_mutable(global_type); + _Bool original_result = wasm_runtime_register_module( + module_name, module, error_buf, error_buf_size); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; return res; } -static inline Result -wasm_memory_type_get_shared_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_memory_type_get_shared(memory_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_memory_type_get_init_page_count_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - uint32_t original_result = - wasm_memory_type_get_init_page_count(memory_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_memory_type_get_max_page_count_checked(wasm_memory_type_t memory_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_memory_type_get_max_page_count(memory_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_elem_kind_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - wasm_valkind_t original_result = wasm_table_type_get_elem_kind(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.wasm_valkind_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_shared_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_table_type_get_shared(table_type); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_type_get_init_size_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_table_type_get_init_size(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_table_type_get_max_size_checked(wasm_table_type_t table_type) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_table_type_get_max_size(table_type); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - static inline Result wasm_runtime_register_natives_checked(void *module_name, void *native_symbols, uint32_t n_native_symbols) @@ -2001,22 +2275,11 @@ wasm_runtime_register_natives_raw_checked(void *module_name, } static inline Result -wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) +wasm_runtime_resolve_symbols_checked(wasm_module_t module) { Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: native_symbols - if (native_symbols == NULL) { - res.error_code = -1; - return res; - } // Execute the original function - _Bool original_result = - wasm_runtime_unregister_natives(module_name, native_symbols); + _Bool original_result = wasm_runtime_resolve_symbols(module); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2024,637 +2287,12 @@ wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) } static inline Result -wasm_runtime_get_export_global_inst_checked(wasm_module_inst_t module_inst, - void *name, void *global_inst) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: global_inst - if (global_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_get_export_global_inst(module_inst, name, global_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_get_export_table_inst_checked(wasm_module_inst_t module_inst, - void *name, void *table_inst) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: table_inst - if (table_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_get_export_table_inst(module_inst, name, table_inst); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_table_get_func_inst_checked(wasm_module_inst_t module_inst, - void *table_inst, uint32_t idx) -{ - Result res; - // Check for null pointer parameter: table_inst - if (table_inst == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_function_inst_t original_result = - wasm_table_get_func_inst(module_inst, table_inst, idx); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_function_inst_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_function_attachment_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_bounds_checks_checked(wasm_module_inst_t module_inst, + _Bool enable) { Result res; // Execute the original function - wasm_runtime_get_function_attachment(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_user_data_checked(wasm_exec_env_t exec_env, void *user_data) -{ - Result res; - // Check for null pointer parameter: user_data - if (user_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_user_data(exec_env, user_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_user_data_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_get_user_data(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_native_stack_boundary_checked(wasm_exec_env_t exec_env, - void *native_stack_boundary) -{ - Result res; - // Check for null pointer parameter: native_stack_boundary - if (native_stack_boundary == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_native_stack_boundary(exec_env, native_stack_boundary); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_set_instruction_count_limit_checked(wasm_exec_env_t exec_env, - int instruction_count) -{ - Result res; - // Execute the original function - wasm_runtime_set_instruction_count_limit(exec_env, instruction_count); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_dump_mem_consumption_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_dump_mem_consumption(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_dump_perf_profiling_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - wasm_runtime_dump_perf_profiling(module_inst); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_sum_wasm_exec_time_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - double original_result = wasm_runtime_sum_wasm_exec_time(module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.double_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_wasm_func_exec_time_checked(wasm_module_inst_t inst, - void *func_name) -{ - Result res; - // Check for null pointer parameter: func_name - if (func_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - double original_result = - wasm_runtime_get_wasm_func_exec_time(inst, func_name); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.double_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_set_max_thread_num_checked(uint32_t num) -{ - Result res; - // Execute the original function - wasm_runtime_set_max_thread_num(num); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_spawn_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_exec_env_t original_result = wasm_runtime_spawn_exec_env(exec_env); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_exec_env_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_destroy_spawned_exec_env_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_destroy_spawned_exec_env(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_spawn_thread_checked(wasm_exec_env_t exec_env, void *tid, - wasm_thread_callback_t callback, void *arg) -{ - Result res; - // Check for null pointer parameter: tid - if (tid == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: arg - if (arg == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int32_t original_result = - wasm_runtime_spawn_thread(exec_env, tid, callback, arg); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_join_thread_checked(wasm_thread_t tid, void *retval) -{ - Result res; - // Check for null pointer parameter: retval - if (retval == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - int32_t original_result = wasm_runtime_join_thread(tid, retval); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.int32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_externref_obj2ref_checked(wasm_module_inst_t module_inst, void *extern_obj, - void *p_externref_idx) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: p_externref_idx - if (p_externref_idx == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_externref_obj2ref(module_inst, extern_obj, p_externref_idx); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_objdel_checked(wasm_module_inst_t module_inst, void *extern_obj) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_externref_objdel(module_inst, extern_obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_set_cleanup_checked(wasm_module_inst_t module_inst, - void *extern_obj, void *extern_obj_cleanup) -{ - Result res; - // Check for null pointer parameter: extern_obj - if (extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: extern_obj_cleanup - if (extern_obj_cleanup == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_externref_set_cleanup(module_inst, extern_obj, extern_obj_cleanup); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_ref2obj_checked(uint32_t externref_idx, void *p_extern_obj) -{ - Result res; - // Check for null pointer parameter: p_extern_obj - if (p_extern_obj == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = wasm_externref_ref2obj(externref_idx, p_extern_obj); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_externref_retain_checked(uint32_t externref_idx) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_externref_retain(externref_idx); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_dump_call_stack_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - wasm_runtime_dump_call_stack(exec_env); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_call_stack_buf_size_checked(wasm_exec_env_t exec_env) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_get_call_stack_buf_size(exec_env); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_dump_call_stack_to_buf_checked(wasm_exec_env_t exec_env, void *buf, - uint32_t len) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = - wasm_runtime_dump_call_stack_to_buf(exec_env, buf, len); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_pgo_prof_data_size_checked(wasm_module_inst_t module_inst) -{ - Result res; - // Execute the original function - uint32_t original_result = wasm_runtime_get_pgo_prof_data_size(module_inst); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_dump_pgo_prof_data_to_buf_checked(wasm_module_inst_t module_inst, - void *buf, uint32_t len) -{ - Result res; - // Check for null pointer parameter: buf - if (buf == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - uint32_t original_result = - wasm_runtime_dump_pgo_prof_data_to_buf(module_inst, buf, len); - // Assign return value and error code - if (original_result == 0) { - res.error_code = 0; - res.value.uint32_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_get_custom_section_checked(wasm_module_t module_comm, void *name, - void *len) -{ - Result res; - // Check for null pointer parameter: name - if (name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: len - if (len == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_custom_section(module_comm, name, len); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_get_version_checked(void *major, void *minor, void *patch) -{ - Result res; - // Check for null pointer parameter: major - if (major == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: minor - if (minor == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: patch - if (patch == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_get_version(major, minor, patch); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_is_import_func_linked_checked(void *module_name, void *func_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: func_name - if (func_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_is_import_func_linked(module_name, func_name); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_is_import_global_linked_checked(void *module_name, - void *global_name) -{ - Result res; - // Check for null pointer parameter: module_name - if (module_name == NULL) { - res.error_code = -1; - return res; - } - // Check for null pointer parameter: global_name - if (global_name == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - _Bool original_result = - wasm_runtime_is_import_global_linked(module_name, global_name); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_enlarge_memory_checked(wasm_module_inst_t module_inst, - uint64_t inc_page_count) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_enlarge_memory(module_inst, inc_page_count); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_set_enlarge_mem_error_callback_checked( - enlarge_memory_error_callback_t callback, void *user_data) -{ - Result res; - // Check for null pointer parameter: user_data - if (user_data == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_set_enlarge_mem_error_callback(callback, user_data); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_create_context_key_checked(void *dtor) -{ - Result res; - // Check for null pointer parameter: dtor - if (dtor == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_create_context_key(dtor); - // Assign return value and error code - res.error_code = 0; - return res; -} - -static inline Result -wasm_runtime_destroy_context_key_checked(void *key) -{ - Result res; - // Check for null pointer parameter: key - if (key == NULL) { - res.error_code = -1; - return res; - } - // Execute the original function - wasm_runtime_destroy_context_key(key); + wasm_runtime_set_bounds_checks(module_inst, enable); // Assign return value and error code res.error_code = 0; return res; @@ -2704,27 +2342,28 @@ wasm_runtime_set_context_spread_checked(wasm_module_inst_t inst, void *key, } static inline Result -wasm_runtime_get_context_checked(wasm_module_inst_t inst, void *key) +wasm_runtime_set_custom_data_checked(wasm_module_inst_t module_inst, + void *custom_data) { Result res; - // Check for null pointer parameter: key - if (key == NULL) { + // Check for null pointer parameter: custom_data + if (custom_data == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_runtime_get_context(inst, key); + wasm_runtime_set_custom_data(module_inst, custom_data); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_default_running_mode_checked(RunningMode running_mode) { Result res; // Execute the original function - _Bool original_result = wasm_runtime_begin_blocking_op(exec_env); + _Bool original_result = wasm_runtime_set_default_running_mode(running_mode); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2732,11 +2371,80 @@ wasm_runtime_begin_blocking_op_checked(wasm_exec_env_t exec_env) } static inline Result -wasm_runtime_end_blocking_op_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_enlarge_mem_error_callback_checked( + enlarge_memory_error_callback_t callback, void *user_data) +{ + Result res; + // Check for null pointer parameter: user_data + if (user_data == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_enlarge_mem_error_callback(callback, user_data); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_exception_checked(wasm_module_inst_t module_inst, + void *exception) +{ + Result res; + // Check for null pointer parameter: exception + if (exception == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_exception(module_inst, exception); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_instruction_count_limit_checked(wasm_exec_env_t exec_env, + int instruction_count) { Result res; // Execute the original function - wasm_runtime_end_blocking_op(exec_env); + wasm_runtime_set_instruction_count_limit(exec_env, instruction_count); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_log_level_checked(log_level_t level) +{ + Result res; + // Execute the original function + wasm_runtime_set_log_level(level); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_max_thread_num_checked(uint32_t num) +{ + Result res; + // Execute the original function + wasm_runtime_set_max_thread_num(num); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_module_inst_checked(wasm_exec_env_t exec_env, + wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_set_module_inst(exec_env, module_inst); // Assign return value and error code res.error_code = 0; return res; @@ -2767,123 +2475,42 @@ wasm_runtime_set_module_name_checked(wasm_module_t module, void *name, } static inline Result -wasm_runtime_get_module_name_checked(wasm_module_t module) +wasm_runtime_set_module_reader_checked(module_reader reader, + module_destroyer destroyer) { Result res; // Execute the original function - wasm_runtime_get_module_name(module); + wasm_runtime_set_module_reader(reader, destroyer); // Assign return value and error code res.error_code = 0; return res; } static inline Result -wasm_runtime_detect_native_stack_overflow_checked(wasm_exec_env_t exec_env) +wasm_runtime_set_native_stack_boundary_checked(wasm_exec_env_t exec_env, + void *native_stack_boundary) { Result res; - // Execute the original function - _Bool original_result = wasm_runtime_detect_native_stack_overflow(exec_env); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_detect_native_stack_overflow_size_checked(wasm_exec_env_t exec_env, - uint32_t required_size) -{ - Result res; - // Execute the original function - _Bool original_result = - wasm_runtime_detect_native_stack_overflow_size(exec_env, required_size); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_is_underlying_binary_freeable_checked(wasm_module_t module) -{ - Result res; - // Execute the original function - _Bool original_result = wasm_runtime_is_underlying_binary_freeable(module); - // Assign return value and error code - res.error_code = original_result ? 0 : -2; - res.value._Bool_value = original_result; - return res; -} - -static inline Result -wasm_runtime_create_shared_heap_checked(void *init_args) -{ - Result res; - // Check for null pointer parameter: init_args - if (init_args == NULL) { + // Check for null pointer parameter: native_stack_boundary + if (native_stack_boundary == NULL) { res.error_code = -1; return res; } // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_create_shared_heap(init_args); + wasm_runtime_set_native_stack_boundary(exec_env, native_stack_boundary); // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } + res.error_code = 0; return res; } static inline Result -wasm_runtime_chain_shared_heaps_checked(wasm_shared_heap_t head, - wasm_shared_heap_t body) -{ - Result res; - // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_chain_shared_heaps(head, body); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_unchain_shared_heaps_checked(wasm_shared_heap_t head, - _Bool entire_chain) -{ - Result res; - // Execute the original function - wasm_shared_heap_t original_result = - wasm_runtime_unchain_shared_heaps(head, entire_chain); - // Assign return value and error code - if (original_result != NULL) { - res.error_code = 0; - res.value.wasm_shared_heap_t_value = original_result; - } - else { - res.error_code = -2; - } - return res; -} - -static inline Result -wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, - wasm_shared_heap_t shared_heap) +wasm_runtime_set_running_mode_checked(wasm_module_inst_t module_inst, + RunningMode running_mode) { Result res; // Execute the original function _Bool original_result = - wasm_runtime_attach_shared_heap(module_inst, shared_heap); + wasm_runtime_set_running_mode(module_inst, running_mode); // Assign return value and error code res.error_code = original_result ? 0 : -2; res.value._Bool_value = original_result; @@ -2891,11 +2518,87 @@ wasm_runtime_attach_shared_heap_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_detach_shared_heap_checked(wasm_module_inst_t module_inst) +wasm_runtime_set_user_data_checked(wasm_exec_env_t exec_env, void *user_data) +{ + Result res; + // Check for null pointer parameter: user_data + if (user_data == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_runtime_set_user_data(exec_env, user_data); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_addr_pool_checked(wasm_module_t module, void *addr_pool, + uint32_t addr_pool_size) { Result res; // Execute the original function - wasm_runtime_detach_shared_heap(module_inst); + wasm_runtime_set_wasi_addr_pool(module, addr_pool, addr_pool_size); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_args_checked(wasm_module_t module, void *dir_list, + uint32_t dir_count, void *map_dir_list, + uint32_t map_dir_count, void *env, + uint32_t env_count, void *argv, int argc) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_args(module, dir_list, dir_count, map_dir_list, + map_dir_count, env, env_count, argv, argc); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_args_ex_checked(wasm_module_t module, void *dir_list, + uint32_t dir_count, void *map_dir_list, + uint32_t map_dir_count, void *env, + uint32_t env_count, void *argv, int argc, + int64_t stdinfd, int64_t stdoutfd, + int64_t stderrfd) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_args_ex(module, dir_list, dir_count, map_dir_list, + map_dir_count, env, env_count, argv, argc, + stdinfd, stdoutfd, stderrfd); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_set_wasi_ns_lookup_pool_checked(wasm_module_t module, + void *ns_lookup_pool, + uint32_t ns_lookup_pool_size) +{ + Result res; + // Execute the original function + wasm_runtime_set_wasi_ns_lookup_pool(module, ns_lookup_pool, + ns_lookup_pool_size); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_shared_heap_free_checked(wasm_module_inst_t module_inst, + uint64_t ptr) +{ + Result res; + // Execute the original function + wasm_runtime_shared_heap_free(module_inst, ptr); // Assign return value and error code res.error_code = 0; return res; @@ -2926,15 +2629,312 @@ wasm_runtime_shared_heap_malloc_checked(wasm_module_inst_t module_inst, } static inline Result -wasm_runtime_shared_heap_free_checked(wasm_module_inst_t module_inst, - uint64_t ptr) +wasm_runtime_spawn_exec_env_checked(wasm_exec_env_t exec_env) { Result res; // Execute the original function - wasm_runtime_shared_heap_free(module_inst, ptr); + wasm_exec_env_t original_result = wasm_runtime_spawn_exec_env(exec_env); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_exec_env_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_spawn_thread_checked(wasm_exec_env_t exec_env, void *tid, + wasm_thread_callback_t callback, void *arg) +{ + Result res; + // Check for null pointer parameter: tid + if (tid == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: arg + if (arg == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + int32_t original_result = + wasm_runtime_spawn_thread(exec_env, tid, callback, arg); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.int32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_start_debug_instance_checked(wasm_exec_env_t exec_env) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_runtime_start_debug_instance(exec_env); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_start_debug_instance_with_port_checked(wasm_exec_env_t exec_env, + int32_t port) +{ + Result res; + // Execute the original function + uint32_t original_result = + wasm_runtime_start_debug_instance_with_port(exec_env, port); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_sum_wasm_exec_time_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + double original_result = wasm_runtime_sum_wasm_exec_time(module_inst); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.double_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_terminate_checked(wasm_module_inst_t module_inst) +{ + Result res; + // Execute the original function + wasm_runtime_terminate(module_inst); // Assign return value and error code res.error_code = 0; return res; } +static inline Result +wasm_runtime_thread_env_inited_checked(void) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_runtime_thread_env_inited(); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_unchain_shared_heaps_checked(wasm_shared_heap_t head, + _Bool entire_chain) +{ + Result res; + // Execute the original function + wasm_shared_heap_t original_result = + wasm_runtime_unchain_shared_heaps(head, entire_chain); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_shared_heap_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_runtime_unload_checked(wasm_module_t module) +{ + Result res; + // Execute the original function + wasm_runtime_unload(module); + // Assign return value and error code + res.error_code = 0; + return res; +} + +static inline Result +wasm_runtime_unregister_natives_checked(void *module_name, void *native_symbols) +{ + Result res; + // Check for null pointer parameter: module_name + if (module_name == NULL) { + res.error_code = -1; + return res; + } + // Check for null pointer parameter: native_symbols + if (native_symbols == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_unregister_natives(module_name, native_symbols); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_app_addr_checked(wasm_module_inst_t module_inst, + uint64_t app_offset, uint64_t size) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_validate_app_addr(module_inst, app_offset, size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_app_str_addr_checked(wasm_module_inst_t module_inst, + uint64_t app_str_offset) +{ + Result res; + // Execute the original function + _Bool original_result = + wasm_runtime_validate_app_str_addr(module_inst, app_str_offset); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_runtime_validate_native_addr_checked(wasm_module_inst_t module_inst, + void *native_ptr, uint64_t size) +{ + Result res; + // Check for null pointer parameter: native_ptr + if (native_ptr == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + _Bool original_result = + wasm_runtime_validate_native_addr(module_inst, native_ptr, size); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + +static inline Result +wasm_table_get_func_inst_checked(wasm_module_inst_t module_inst, + void *table_inst, uint32_t idx) +{ + Result res; + // Check for null pointer parameter: table_inst + if (table_inst == NULL) { + res.error_code = -1; + return res; + } + // Execute the original function + wasm_function_inst_t original_result = + wasm_table_get_func_inst(module_inst, table_inst, idx); + // Assign return value and error code + if (original_result != NULL) { + res.error_code = 0; + res.value.wasm_function_inst_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_get_elem_kind_checked(wasm_table_type_t table_type) +{ + Result res; + // Execute the original function + wasm_valkind_t original_result = wasm_table_type_get_elem_kind(table_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.wasm_valkind_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_get_init_size_checked(wasm_table_type_t table_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_table_type_get_init_size(table_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_get_max_size_checked(wasm_table_type_t table_type) +{ + Result res; + // Execute the original function + uint32_t original_result = wasm_table_type_get_max_size(table_type); + // Assign return value and error code + if (original_result == 0) { + res.error_code = 0; + res.value.uint32_t_value = original_result; + } + else { + res.error_code = -2; + } + return res; +} + +static inline Result +wasm_table_type_get_shared_checked(wasm_table_type_t table_type) +{ + Result res; + // Execute the original function + _Bool original_result = wasm_table_type_get_shared(table_type); + // Assign return value and error code + res.error_code = original_result ? 0 : -2; + res.value._Bool_value = original_result; + return res; +} + #endif // WASM_EXPORT_CHECKED_H