Import reference-types feature (#612)
Implement spec reference-types proposal for interpreter, AOT and JIT, update documents and add sample. And upgrade AOT_CURRENT_VERSION to 3 as AOT file format and AOT module instance layout are changed. Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
@ -307,7 +307,8 @@ bh_hash_map_get_elem_struct_size()
|
||||
}
|
||||
|
||||
bool
|
||||
bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback)
|
||||
bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback,
|
||||
void *user_data)
|
||||
{
|
||||
uint32 index;
|
||||
HashMapElem *elem, *next;
|
||||
@ -325,7 +326,7 @@ bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback)
|
||||
elem = map->elements[index];
|
||||
while (elem) {
|
||||
next = elem->next;
|
||||
callback(elem->key, elem->value);
|
||||
callback(elem->key, elem->value, user_data);
|
||||
elem = next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ typedef void (*ValueDestroyFunc)(void *key);
|
||||
|
||||
/* traverse callback function:
|
||||
auto called when traverse every hash element */
|
||||
typedef void (*TraverseCallbackFunc)(void *key, void *value);
|
||||
typedef void (*TraverseCallbackFunc)(void *key, void *value, void *user_data);
|
||||
|
||||
/**
|
||||
* Create a hash map.
|
||||
@ -150,14 +150,16 @@ bh_hash_map_get_elem_struct_size();
|
||||
* Traverse the hash map and call the callback function
|
||||
*
|
||||
* @param map the hash map to traverse
|
||||
* @callback the function to be called for every element
|
||||
* @param callback the function to be called for every element
|
||||
* @param user_data the argument to be passed to the callback function
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
* Note: if the hash map has lock, the map will be locked during traverse,
|
||||
* keep the callback function as simple as possible.
|
||||
*/
|
||||
bool
|
||||
bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback);
|
||||
bh_hash_map_traverse(HashMap *map, TraverseCallbackFunc callback,
|
||||
void *user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user