mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Estimated hours taken: 2 Branches: main compiler/mercury_compile.m: compiler/notes/compiler_design.html: Perform loop invariant hoisting after inlining, since inlining can create opportunities for loop invariant hoisting. library/string.m: Implement string__index in Mercury, in terms of string__length, string__unsafe_index, and a new procedure string__index_check, rather than implementing in C. string__index_check contains just the index checking code from the old string__index implementation. Implementing string__index in Mercury like this should allow the Mercury compiler to do loop invariant hoisting on the calls to string__length. Declare the output argument for string__unsafe_index and string__index_det with mode `uo', to match string__index. For unsafe__index, this change was needed now that string__index is implemented in terms of string__unsafe_index.