| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- /*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
- #include "../wasm_runtime_common.h"
- #if WASM_ENABLE_INTERP != 0
- #include "../interpreter/wasm_runtime.h"
- #endif
- #if WASM_ENABLE_AOT != 0
- #include "../aot/aot_runtime.h"
- #endif
- uint32
- wasm_get_defined_type_count(WASMModuleCommon *const module)
- {
- /* TODO */
- return 0;
- }
- WASMType *
- wasm_get_defined_type(WASMModuleCommon *const module, uint32 index)
- {
- /* TODO */
- return NULL;
- }
- bool
- wasm_defined_type_is_func_type(WASMType *const def_type)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_defined_type_is_struct_type(WASMType *const def_type)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_defined_type_is_array_type(WASMType *const def_type)
- {
- /* TODO */
- return false;
- }
- uint32
- wasm_func_type_get_param_count(WASMFuncType *const func_type)
- {
- /* TODO */
- return 0;
- }
- wasm_ref_type_t
- wasm_func_type_get_param_type(WASMFuncType *const func_type, uint32 param_idx)
- {
- wasm_ref_type_t ref_type = { 0 };
- /* TODO */
- return ref_type;
- }
- uint32
- wasm_func_type_get_result_count(WASMFuncType *const func_type)
- {
- /* TODO */
- return 0;
- }
- wasm_ref_type_t
- wasm_func_type_get_result_type(WASMFuncType *const func_type, uint32 param_idx)
- {
- wasm_ref_type_t ref_type = { 0 };
- /* TODO */
- return ref_type;
- }
- uint32
- wasm_struct_type_get_field_count(WASMStructType *const struct_type)
- {
- /* TODO */
- return 0;
- }
- wasm_ref_type_t
- wasm_struct_type_get_field_type(WASMStructType *const struct_type,
- uint32 field_idx, bool *p_is_mutable)
- {
- wasm_ref_type_t ref_type = { 0 };
- /* TODO */
- return ref_type;
- }
- wasm_ref_type_t
- wasm_array_type_get_elem_type(WASMArrayType *const array_type,
- bool *p_is_mutable)
- {
- wasm_ref_type_t ref_type = { 0 };
- /* TODO */
- return ref_type;
- }
- bool
- wasm_defined_type_equal(WASMType *const def_type1, WASMType *const def_type2,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_defined_type_is_subtype_of(WASMType *const def_type1,
- WASMType *const def_type2,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- void
- wasm_ref_type_set_type_idx(wasm_ref_type_t *ref_type, bool nullable,
- int32 type_idx)
- {
- /* TODO */
- }
- void
- wasm_ref_type_set_heap_type(wasm_ref_type_t *ref_type, bool nullable,
- int32 heap_type)
- {
- /* TODO */
- }
- bool
- wasm_ref_type_equal(const wasm_ref_type_t *ref_type1,
- const wasm_ref_type_t *ref_type2,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_ref_type_is_subtype_of(const wasm_ref_type_t *ref_type1,
- const wasm_ref_type_t *ref_type2,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- WASMStructObjectRef
- wasm_struct_obj_new_with_typeidx(WASMExecEnv *exec_env, uint32 type_idx)
- {
- /* TODO */
- return NULL;
- }
- WASMStructObjectRef
- wasm_struct_obj_new_with_type(WASMExecEnv *exec_env, WASMStructType *type)
- {
- /* TODO */
- return NULL;
- }
- WASMArrayObjectRef
- wasm_array_obj_new_with_typeidx(WASMExecEnv *exec_env, uint32 type_idx)
- {
- /* TODO */
- return NULL;
- }
- WASMArrayObjectRef
- wasm_array_obj_new_with_type(WASMExecEnv *exec_env, WASMArrayType *type)
- {
- /* TODO */
- return NULL;
- }
- WASMFuncObjectRef
- wasm_func_obj_new_with_typeidx(WASMExecEnv *exec_env, uint32 type_idx)
- {
- /* TODO */
- return NULL;
- }
- WASMFuncObjectRef
- wasm_func_obj_new_with_type(WASMExecEnv *exec_env, WASMFuncType *type)
- {
- /* TODO */
- return NULL;
- }
- bool
- wasm_obj_is_instance_of_defined_type(WASMObjectRef obj, WASMType *defined_type,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_obj_is_instance_of_type_idx(WASMObjectRef obj, uint32 type_idx,
- WASMModuleCommon *const module)
- {
- /* TODO */
- return false;
- }
- bool
- wasm_obj_is_instance_of_ref_type(const WASMObjectRef obj,
- const wasm_ref_type_t *ref_type)
- {
- /* TODO */
- return false;
- }
- void
- wasm_runtime_push_local_object_ref(WASMExecEnv *exec_env,
- WASMLocalObjectRef *ref)
- {
- ref->val = NULL;
- ref->prev = exec_env->cur_local_object_ref;
- exec_env->cur_local_object_ref = ref;
- }
- WASMLocalObjectRef *
- wasm_runtime_pop_local_object_ref(WASMExecEnv *exec_env)
- {
- WASMLocalObjectRef *local_ref = exec_env->cur_local_object_ref;
- exec_env->cur_local_object_ref = exec_env->cur_local_object_ref->prev;
- return local_ref;
- }
- void
- wasm_runtime_pop_local_object_refs(WASMExecEnv *exec_env, uint32 n)
- {
- bh_assert(n > 0);
- do {
- exec_env->cur_local_object_ref = exec_env->cur_local_object_ref->prev;
- } while (--n > 0);
- }
- void
- wasm_runtime_gc_prepare(WASMExecEnv *exec_env)
- {
- #if 0
- /* TODO: implement wasm_runtime_gc_prepare for multi-thread */
- exec_env->is_gc_reclaiming = false;
- wasm_thread_suspend_all();
- exec_env->is_gc_reclaim = 1;
- exec_env->requesting_suspend = 0;
- #endif
- }
- void
- wasm_runtime_gc_finalize(WASMExecEnv *exec_env)
- {
- #if 0
- /* TODO: implement wasm_runtime_gc_finalize for multi-thread */
- wasm_thread_resume_all();
- exec_env->doing_gc_reclaim = 0;
- #endif
- }
- bool
- wasm_runtime_get_wasm_object_ref_list(WASMObjectRef obj,
- bool *p_is_compact_mode,
- uint32 *p_ref_num, uint16 **p_ref_list,
- uint32 *p_ref_start_offset)
- {
- return wasm_object_get_ref_list(obj, p_is_compact_mode, p_ref_num,
- p_ref_list, p_ref_start_offset);
- }
- bool
- wasm_runtime_traverse_gc_rootset(WASMExecEnv *exec_env, void *heap)
- {
- #if WASM_ENABLE_INTERP != 0
- if (exec_env->module_inst->module_type == Wasm_Module_Bytecode) {
- return wasm_traverse_gc_rootset(exec_env, heap);
- }
- #endif
- #if WASM_ENABLE_AOT != 0
- if (exec_env->module_inst->module_type == Wasm_Module_AoT) {
- /* TODO */
- /*return aot_traverse_gc_rootset(exec_env, heap);*/
- }
- #endif
- return false;
- }
- void
- wasm_runtime_set_gc_heap_handle(WASMModuleInstanceCommon *module_inst,
- void *gc_heap_handle)
- {
- #if WASM_ENABLE_INTERP != 0
- if (module_inst->module_type == Wasm_Module_Bytecode)
- ((WASMModuleInstance *)module_inst)->e->gc_heap_handle = gc_heap_handle;
- #endif
- #if WASM_ENABLE_AOT != 0
- if (module_inst->module_type == Wasm_Module_AoT) {
- /* TODO */
- /*
- ((AOTModuleInstance *)module_inst)->e->gc_heap_handle.ptr =
- gc_heap_handle;
- */
- }
- #endif
- }
- void *
- wasm_runtime_get_gc_heap_handle(WASMModuleInstanceCommon *module_inst)
- {
- #if WASM_ENABLE_INTERP != 0
- if (module_inst->module_type == Wasm_Module_Bytecode)
- return ((WASMModuleInstance *)module_inst)->e->gc_heap_handle;
- #endif
- #if WASM_ENABLE_AOT != 0
- if (module_inst->module_type == Wasm_Module_AoT) {
- /* TODO */
- /*
- return ((AOTModuleInstance *)module_inst)->e->gc_heap_handle.ptr;
- */
- }
- #endif
- return NULL;
- }
|