Refactor externref related APIs of reference types feature (#971)
Currently when calling wasm_runtime_call_wasm() to invoke wasm function with externref type argument from runtime embedder, developer needs to use wasm_externref_obj2ref() to convert externref obj into an internal ref index firstly, which is not convenient to developer. To align with GC feature in which all the references passed to wasm_runtime_call_wasm() can be object pointers directly, we change the interface of wasm_runtime_call_wasm() to allow to pass object pointer directly for the externref argument, and refactor the related codes, update the related samples and the document.
This commit is contained in:
@ -544,6 +544,19 @@ wasm_get_cell_num(const uint8 *types, uint32 type_count)
|
||||
return cell_num;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_REF_TYPES != 0
|
||||
inline static uint16
|
||||
wasm_value_type_cell_num_outside(uint8 value_type)
|
||||
{
|
||||
if (VALUE_TYPE_EXTERNREF == value_type) {
|
||||
return sizeof(uintptr_t) / sizeof(uint32);
|
||||
}
|
||||
else {
|
||||
return wasm_value_type_cell_num(value_type);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
inline static bool
|
||||
wasm_type_equal(const WASMType *type1, const WASMType *type2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user