libart-compiler cleanup
- Move compile-time code to src/compiler and libart-compiler
OatWriter, ImageWriter, ElfWriter, ElfFixup, ElfStripper, stub generation
- Move ClassReference and MethodReference to remove MethodVerifier dependency on CompilerDriver
- Move runtime_support_llvm.cc out of src/compiler and next to runtime_support.cc
- Change dex2oat and gtests to directly depend on libart-compiler
- Move non-common definitions from Android.common.mk to more specific makefiles
- Add LOCAL_ADDITIONAL_DEPENDENCIES on appropriate makefiles
Change-Id: I897027e69945914128f21f317a92caf9255bc600
diff --git a/src/compiler/dex/dex_to_dex_compiler.cc b/src/compiler/dex/dex_to_dex_compiler.cc
index afb29f4..ce512ec 100644
--- a/src/compiler/dex/dex_to_dex_compiler.cc
+++ b/src/compiler/dex/dex_to_dex_compiler.cc
@@ -206,7 +206,7 @@
return;
}
uint32_t method_idx = is_range ? inst->VRegB_3rc() : inst->VRegB_35c();
- CompilerDriver::MethodReference target_method(&GetDexFile(), method_idx);
+ MethodReference target_method(&GetDexFile(), method_idx);
InvokeType invoke_type = kVirtual;
InvokeType original_invoke_type = invoke_type;
int vtable_idx;
diff --git a/src/compiler/dex/mir_dataflow.cc b/src/compiler/dex/mir_dataflow.cc
index 3b2c1a6..381afb1 100644
--- a/src/compiler/dex/mir_dataflow.cc
+++ b/src/compiler/dex/mir_dataflow.cc
@@ -1225,7 +1225,7 @@
return false;
}
DexCompilationUnit m_unit(cu_);
- CompilerDriver::MethodReference target_method(cu_->dex_file, mir->dalvikInsn.vB);
+ MethodReference target_method(cu_->dex_file, mir->dalvikInsn.vB);
int vtable_idx;
uintptr_t direct_code;
uintptr_t direct_method;
diff --git a/src/compiler/dex/quick/codegen_util.cc b/src/compiler/dex/quick/codegen_util.cc
index ac2828c..766cdce 100644
--- a/src/compiler/dex/quick/codegen_util.cc
+++ b/src/compiler/dex/quick/codegen_util.cc
@@ -632,7 +632,7 @@
max_native_offset = native_offset;
}
}
- CompilerDriver::MethodReference method_ref(cu_->dex_file, cu_->method_idx);
+ MethodReference method_ref(cu_->dex_file, cu_->method_idx);
const std::vector<uint8_t>* gc_map_raw = verifier::MethodVerifier::GetDexGcMap(method_ref);
verifier::DexPcToReferenceMap dex_gc_map(&(*gc_map_raw)[4], gc_map_raw->size() - 4);
// Compute native offset to references size.
diff --git a/src/compiler/dex/quick/gen_common.cc b/src/compiler/dex/quick/gen_common.cc
index 7aa71cf..2980acb 100644
--- a/src/compiler/dex/quick/gen_common.cc
+++ b/src/compiler/dex/quick/gen_common.cc
@@ -1077,7 +1077,7 @@
// Note: currently type_known_final is unused, as optimizing will only improve the performance
// of the exception throw path.
DexCompilationUnit* cu = mir_graph_->GetCurrentDexCompilationUnit();
- const CompilerDriver::MethodReference mr(cu->GetDexFile(), cu->GetDexMethodIndex());
+ const MethodReference mr(cu->GetDexFile(), cu->GetDexMethodIndex());
if (!needs_access_check && cu_->compiler_driver->IsSafeCast(mr, insn_idx)) {
// Verifier type analysis proved this check cast would never cause an exception.
return;
diff --git a/src/compiler/dex/quick/gen_invoke.cc b/src/compiler/dex/quick/gen_invoke.cc
index 4b12bb4..3bc7340 100644
--- a/src/compiler/dex/quick/gen_invoke.cc
+++ b/src/compiler/dex/quick/gen_invoke.cc
@@ -313,7 +313,7 @@
* emit the next instruction in static & direct invoke sequences.
*/
static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info,
- int state, const CompilerDriver::MethodReference& target_method,
+ int state, const MethodReference& target_method,
uint32_t unused,
uintptr_t direct_code, uintptr_t direct_method,
InvokeType type)
@@ -418,7 +418,7 @@
* kArg1 here rather than the standard LoadArgRegs.
*/
static int NextVCallInsn(CompilationUnit* cu, CallInfo* info,
- int state, const CompilerDriver::MethodReference& target_method,
+ int state, const MethodReference& target_method,
uint32_t method_idx, uintptr_t unused, uintptr_t unused2,
InvokeType unused3)
{
@@ -467,7 +467,7 @@
* which will locate the target and continue on via a tail call.
*/
static int NextInterfaceCallInsn(CompilationUnit* cu, CallInfo* info, int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t unused, uintptr_t unused2,
uintptr_t direct_method, InvokeType unused4)
{
@@ -535,7 +535,7 @@
}
static int NextInvokeInsnSP(CompilationUnit* cu, CallInfo* info, int trampoline,
- int state, const CompilerDriver::MethodReference& target_method,
+ int state, const MethodReference& target_method,
uint32_t method_idx)
{
Mir2Lir* cg = static_cast<Mir2Lir*>(cu->cg.get());
@@ -558,7 +558,7 @@
static int NextStaticCallInsnSP(CompilationUnit* cu, CallInfo* info,
int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t method_idx,
uintptr_t unused, uintptr_t unused2,
InvokeType unused3)
@@ -568,7 +568,7 @@
}
static int NextDirectCallInsnSP(CompilationUnit* cu, CallInfo* info, int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t method_idx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
@@ -577,7 +577,7 @@
}
static int NextSuperCallInsnSP(CompilationUnit* cu, CallInfo* info, int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t method_idx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
@@ -586,7 +586,7 @@
}
static int NextVCallInsnSP(CompilationUnit* cu, CallInfo* info, int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t method_idx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
@@ -596,7 +596,7 @@
static int NextInterfaceCallInsnWithAccessCheck(CompilationUnit* cu,
CallInfo* info, int state,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t unused,
uintptr_t unused2, uintptr_t unused3,
InvokeType unused4)
@@ -607,7 +607,7 @@
int Mir2Lir::LoadArgRegs(CallInfo* info, int call_state,
NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx, uintptr_t direct_code,
uintptr_t direct_method, InvokeType type, bool skip_this)
{
@@ -647,7 +647,7 @@
*/
int Mir2Lir::GenDalvikArgsNoRange(CallInfo* info,
int call_state, LIR** pcrLabel, NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx, uintptr_t direct_code,
uintptr_t direct_method, InvokeType type, bool skip_this)
{
@@ -747,7 +747,7 @@
*/
int Mir2Lir::GenDalvikArgsRange(CallInfo* info, int call_state,
LIR** pcrLabel, NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx, uintptr_t direct_code, uintptr_t direct_method,
InvokeType type, bool skip_this)
{
@@ -1373,7 +1373,7 @@
LockCallTemps();
DexCompilationUnit* cUnit = mir_graph_->GetCurrentDexCompilationUnit();
- CompilerDriver::MethodReference target_method(cUnit->GetDexFile(), info->index);
+ MethodReference target_method(cUnit->GetDexFile(), info->index);
int vtable_idx;
uintptr_t direct_code;
uintptr_t direct_method;
diff --git a/src/compiler/dex/quick/mir_to_lir.h b/src/compiler/dex/quick/mir_to_lir.h
index 9eb4524..93098db 100644
--- a/src/compiler/dex/quick/mir_to_lir.h
+++ b/src/compiler/dex/quick/mir_to_lir.h
@@ -100,7 +100,7 @@
class Mir2Lir;
typedef int (*NextCallInsn)(CompilationUnit*, CallInfo*, int,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t method_idx, uintptr_t direct_code,
uintptr_t direct_method, InvokeType type);
@@ -467,13 +467,13 @@
void FlushIns(RegLocation* ArgLocs, RegLocation rl_method);
int GenDalvikArgsNoRange(CallInfo* info, int call_state, LIR** pcrLabel,
NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx,
uintptr_t direct_code, uintptr_t direct_method, InvokeType type,
bool skip_this);
int GenDalvikArgsRange(CallInfo* info, int call_state, LIR** pcrLabel,
NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx,
uintptr_t direct_code, uintptr_t direct_method, InvokeType type,
bool skip_this);
@@ -495,7 +495,7 @@
bool GenIntrinsic(CallInfo* info);
int LoadArgRegs(CallInfo* info, int call_state,
NextCallInsn next_call_insn,
- const CompilerDriver::MethodReference& target_method,
+ const MethodReference& target_method,
uint32_t vtable_idx,
uintptr_t direct_code, uintptr_t direct_method, InvokeType type,
bool skip_this);
diff --git a/src/compiler/dex/write_elf.cc b/src/compiler/dex/write_elf.cc
deleted file mode 100644
index d9e45a9..0000000
--- a/src/compiler/dex/write_elf.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "elf_fixup.h"
-#include "elf_stripper.h"
-#include "os.h"
-
-#if defined(ART_USE_PORTABLE_COMPILER)
-#include "elf_writer_mclinker.h"
-#else
-#include "elf_writer_quick.h"
-#endif
-
-namespace art {
-class CompilerDriver;
-class DexFile;
-} // namespace art
-
-extern "C" bool WriteElf(art::CompilerDriver& driver,
- const std::string& android_root,
- bool is_host,
- const std::vector<const art::DexFile*>& dex_files,
- std::vector<uint8_t>& oat_contents,
- art::File* file)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-#if defined(ART_USE_PORTABLE_COMPILER)
- return art::ElfWriterMclinker::Create(file, oat_contents, dex_files, android_root, is_host, driver);
-#else
- return art::ElfWriterQuick::Create(file, oat_contents, dex_files, android_root, is_host, driver);
-#endif
-}
-extern "C" bool FixupElf(art::File* file, uintptr_t oat_data_begin) {
- return art::ElfFixup::Fixup(file, oat_data_begin);
-}
-extern "C" void GetOatElfInformation(art::File* file,
- size_t& oat_loaded_size,
- size_t& oat_data_offset) {
- art::ElfWriter::GetOatElfInformation(file, oat_loaded_size, oat_data_offset);
-}
-extern "C" bool StripElf(art::File* file) {
- return art::ElfStripper::Strip(file);
-}