Fix several AOT compiler issues (#2697)

- Fix potential invalid push param phis and add incoming phis to a un-existed basic block
- Fix potential invalid shift count int rotl/rotr opcodes
- Resize memory_data_size to UINT32_MAX if it is 4G when hw bound check is enabled
- Fix negative linear memory offset is used for 64-bit target it is const and larger than INT32_MAX
This commit is contained in:
Wenyong Huang
2023-11-02 20:36:21 +08:00
committed by GitHub
parent 0b2313f6f8
commit 68a627ea2c
5 changed files with 37 additions and 6 deletions

View File

@ -344,7 +344,9 @@ push_aot_block_to_stack_and_pass_params(AOTCompContext *comp_ctx,
for (i = 0; i < block->param_count; i++) {
param_index = block->param_count - 1 - i;
POP(value, block->param_types[param_index]);
ADD_TO_PARAM_PHIS(block, value, param_index);
if (block->llvm_entry_block)
/* Only add incoming phis if the entry block was created */
ADD_TO_PARAM_PHIS(block, value, param_index);
if (block->label_type == LABEL_TYPE_IF
&& !block->skip_wasm_code_else) {
if (block->llvm_else_block) {
@ -366,7 +368,17 @@ push_aot_block_to_stack_and_pass_params(AOTCompContext *comp_ctx,
/* Push param phis to the new block */
for (i = 0; i < block->param_count; i++) {
PUSH(block->param_phis[i], block->param_types[i]);
if (block->llvm_entry_block)
/* Push param phis if the entry basic block was created */
PUSH(block->param_phis[i], block->param_types[i]);
else {
bh_assert(block->label_type == LABEL_TYPE_IF
&& block->llvm_else_block && block->else_param_phis
&& !block->skip_wasm_code_else);
/* Push else param phis if we start to translate the
else branch */
PUSH(block->else_param_phis[i], block->param_types[i]);
}
}
return true;