summaryrefslogtreecommitdiffstats
path: root/compiler/driver
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-03-12 11:05:25 -0700
committerJeff Hao <jeffhao@google.com>2014-03-12 18:06:51 -0700
commit49161cef10a308aedada18e9aa742498d6e6c8c7 (patch)
treeb5ea61ffc97dd043a00e8dd7746788d9d96b9dd0 /compiler/driver
parentca46e2003360b44f4c043f6da87092592bc3d6d6 (diff)
downloadart-49161cef10a308aedada18e9aa742498d6e6c8c7.tar.gz
art-49161cef10a308aedada18e9aa742498d6e6c8c7.tar.bz2
art-49161cef10a308aedada18e9aa742498d6e6c8c7.zip
Allow patching between dex files in the boot classpath.
Change-Id: I53f219a5382d0fcd580e96e50025fdad4fc399df
Diffstat (limited to 'compiler/driver')
-rw-r--r--compiler/driver/compiler_driver.cc12
-rw-r--r--compiler/driver/compiler_driver.h14
2 files changed, 22 insertions, 4 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 7c4a6f7c1..afdc37c71 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1120,8 +1120,6 @@ void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType* type, InvokeType
if (target_method->dex_file == method->GetDeclaringClass()->GetDexCache()->GetDexFile()) {
target_method->dex_method_index = method->GetDexMethodIndex();
} else {
- // TODO: support patching from one dex file to another in the boot image.
- use_dex_cache = use_dex_cache || compiling_boot;
if (no_guarantee_of_dex_cache_entry) {
// See if the method is also declared in this dex cache.
uint32_t dex_method_idx = MethodHelper(method).FindDexMethodIndexInOtherDexFile(
@@ -1129,6 +1127,10 @@ void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType* type, InvokeType
if (dex_method_idx != DexFile::kDexNoIndex) {
target_method->dex_method_index = dex_method_idx;
} else {
+ if (compiling_boot) {
+ target_method->dex_method_index = method->GetDexMethodIndex();
+ target_method->dex_file = method->GetDeclaringClass()->GetDexCache()->GetDexFile();
+ }
must_use_direct_pointers = true;
}
}
@@ -1254,6 +1256,7 @@ void CompilerDriver::AddCodePatch(const DexFile* dex_file,
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset) {
MutexLock mu(Thread::Current(), compiled_methods_lock_);
@@ -1262,6 +1265,7 @@ void CompilerDriver::AddCodePatch(const DexFile* dex_file,
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset));
}
@@ -1270,6 +1274,7 @@ void CompilerDriver::AddRelativeCodePatch(const DexFile* dex_file,
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset,
int32_t pc_relative_offset) {
@@ -1279,6 +1284,7 @@ void CompilerDriver::AddRelativeCodePatch(const DexFile* dex_file,
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset,
pc_relative_offset));
@@ -1288,6 +1294,7 @@ void CompilerDriver::AddMethodPatch(const DexFile* dex_file,
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset) {
MutexLock mu(Thread::Current(), compiled_methods_lock_);
@@ -1296,6 +1303,7 @@ void CompilerDriver::AddMethodPatch(const DexFile* dex_file,
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset));
}
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 26210c944..e0f3a1a2b 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -323,6 +323,7 @@ class CompilerDriver {
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset)
LOCKS_EXCLUDED(compiled_methods_lock_);
@@ -331,6 +332,7 @@ class CompilerDriver {
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset,
int32_t pc_relative_offset)
@@ -340,6 +342,7 @@ class CompilerDriver {
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset)
LOCKS_EXCLUDED(compiled_methods_lock_);
@@ -456,6 +459,9 @@ class CompilerDriver {
uint32_t GetTargetMethodIdx() const {
return target_method_idx_;
}
+ const DexFile* GetTargetDexFile() const {
+ return target_dex_file_;
+ }
InvokeType GetTargetInvokeType() const {
return target_invoke_type_;
}
@@ -479,18 +485,21 @@ class CompilerDriver {
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset)
: PatchInformation(dex_file, referrer_class_def_idx,
referrer_method_idx, literal_offset),
referrer_invoke_type_(referrer_invoke_type),
target_method_idx_(target_method_idx),
+ target_dex_file_(target_dex_file),
target_invoke_type_(target_invoke_type) {
}
private:
const InvokeType referrer_invoke_type_;
const uint32_t target_method_idx_;
+ const DexFile* target_dex_file_;
const InvokeType target_invoke_type_;
friend class CompilerDriver;
@@ -512,12 +521,13 @@ class CompilerDriver {
uint32_t referrer_method_idx,
InvokeType referrer_invoke_type,
uint32_t target_method_idx,
+ const DexFile* target_dex_file,
InvokeType target_invoke_type,
size_t literal_offset,
int32_t pc_relative_offset)
: CallPatchInformation(dex_file, referrer_class_def_idx,
- referrer_method_idx, referrer_invoke_type,
- target_method_idx, target_invoke_type, literal_offset),
+ referrer_method_idx, referrer_invoke_type, target_method_idx,
+ target_dex_file, target_invoke_type, literal_offset),
offset_(pc_relative_offset) {
}