diff options
author | 2016-08-09 11:04:26 +0100 | |
---|---|---|
committer | 2016-09-05 17:27:41 +0100 | |
commit | 70e97462116a47ef2e582ea29a037847debcc029 (patch) | |
tree | ee587e35b9b9483c35875ccc8ddea139978ca823 /compiler/optimizing/register_allocation_resolver.h | |
parent | 521691ae4dfad47cf6b46858347fa5fa32fd7bcc (diff) |
Avoid excessive spill slots for slow paths.
Reducing the frame size makes stack maps smaller as we need
fewer bits for stack masks and some dex register locations
may use short location kind rather than long. On Nexus 9,
AOSP ToT, the boot.oat size reduction is
prebuilt multi-part boot image:
- 32-bit boot.oat: -416KiB (-0.6%)
- 64-bit boot.oat: -635KiB (-0.9%)
prebuilt multi-part boot image with read barrier:
- 32-bit boot.oat: -483KiB (-0.7%)
- 64-bit boot.oat: -703KiB (-0.9%)
on-device built single boot image:
- 32-bit boot.oat: -380KiB (-0.6%)
- 64-bit boot.oat: -632KiB (-0.9%)
on-device built single boot image with read barrier:
- 32-bit boot.oat: -448KiB (-0.6%)
- 64-bit boot.oat: -692KiB (-0.9%)
The other benefit is that at runtime, threads may need fewer
pages for their stacks, reducing overall memory usage.
We defer the calculation of the maximum spill size from
the main register allocator (linear scan or graph coloring)
to the RegisterAllocationResolver and do it based on the
live registers at slow path safepoints. The old notion of
an artificial slow path safepoint interval is removed as
it is no longer needed.
Test: Run ART test suite on host and Nexus 9.
Bug: 30212852
Change-Id: I40b3d114e278e2c5807982904fa49bf6642c6275
Diffstat (limited to 'compiler/optimizing/register_allocation_resolver.h')
-rw-r--r-- | compiler/optimizing/register_allocation_resolver.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/optimizing/register_allocation_resolver.h b/compiler/optimizing/register_allocation_resolver.h index 6ceb9bc955..a70ceae076 100644 --- a/compiler/optimizing/register_allocation_resolver.h +++ b/compiler/optimizing/register_allocation_resolver.h @@ -20,6 +20,7 @@ #include "base/arena_containers.h" #include "base/value_object.h" #include "primitive.h" +#include "utils/array_ref.h" namespace art { @@ -43,8 +44,7 @@ class RegisterAllocationResolver : ValueObject { CodeGenerator* codegen, const SsaLivenessAnalysis& liveness); - void Resolve(size_t max_safepoint_live_core_regs, - size_t max_safepoint_live_fp_regs, + void Resolve(ArrayRef<HInstruction* const> safepoints, size_t reserved_out_slots, // Includes slot(s) for the art method. size_t int_spill_slots, size_t long_spill_slots, @@ -54,10 +54,14 @@ class RegisterAllocationResolver : ValueObject { const ArenaVector<LiveInterval*>& temp_intervals); private: + // Update live registers of safepoint location summary. + void UpdateSafepointLiveRegisters(); + + // Calculate the maximum size of the spill area for safepoints. + size_t CalculateMaximumSafepointSpillSize(ArrayRef<HInstruction* const> safepoints); + // Connect adjacent siblings within blocks, and resolve inputs along the way. - // Uses max_safepoint_live_regs to check that we did not underestimate the - // number of live registers at safepoints. - void ConnectSiblings(LiveInterval* interval, size_t max_safepoint_live_regs); + void ConnectSiblings(LiveInterval* interval); // Connect siblings between block entries and exits. void ConnectSplitSiblings(LiveInterval* interval, HBasicBlock* from, HBasicBlock* to) const; |