Remove ExtractCodeAndPrelink and switch Portable to MCLinker
Change-Id: Ia2459c7da6b79e0a1c0f1148c6e28ad9cbbe27a2
diff --git a/src/compiler/llvm/compiler_llvm.cc b/src/compiler/llvm/compiler_llvm.cc
index 1c9a494..be1730f 100644
--- a/src/compiler/llvm/compiler_llvm.cc
+++ b/src/compiler/llvm/compiler_llvm.cc
@@ -16,14 +16,15 @@
#include "compiler_llvm.h"
-#include "base/stl_util.h"
#include "backend_options.h"
+#include "base/stl_util.h"
#include "class_linker.h"
#include "compiled_method.h"
#include "compiler/driver/compiler_driver.h"
#include "compiler/driver/dex_compilation_unit.h"
#include "compiler/invoke_stubs/portable/stub_compiler.h"
#include "compiler/jni/portable/jni_compiler.h"
+#include "globals.h"
#include "ir_builder.h"
#include "llvm_compilation_unit.h"
#include "oat_file.h"
@@ -43,7 +44,7 @@
uint32_t access_flags, InvokeType invoke_type,
uint32_t class_def_idx, uint32_t method_idx, jobject class_loader,
const DexFile& dex_file,
- LLVMInfo* llvm_info);
+ llvm::LlvmCompilationUnit* llvm_info);
}
namespace llvm {
@@ -65,17 +66,17 @@
art::llvm::InitialBackendOptions();
// Initialize LLVM target, MC subsystem, asm printer, and asm parser.
-#if defined(ART_TARGET)
- // Don't initialize all targets on device. Just initialize the device's native target
- llvm::InitializeNativeTarget();
- llvm::InitializeNativeTargetAsmPrinter();
- llvm::InitializeNativeTargetAsmParser();
-#else
- llvm::InitializeAllTargets();
- llvm::InitializeAllTargetMCs();
- llvm::InitializeAllAsmPrinters();
- llvm::InitializeAllAsmParsers();
-#endif
+ if (art::kIsTargetBuild) {
+ // Don't initialize all targets on device. Just initialize the device's native target
+ llvm::InitializeNativeTarget();
+ llvm::InitializeNativeTargetAsmPrinter();
+ llvm::InitializeNativeTargetAsmParser();
+ } else {
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllAsmParsers();
+ }
// Initialize LLVM optimization passes
llvm::PassRegistry ®istry = *llvm::PassRegistry::getPassRegistry();
@@ -110,8 +111,7 @@
CompilerLLVM::CompilerLLVM(CompilerDriver* driver, InstructionSet insn_set)
: compiler_driver_(driver), insn_set_(insn_set),
- num_cunits_lock_("compilation unit counter lock"), num_cunits_(0),
- plt_(insn_set) {
+ next_cunit_id_lock_("compilation unit id lock"), next_cunit_id_(1) {
// Initialize LLVM libraries
pthread_once(&llvm_initialized, InitializeLLVM);
@@ -123,10 +123,12 @@
LlvmCompilationUnit* CompilerLLVM::AllocateCompilationUnit() {
- MutexLock GUARD(Thread::Current(), num_cunits_lock_);
- LlvmCompilationUnit* cunit = new LlvmCompilationUnit(this, ++num_cunits_);
+ MutexLock GUARD(Thread::Current(), next_cunit_id_lock_);
+ LlvmCompilationUnit* cunit = new LlvmCompilationUnit(this, next_cunit_id_++);
if (!bitcode_filename_.empty()) {
- cunit->SetBitcodeFileName(StringPrintf("%s-%zu", bitcode_filename_.c_str(), cunit->GetIndex()));
+ cunit->SetBitcodeFileName(StringPrintf("%s-%zu",
+ bitcode_filename_.c_str(),
+ cunit->GetCompilationUnitId()));
}
return cunit;
}
@@ -136,8 +138,8 @@
CompileDexMethod(DexCompilationUnit* dex_compilation_unit, InvokeType invoke_type) {
UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit());
- std::string methodName(PrettyMethod(dex_compilation_unit->GetDexMethodIndex(),
- *dex_compilation_unit->GetDexFile()));
+ cunit->SetDexCompilationUnit(dex_compilation_unit);
+ cunit->SetCompiler(compiler_driver_);
// TODO: consolidate ArtCompileMethods
CompileOneMethod(*compiler_driver_,
kPortable,
@@ -148,19 +150,16 @@
dex_compilation_unit->GetDexMethodIndex(),
dex_compilation_unit->GetClassLoader(),
*dex_compilation_unit->GetDexFile(),
- cunit->GetQuickContext()
- );
-
- cunit->SetCompiler(compiler_driver_);
- cunit->SetDexCompilationUnit(dex_compilation_unit);
+ cunit.get());
cunit->Materialize();
CompilerDriver::MethodReference mref(dex_compilation_unit->GetDexFile(),
dex_compilation_unit->GetDexMethodIndex());
return new CompiledMethod(compiler_driver_->GetInstructionSet(),
- cunit->GetCompiledCode(),
- *verifier::MethodVerifier::GetDexGcMap(mref));
+ cunit->GetElfObject(),
+ *verifier::MethodVerifier::GetDexGcMap(mref),
+ cunit->GetDexCompilationUnit()->GetSymbol());
}
@@ -235,7 +234,7 @@
art::ClassLinker *class_linker = art::Runtime::Current()->GetClassLinker();
art::DexCompilationUnit dex_compilation_unit(
- class_loader, class_linker, dex_file, code_item,
+ NULL, class_loader, class_linker, dex_file, code_item,
class_def_idx, method_idx, access_flags);
art::llvm::CompilerLLVM* compiler_llvm = ContextOf(driver);
art::CompiledMethod* result = compiler_llvm->CompileDexMethod(&dex_compilation_unit, invoke_type);
@@ -248,7 +247,7 @@
art::ClassLinker *class_linker = art::Runtime::Current()->GetClassLinker();
art::DexCompilationUnit dex_compilation_unit(
- NULL, class_linker, dex_file, NULL,
+ NULL, NULL, class_linker, dex_file, NULL,
0, method_idx, access_flags);
art::llvm::CompilerLLVM* compiler_llvm = ContextOf(driver);
diff --git a/src/compiler/llvm/compiler_llvm.h b/src/compiler/llvm/compiler_llvm.h
index 870a541..cbee115 100644
--- a/src/compiler/llvm/compiler_llvm.h
+++ b/src/compiler/llvm/compiler_llvm.h
@@ -22,7 +22,6 @@
#include "dex_file.h"
#include "instruction_set.h"
#include "mirror/object.h"
-#include "procedure_linkage_table.h"
#include <UniquePtr.h>
@@ -87,10 +86,6 @@
CompiledInvokeStub* CreateProxyStub(const char *shorty);
- const ProcedureLinkageTable& GetProcedureLinkageTable() const {
- return plt_;
- }
-
private:
LlvmCompilationUnit* AllocateCompilationUnit();
@@ -98,13 +93,11 @@
InstructionSet insn_set_;
- Mutex num_cunits_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
- size_t num_cunits_ GUARDED_BY(num_cunits_lock_);
+ Mutex next_cunit_id_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
+ size_t next_cunit_id_ GUARDED_BY(next_cunit_id_lock_);
std::string bitcode_filename_;
- ProcedureLinkageTable plt_;
-
DISALLOW_COPY_AND_ASSIGN(CompilerLLVM);
};
diff --git a/src/compiler/llvm/compiler_runtime_func_list.h b/src/compiler/llvm/compiler_runtime_func_list.h
deleted file mode 100644
index ffbae85..0000000
--- a/src/compiler/llvm/compiler_runtime_func_list.h
+++ /dev/null
@@ -1,234 +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.
- */
-
-#ifndef ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
-#define ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
-
-// NOTE: COMPILER_RUNTIME_FUNC_LIST_* should be sorted!
-
-#define COMPILER_RUNTIME_FUNC_LIST_X86(V) \
- V(__ashldi3, long long, long long, int) \
- V(__ashrdi3, long long, long long, int) \
- V(__divdi3, long long, long long, long long) \
- V(__fixdfdi, long long, double) \
- V(__fixsfdi, long long, float) \
- V(__fixtfdi, long long, long double) \
- V(__fixtfsi, int, long double) \
- V(__fixunsdfdi, unsigned long long, double) \
- V(__fixunsdfsi, unsigned int, double) \
- V(__fixunssfdi, unsigned long long, float) \
- V(__fixunssfsi, unsigned int, float) \
- V(__fixunstfdi, unsigned long long, long double) \
- V(__fixunstfsi, unsigned int, long double) \
- V(__fixunsxfdi, unsigned long long, long double) \
- V(__fixunsxfsi, unsigned int, long double) \
- V(__fixxfdi, long long, long double) \
- V(__floatdidf, double, long long) \
- V(__floatdisf, float, long long) \
- V(__floatditf, long double, long long) \
- V(__floatdixf, long double, long long) \
- V(__floatsitf, long double, int) \
- V(__floatundidf, double, unsigned long long) \
- V(__floatundisf, float, unsigned long long) \
- V(__floatunditf, long double, unsigned long long) \
- V(__floatundixf, long double, unsigned long long) \
- V(__floatunsitf, long double, int) \
- V(__lshrdi3, long long, long long, int) \
- V(__moddi3, long long, long long, long long) \
- V(__muldi3, long long, long long, long long) \
- V(__negdi2, long long, long long) \
- V(__powidf2, double, double, int) \
- V(__powisf2, float, float, int) \
- V(__powitf2, long double, long double, int) \
- V(__powixf2, long double, long double, int) \
- V(__trunctfdf2, double, long double) \
- V(__trunctfsf2, float, long double) \
- V(__udivdi3, unsigned long long, unsigned long long, unsigned long long) \
- V(__umoddi3, unsigned long long, unsigned long long, unsigned long long) \
- V(ceil, double, double) \
- V(ceilf, float, float) \
- V(ceill, long double, long double) \
- V(copysign, double, double, double) \
- V(copysignf, float, float, float) \
- V(copysignl, long double, long double, long double) \
- V(cos, double, double) \
- V(cosf, float, float) \
- V(exp, double, double) \
- V(exp2, double, double) \
- V(exp2f, float, float) \
- V(expf, float, float) \
- V(floor, double, double) \
- V(floorf, float, float) \
- V(floorl, long double, long double) \
- V(fma, double, double, double, double) \
- V(fmaf, float, float, float, float) \
- V(fmod, double, double, double) \
- V(fmodf, float, float, float) \
- V(log, double, double) \
- V(log10, double, double) \
- V(log10f, float, float) \
- V(logf, float, float) \
- V(memcpy, void *, void *, const void *, size_t) \
- V(memmove, void *, void *, const void *, size_t) \
- V(memset, void *, void *, int, size_t) \
- V(nearbyint, double, double) \
- V(nearbyintf, float, float) \
- V(pow, double, double, double) \
- V(powf, float, float, float) \
- V(rint, double, double) \
- V(rintf, float, float) \
- V(sin, double, double) \
- V(sinf, float, float) \
- V(sqrt, double, double) \
- V(sqrtf, float, float) \
- V(trunc, double, double) \
- V(truncf, float, float) \
- V(truncl, long double, long double)
-
-#define COMPILER_RUNTIME_FUNC_LIST_MIPS(V) \
- V(__ashldi3, long long, long long, int) \
- V(__ashrdi3, long long, long long, int) \
- V(__divdi3, long long, long long, long long) \
- V(__fixdfdi, long long, double) \
- V(__fixsfdi, long long, float) \
- V(__fixunsdfdi, unsigned long long, double) \
- V(__fixunsdfsi, unsigned int, double) \
- V(__fixunssfdi, unsigned long long, float) \
- V(__fixunssfsi, unsigned int, float) \
- V(__floatdidf, double, long long) \
- V(__floatdisf, float, long long) \
- V(__floatundidf, double, unsigned long long) \
- V(__floatundisf, float, unsigned long long) \
- V(__lshrdi3, long long, long long, int) \
- V(__moddi3, long long, long long, long long) \
- V(__muldi3, long long, long long, long long) \
- V(__negdi2, long long, long long) \
- V(__powidf2, double, double, int) \
- V(__powisf2, float, float, int) \
- V(__udivdi3, unsigned long long, unsigned long long, unsigned long long) \
- V(__umoddi3, unsigned long long, unsigned long long, unsigned long long) \
- V(ceil, double, double) \
- V(ceilf, float, float) \
- V(ceill, long double, long double) \
- V(copysign, double, double, double) \
- V(copysignf, float, float, float) \
- V(copysignl, long double, long double, long double) \
- V(cos, double, double) \
- V(cosf, float, float) \
- V(exp, double, double) \
- V(exp2, double, double) \
- V(exp2f, float, float) \
- V(expf, float, float) \
- V(floor, double, double) \
- V(floorf, float, float) \
- V(floorl, long double, long double) \
- V(fma, double, double, double, double) \
- V(fmaf, float, float, float, float) \
- V(fmod, double, double, double) \
- V(fmodf, float, float, float) \
- V(log, double, double) \
- V(log10, double, double) \
- V(log10f, float, float) \
- V(logf, float, float) \
- V(memcpy, void *, void *, const void *, size_t) \
- V(memmove, void *, void *, const void *, size_t) \
- V(memset, void *, void *, int, size_t) \
- V(nearbyint, double, double) \
- V(nearbyintf, float, float) \
- V(pow, double, double, double) \
- V(powf, float, float, float) \
- V(rint, double, double) \
- V(rintf, float, float) \
- V(sin, double, double) \
- V(sinf, float, float) \
- V(sqrt, double, double) \
- V(sqrtf, float, float) \
- V(trunc, double, double) \
- V(truncf, float, float) \
- V(truncl, long double, long double)
-
-#define COMPILER_RUNTIME_FUNC_LIST_ARM(V) \
- V(__aeabi_d2f, float, double) \
- V(__aeabi_d2iz, int, double) \
- V(__aeabi_d2lz, long long, double) \
- V(__aeabi_d2uiz, unsigned, double) \
- V(__aeabi_d2ulz, unsigned long long, double) \
- V(__aeabi_dadd, double, double, double) \
- V(__aeabi_dcmpeq, int, double, double) \
- V(__aeabi_dcmpge, int, double, double) \
- V(__aeabi_dcmpgt, int, double, double) \
- V(__aeabi_dcmple, int, double, double) \
- V(__aeabi_dcmplt, int, double, double) \
- V(__aeabi_dcmpun, int, double, double) \
- V(__aeabi_ddiv, double, double, double) \
- V(__aeabi_dmul, double, double, double) \
- V(__aeabi_dsub, double, double, double) \
- V(__aeabi_f2d, double, float) \
- V(__aeabi_f2iz, int, float) \
- V(__aeabi_f2lz, long long, float) \
- V(__aeabi_f2uiz, unsigned int, float) \
- V(__aeabi_f2ulz, unsigned long long, float) \
- V(__aeabi_fadd, float, float, float) \
- V(__aeabi_fcmpeq, int, float, float) \
- V(__aeabi_fcmpge, int, float, float) \
- V(__aeabi_fcmpgt, int, float, float) \
- V(__aeabi_fcmple, int, float, float) \
- V(__aeabi_fcmplt, int, float, float) \
- V(__aeabi_fcmpun, int, float, float) \
- V(__aeabi_fdiv, float, float, float) \
- V(__aeabi_fmul, float, float, float) \
- V(__aeabi_fsub, float, float, float) \
- V(__aeabi_i2d, double, int) \
- V(__aeabi_i2f, float, int) \
- V(__aeabi_idiv, int, int, int) \
- V(__aeabi_l2d, double, long long) \
- V(__aeabi_l2f, float, long long) \
- V(__aeabi_lasr, long long, long long, int) \
- V(__aeabi_ldivmod, /* value in regs */ void, long long, long long) \
- V(__aeabi_llsl, long long, long long, int) \
- V(__aeabi_llsr, long long, long long, int) \
- V(__aeabi_lmul, long long, long long, long long) \
- V(__aeabi_memcpy, void, void *, const void *, size_t) \
- V(__aeabi_memmove, void, void *, const void *, size_t) \
- V(__aeabi_memset, void, void *, size_t, int) /* different from stdlib */ \
- V(__aeabi_ui2d, double, unsigned int) \
- V(__aeabi_ui2f, float, unsigned int) \
- V(__aeabi_uidiv, unsigned int, unsigned int, unsigned int) \
- V(__aeabi_ul2d, double, unsigned long long) \
- V(__aeabi_ul2f, float, unsigned long long) \
- V(__aeabi_uldivmod, /* value in regs */ void, unsigned long long, unsigned long long) \
- V(__moddi3, long long, long long, long long) \
- V(__modsi3, int, int, int) \
- V(__umoddi3, unsigned long long, unsigned long long, unsigned long long) \
- V(__umodsi3, unsigned int, unsigned int, unsigned int) \
- V(fmod, double, double, double) \
- V(fmodf, float, float, float) \
- V(memcpy, void *, void *, const void *, size_t) \
- V(memmove, void *, void *, const void *, size_t) \
- V(memset, void *, void *, int, size_t)
-
-
-#if defined(__arm__)
-#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_ARM(V)
-#elif defined(__mips__)
-#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_MIPS(V)
-#elif defined(__i386__)
-#define COMPILER_RUNTIME_FUNC_LIST_NATIVE(V) COMPILER_RUNTIME_FUNC_LIST_X86(V)
-#else
-#error "Unknown target platform"
-#endif
-
-#endif // ART_SRC_COMPILER_LLVM_COMPILER_RUNTIME_FUNC_LIST_H_
diff --git a/src/compiler/llvm/gbc_expander.cc b/src/compiler/llvm/gbc_expander.cc
index 4e1a91d..9de2e41 100644
--- a/src/compiler/llvm/gbc_expander.cc
+++ b/src/compiler/llvm/gbc_expander.cc
@@ -326,7 +326,7 @@
static char ID;
GBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb,
- art::CompilerDriver* compiler, art::DexCompilationUnit* dex_compilation_unit)
+ art::CompilerDriver* compiler, const art::DexCompilationUnit* dex_compilation_unit)
: llvm::FunctionPass(ID), intrinsic_helper_(intrinsic_helper), irb_(irb),
context_(irb.getContext()), rtb_(irb.Runtime()),
shadow_frame_(NULL), old_shadow_frame_(NULL),
@@ -350,7 +350,7 @@
VLOG(compiler) << "GBC expansion on " << func.getName().str();
// Runtime support or stub
- if (func.getName().startswith("art_") || func.getName().startswith("Art")) {
+ if (dex_compilation_unit_ == NULL) {
return false;
}
@@ -3634,7 +3634,7 @@
::llvm::FunctionPass*
CreateGBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb,
- CompilerDriver* driver, DexCompilationUnit* dex_compilation_unit) {
+ CompilerDriver* driver, const DexCompilationUnit* dex_compilation_unit) {
return new GBCExpanderPass(intrinsic_helper, irb, driver, dex_compilation_unit);
}
diff --git a/src/compiler/llvm/llvm_compilation_unit.cc b/src/compiler/llvm/llvm_compilation_unit.cc
index aad18fb..3783ae9 100644
--- a/src/compiler/llvm/llvm_compilation_unit.cc
+++ b/src/compiler/llvm/llvm_compilation_unit.cc
@@ -16,16 +16,11 @@
#include "llvm_compilation_unit.h"
-#include "base/logging.h"
-#include "compiled_method.h"
-#include "compiler_llvm.h"
-#include "instruction_set.h"
-#include "ir_builder.h"
-#include "os.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
-#include "runtime_support_builder_arm.h"
-#include "runtime_support_builder_thumb2.h"
-#include "runtime_support_builder_x86.h"
+#include <string>
#include <llvm/ADT/OwningPtr.h>
#include <llvm/ADT/StringSet.h>
@@ -71,24 +66,30 @@
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm/Transforms/Scalar.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <string>
+#include "base/logging.h"
+#include "base/unix_file/fd_file.h"
+#include "compiled_method.h"
+#include "compiler_llvm.h"
+#include "instruction_set.h"
+#include "ir_builder.h"
+#include "os.h"
+#include "runtime_support_builder_arm.h"
+#include "runtime_support_builder_thumb2.h"
+#include "runtime_support_builder_x86.h"
+#include "utils_llvm.h"
namespace art {
namespace llvm {
::llvm::FunctionPass*
CreateGBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb,
- CompilerDriver* compiler, DexCompilationUnit* dex_compilation_unit);
+ CompilerDriver* compiler, const DexCompilationUnit* dex_compilation_unit);
::llvm::Module* makeLLVMModuleContents(::llvm::Module* module);
-LlvmCompilationUnit::LlvmCompilationUnit(const CompilerLLVM* compiler_llvm, size_t cunit_idx)
- : compiler_llvm_(compiler_llvm), cunit_idx_(cunit_idx) {
+LlvmCompilationUnit::LlvmCompilationUnit(const CompilerLLVM* compiler_llvm, size_t cunit_id)
+ : compiler_llvm_(compiler_llvm), cunit_id_(cunit_id) {
driver_ = NULL;
dex_compilation_unit_ = NULL;
llvm_info_.reset(new LLVMInfo());
@@ -136,27 +137,24 @@
bool LlvmCompilationUnit::Materialize() {
- std::string elf_image;
-
// Compile and prelink ::llvm::Module
- if (!MaterializeToString(elf_image)) {
- LOG(ERROR) << "Failed to materialize compilation unit " << cunit_idx_;
+ if (!MaterializeToString(elf_object_)) {
+ LOG(ERROR) << "Failed to materialize compilation unit " << cunit_id_;
return false;
}
-#if 0
- // Dump the ELF image for debugging
- std::string filename(StringPrintf("%s/Art%zu.elf",
- GetArtCacheOrDie(GetAndroidData()).c_str(),
- cunit_idx_));
- UniquePtr<File> output(OS::OpenFile(filename.c_str(), true));
- output->WriteFully(elf_image.data(), elf_image.size());
-#endif
-
- // Extract the .text section and prelink the code
- if (!ExtractCodeAndPrelink(elf_image)) {
- LOG(ERROR) << "Failed to extract code from compilation unit " << cunit_idx_;
- return false;
+ if (false) {
+ // Dump the ELF image for debugging
+ std::string directory;
+ if (kIsTargetBuild) {
+ directory += GetArtCacheOrDie(GetAndroidData());
+ } else {
+ directory += "/tmp";
+ }
+ std::string filename(StringPrintf("%s/Art%u.o", directory.c_str(), cunit_id_));
+ UniquePtr<File> output(OS::OpenFile(filename.c_str(), true));
+ output->WriteFully(elf_object_.data(), elf_object_.size());
+ LOG(INFO) << ".o file written successfully: " << filename;
}
return true;
@@ -284,112 +282,6 @@
return true;
}
-bool LlvmCompilationUnit::ExtractCodeAndPrelink(const std::string& elf_image) {
- if (GetInstructionSet() == kX86) {
- compiled_code_.push_back(0xccU);
- compiled_code_.push_back(0xccU);
- compiled_code_.push_back(0xccU);
- compiled_code_.push_back(0xccU);
- return true;
- }
-
- ::llvm::OwningPtr< ::llvm::MemoryBuffer> elf_image_buff(
- ::llvm::MemoryBuffer::getMemBuffer(::llvm::StringRef(elf_image.data(),
- elf_image.size())));
-
- ::llvm::OwningPtr< ::llvm::object::ObjectFile> elf_file(
- ::llvm::object::ObjectFile::createELFObjectFile(elf_image_buff.take()));
-
- ::llvm::error_code ec;
-
- const ProcedureLinkageTable& plt = compiler_llvm_->GetProcedureLinkageTable();
-
- for (::llvm::object::section_iterator
- sec_iter = elf_file->begin_sections(),
- sec_end = elf_file->end_sections();
- sec_iter != sec_end; sec_iter.increment(ec)) {
-
- CHECK(ec == 0) << "Failed to read section because " << ec.message();
-
- // Read the section information
- ::llvm::StringRef name;
- uint64_t alignment = 0u;
- uint64_t size = 0u;
-
- CHECK(sec_iter->getName(name) == 0);
- CHECK(sec_iter->getSize(size) == 0);
- CHECK(sec_iter->getAlignment(alignment) == 0);
-
- if (name == ".data" || name == ".bss" || name == ".rodata") {
- if (size > 0) {
- LOG(FATAL) << "Compilation unit " << cunit_idx_ << " has non-empty "
- << name.str() << " section";
- }
-
- } else if (name == "" || name == ".rel.text" ||
- name == ".ARM.attributes" || name == ".symtab" ||
- name == ".strtab" || name == ".shstrtab") {
- // We can ignore these sections. We don't have to copy them into
- // the result Oat file.
-
- } else if (name == ".text") {
- // Ensure the alignment requirement is less than or equal to
- // kArchAlignment
- CheckCodeAlign(alignment);
-
- // Copy the compiled code
- ::llvm::StringRef contents;
- CHECK(sec_iter->getContents(contents) == 0);
-
- copy(contents.data(),
- contents.data() + contents.size(),
- back_inserter(compiled_code_));
-
- // Prelink the compiled code
- for (::llvm::object::relocation_iterator
- rel_iter = sec_iter->begin_relocations(),
- rel_end = sec_iter->end_relocations(); rel_iter != rel_end;
- rel_iter.increment(ec)) {
-
- CHECK(ec == 0) << "Failed to read relocation because " << ec.message();
-
- // Read the relocation information
- ::llvm::object::SymbolRef sym_ref;
- uint64_t rel_offset = 0;
- uint64_t rel_type = 0;
- int64_t rel_addend = 0;
-
- CHECK(rel_iter->getSymbol(sym_ref) == 0);
- CHECK(rel_iter->getOffset(rel_offset) == 0);
- CHECK(rel_iter->getType(rel_type) == 0);
- CHECK(rel_iter->getAdditionalInfo(rel_addend) == 0);
-
- // Read the symbol related to this relocation fixup
- ::llvm::StringRef sym_name;
- CHECK(sym_ref.getName(sym_name) == 0);
-
- // Relocate the fixup.
- // TODO: Support more relocation type.
- CHECK(rel_type == ::llvm::ELF::R_ARM_ABS32);
- CHECK_LE(rel_offset + 4, compiled_code_.size());
-
- uintptr_t dest_addr = plt.GetEntryAddress(sym_name.str().c_str());
- uintptr_t final_addr = dest_addr + rel_addend;
- compiled_code_[rel_offset] = final_addr & 0xff;
- compiled_code_[rel_offset + 1] = (final_addr >> 8) & 0xff;
- compiled_code_[rel_offset + 2] = (final_addr >> 16) & 0xff;
- compiled_code_[rel_offset + 3] = (final_addr >> 24) & 0xff;
- }
-
- } else {
- LOG(WARNING) << "Unexpected section: " << name.str();
- }
- }
-
- return true;
-}
-
-
// Check whether the align is less than or equal to the code alignment of
// that architecture. Since the Oat writer only guarantee that the compiled
// method being aligned to kArchAlignment, we have no way to align the ELf
diff --git a/src/compiler/llvm/llvm_compilation_unit.h b/src/compiler/llvm/llvm_compilation_unit.h
index 9ca9e3f..96d019c 100644
--- a/src/compiler/llvm/llvm_compilation_unit.h
+++ b/src/compiler/llvm/llvm_compilation_unit.h
@@ -53,8 +53,8 @@
public:
~LlvmCompilationUnit();
- size_t GetIndex() const {
- return cunit_idx_;
+ uint32_t GetCompilationUnitId() const {
+ return cunit_id_;
}
InstructionSet GetInstructionSet() const;
@@ -81,27 +81,30 @@
void SetCompiler(CompilerDriver* driver) {
driver_ = driver;
}
- void SetDexCompilationUnit(DexCompilationUnit* dex_compilation_unit) {
+ const DexCompilationUnit* GetDexCompilationUnit() {
+ return dex_compilation_unit_;
+ }
+ void SetDexCompilationUnit(const DexCompilationUnit* dex_compilation_unit) {
dex_compilation_unit_ = dex_compilation_unit;
}
bool Materialize();
bool IsMaterialized() const {
- return !compiled_code_.empty();
+ return !elf_object_.empty();
}
- const std::vector<uint8_t>& GetCompiledCode() const {
+ const std::string& GetElfObject() const {
DCHECK(IsMaterialized());
- return compiled_code_;
+ return elf_object_;
}
private:
LlvmCompilationUnit(const CompilerLLVM* compiler_llvm,
- size_t cunit_idx);
+ uint32_t cunit_id);
const CompilerLLVM* compiler_llvm_;
- const size_t cunit_idx_;
+ const uint32_t cunit_id_;
UniquePtr< ::llvm::LLVMContext> context_;
UniquePtr<IRBuilder> irb_;
@@ -110,11 +113,11 @@
UniquePtr<IntrinsicHelper> intrinsic_helper_;
UniquePtr<LLVMInfo> llvm_info_;
CompilerDriver* driver_;
- DexCompilationUnit* dex_compilation_unit_;
+ const DexCompilationUnit* dex_compilation_unit_;
std::string bitcode_filename_;
- std::vector<uint8_t> compiled_code_;
+ std::string elf_object_;
SafeMap<const ::llvm::Function*, CompiledMethod*> compiled_methods_map_;
@@ -123,8 +126,6 @@
bool MaterializeToString(std::string& str_buffer);
bool MaterializeToRawOStream(::llvm::raw_ostream& out_stream);
- bool ExtractCodeAndPrelink(const std::string& elf_image);
-
friend class CompilerLLVM; // For LlvmCompilationUnit constructor
};
diff --git a/src/compiler/llvm/procedure_linkage_table.cc b/src/compiler/llvm/procedure_linkage_table.cc
deleted file mode 100644
index 47ba9bd..0000000
--- a/src/compiler/llvm/procedure_linkage_table.cc
+++ /dev/null
@@ -1,326 +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 "procedure_linkage_table.h"
-
-#include "base/logging.h"
-#include "compiler_runtime_func_list.h"
-#include "globals.h"
-#include "instruction_set.h"
-#include "runtime_support_func_list.h"
-#include "runtime_support_llvm.h"
-#include "utils_llvm.h"
-
-#include <algorithm>
-
-#include <UniquePtr.h>
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-
-namespace {
- const char* const art_runtime_func_name_list[] = {
-#define DEFINE_ENTRY(ID, NAME) #NAME,
- RUNTIME_SUPPORT_FUNC_LIST(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- const char* const compiler_runtime_func_name_list_arm[] = {
-#define DEFINE_ENTRY(NAME, RETURN_TYPE, ...) #NAME,
- COMPILER_RUNTIME_FUNC_LIST_ARM(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- const char* const compiler_runtime_func_name_list_mips[] = {
-#define DEFINE_ENTRY(NAME, RETURN_TYPE, ...) #NAME,
- COMPILER_RUNTIME_FUNC_LIST_MIPS(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- const char* const compiler_runtime_func_name_list_x86[] = {
-#define DEFINE_ENTRY(NAME, RETURN_TYPE, ...) #NAME,
- COMPILER_RUNTIME_FUNC_LIST_X86(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- const size_t art_runtime_func_count =
- sizeof(art_runtime_func_name_list) / sizeof(const char*);
-
- const size_t compiler_runtime_func_count_arm =
- sizeof(compiler_runtime_func_name_list_arm) / sizeof(const char*);
-
- const size_t compiler_runtime_func_count_mips =
- sizeof(compiler_runtime_func_name_list_mips) / sizeof(const char*);
-
- const size_t compiler_runtime_func_count_x86 =
- sizeof(compiler_runtime_func_name_list_x86) / sizeof(const char*);
-}
-
-
-namespace art {
-namespace llvm {
-
-
-ProcedureLinkageTable::ProcedureLinkageTable(InstructionSet insn_set)
- : insn_set_(insn_set) {
-}
-
-
-ProcedureLinkageTable::~ProcedureLinkageTable() {
-}
-
-
-bool ProcedureLinkageTable::AllocateTable() {
- if (table_mmap_.get()) {
- return true;
- }
-
- // Allocate the PLT
- byte* suggested_table_addr = reinterpret_cast<byte*>(kTableAddress);
-
- UniquePtr<MemMap> table_mmap(
- MemMap::MapAnonymous(".plt", suggested_table_addr,
- GetTableSizeInBytes(), PROT_READ | PROT_WRITE));
-
- if (!table_mmap.get()) {
- return false;
- }
-
- if (table_mmap->Begin() != suggested_table_addr) {
- // Our PLT should be allocated at the FIXED address
- return false;
- }
-
- // Create the stubs in the PLT
- byte* stub_ptr = table_mmap->Begin();
- size_t stub_size = GetStubSizeInBytes();
-
- for (size_t i = 0; i < art_runtime_func_count; ++i, stub_ptr += stub_size) {
- const char* name = art_runtime_func_name_list[i];
- void* func = art_portable_find_runtime_support_func(NULL, name);
- DCHECK(func != NULL);
- CreateStub(stub_ptr, func);
- }
-
- const char* const* crt_name_list = NULL;
- size_t crt_count = 0u;
-
- switch (insn_set_) {
- case kArm:
- case kThumb2:
- crt_name_list = compiler_runtime_func_name_list_arm;
- crt_count = compiler_runtime_func_count_arm;
- break;
-
- case kMips:
- crt_name_list = compiler_runtime_func_name_list_mips;
- crt_count = compiler_runtime_func_count_mips;
- break;
-
- case kX86:
- crt_name_list = compiler_runtime_func_name_list_x86;
- crt_count = compiler_runtime_func_count_x86;
- break;
-
- default:
- LOG(FATAL) << "Unknown instruction set: " << insn_set_;
- return false;
- }
-
- for (size_t i = 0; i < crt_count; ++i, stub_ptr += stub_size) {
- void* func = art_portable_find_runtime_support_func(NULL, crt_name_list[i]);
- DCHECK(func != NULL);
- CreateStub(stub_ptr, func);
- }
-
- // Protect the procedure linkage table
- table_mmap->Protect(PROT_READ | PROT_EXEC);
-
- // Flush the instruction cache on specific architecture
-#if defined(__arm__) || defined(__mips__)
- cacheflush(reinterpret_cast<long int>(table_mmap->Begin()),
- reinterpret_cast<long int>(table_mmap->End()), 0);
-#endif
-
- // Transfer the ownership
- table_mmap_.reset(table_mmap.release());
-
- return true;
-}
-
-
-uintptr_t ProcedureLinkageTable::GetEntryAddress(const char* name) const {
- int func_idx = IndexOfRuntimeFunc(name);
- if (func_idx == -1) {
- return 0u;
- }
-
- return (kTableAddress + func_idx * GetStubSizeInBytes());
-}
-
-
-
-int ProcedureLinkageTable::IndexOfRuntimeFunc(const char* name) const {
- int result = IndexOfCompilerRuntimeFunc(name);
- if (result != -1) {
- return art_runtime_func_count + result;
- }
-
- return IndexOfArtRuntimeFunc(name);
-}
-
-
-int ProcedureLinkageTable::IndexOfArtRuntimeFunc(const char* name) {
- for (size_t i = 0; i < art_runtime_func_count; ++i) {
- if (strcmp(name, art_runtime_func_name_list[i]) == 0) {
- return static_cast<int>(i);
- }
- }
- return -1;
-}
-
-int ProcedureLinkageTable::IndexOfCompilerRuntimeFunc(InstructionSet insn_set,
- const char* name) {
- const char* const* rt_begin = NULL;
- const char* const* rt_end = NULL;
-
- switch (insn_set) {
- case kArm:
- case kThumb2:
- rt_begin = compiler_runtime_func_name_list_arm;
- rt_end = compiler_runtime_func_name_list_arm +
- compiler_runtime_func_count_arm;
- break;
-
- case kMips:
- rt_begin = compiler_runtime_func_name_list_mips;
- rt_end = compiler_runtime_func_name_list_mips +
- compiler_runtime_func_count_mips;
- break;
-
- case kX86:
- rt_begin = compiler_runtime_func_name_list_x86;
- rt_end = compiler_runtime_func_name_list_x86 +
- compiler_runtime_func_count_x86;
- break;
-
- default:
- LOG(FATAL) << "Unknown instruction set: " << insn_set;
- return -1;
- }
-
- const char* const* name_lbound_ptr =
- std::lower_bound(rt_begin, rt_end, name, CStringLessThanComparator());
-
- if (name_lbound_ptr < rt_end && strcmp(*name_lbound_ptr, name) == 0) {
- return (name_lbound_ptr - rt_begin);
- } else {
- return -1;
- }
-}
-
-
-size_t ProcedureLinkageTable::GetStubCount(InstructionSet insn_set) {
- switch (insn_set) {
- case kArm:
- case kThumb2:
- return art_runtime_func_count + compiler_runtime_func_count_arm;
-
- case kMips:
- return art_runtime_func_count + compiler_runtime_func_count_mips;
-
- case kX86:
- return art_runtime_func_count + compiler_runtime_func_count_x86;
-
- default:
- LOG(FATAL) << "Unknown instruction set: " << insn_set;
- return 0u;
- }
-}
-
-
-size_t ProcedureLinkageTable::GetStubSizeInBytes(InstructionSet insn_set) {
- switch (insn_set) {
- case kArm:
- case kThumb2:
- return 8u;
-
- case kMips:
- return 16u;
-
- case kX86:
- return 8u;
-
- default:
- LOG(FATAL) << "Unknown instruction set: " << insn_set;
- return 0u;
- }
-}
-
-
-void ProcedureLinkageTable::CreateStub(InstructionSet insn_set,
- byte* stub, void* dest_) {
- switch (insn_set) {
- case kArm:
- case kThumb2:
- {
- uint32_t dest = static_cast<uint32_t>(
- reinterpret_cast<uintptr_t>(dest_) & 0xfffffffful);
- uint32_t* stub_w = reinterpret_cast<uint32_t*>(stub);
-
- stub_w[0] = 0xe51ff004ul; // ldr pc, [pc #-4]
- stub_w[1] = dest;
- }
- break;
-
- case kMips:
- {
- uint32_t dest = static_cast<uint32_t>(
- reinterpret_cast<uintptr_t>(dest_) & 0xfffffffful);
- uint32_t* stub_w = reinterpret_cast<uint32_t*>(stub);
-
- stub_w[0] = 0x3c190000ul | ((dest >> 16) & 0xfffful); // lui
- stub_w[1] = 0x37390000ul | (dest & 0xfffful);; // ori
- stub_w[2] = 0x03200008ul; // jr (jump register)
- stub_w[3] = 0x00000000ul; // nop
- }
- break;
-
- case kX86:
- {
- uint32_t off = static_cast<uint32_t>(
- reinterpret_cast<uintptr_t>(dest_) -
- reinterpret_cast<uintptr_t>(stub + 1) - 4);
- // jmp (32-bit offset)
- stub[0] = 0xe9u;
- stub[1] = off & 0xffu;
- stub[2] = (off >> 8) & 0xffu;
- stub[2] = (off >> 16) & 0xffu;
- stub[2] = (off >> 24) & 0xffu;
- }
- break;
-
- default:
- LOG(FATAL) << "Unknown instruction set: " << insn_set;
- }
-}
-
-
-} // namespace llvm
-} // namespace art
diff --git a/src/compiler/llvm/procedure_linkage_table.h b/src/compiler/llvm/procedure_linkage_table.h
deleted file mode 100644
index 1c89d29..0000000
--- a/src/compiler/llvm/procedure_linkage_table.h
+++ /dev/null
@@ -1,85 +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.
- */
-
-#ifndef ART_SRC_COMPILER_LLVM_PROCEDURE_LINKAGE_TABLE_H_
-#define ART_SRC_COMPILER_LLVM_PROCEDURE_LINKAGE_TABLE_H_
-
-#include "globals.h"
-#include "instruction_set.h"
-#include "mem_map.h"
-
-#include <UniquePtr.h>
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace art {
-namespace llvm {
-
-
-class ProcedureLinkageTable {
- public:
- ProcedureLinkageTable(InstructionSet insn_set);
-
- ~ProcedureLinkageTable();
-
- bool AllocateTable();
-
- uintptr_t GetEntryAddress(const char* func_name) const;
-
- private:
- static size_t GetStubCount(InstructionSet insn_set);
- static size_t GetStubSizeInBytes(InstructionSet insn_set);
- static void CreateStub(InstructionSet insn_set,
- byte* stub, void* branch_dest);
-
- int IndexOfRuntimeFunc(const char* name) const;
- static int IndexOfArtRuntimeFunc(const char* name);
- static int IndexOfCompilerRuntimeFunc(InstructionSet insn_set,
- const char* name);
-
- size_t GetStubCount() const {
- return GetStubCount(insn_set_);
- }
-
- size_t GetStubSizeInBytes() const {
- return GetStubSizeInBytes(insn_set_);
- }
-
- size_t GetTableSizeInBytes() const {
- return GetStubSizeInBytes() * GetStubCount();
- }
-
- void CreateStub(byte* stub, void* branch_dest) {
- return CreateStub(insn_set_, stub, branch_dest);
- }
-
- int IndexOfCompilerRuntimeFunc(const char* name) const {
- return IndexOfCompilerRuntimeFunc(insn_set_, name);
- }
-
- InstructionSet insn_set_;
- UniquePtr<MemMap> table_mmap_;
-
- static const size_t kTableSizeInBytes = 1024u;
- static const uintptr_t kTableAddress = 0x5fffc000u;
-};
-
-
-} // namespace llvm
-} // namespace art
-
-#endif // ART_SRC_COMPILER_LLVM_PROCEDURE_LINKAGE_TABLE_H_
diff --git a/src/compiler/llvm/runtime_support_llvm.cc b/src/compiler/llvm/runtime_support_llvm.cc
index ae8bb4a..b18eefe 100644
--- a/src/compiler/llvm/runtime_support_llvm.cc
+++ b/src/compiler/llvm/runtime_support_llvm.cc
@@ -20,7 +20,6 @@
#include "asm_support.h"
#include "class_linker.h"
#include "class_linker-inl.h"
-#include "compiler_runtime_func_list.h"
#include "dex_file.h"
#include "dex_instruction.h"
#include "mirror/abstract_method-inl.h"
@@ -743,46 +742,6 @@
return o;
}
-//----------------------------------------------------------------------------
-// Runtime Support Function Lookup Callback
-//----------------------------------------------------------------------------
-
-#define EXTERNAL_LINKAGE(NAME, RETURN_TYPE, ...) \
-extern "C" RETURN_TYPE NAME(__VA_ARGS__);
-COMPILER_RUNTIME_FUNC_LIST_NATIVE(EXTERNAL_LINKAGE)
-#undef EXTERNAL_LINKAGE
-
-static void* art_portable_find_compiler_runtime_func(const char* name) {
-// TODO: If target support some math func, use the target's version. (e.g. art_portable_d2i -> __aeabi_d2iz)
- static const char* const names[] = {
-#define DEFINE_ENTRY(NAME, RETURN_TYPE, ...) #NAME ,
- COMPILER_RUNTIME_FUNC_LIST_NATIVE(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- static void* const funcs[] = {
-#define DEFINE_ENTRY(NAME, RETURN_TYPE, ...) \
- reinterpret_cast<void*>(static_cast<RETURN_TYPE (*)(__VA_ARGS__)>(NAME)) ,
- COMPILER_RUNTIME_FUNC_LIST_NATIVE(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- static const size_t num_entries = sizeof(names) / sizeof(const char* const);
-
- const char* const* const names_begin = names;
- const char* const* const names_end = names + num_entries;
-
- const char* const* name_lbound_ptr =
- std::lower_bound(names_begin, names_end, name,
- CStringLessThanComparator());
-
- if (name_lbound_ptr < names_end && strcmp(*name_lbound_ptr, name) == 0) {
- return funcs[name_lbound_ptr - names_begin];
- } else {
- return NULL;
- }
-}
-
// Handler for invocation on proxy methods. Create a boxed argument array and invoke the invocation
// handler which is a field within the proxy object receiver. The var args encode the arguments
// with the last argument being a pointer to a JValue to store the result in.
@@ -860,43 +819,6 @@
}
}
-void* art_portable_find_runtime_support_func(void* context, const char* name) {
- struct func_entry_t {
- const char* name;
- size_t name_len;
- void* addr;
- };
-
- static struct func_entry_t const tab[] = {
-#define DEFINE_ENTRY(ID, NAME) \
- { #NAME, sizeof(#NAME) - 1, reinterpret_cast<void*>(NAME) },
- RUNTIME_SUPPORT_FUNC_LIST(DEFINE_ENTRY)
-#undef DEFINE_ENTRY
- };
-
- static size_t const tab_size = sizeof(tab) / sizeof(struct func_entry_t);
-
- // Search the compiler runtime (such as __divdi3)
- void* result = art_portable_find_compiler_runtime_func(name);
- if (result != NULL) {
- return result;
- }
-
- // Note: Since our table is small, we are using trivial O(n) searching
- // function. For bigger table, it will be better to use a binary
- // search or hash function.
- size_t i;
- size_t name_len = strlen(name);
- for (i = 0; i < tab_size; ++i) {
- if (name_len == tab[i].name_len && strcmp(name, tab[i].name) == 0) {
- return tab[i].addr;
- }
- }
-
- LOG(FATAL) << "Error: Can't find symbol " << name;
- return 0;
-}
-
//----------------------------------------------------------------------------
// Memory barrier
//----------------------------------------------------------------------------
diff --git a/src/compiler/llvm/utils_llvm.h b/src/compiler/llvm/utils_llvm.h
index e06e113..2e273f4 100644
--- a/src/compiler/llvm/utils_llvm.h
+++ b/src/compiler/llvm/utils_llvm.h
@@ -17,13 +17,8 @@
#ifndef ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_
-#include "base/stringprintf.h"
-
#include <llvm/Analysis/Verifier.h>
-#include <stdint.h>
-#include <string>
-
namespace art {
#ifndef NDEBUG
@@ -32,17 +27,6 @@
#define VERIFY_LLVM_FUNCTION(func)
#endif
-inline static std::string ElfFuncName(uint32_t idx) {
- return StringPrintf("Art%u", static_cast<unsigned int>(idx));
-}
-
-class CStringLessThanComparator {
- public:
- bool operator()(const char* lhs, const char* rhs) const {
- return (strcmp(lhs, rhs) < 0);
- }
-};
-
} // namespace art
#endif // ART_SRC_UTILS_LLVM_H_