summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Logan Chien <loganchien@google.com> 2012-03-17 20:08:29 +0800
committer Shih-wei Liao <sliao@google.com> 2012-03-26 20:55:39 -0700
commit6546ec57eefb0c28e79c0d80ed5a298c15aa8fbe (patch)
tree372d471f0d9603d3381a195b0eb5f2c386504adb
parentb9eaeeae2fb9785df112d8d9ccad6edfdb5926ec (diff)
Add ELF index to art::compiler_llvm::CompilationUnit.
We need an ELF index to remember which ELF image contains the CompiledMethod or CompiledInvokeStub. (cherry picked from commit df612fb98fabeec2fa7277c7ab332589fa38283c) Change-Id: Ic8a4aca7d030685e156c9f3fe632bf45a5c4d02b
-rw-r--r--src/compiler_llvm/compilation_unit.cc5
-rw-r--r--src/compiler_llvm/compilation_unit.h7
-rw-r--r--src/compiler_llvm/compiler_llvm.cc2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index f654e488b6..d548976d1f 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -60,8 +60,9 @@ namespace compiler_llvm {
llvm::Module* makeLLVMModuleContents(llvm::Module* module);
-CompilationUnit::CompilationUnit(InstructionSet insn_set)
-: insn_set_(insn_set), context_(new llvm::LLVMContext()), mem_usage_(0) {
+CompilationUnit::CompilationUnit(InstructionSet insn_set, size_t elf_idx)
+: insn_set_(insn_set), elf_idx_(elf_idx), context_(new llvm::LLVMContext()),
+ mem_usage_(0) {
// Create the module and include the runtime function declaration
module_ = new llvm::Module("art", *context_);
diff --git a/src/compiler_llvm/compilation_unit.h b/src/compiler_llvm/compilation_unit.h
index a0882bbd79..4a230952f8 100644
--- a/src/compiler_llvm/compilation_unit.h
+++ b/src/compiler_llvm/compilation_unit.h
@@ -36,10 +36,14 @@ class IRBuilder;
class CompilationUnit {
public:
- CompilationUnit(InstructionSet insn_set);
+ CompilationUnit(InstructionSet insn_set, size_t elf_idx);
~CompilationUnit();
+ size_t GetElfIndex() const {
+ return elf_idx_;
+ }
+
InstructionSet GetInstructionSet() const {
return insn_set_;
}
@@ -98,6 +102,7 @@ class CompilationUnit {
private:
InstructionSet insn_set_;
+ const size_t elf_idx_;
UniquePtr<llvm::LLVMContext> context_;
UniquePtr<IRBuilder> irb_;
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index 7563fe009d..d528615f7c 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -119,7 +119,7 @@ void CompilerLLVM::EnsureCompilationUnit() {
// Allocate compilation unit
size_t cunit_idx = cunits_.size();
- curr_cunit_ = new CompilationUnit(insn_set_);
+ curr_cunit_ = new CompilationUnit(insn_set_, cunit_idx);
// Setup output filename
curr_cunit_->SetElfFileName(