mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
Allow to set segue flags for wasm-c-api JIT (#2926)
Add an API to set segue flags for wasm-c-api LLVM JIT mode: ```C wasm_config_t * wasm_config_set_segue_flags(wasm_config_t *config, uint32 segue_flags); ```
This commit is contained in:
parent
aa4d68c2af
commit
c43e4505da
|
@ -299,6 +299,7 @@ wasm_config_new(void)
|
||||||
|
|
||||||
memset(config, 0, sizeof(wasm_config_t));
|
memset(config, 0, sizeof(wasm_config_t));
|
||||||
config->mem_alloc_type = Alloc_With_System_Allocator;
|
config->mem_alloc_type = Alloc_With_System_Allocator;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +335,16 @@ wasm_config_set_linux_perf_opt(wasm_config_t *config, bool enable)
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wasm_config_t *
|
||||||
|
wasm_config_set_segue_flags(wasm_config_t *config, uint32 segue_flags)
|
||||||
|
{
|
||||||
|
if (!config)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
config->segue_flags = segue_flags;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wasm_engine_delete_internal(wasm_engine_t *engine)
|
wasm_engine_delete_internal(wasm_engine_t *engine)
|
||||||
{
|
{
|
||||||
|
@ -380,8 +391,8 @@ wasm_engine_new_internal(wasm_config_t *config)
|
||||||
init_args.mem_alloc_type = config->mem_alloc_type;
|
init_args.mem_alloc_type = config->mem_alloc_type;
|
||||||
memcpy(&init_args.mem_alloc_option, &config->mem_alloc_option,
|
memcpy(&init_args.mem_alloc_option, &config->mem_alloc_option,
|
||||||
sizeof(MemAllocOption));
|
sizeof(MemAllocOption));
|
||||||
|
|
||||||
init_args.enable_linux_perf = config->enable_linux_perf;
|
init_args.enable_linux_perf = config->enable_linux_perf;
|
||||||
|
init_args.segue_flags = config->segue_flags;
|
||||||
|
|
||||||
if (!wasm_runtime_full_init(&init_args)) {
|
if (!wasm_runtime_full_init(&init_args)) {
|
||||||
LOG_DEBUG("wasm_runtime_full_init failed");
|
LOG_DEBUG("wasm_runtime_full_init failed");
|
||||||
|
|
|
@ -438,7 +438,7 @@ typedef struct wasm_frame_t {
|
||||||
const char *func_name_wp;
|
const char *func_name_wp;
|
||||||
} WASMCApiFrame;
|
} WASMCApiFrame;
|
||||||
|
|
||||||
#ifdef WASM_ENABLE_JIT
|
#if WASM_ENABLE_JIT != 0
|
||||||
typedef struct LLVMJITOptions {
|
typedef struct LLVMJITOptions {
|
||||||
uint32 opt_level;
|
uint32 opt_level;
|
||||||
uint32 size_level;
|
uint32 size_level;
|
||||||
|
|
|
@ -181,6 +181,7 @@ typedef union MemAllocOption {
|
||||||
struct wasm_config_t {
|
struct wasm_config_t {
|
||||||
mem_alloc_type_t mem_alloc_type;
|
mem_alloc_type_t mem_alloc_type;
|
||||||
MemAllocOption mem_alloc_option;
|
MemAllocOption mem_alloc_option;
|
||||||
|
uint32_t segue_flags;
|
||||||
bool enable_linux_perf;
|
bool enable_linux_perf;
|
||||||
/*TODO: wasi args*/
|
/*TODO: wasi args*/
|
||||||
};
|
};
|
||||||
|
@ -200,6 +201,17 @@ wasm_config_set_mem_alloc_opt(wasm_config_t *, mem_alloc_type_t, MemAllocOption
|
||||||
WASM_API_EXTERN own wasm_config_t*
|
WASM_API_EXTERN own wasm_config_t*
|
||||||
wasm_config_set_linux_perf_opt(wasm_config_t *, bool);
|
wasm_config_set_linux_perf_opt(wasm_config_t *, bool);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable using GS register as the base address of linear memory in linux x86_64,
|
||||||
|
* which may speedup the linear memory access for LLVM AOT/JIT:
|
||||||
|
* bit0 to bit4 denotes i32.load, i64.load, f32.load, f64.load, v128.load
|
||||||
|
* bit8 to bit12 denotes i32.store, i64.store, f32.store, f64.store, v128.store
|
||||||
|
* For example, 0x01 enables i32.load, 0x0100 enables i32.store.
|
||||||
|
* To enable all load/store operations, use 0x1F1F
|
||||||
|
*/
|
||||||
|
WASM_API_EXTERN wasm_config_t*
|
||||||
|
wasm_config_set_segue_flags(wasm_config_t *config, uint32_t segue_flags);
|
||||||
|
|
||||||
// Engine
|
// Engine
|
||||||
|
|
||||||
WASM_DECLARE_OWN(engine)
|
WASM_DECLARE_OWN(engine)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user