summaryrefslogtreecommitdiff
path: root/compiler/optimizing/inliner.cc
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2017-04-06 14:40:08 -0700
committer Igor Murashkin <iam@google.com> 2017-04-10 14:59:19 -0700
commit032cacdbf32c50d3c43590600ed1e171a35fa93c (patch)
treec3e3eb480f46de2224fe58e8c30d8d5698238998 /compiler/optimizing/inliner.cc
parent8827cec4193238c2261d83c4d2c0404cc20641f0 (diff)
optimizing: do not illegally remove constructor barriers after inlining
Remove the illegal optimization that destroyed constructor barriers after inlining invoke-super constructor calls. --- According to JLS 7.5.1, "Note that if one constructor invokes another constructor, and the invoked constructor sets a final field, the freeze for the final field takes place at the end of the invoked constructor." This means if an object is published (stored to a location potentially visible to another thread) inside of an outer constructor, all final field stores from any inner constructors must be visible to other threads. Test: art/test.py Bug: 37001605 Change-Id: I3b55f6c628ff1773dab88022a6475d50a1a6f906
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r--compiler/optimizing/inliner.cc20
1 files changed, 0 insertions, 20 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 298ae5c847..66948ebf8c 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1565,25 +1565,6 @@ bool HInliner::TryBuildAndInlineHelper(HInvoke* invoke_instruction,
/* verified_method */ nullptr,
dex_cache);
- 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());
- }
- }
-
InvokeType invoke_type = invoke_instruction->GetInvokeType();
if (invoke_type == kInterface) {
// We have statically resolved the dispatch. To please the class linker
@@ -1596,7 +1577,6 @@ bool HInliner::TryBuildAndInlineHelper(HInvoke* invoke_instruction,
graph_->GetArena(),
callee_dex_file,
method_index,
- requires_ctor_barrier,
compiler_driver_->GetInstructionSet(),
invoke_type,
graph_->IsDebuggable(),