Allow patching between dex files in the boot classpath.
Change-Id: I53f219a5382d0fcd580e96e50025fdad4fc399df
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 7c4a6f7..afdc37c 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1120,8 +1120,6 @@
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 @@
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 @@
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 @@
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset));
}
@@ -1270,6 +1274,7 @@
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 @@
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset,
pc_relative_offset));
@@ -1288,6 +1294,7 @@
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 @@
referrer_method_idx,
referrer_invoke_type,
target_method_idx,
+ target_dex_file,
target_invoke_type,
literal_offset));
}