mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 06:55:07 +00:00
GC: Add wasm_struct_obj_get_field_count API (#3236)
This commit is contained in:
parent
7486056aee
commit
b11a1d157d
|
@ -189,6 +189,16 @@ wasm_struct_obj_get_field(const WASMStructObjectRef struct_obj,
|
|||
}
|
||||
}
|
||||
|
||||
uint32
|
||||
wasm_struct_obj_get_field_count(const WASMStructObjectRef struct_obj)
|
||||
{
|
||||
WASMRttTypeRef rtt_type =
|
||||
(WASMRttTypeRef)wasm_object_header((WASMObjectRef)struct_obj);
|
||||
WASMStructType *struct_type = (WASMStructType *)rtt_type->defined_type;
|
||||
|
||||
return struct_type->field_count;
|
||||
}
|
||||
|
||||
WASMArrayObjectRef
|
||||
wasm_array_obj_new_internal(void *heap_handle, WASMRttTypeRef rtt_type,
|
||||
uint32 length, WASMValue *init_value)
|
||||
|
|
|
@ -157,6 +157,16 @@ void
|
|||
wasm_struct_obj_get_field(const WASMStructObjectRef struct_obj,
|
||||
uint32 field_idx, bool sign_extend, WASMValue *value);
|
||||
|
||||
/**
|
||||
* Return the field count of the WASM struct object.
|
||||
*
|
||||
* @param struct_obj the WASM struct object
|
||||
*
|
||||
* @return the field count of the WASM struct object
|
||||
*/
|
||||
uint32
|
||||
wasm_struct_obj_get_field_count(const WASMStructObjectRef struct_obj);
|
||||
|
||||
WASMArrayObjectRef
|
||||
wasm_array_obj_new_internal(void *heap_handle, WASMRttTypeRef rtt_type,
|
||||
uint32 length, WASMValue *init_value);
|
||||
|
|
|
@ -437,6 +437,16 @@ WASM_RUNTIME_API_EXTERN void
|
|||
wasm_struct_obj_get_field(const wasm_struct_obj_t obj, uint32_t field_idx,
|
||||
bool sign_extend, wasm_value_t *value);
|
||||
|
||||
/**
|
||||
* Get the field count of the a struct object.
|
||||
*
|
||||
* @param obj the WASM struct object
|
||||
*
|
||||
* @return the field count of the a struct object
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint32_t
|
||||
wasm_struct_obj_get_field_count(const wasm_struct_obj_t obj);
|
||||
|
||||
/**
|
||||
* Create an array object with the index of defined type, the obj's length is
|
||||
* length, init value is init_value
|
||||
|
|
Loading…
Reference in New Issue
Block a user