-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do aot bounds check by calling native #1
base: main
Are you sure you want to change the base?
Conversation
core/iwasm/aot/aot_runtime.c
Outdated
@@ -2728,7 +2728,20 @@ aot_module_realloc_internal(AOTModuleInstance *module_inst, | |||
*p_native_addr = addr; | |||
return (uint64)(addr - memory_inst->memory_data); | |||
} | |||
uintptr_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint64
core/iwasm/aot/aot_runtime.c
Outdated
return memory->memory_data + offset; | ||
} | ||
// execption | ||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return NULL as error
core/iwasm/aot/aot_runtime.h
Outdated
@@ -520,7 +520,9 @@ aot_lookup_function(const AOTModuleInstance *module_inst, const char *name); | |||
*/ | |||
AOTFunctionInstance * | |||
aot_get_function_instance(AOTModuleInstance *module_inst, uint32_t func_idx); | |||
|
|||
uintptr_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
} | ||
|
||
#if WASM_ENABLE_AOT_NATIVE_BOUNDS_CHECK == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
@@ -257,6 +257,33 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
&& !(is_local_of_aot_value | |||
&& aot_checked_addr_list_find(func_ctx, local_idx_of_aot_value, | |||
offset, bytes))) { | |||
#if WASM_ENABLE_AOT_NATIVE_BOUNDS_CHECK != 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new param to wamrc to control this behavior
c2b3a21
to
1da0f59
Compare
Signed-off-by: wenlingyun1 <wenlingyun1@xiaomi.com>
7cd8b1a
to
80e711b
Compare
{ | ||
LLVMValueRef param_values[3], value, maddr, func; | ||
LLVMTypeRef param_types[3], ret_type = 0, func_type = 0, func_ptr_type = 0; | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this line
@@ -337,6 +431,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, | |||
goto fail; | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
LLVMBasicBlockRef incoming_blocks[] = { runtime_bounds_check, check_succ }; | ||
LLVMAddIncoming(phi, incoming_values, incoming_blocks, 2); | ||
|
||
return phi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use phi here? How about let aot_bounds_check return offset1 below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need to check whether the offset is out of bound during runtime, a phi node is needed to select the offset dynamically
Signed-off-by: wenlingyun1 <wenlingyun1@xiaomi.com>
No description provided.