Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2012: Refactor singlepass init stack assembly r=syrusakbary a=slave5vw <!-- Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test: https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests --> # Description <!-- Provide details regarding the change including motivation, links to related issues, and the context of the PR. --> <!-- Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test: https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests --> The old method generated 1 mov assembly instruction per stack slot. This takes up 15 bytes * slots count size. So more local stack variables use, the larger the code size. The suggested method is the same as c memset. Initialize with a fixed instructions (24 bytes) using the rep stosq assembly instruction. It works on a range basis. https://www.felixcloutier.com/x86/stos:stosb:stosw:stosd:stosq However, in this way, the skip_stack_guard_page test fails. https://github.com/wasmerio/wasmer/blob/1b49fe8475e335c6cdbb702a7100ba044201afd0/lib/vm/src/trap/traphandlers.rs#L124 The reason is that DF Flag is 0, so it is accessed in reverse order and initialized. However, The vm trap handler checks the last address and determines it as a heap oob without range. the stack oob is correct, and the test condition fails because it is a stack oob occurrence. I think there are two ways. 1. improve stack oob check in VM trap handler -> Abstract. There is no information on the range of access, so this may not be possible. 2. pushf/popf/std(set DF=1), and access to sequential order -> Not recommended. Unnecessarily increases assembly size. So for now, I added it to ignores.txt like cranelift/llvm. # Review - [ ] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Jiyong Ha <[email protected]> Co-authored-by: losfair <[email protected]> Co-authored-by: Jiyong Ha <[email protected]> Co-authored-by: Syrus Akbary <[email protected]>
- Loading branch information