diff options
author | 2015-05-14 15:15:42 +0100 | |
---|---|---|
committer | 2015-05-19 15:54:19 +0100 | |
commit | 3cd4fc8bbb40a57d2ffde85f543c124f53237c1d (patch) | |
tree | 97eee6cc70206f605e251ad85f6f2941f4eb0383 /compiler/optimizing/inliner.cc | |
parent | 2f9d1379fdebcdeeac52eaeff25ad5697c6b6ffb (diff) |
Eliminate redundant constructor barriers when inlining.
Bug: 20410297
Change-Id: I2097743d00eb795d050d390b1918e38c7f41d506
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r-- | compiler/optimizing/inliner.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index afffc7ab4f..56d868f116 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -169,10 +169,30 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, resolved_method->GetAccessFlags(), nullptr); + bool requires_ctor_barrier = false; + + if (dex_compilation_unit.IsConstructor()) { + // If it's a super invocation and we already generate a barrier there's no need + // to generate another one. + // We identify super calls by looking at the "this" pointer. If its value is the + // same as the local "this" pointer then we must have a super invocation. + bool is_super_invocation = invoke_instruction->InputAt(0)->IsParameterValue() + && invoke_instruction->InputAt(0)->AsParameterValue()->IsThis(); + if (is_super_invocation && graph_->ShouldGenerateConstructorBarrier()) { + requires_ctor_barrier = false; + } else { + Thread* self = Thread::Current(); + requires_ctor_barrier = compiler_driver_->RequiresConstructorBarrier(self, + dex_compilation_unit.GetDexFile(), + dex_compilation_unit.GetClassDefIndex()); + } + } + HGraph* callee_graph = new (graph_->GetArena()) HGraph( graph_->GetArena(), caller_dex_file, method_index, + requires_ctor_barrier, graph_->IsDebuggable(), graph_->GetCurrentInstructionId()); |