Skip to content

do aot bounds check by calling native#1

Open
WenLY1 wants to merge 2 commits intomainfrom
dev4
Open

do aot bounds check by calling native#1
WenLY1 wants to merge 2 commits intomainfrom
dev4

Conversation

@WenLY1
Copy link
Owner

@WenLY1 WenLY1 commented Jun 26, 2024

No description provided.

*p_native_addr = addr;
return (uint64)(addr - memory_inst->memory_data);
}
uintptr_t
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint64

return memory->memory_data + offset;
}
// execption
return 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NULL as error

AOTFunctionInstance *
aot_get_function_instance(AOTModuleInstance *module_inst, uint32_t func_idx);

uintptr_t
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

#endif
}

#if WASM_ENABLE_AOT_NATIVE_BOUNDS_CHECK == 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

&& !(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
Copy link

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

@WenLY1 WenLY1 force-pushed the dev4 branch 3 times, most recently from c2b3a21 to 1da0f59 Compare June 26, 2024 11:01
Signed-off-by: wenlingyun1 <wenlingyun1@xiaomi.com>
@WenLY1 WenLY1 force-pushed the dev4 branch 2 times, most recently from 7cd8b1a to 80e711b Compare July 10, 2024 07:03
{
LLVMValueRef param_values[3], value, maddr, func;
LLVMTypeRef param_types[3], ret_type = 0, func_type = 0, func_ptr_type = 0;
;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

return maddr;
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this line

goto fail;
}
}

Copy link

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;
Copy link

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?

Copy link
Owner Author

@WenLY1 WenLY1 Jul 11, 2024

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants