| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "builder.h" |
| 18 | #include "code_generator.h" |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 19 | #include "code_generator_x86.h" |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 20 | #include "dex_file.h" |
| 21 | #include "dex_instruction.h" |
| 22 | #include "nodes.h" |
| 23 | #include "optimizing_unit_test.h" |
| 24 | #include "register_allocator.h" |
| 25 | #include "ssa_liveness_analysis.h" |
| Nicolas Geoffray | 3ac17fc | 2014-08-06 23:02:54 +0100 | [diff] [blame] | 26 | #include "ssa_phi_elimination.h" |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 27 | #include "utils/arena_allocator.h" |
| 28 | |
| 29 | #include "gtest/gtest.h" |
| 30 | |
| 31 | namespace art { |
| 32 | |
| 33 | // Note: the register allocator tests rely on the fact that constants have live |
| 34 | // intervals and registers get allocated to them. |
| 35 | |
| 36 | static bool Check(const uint16_t* data) { |
| 37 | ArenaPool pool; |
| 38 | ArenaAllocator allocator(&pool); |
| 39 | HGraphBuilder builder(&allocator); |
| 40 | const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data); |
| 41 | HGraph* graph = builder.BuildGraph(*item); |
| 42 | graph->BuildDominatorTree(); |
| 43 | graph->TransformToSSA(); |
| 44 | graph->FindNaturalLoops(); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 45 | x86::CodeGeneratorX86 codegen(graph); |
| 46 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 47 | liveness.Analyze(); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 48 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| Nicolas Geoffray | 86dbb9a | 2014-06-04 11:12:39 +0100 | [diff] [blame] | 49 | register_allocator.AllocateRegisters(); |
| 50 | return register_allocator.Validate(false); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Unit testing of RegisterAllocator::ValidateIntervals. Register allocator |
| 55 | * tests are based on this validation method. |
| 56 | */ |
| 57 | TEST(RegisterAllocatorTest, ValidateIntervals) { |
| 58 | ArenaPool pool; |
| 59 | ArenaAllocator allocator(&pool); |
| 60 | HGraph* graph = new (&allocator) HGraph(&allocator); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 61 | x86::CodeGeneratorX86 codegen(graph); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 62 | GrowableArray<LiveInterval*> intervals(&allocator, 0); |
| 63 | |
| 64 | // Test with two intervals of the same range. |
| 65 | { |
| 66 | static constexpr size_t ranges[][2] = {{0, 42}}; |
| 67 | intervals.Add(BuildInterval(ranges, arraysize(ranges), &allocator, 0)); |
| 68 | intervals.Add(BuildInterval(ranges, arraysize(ranges), &allocator, 1)); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 69 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 70 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 71 | |
| 72 | intervals.Get(1)->SetRegister(0); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 73 | ASSERT_FALSE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 74 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 75 | intervals.Reset(); |
| 76 | } |
| 77 | |
| 78 | // Test with two non-intersecting intervals. |
| 79 | { |
| 80 | static constexpr size_t ranges1[][2] = {{0, 42}}; |
| 81 | intervals.Add(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0)); |
| 82 | static constexpr size_t ranges2[][2] = {{42, 43}}; |
| 83 | intervals.Add(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1)); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 84 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 85 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 86 | |
| 87 | intervals.Get(1)->SetRegister(0); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 88 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 89 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 90 | intervals.Reset(); |
| 91 | } |
| 92 | |
| 93 | // Test with two non-intersecting intervals, with one with a lifetime hole. |
| 94 | { |
| 95 | static constexpr size_t ranges1[][2] = {{0, 42}, {45, 48}}; |
| 96 | intervals.Add(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0)); |
| 97 | static constexpr size_t ranges2[][2] = {{42, 43}}; |
| 98 | intervals.Add(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1)); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 99 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 100 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 101 | |
| 102 | intervals.Get(1)->SetRegister(0); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 103 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 104 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 105 | intervals.Reset(); |
| 106 | } |
| 107 | |
| 108 | // Test with intersecting intervals. |
| 109 | { |
| 110 | static constexpr size_t ranges1[][2] = {{0, 42}, {44, 48}}; |
| 111 | intervals.Add(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0)); |
| 112 | static constexpr size_t ranges2[][2] = {{42, 47}}; |
| 113 | intervals.Add(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1)); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 114 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 115 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 116 | |
| 117 | intervals.Get(1)->SetRegister(0); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 118 | ASSERT_FALSE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 119 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 120 | intervals.Reset(); |
| 121 | } |
| 122 | |
| 123 | // Test with siblings. |
| 124 | { |
| 125 | static constexpr size_t ranges1[][2] = {{0, 42}, {44, 48}}; |
| 126 | intervals.Add(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0)); |
| 127 | intervals.Get(0)->SplitAt(43); |
| 128 | static constexpr size_t ranges2[][2] = {{42, 47}}; |
| 129 | intervals.Add(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1)); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 130 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 131 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 132 | |
| 133 | intervals.Get(1)->SetRegister(0); |
| 134 | // Sibling of the first interval has no register allocated to it. |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 135 | ASSERT_TRUE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 136 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 137 | |
| 138 | intervals.Get(0)->GetNextSibling()->SetRegister(0); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 139 | ASSERT_FALSE(RegisterAllocator::ValidateIntervals( |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 140 | intervals, 0, 0, codegen, &allocator, true, false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 141 | } |
| 142 | } |
| 143 | |
| 144 | TEST(RegisterAllocatorTest, CFG1) { |
| 145 | /* |
| 146 | * Test the following snippet: |
| 147 | * return 0; |
| 148 | * |
| 149 | * Which becomes the following graph: |
| 150 | * constant0 |
| 151 | * goto |
| 152 | * | |
| 153 | * return |
| 154 | * | |
| 155 | * exit |
| 156 | */ |
| 157 | const uint16_t data[] = ONE_REGISTER_CODE_ITEM( |
| 158 | Instruction::CONST_4 | 0 | 0, |
| 159 | Instruction::RETURN); |
| 160 | |
| 161 | ASSERT_TRUE(Check(data)); |
| 162 | } |
| 163 | |
| 164 | TEST(RegisterAllocatorTest, Loop1) { |
| 165 | /* |
| 166 | * Test the following snippet: |
| 167 | * int a = 0; |
| 168 | * while (a == a) { |
| 169 | * a = 4; |
| 170 | * } |
| 171 | * return 5; |
| 172 | * |
| 173 | * Which becomes the following graph: |
| 174 | * constant0 |
| 175 | * constant4 |
| 176 | * constant5 |
| 177 | * goto |
| 178 | * | |
| 179 | * goto |
| 180 | * | |
| 181 | * phi |
| 182 | * equal |
| 183 | * if +++++ |
| 184 | * | \ + |
| 185 | * | goto |
| 186 | * | |
| 187 | * return |
| 188 | * | |
| 189 | * exit |
| 190 | */ |
| 191 | |
| 192 | const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( |
| 193 | Instruction::CONST_4 | 0 | 0, |
| 194 | Instruction::IF_EQ, 4, |
| 195 | Instruction::CONST_4 | 4 << 12 | 0, |
| 196 | Instruction::GOTO | 0xFD00, |
| 197 | Instruction::CONST_4 | 5 << 12 | 1 << 8, |
| 198 | Instruction::RETURN | 1 << 8); |
| 199 | |
| 200 | ASSERT_TRUE(Check(data)); |
| 201 | } |
| 202 | |
| 203 | TEST(RegisterAllocatorTest, Loop2) { |
| 204 | /* |
| 205 | * Test the following snippet: |
| 206 | * int a = 0; |
| 207 | * while (a == 8) { |
| 208 | * a = 4 + 5; |
| 209 | * } |
| 210 | * return 6 + 7; |
| 211 | * |
| 212 | * Which becomes the following graph: |
| 213 | * constant0 |
| 214 | * constant4 |
| 215 | * constant5 |
| 216 | * constant6 |
| 217 | * constant7 |
| 218 | * constant8 |
| 219 | * goto |
| 220 | * | |
| 221 | * goto |
| 222 | * | |
| 223 | * phi |
| 224 | * equal |
| 225 | * if +++++ |
| 226 | * | \ + |
| 227 | * | 4 + 5 |
| 228 | * | goto |
| 229 | * | |
| 230 | * 6 + 7 |
| 231 | * return |
| 232 | * | |
| 233 | * exit |
| 234 | */ |
| 235 | |
| 236 | const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( |
| 237 | Instruction::CONST_4 | 0 | 0, |
| 238 | Instruction::CONST_4 | 8 << 12 | 1 << 8, |
| 239 | Instruction::IF_EQ | 1 << 8, 7, |
| 240 | Instruction::CONST_4 | 4 << 12 | 0 << 8, |
| 241 | Instruction::CONST_4 | 5 << 12 | 1 << 8, |
| 242 | Instruction::ADD_INT, 1 << 8 | 0, |
| 243 | Instruction::GOTO | 0xFA00, |
| 244 | Instruction::CONST_4 | 6 << 12 | 1 << 8, |
| 245 | Instruction::CONST_4 | 7 << 12 | 1 << 8, |
| 246 | Instruction::ADD_INT, 1 << 8 | 0, |
| 247 | Instruction::RETURN | 1 << 8); |
| 248 | |
| 249 | ASSERT_TRUE(Check(data)); |
| 250 | } |
| 251 | |
| 252 | static HGraph* BuildSSAGraph(const uint16_t* data, ArenaAllocator* allocator) { |
| 253 | HGraphBuilder builder(allocator); |
| 254 | const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data); |
| 255 | HGraph* graph = builder.BuildGraph(*item); |
| 256 | graph->BuildDominatorTree(); |
| 257 | graph->TransformToSSA(); |
| 258 | graph->FindNaturalLoops(); |
| 259 | return graph; |
| 260 | } |
| 261 | |
| 262 | TEST(RegisterAllocatorTest, Loop3) { |
| 263 | /* |
| 264 | * Test the following snippet: |
| 265 | * int a = 0 |
| 266 | * do { |
| 267 | * b = a; |
| 268 | * a++; |
| 269 | * } while (a != 5) |
| 270 | * return b; |
| 271 | * |
| 272 | * Which becomes the following graph: |
| 273 | * constant0 |
| 274 | * constant1 |
| 275 | * constant5 |
| 276 | * goto |
| 277 | * | |
| 278 | * goto |
| 279 | * |++++++++++++ |
| 280 | * phi + |
| 281 | * a++ + |
| 282 | * equals + |
| 283 | * if + |
| 284 | * |++++++++++++ |
| 285 | * return |
| 286 | * | |
| 287 | * exit |
| 288 | */ |
| 289 | |
| 290 | const uint16_t data[] = THREE_REGISTERS_CODE_ITEM( |
| 291 | Instruction::CONST_4 | 0 | 0, |
| 292 | Instruction::ADD_INT_LIT8 | 1 << 8, 1 << 8, |
| 293 | Instruction::CONST_4 | 5 << 12 | 2 << 8, |
| 294 | Instruction::IF_NE | 1 << 8 | 2 << 12, 3, |
| 295 | Instruction::RETURN | 0 << 8, |
| 296 | Instruction::MOVE | 1 << 12 | 0 << 8, |
| 297 | Instruction::GOTO | 0xF900); |
| 298 | |
| 299 | ArenaPool pool; |
| 300 | ArenaAllocator allocator(&pool); |
| 301 | HGraph* graph = BuildSSAGraph(data, &allocator); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 302 | x86::CodeGeneratorX86 codegen(graph); |
| 303 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| Nicolas Geoffray | 31d76b4 | 2014-06-09 15:02:22 +0100 | [diff] [blame] | 304 | liveness.Analyze(); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 305 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| Nicolas Geoffray | 86dbb9a | 2014-06-04 11:12:39 +0100 | [diff] [blame] | 306 | register_allocator.AllocateRegisters(); |
| 307 | ASSERT_TRUE(register_allocator.Validate(false)); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 308 | |
| 309 | HBasicBlock* loop_header = graph->GetBlocks().Get(2); |
| 310 | HPhi* phi = loop_header->GetFirstPhi()->AsPhi(); |
| 311 | |
| 312 | LiveInterval* phi_interval = phi->GetLiveInterval(); |
| 313 | LiveInterval* loop_update = phi->InputAt(1)->GetLiveInterval(); |
| 314 | ASSERT_TRUE(phi_interval->HasRegister()); |
| 315 | ASSERT_TRUE(loop_update->HasRegister()); |
| 316 | ASSERT_NE(phi_interval->GetRegister(), loop_update->GetRegister()); |
| 317 | |
| 318 | HBasicBlock* return_block = graph->GetBlocks().Get(3); |
| Nicolas Geoffray | 86dbb9a | 2014-06-04 11:12:39 +0100 | [diff] [blame] | 319 | HReturn* ret = return_block->GetLastInstruction()->AsReturn(); |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 320 | ASSERT_EQ(phi_interval->GetRegister(), ret->InputAt(0)->GetLiveInterval()->GetRegister()); |
| 321 | } |
| 322 | |
| Nicolas Geoffray | de025a7 | 2014-06-19 17:06:46 +0100 | [diff] [blame] | 323 | TEST(RegisterAllocatorTest, FirstRegisterUse) { |
| 324 | const uint16_t data[] = THREE_REGISTERS_CODE_ITEM( |
| 325 | Instruction::CONST_4 | 0 | 0, |
| 326 | Instruction::ADD_INT_LIT8 | 1 << 8, 1 << 8, |
| 327 | Instruction::ADD_INT_LIT8 | 0 << 8, 1 << 8, |
| 328 | Instruction::ADD_INT_LIT8 | 1 << 8, 1 << 8 | 1, |
| 329 | Instruction::RETURN_VOID); |
| 330 | |
| 331 | ArenaPool pool; |
| 332 | ArenaAllocator allocator(&pool); |
| 333 | HGraph* graph = BuildSSAGraph(data, &allocator); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 334 | x86::CodeGeneratorX86 codegen(graph); |
| 335 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| Nicolas Geoffray | de025a7 | 2014-06-19 17:06:46 +0100 | [diff] [blame] | 336 | liveness.Analyze(); |
| 337 | |
| 338 | HAdd* first_add = graph->GetBlocks().Get(1)->GetFirstInstruction()->AsAdd(); |
| 339 | HAdd* last_add = graph->GetBlocks().Get(1)->GetLastInstruction()->GetPrevious()->AsAdd(); |
| 340 | ASSERT_EQ(last_add->InputAt(0), first_add); |
| 341 | LiveInterval* interval = first_add->GetLiveInterval(); |
| Nicolas Geoffray | fd680d8 | 2014-09-29 09:46:03 +0100 | [diff] [blame] | 342 | ASSERT_EQ(interval->GetEnd(), last_add->GetLifetimePosition()); |
| Nicolas Geoffray | de025a7 | 2014-06-19 17:06:46 +0100 | [diff] [blame] | 343 | ASSERT_TRUE(interval->GetNextSibling() == nullptr); |
| 344 | |
| 345 | // We need a register for the output of the instruction. |
| 346 | ASSERT_EQ(interval->FirstRegisterUse(), first_add->GetLifetimePosition()); |
| 347 | |
| 348 | // Split at the next instruction. |
| 349 | interval = interval->SplitAt(first_add->GetLifetimePosition() + 2); |
| 350 | // The user of the split is the last add. |
| Nicolas Geoffray | 1f897b9 | 2014-10-21 17:14:05 +0100 | [diff] [blame] | 351 | ASSERT_EQ(interval->FirstRegisterUse(), last_add->GetLifetimePosition()); |
| Nicolas Geoffray | de025a7 | 2014-06-19 17:06:46 +0100 | [diff] [blame] | 352 | |
| 353 | // Split before the last add. |
| 354 | LiveInterval* new_interval = interval->SplitAt(last_add->GetLifetimePosition() - 1); |
| 355 | // Ensure the current interval has no register use... |
| 356 | ASSERT_EQ(interval->FirstRegisterUse(), kNoLifetime); |
| 357 | // And the new interval has it for the last add. |
| Nicolas Geoffray | 1f897b9 | 2014-10-21 17:14:05 +0100 | [diff] [blame] | 358 | ASSERT_EQ(new_interval->FirstRegisterUse(), last_add->GetLifetimePosition()); |
| Nicolas Geoffray | de025a7 | 2014-06-19 17:06:46 +0100 | [diff] [blame] | 359 | } |
| 360 | |
| Nicolas Geoffray | 3ac17fc | 2014-08-06 23:02:54 +0100 | [diff] [blame] | 361 | TEST(RegisterAllocatorTest, DeadPhi) { |
| 362 | /* Test for a dead loop phi taking as back-edge input a phi that also has |
| 363 | * this loop phi as input. Walking backwards in SsaDeadPhiElimination |
| 364 | * does not solve the problem because the loop phi will be visited last. |
| 365 | * |
| 366 | * Test the following snippet: |
| 367 | * int a = 0 |
| 368 | * do { |
| 369 | * if (true) { |
| 370 | * a = 2; |
| 371 | * } |
| 372 | * } while (true); |
| 373 | */ |
| 374 | |
| 375 | const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( |
| 376 | Instruction::CONST_4 | 0 | 0, |
| 377 | Instruction::CONST_4 | 1 << 8 | 0, |
| 378 | Instruction::IF_NE | 1 << 8 | 1 << 12, 3, |
| 379 | Instruction::CONST_4 | 2 << 12 | 0 << 8, |
| 380 | Instruction::GOTO | 0xFD00, |
| 381 | Instruction::RETURN_VOID); |
| 382 | |
| 383 | ArenaPool pool; |
| 384 | ArenaAllocator allocator(&pool); |
| 385 | HGraph* graph = BuildSSAGraph(data, &allocator); |
| 386 | SsaDeadPhiElimination(graph).Run(); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 387 | x86::CodeGeneratorX86 codegen(graph); |
| 388 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| Nicolas Geoffray | 3ac17fc | 2014-08-06 23:02:54 +0100 | [diff] [blame] | 389 | liveness.Analyze(); |
| Nicolas Geoffray | 8a16d97 | 2014-09-11 10:30:02 +0100 | [diff] [blame] | 390 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| Nicolas Geoffray | 3ac17fc | 2014-08-06 23:02:54 +0100 | [diff] [blame] | 391 | register_allocator.AllocateRegisters(); |
| 392 | ASSERT_TRUE(register_allocator.Validate(false)); |
| 393 | } |
| 394 | |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 395 | /** |
| 396 | * Test that the TryAllocateFreeReg method works in the presence of inactive intervals |
| 397 | * that share the same register. It should split the interval it is currently |
| 398 | * allocating for at the minimum lifetime position between the two inactive intervals. |
| 399 | */ |
| 400 | TEST(RegisterAllocatorTest, FreeUntil) { |
| 401 | const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( |
| 402 | Instruction::CONST_4 | 0 | 0, |
| 403 | Instruction::RETURN); |
| 404 | |
| 405 | ArenaPool pool; |
| 406 | ArenaAllocator allocator(&pool); |
| 407 | HGraph* graph = BuildSSAGraph(data, &allocator); |
| 408 | SsaDeadPhiElimination(graph).Run(); |
| 409 | x86::CodeGeneratorX86 codegen(graph); |
| 410 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 411 | liveness.Analyze(); |
| 412 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 413 | |
| 414 | // Add an artifical range to cover the temps that will be put in the unhandled list. |
| 415 | LiveInterval* unhandled = graph->GetEntryBlock()->GetFirstInstruction()->GetLiveInterval(); |
| 416 | unhandled->AddLoopRange(0, 60); |
| Mingyao Yang | 296bd60 | 2014-10-06 16:47:28 -0700 | [diff] [blame] | 417 | // For SSA value intervals, only an interval resulted from a split may intersect |
| 418 | // with inactive intervals. |
| 419 | unhandled = register_allocator.Split(unhandled, 5); |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 420 | |
| 421 | // Add three temps holding the same register, and starting at different positions. |
| 422 | // Put the one that should be picked in the middle of the inactive list to ensure |
| 423 | // we do not depend on an order. |
| Mingyao Yang | 296bd60 | 2014-10-06 16:47:28 -0700 | [diff] [blame] | 424 | LiveInterval* interval = LiveInterval::MakeInterval(&allocator, Primitive::kPrimInt); |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 425 | interval->SetRegister(0); |
| 426 | interval->AddRange(40, 50); |
| 427 | register_allocator.inactive_.Add(interval); |
| 428 | |
| Mingyao Yang | 296bd60 | 2014-10-06 16:47:28 -0700 | [diff] [blame] | 429 | interval = LiveInterval::MakeInterval(&allocator, Primitive::kPrimInt); |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 430 | interval->SetRegister(0); |
| 431 | interval->AddRange(20, 30); |
| 432 | register_allocator.inactive_.Add(interval); |
| 433 | |
| Mingyao Yang | 296bd60 | 2014-10-06 16:47:28 -0700 | [diff] [blame] | 434 | interval = LiveInterval::MakeInterval(&allocator, Primitive::kPrimInt); |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 435 | interval->SetRegister(0); |
| 436 | interval->AddRange(60, 70); |
| 437 | register_allocator.inactive_.Add(interval); |
| 438 | |
| 439 | register_allocator.number_of_registers_ = 1; |
| 440 | register_allocator.registers_array_ = allocator.AllocArray<size_t>(1); |
| 441 | register_allocator.processing_core_registers_ = true; |
| 442 | register_allocator.unhandled_ = ®ister_allocator.unhandled_core_intervals_; |
| 443 | |
| Mingyao Yang | 296bd60 | 2014-10-06 16:47:28 -0700 | [diff] [blame] | 444 | ASSERT_TRUE(register_allocator.TryAllocateFreeReg(unhandled)); |
| Nicolas Geoffray | aac0f39 | 2014-09-16 14:11:14 +0100 | [diff] [blame] | 445 | |
| 446 | // Check that we have split the interval. |
| 447 | ASSERT_EQ(1u, register_allocator.unhandled_->Size()); |
| 448 | // Check that we know need to find a new register where the next interval |
| 449 | // that uses the register starts. |
| 450 | ASSERT_EQ(20u, register_allocator.unhandled_->Get(0)->GetStart()); |
| 451 | } |
| 452 | |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 453 | static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, |
| 454 | HPhi** phi, |
| 455 | HInstruction** input1, |
| 456 | HInstruction** input2) { |
| 457 | HGraph* graph = new (allocator) HGraph(allocator); |
| 458 | HBasicBlock* entry = new (allocator) HBasicBlock(graph); |
| 459 | graph->AddBlock(entry); |
| 460 | graph->SetEntryBlock(entry); |
| 461 | HInstruction* parameter = new (allocator) HParameterValue(0, Primitive::kPrimNot); |
| 462 | entry->AddInstruction(parameter); |
| 463 | |
| 464 | HBasicBlock* block = new (allocator) HBasicBlock(graph); |
| 465 | graph->AddBlock(block); |
| 466 | entry->AddSuccessor(block); |
| 467 | |
| 468 | HInstruction* test = new (allocator) HInstanceFieldGet( |
| 469 | parameter, Primitive::kPrimBoolean, MemberOffset(22)); |
| 470 | block->AddInstruction(test); |
| 471 | block->AddInstruction(new (allocator) HIf(test)); |
| 472 | HBasicBlock* then = new (allocator) HBasicBlock(graph); |
| 473 | HBasicBlock* else_ = new (allocator) HBasicBlock(graph); |
| 474 | HBasicBlock* join = new (allocator) HBasicBlock(graph); |
| 475 | graph->AddBlock(then); |
| 476 | graph->AddBlock(else_); |
| 477 | graph->AddBlock(join); |
| 478 | |
| 479 | block->AddSuccessor(then); |
| 480 | block->AddSuccessor(else_); |
| 481 | then->AddSuccessor(join); |
| 482 | else_->AddSuccessor(join); |
| 483 | then->AddInstruction(new (allocator) HGoto()); |
| 484 | else_->AddInstruction(new (allocator) HGoto()); |
| 485 | |
| 486 | *phi = new (allocator) HPhi(allocator, 0, 0, Primitive::kPrimInt); |
| 487 | join->AddPhi(*phi); |
| 488 | *input1 = new (allocator) HInstanceFieldGet(parameter, Primitive::kPrimInt, MemberOffset(42)); |
| 489 | *input2 = new (allocator) HInstanceFieldGet(parameter, Primitive::kPrimInt, MemberOffset(42)); |
| 490 | then->AddInstruction(*input1); |
| 491 | else_->AddInstruction(*input2); |
| 492 | join->AddInstruction(new (allocator) HExit()); |
| 493 | (*phi)->AddInput(*input1); |
| 494 | (*phi)->AddInput(*input2); |
| 495 | |
| 496 | graph->BuildDominatorTree(); |
| 497 | graph->FindNaturalLoops(); |
| 498 | return graph; |
| 499 | } |
| 500 | |
| 501 | TEST(RegisterAllocatorTest, PhiHint) { |
| 502 | ArenaPool pool; |
| 503 | ArenaAllocator allocator(&pool); |
| 504 | HPhi *phi; |
| 505 | HInstruction *input1, *input2; |
| 506 | |
| 507 | { |
| 508 | HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2); |
| 509 | x86::CodeGeneratorX86 codegen(graph); |
| 510 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 511 | liveness.Analyze(); |
| 512 | |
| 513 | // Check that the register allocator is deterministic. |
| 514 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 515 | register_allocator.AllocateRegisters(); |
| 516 | |
| 517 | ASSERT_EQ(input1->GetLiveInterval()->GetRegister(), 0); |
| 518 | ASSERT_EQ(input2->GetLiveInterval()->GetRegister(), 0); |
| 519 | ASSERT_EQ(phi->GetLiveInterval()->GetRegister(), 0); |
| 520 | } |
| 521 | |
| 522 | { |
| 523 | HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2); |
| 524 | x86::CodeGeneratorX86 codegen(graph); |
| 525 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 526 | liveness.Analyze(); |
| 527 | |
| 528 | // Set the phi to a specific register, and check that the inputs get allocated |
| 529 | // the same register. |
| Nicolas Geoffray | 56b9ee6 | 2014-10-09 11:47:51 +0100 | [diff] [blame] | 530 | phi->GetLocations()->SetOut(Location::RegisterLocation(2)); |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 531 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 532 | register_allocator.AllocateRegisters(); |
| 533 | |
| 534 | ASSERT_EQ(input1->GetLiveInterval()->GetRegister(), 2); |
| 535 | ASSERT_EQ(input2->GetLiveInterval()->GetRegister(), 2); |
| 536 | ASSERT_EQ(phi->GetLiveInterval()->GetRegister(), 2); |
| 537 | } |
| 538 | |
| 539 | { |
| 540 | HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2); |
| 541 | x86::CodeGeneratorX86 codegen(graph); |
| 542 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 543 | liveness.Analyze(); |
| 544 | |
| 545 | // Set input1 to a specific register, and check that the phi and other input get allocated |
| 546 | // the same register. |
| Nicolas Geoffray | 56b9ee6 | 2014-10-09 11:47:51 +0100 | [diff] [blame] | 547 | input1->GetLocations()->SetOut(Location::RegisterLocation(2)); |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 548 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 549 | register_allocator.AllocateRegisters(); |
| 550 | |
| 551 | ASSERT_EQ(input1->GetLiveInterval()->GetRegister(), 2); |
| 552 | ASSERT_EQ(input2->GetLiveInterval()->GetRegister(), 2); |
| 553 | ASSERT_EQ(phi->GetLiveInterval()->GetRegister(), 2); |
| 554 | } |
| 555 | |
| 556 | { |
| 557 | HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2); |
| 558 | x86::CodeGeneratorX86 codegen(graph); |
| 559 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 560 | liveness.Analyze(); |
| 561 | |
| 562 | // Set input2 to a specific register, and check that the phi and other input get allocated |
| 563 | // the same register. |
| Nicolas Geoffray | 56b9ee6 | 2014-10-09 11:47:51 +0100 | [diff] [blame] | 564 | input2->GetLocations()->SetOut(Location::RegisterLocation(2)); |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 565 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 566 | register_allocator.AllocateRegisters(); |
| 567 | |
| 568 | ASSERT_EQ(input1->GetLiveInterval()->GetRegister(), 2); |
| 569 | ASSERT_EQ(input2->GetLiveInterval()->GetRegister(), 2); |
| 570 | ASSERT_EQ(phi->GetLiveInterval()->GetRegister(), 2); |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | static HGraph* BuildFieldReturn(ArenaAllocator* allocator, |
| 575 | HInstruction** field, |
| 576 | HInstruction** ret) { |
| 577 | HGraph* graph = new (allocator) HGraph(allocator); |
| 578 | HBasicBlock* entry = new (allocator) HBasicBlock(graph); |
| 579 | graph->AddBlock(entry); |
| 580 | graph->SetEntryBlock(entry); |
| 581 | HInstruction* parameter = new (allocator) HParameterValue(0, Primitive::kPrimNot); |
| 582 | entry->AddInstruction(parameter); |
| 583 | |
| 584 | HBasicBlock* block = new (allocator) HBasicBlock(graph); |
| 585 | graph->AddBlock(block); |
| 586 | entry->AddSuccessor(block); |
| 587 | |
| 588 | *field = new (allocator) HInstanceFieldGet(parameter, Primitive::kPrimInt, MemberOffset(42)); |
| 589 | block->AddInstruction(*field); |
| 590 | *ret = new (allocator) HReturn(*field); |
| 591 | block->AddInstruction(*ret); |
| 592 | |
| 593 | HBasicBlock* exit = new (allocator) HBasicBlock(graph); |
| 594 | graph->AddBlock(exit); |
| 595 | block->AddSuccessor(exit); |
| 596 | exit->AddInstruction(new (allocator) HExit()); |
| 597 | return graph; |
| 598 | } |
| 599 | |
| 600 | TEST(RegisterAllocatorTest, ExpectedInRegisterHint) { |
| 601 | ArenaPool pool; |
| 602 | ArenaAllocator allocator(&pool); |
| 603 | HInstruction *field, *ret; |
| 604 | |
| 605 | { |
| 606 | HGraph* graph = BuildFieldReturn(&allocator, &field, &ret); |
| 607 | x86::CodeGeneratorX86 codegen(graph); |
| 608 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 609 | liveness.Analyze(); |
| 610 | |
| 611 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 612 | register_allocator.AllocateRegisters(); |
| 613 | |
| 614 | // Sanity check that in normal conditions, the register should be hinted to 0 (EAX). |
| 615 | ASSERT_EQ(field->GetLiveInterval()->GetRegister(), 0); |
| 616 | } |
| 617 | |
| 618 | { |
| 619 | HGraph* graph = BuildFieldReturn(&allocator, &field, &ret); |
| 620 | x86::CodeGeneratorX86 codegen(graph); |
| 621 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 622 | liveness.Analyze(); |
| 623 | |
| 624 | // Check that the field gets put in the register expected by its use. |
| Nicolas Geoffray | f43083d | 2014-11-07 10:48:10 +0000 | [diff] [blame] | 625 | // Don't use SetInAt because we are overriding an already allocated location. |
| 626 | ret->GetLocations()->inputs_.Put(0, Location::RegisterLocation(2)); |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 627 | |
| 628 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 629 | register_allocator.AllocateRegisters(); |
| 630 | |
| 631 | ASSERT_EQ(field->GetLiveInterval()->GetRegister(), 2); |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | static HGraph* BuildTwoAdds(ArenaAllocator* allocator, |
| 636 | HInstruction** first_add, |
| 637 | HInstruction** second_add) { |
| 638 | HGraph* graph = new (allocator) HGraph(allocator); |
| 639 | HBasicBlock* entry = new (allocator) HBasicBlock(graph); |
| 640 | graph->AddBlock(entry); |
| 641 | graph->SetEntryBlock(entry); |
| 642 | HInstruction* parameter = new (allocator) HParameterValue(0, Primitive::kPrimInt); |
| 643 | HInstruction* constant1 = new (allocator) HIntConstant(0); |
| 644 | HInstruction* constant2 = new (allocator) HIntConstant(0); |
| 645 | entry->AddInstruction(parameter); |
| 646 | entry->AddInstruction(constant1); |
| 647 | entry->AddInstruction(constant2); |
| 648 | |
| 649 | HBasicBlock* block = new (allocator) HBasicBlock(graph); |
| 650 | graph->AddBlock(block); |
| 651 | entry->AddSuccessor(block); |
| 652 | |
| 653 | *first_add = new (allocator) HAdd(Primitive::kPrimInt, parameter, constant1); |
| 654 | block->AddInstruction(*first_add); |
| 655 | *second_add = new (allocator) HAdd(Primitive::kPrimInt, *first_add, constant2); |
| 656 | block->AddInstruction(*second_add); |
| 657 | |
| 658 | block->AddInstruction(new (allocator) HExit()); |
| 659 | return graph; |
| 660 | } |
| 661 | |
| 662 | TEST(RegisterAllocatorTest, SameAsFirstInputHint) { |
| 663 | ArenaPool pool; |
| 664 | ArenaAllocator allocator(&pool); |
| 665 | HInstruction *first_add, *second_add; |
| 666 | |
| 667 | { |
| 668 | HGraph* graph = BuildTwoAdds(&allocator, &first_add, &second_add); |
| 669 | x86::CodeGeneratorX86 codegen(graph); |
| 670 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 671 | liveness.Analyze(); |
| 672 | |
| 673 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 674 | register_allocator.AllocateRegisters(); |
| 675 | |
| 676 | // Sanity check that in normal conditions, the registers are the same. |
| 677 | ASSERT_EQ(first_add->GetLiveInterval()->GetRegister(), 1); |
| 678 | ASSERT_EQ(second_add->GetLiveInterval()->GetRegister(), 1); |
| 679 | } |
| 680 | |
| 681 | { |
| 682 | HGraph* graph = BuildTwoAdds(&allocator, &first_add, &second_add); |
| 683 | x86::CodeGeneratorX86 codegen(graph); |
| 684 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 685 | liveness.Analyze(); |
| 686 | |
| 687 | // check that both adds get the same register. |
| Nicolas Geoffray | f43083d | 2014-11-07 10:48:10 +0000 | [diff] [blame] | 688 | // Don't use SetOutput because output is already allocated. |
| 689 | first_add->InputAt(0)->GetLocations()->output_ = Location::RegisterLocation(2); |
| Nicolas Geoffray | 01ef345 | 2014-10-01 11:32:17 +0100 | [diff] [blame] | 690 | ASSERT_EQ(first_add->GetLocations()->Out().GetPolicy(), Location::kSameAsFirstInput); |
| 691 | ASSERT_EQ(second_add->GetLocations()->Out().GetPolicy(), Location::kSameAsFirstInput); |
| 692 | |
| 693 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 694 | register_allocator.AllocateRegisters(); |
| 695 | |
| 696 | ASSERT_EQ(first_add->GetLiveInterval()->GetRegister(), 2); |
| 697 | ASSERT_EQ(second_add->GetLiveInterval()->GetRegister(), 2); |
| 698 | } |
| 699 | } |
| 700 | |
| Calin Juravle | d0d4852 | 2014-11-04 16:40:20 +0000 | [diff] [blame] | 701 | static HGraph* BuildDiv(ArenaAllocator* allocator, |
| 702 | HInstruction** div) { |
| 703 | HGraph* graph = new (allocator) HGraph(allocator); |
| 704 | HBasicBlock* entry = new (allocator) HBasicBlock(graph); |
| 705 | graph->AddBlock(entry); |
| 706 | graph->SetEntryBlock(entry); |
| 707 | HInstruction* first = new (allocator) HParameterValue(0, Primitive::kPrimInt); |
| 708 | HInstruction* second = new (allocator) HParameterValue(0, Primitive::kPrimInt); |
| 709 | entry->AddInstruction(first); |
| 710 | entry->AddInstruction(second); |
| 711 | |
| 712 | HBasicBlock* block = new (allocator) HBasicBlock(graph); |
| 713 | graph->AddBlock(block); |
| 714 | entry->AddSuccessor(block); |
| 715 | |
| Calin Juravle | d6fb6cf | 2014-11-11 19:07:44 +0000 | [diff] [blame] | 716 | *div = new (allocator) HDiv(Primitive::kPrimInt, first, second, 0); // don't care about dex_pc. |
| Calin Juravle | d0d4852 | 2014-11-04 16:40:20 +0000 | [diff] [blame] | 717 | block->AddInstruction(*div); |
| 718 | |
| 719 | block->AddInstruction(new (allocator) HExit()); |
| 720 | return graph; |
| 721 | } |
| 722 | |
| 723 | TEST(RegisterAllocatorTest, ExpectedExactInRegisterAndSameOutputHint) { |
| 724 | ArenaPool pool; |
| 725 | ArenaAllocator allocator(&pool); |
| 726 | HInstruction *div; |
| 727 | |
| 728 | { |
| 729 | HGraph* graph = BuildDiv(&allocator, &div); |
| 730 | x86::CodeGeneratorX86 codegen(graph); |
| 731 | SsaLivenessAnalysis liveness(*graph, &codegen); |
| 732 | liveness.Analyze(); |
| 733 | |
| 734 | RegisterAllocator register_allocator(&allocator, &codegen, liveness); |
| 735 | register_allocator.AllocateRegisters(); |
| 736 | |
| 737 | // div on x86 requires its first input in eax and the output be the same as the first input. |
| 738 | ASSERT_EQ(div->GetLiveInterval()->GetRegister(), 0); |
| 739 | } |
| 740 | } |
| 741 | |
| Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 742 | } // namespace art |