Add interpreter commands to get at interpreter specific data.

Signed-off-by: Mic Bowman <mic.bowman@intel.com>
This commit is contained in:
Mic Bowman 2019-10-01 16:57:54 -07:00
parent 526c52eebf
commit 237c08e0d9
2 changed files with 27 additions and 1 deletions

View File

@ -254,6 +254,19 @@ wasm_runtime_get_exception(wasm_module_inst_t module_inst);
void
wasm_runtime_clear_exception(wasm_module_inst_t module_inst);
/**
* Save data with the module instance
*/
bool
wasm_runtime_set_instance_data(wasm_module_inst_t module_inst,
void *thread_data);
/**
* Retrieve saved instance data
*/
void*
wasm_runtime_get_instance_data(wasm_module_inst_t module_inst);
/**
* Attach the current native thread to a WASM module instance.
* A native thread cannot be attached simultaneously to two WASM module

View File

@ -1133,6 +1133,20 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *env)
}
}
bool
wasm_runtime_set_instance_data(WASMModuleInstance *module_inst,
void *thread_data)
{
module_inst->thread_data = thread_data;
return true;
}
void*
wasm_runtime_get_instance_data(WASMModuleInstance *module_inst)
{
return module_inst->thread_data;
}
bool
wasm_runtime_attach_current_thread(WASMModuleInstance *module_inst,
void *thread_data)
@ -1674,4 +1688,3 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
}
#endif /* end of !defined(__x86_64__) && !defined(__amd_64__) */