summaryrefslogtreecommitdiff
path: root/compiler/common_compiler_test.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-11-23 19:49:34 +0000
committerVladimir Marko <vmarko@google.com>2015-12-23 09:59:07 +0000
commit5f7b58ea1adfc0639dd605b65f59198d3763f801 (patch)
tree04556e673cdd3967cc967ff79931eab49e523956 /compiler/common_compiler_test.cc
parent1201804d1813d7db0accead9721d67c40b3de564 (diff)
Rewrite HInstruction::Is/As<type>().
Make Is<type>() and As<type>() non-virtual for concrete instruction types, relying on GetKind(), and mark GetKind() as PURE to improve optimization opportunities. This reduces the number of relocations in libart-compiler.so's .rel.dyn section by ~4K, or ~44%, and in .data.rel.ro by ~18K, or ~65%. The file is 96KiB smaller for Nexus 5, including 8KiB reduction of the .text section. Unfortunately, the g++/clang++ __attribute__((pure)) is not strong enough to avoid duplicated virtual calls and we would need the C++ [[pure]] attribute proposed in n3744 instead. To work around this deficiency, we introduce an extra non-virtual indirection for GetKind(), so that the compiler can optimize common expressions such as instruction->IsAdd() || instruction->IsSub() or instruction->IsAdd() && instruction->AsAdd()->... which contain two virtual calls to GetKind() after inlining. Change-Id: I83787de0671a5cb9f5b0a5f4a536cef239d5b401
Diffstat (limited to 'compiler/common_compiler_test.cc')
0 files changed, 0 insertions, 0 deletions