summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author Richard Neill <richard.neill@arm.com> 2024-01-07 15:48:41 +0000
committer Hans Boehm <hboehm@google.com> 2024-01-24 05:15:45 +0000
commitdd98d26e9bb6add7b79efb5abe01a437b33a3b96 (patch)
tree54182f7af0e17a530f4cf218a1d6fae4f092807f /compiler/optimizing/nodes.h
parent3027926d518f624b0287fcab705d7e5cd93b9b40 (diff)
Optimize division by / modulo of gPageSize
When running under the page-agnostic configuration, while the global constant gPageSize is always set to a power-of-two value at static initialization time, it may not be recognised as a guaranteed power-of-two by the compiler for the purpose of optimizations. This means that divisions by gPageSize may not be replaced by an efficient right-shift, and applications of modulo gPageSize may not be optimized via a bitwise-AND. This patch introduces two functions: one to perform a gPageSize division as a logical right-shift, and the other to compute modulo gPageSize via bitwise-AND. Inlining these optimized implementations is then done everywhere that requires division or modulo of gPageSize. As they are inlined, the compiler is able to optimize the reuse of registers when multiple divisions or modulos are required (for example, the result of WhichPowerOf2 on the page size is stored when subsequent divisions are necessary, which then each become just a single right-shift). The tests were run for legacy 4K, page size agnostic 4K and 16K. Test: art/tools/run-gtests.sh Test: art/test/testrunner/testrunner.py --target --64 Test: art/tools/run-libcore-tests.sh --mode=device --variant=X64 Test: art/tools/run-libjdwp-tests.sh --mode=device --variant=X64 Change-Id: I01bd5fa89b88806c84660d4a2d62ddcba061678c
Diffstat (limited to 'compiler/optimizing/nodes.h')
0 files changed, 0 insertions, 0 deletions