diff options
author | Ian Rogers <irogers@google.com> | 2013-07-31 14:49:16 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-08-12 06:22:42 +0000 |
commit | a49bdffd3826ea45b5d8f435b2add160871351bb (patch) | |
tree | 6adb6d61d0c756a4b09fd303747e030b74fa7fb3 | |
parent | 96faf5b363d922ae91cf25404dee0e87c740c7c5 (diff) | |
download | art-a49bdffd3826ea45b5d8f435b2add160871351bb.zip art-a49bdffd3826ea45b5d8f435b2add160871351bb.tar.gz art-a49bdffd3826ea45b5d8f435b2add160871351bb.tar.bz2 |
Don't add barriers to clinit methods.
Change-Id: I13e6c008feb8c19e452d6e2f88b2bbbcac997de5
(cherry picked from commit 9fc16eb43fe938f0cddb13638bd7cbc2ea9534a2)
-rw-r--r-- | compiler/dex/dex_to_dex_compiler.cc | 4 | ||||
-rw-r--r-- | compiler/driver/dex_compilation_unit.h | 4 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc index 1ee29cb..60e638c 100644 --- a/compiler/dex/dex_to_dex_compiler.cc +++ b/compiler/dex/dex_to_dex_compiler.cc @@ -209,8 +209,8 @@ void DexCompiler::Compile() { void DexCompiler::CompileReturnVoid(Instruction* inst, uint32_t dex_pc) { DCHECK(inst->Opcode() == Instruction::RETURN_VOID); - // Are we compiling a constructor ? - if ((unit_.GetAccessFlags() & kAccConstructor) == 0) { + // Are we compiling a non-clinit constructor? + if (!unit_.IsConstructor() || unit_.IsStatic()) { return; } // Do we need a constructor barrier ? diff --git a/compiler/driver/dex_compilation_unit.h b/compiler/driver/dex_compilation_unit.h index 5bf0086..465139b 100644 --- a/compiler/driver/dex_compilation_unit.h +++ b/compiler/driver/dex_compilation_unit.h @@ -80,6 +80,10 @@ class DexCompilationUnit { return access_flags_; } + bool IsConstructor() const { + return ((access_flags_ & kAccConstructor) != 0); + } + bool IsNative() const { return ((access_flags_ & kAccNative) != 0); } diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index f1de565..d10dc73 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -2507,8 +2507,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { // Special instructions. case Instruction::RETURN_VOID_BARRIER: - DCHECK(Runtime::Current()->IsStarted()); - if (!IsConstructor()) { + DCHECK(Runtime::Current()->IsStarted()) << PrettyMethod(dex_method_idx_, *dex_file_); + if (!IsConstructor() || IsStatic()) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "return-void-barrier not expected"; } break; |