Add wamrc parameter to configure stack frame features (#3763)
Those parameters can be used to reduce the size of the AOT code. There's going to be more changes related to AOT code size reduction, this is just the initial step. p.s. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3758
This commit is contained in:
@ -682,24 +682,29 @@ alloc_frame_for_aot_func(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
|
||||
new_frame = wasm_stack_top;
|
||||
|
||||
if (!(check_wasm_stack_succ = LLVMAppendBasicBlockInContext(
|
||||
comp_ctx->context, func_ctx->func, "check_wasm_stack_succ"))) {
|
||||
aot_set_last_error("llvm add basic block failed.");
|
||||
return false;
|
||||
}
|
||||
if (comp_ctx->call_stack_features.bounds_checks) {
|
||||
if (!(check_wasm_stack_succ = LLVMAppendBasicBlockInContext(
|
||||
comp_ctx->context, func_ctx->func,
|
||||
"check_wasm_stack_succ"))) {
|
||||
aot_set_last_error("llvm add basic block failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
LLVMMoveBasicBlockAfter(check_wasm_stack_succ,
|
||||
LLVMGetInsertBlock(comp_ctx->builder));
|
||||
LLVMMoveBasicBlockAfter(check_wasm_stack_succ,
|
||||
LLVMGetInsertBlock(comp_ctx->builder));
|
||||
|
||||
if (!(cmp = LLVMBuildICmp(comp_ctx->builder, LLVMIntUGT, wasm_stack_top_max,
|
||||
wasm_stack_top_bound, "cmp"))) {
|
||||
aot_set_last_error("llvm build icmp failed");
|
||||
return false;
|
||||
}
|
||||
if (!(cmp = LLVMBuildICmp(comp_ctx->builder, LLVMIntUGT,
|
||||
wasm_stack_top_max, wasm_stack_top_bound,
|
||||
"cmp"))) {
|
||||
aot_set_last_error("llvm build icmp failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(aot_emit_exception(comp_ctx, func_ctx, EXCE_OPERAND_STACK_OVERFLOW,
|
||||
true, cmp, check_wasm_stack_succ))) {
|
||||
return false;
|
||||
if (!(aot_emit_exception(comp_ctx, func_ctx,
|
||||
EXCE_OPERAND_STACK_OVERFLOW, true, cmp,
|
||||
check_wasm_stack_succ))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_GC != 0
|
||||
@ -1285,6 +1290,10 @@ commit_params_to_frame_of_import_func(AOTCompContext *comp_ctx,
|
||||
{
|
||||
uint32 i, n;
|
||||
|
||||
if (!comp_ctx->call_stack_features.values) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0, n = 0; i < func_type->param_count; i++, n++) {
|
||||
switch (func_type->types[i]) {
|
||||
case VALUE_TYPE_I32:
|
||||
|
||||
Reference in New Issue
Block a user