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:
Wenyong Huang
2021-04-15 11:29:20 +08:00
committed by GitHub
parent 7706e4b151
commit 03d45f1d62
48 changed files with 5557 additions and 856 deletions

View File

@ -71,6 +71,7 @@ typedef struct AOTImportTable {
uint32 table_flags;
uint32 table_init_size;
uint32 table_max_size;
bool possible_grow;
} AOTImportTable;
/**
@ -81,12 +82,19 @@ typedef struct AOTTable {
uint32 table_flags;
uint32 table_init_size;
uint32 table_max_size;
bool possible_grow;
} AOTTable;
/**
* A segment of table init data
*/
typedef struct AOTTableInitData {
/* 0 to 7 */
uint32 mode;
/* funcref or externref, elemkind will be considered as funcref */
uint32 elem_type;
bool is_dropped;
/* optional, only for active */
uint32 table_index;
/* Start address of init data */
AOTInitExpr offset;
@ -245,6 +253,18 @@ aot_set_last_error_v(const char *format, ...);
} while (0)
#endif
static inline uint32
aot_get_tbl_data_slots(const AOTTable *tbl)
{
return tbl->possible_grow ? tbl->table_max_size : tbl->table_init_size;
}
static inline uint32
aot_get_imp_tbl_data_slots(const AOTImportTable *tbl)
{
return tbl->possible_grow ? tbl->table_max_size : tbl->table_init_size;
}
#ifdef __cplusplus
} /* end of extern "C" */
#endif