From e4d4d323aa42506351b03e842818e9ec09ea6c37 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 4 Dec 2014 09:09:57 -0800 Subject: ART: Add SparseSwitch support to the optimizing compiler Add simple sparse-switch support through chained IFs. Refactor a bit to better reuse code between switch types. Now enables compiled versions of 015-switch and 095-switch-MAX_INT. Bug: 18410979 Change-Id: Ib617e4b877f0b7fbc3bb289800f612f013480713 --- compiler/optimizing/builder.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/builder.h') diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index e4e370582..73c2f5095 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -29,6 +29,7 @@ namespace art { class Instruction; +class SwitchTable; class HGraphBuilder : public ValueObject { public: @@ -203,10 +204,17 @@ class HGraphBuilder : public ValueObject { uint16_t type_index, uint32_t dex_pc); - // Builds an instruction sequence for a packed switch statement. This will punt to the interpreter - // for a switch with a full 64k set of cases. + // Builds an instruction sequence for a packed switch statement. bool BuildPackedSwitch(const Instruction& instruction, uint32_t dex_pc); + // Builds an instruction sequence for a sparse switch statement. + bool BuildSparseSwitch(const Instruction& instruction, uint32_t dex_pc); + + void BuildSwitchCaseHelper(const Instruction& instruction, size_t index, + bool is_last_case, const SwitchTable& table, + HInstruction* value, int32_t case_value_int, + int32_t target_offset, uint32_t dex_pc); + ArenaAllocator* const arena_; // A list of the size of the dex code holding block information for -- cgit v1.2.3