summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-03-13 17:55:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-03-13 17:55:44 +0000
commit9545a446e99b22248099fe66f5f9431530c20851 (patch)
tree359962d0a6a50f0c73f969d5ad67305de397e8a4
parent0d64958d157ff6a30cbbe79df14ee4c723d14754 (diff)
parent49161cef10a308aedada18e9aa742498d6e6c8c7 (diff)
downloadart-9545a446e99b22248099fe66f5f9431530c20851.zip
art-9545a446e99b22248099fe66f5f9431530c20851.tar.gz
art-9545a446e99b22248099fe66f5f9431530c20851.tar.bz2
Merge "Allow patching between dex files in the boot classpath."
-rw-r--r--compiler/dex/quick/codegen_util.cc56
-rw-r--r--compiler/dex/quick/gen_invoke.cc13
-rw-r--r--compiler/dex/quick/mir_to_lir.h8
-rw-r--r--compiler/dex/quick/x86/codegen_x86.h8
-rw-r--r--compiler/dex/quick/x86/target_x86.cc49
-rw-r--r--compiler/driver/compiler_driver.cc12
-rw-r--r--compiler/driver/compiler_driver.h14
-rw-r--r--compiler/image_writer.cc12
8 files changed, 104 insertions, 68 deletions
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index d095444..9e5ec6e 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -409,46 +409,52 @@ void Mir2Lir::InstallLiteralPools() {
// Push code and method literals, record offsets for the compiler to patch.
data_lir = code_literal_list_;
while (data_lir != NULL) {
- uint32_t target = data_lir->operands[0];
+ uint32_t target_method_idx = data_lir->operands[0];
+ const DexFile* target_dex_file =
+ reinterpret_cast<const DexFile*>(UnwrapPointer(data_lir->operands[1]));
cu_->compiler_driver->AddCodePatch(cu_->dex_file,
cu_->class_def_idx,
cu_->method_idx,
cu_->invoke_type,
- target,
- static_cast<InvokeType>(data_lir->operands[1]),
+ target_method_idx,
+ target_dex_file,
+ static_cast<InvokeType>(data_lir->operands[2]),
code_buffer_.size());
- const DexFile::MethodId& id = cu_->dex_file->GetMethodId(target);
+ const DexFile::MethodId& target_method_id = target_dex_file->GetMethodId(target_method_idx);
// unique value based on target to ensure code deduplication works
- PushPointer(code_buffer_, &id, cu_->target64);
+ PushPointer(code_buffer_, &target_method_id, cu_->target64);
data_lir = NEXT_LIR(data_lir);
}
data_lir = method_literal_list_;
while (data_lir != NULL) {
- uint32_t target = data_lir->operands[0];
+ uint32_t target_method_idx = data_lir->operands[0];
+ const DexFile* target_dex_file =
+ reinterpret_cast<const DexFile*>(UnwrapPointer(data_lir->operands[1]));
cu_->compiler_driver->AddMethodPatch(cu_->dex_file,
cu_->class_def_idx,
cu_->method_idx,
cu_->invoke_type,
- target,
- static_cast<InvokeType>(data_lir->operands[1]),
+ target_method_idx,
+ target_dex_file,
+ static_cast<InvokeType>(data_lir->operands[2]),
code_buffer_.size());
- const DexFile::MethodId& id = cu_->dex_file->GetMethodId(target);
+ const DexFile::MethodId& target_method_id = target_dex_file->GetMethodId(target_method_idx);
// unique value based on target to ensure code deduplication works
- PushPointer(code_buffer_, &id, cu_->target64);
+ PushPointer(code_buffer_, &target_method_id, cu_->target64);
data_lir = NEXT_LIR(data_lir);
}
// Push class literals.
data_lir = class_literal_list_;
while (data_lir != NULL) {
- uint32_t target = data_lir->operands[0];
+ uint32_t target_method_idx = data_lir->operands[0];
cu_->compiler_driver->AddClassPatch(cu_->dex_file,
cu_->class_def_idx,
cu_->method_idx,
- target,
+ target_method_idx,
code_buffer_.size());
- const DexFile::TypeId& id = cu_->dex_file->GetTypeId(target);
+ const DexFile::TypeId& target_method_id = cu_->dex_file->GetTypeId(target_method_idx);
// unique value based on target to ensure code deduplication works
- PushPointer(code_buffer_, &id, cu_->target64);
+ PushPointer(code_buffer_, &target_method_id, cu_->target64);
data_lir = NEXT_LIR(data_lir);
}
}
@@ -1196,22 +1202,28 @@ void Mir2Lir::AddSlowPath(LIRSlowPath* slowpath) {
slow_paths_.Insert(slowpath);
}
-void Mir2Lir::LoadCodeAddress(int dex_method_index, InvokeType type, SpecialTargetRegister symbolic_reg) {
- LIR* data_target = ScanLiteralPool(code_literal_list_, dex_method_index, 0);
+void Mir2Lir::LoadCodeAddress(const MethodReference& target_method, InvokeType type,
+ SpecialTargetRegister symbolic_reg) {
+ int target_method_idx = target_method.dex_method_index;
+ LIR* data_target = ScanLiteralPool(code_literal_list_, target_method_idx, 0);
if (data_target == NULL) {
- data_target = AddWordData(&code_literal_list_, dex_method_index);
- data_target->operands[1] = type;
+ data_target = AddWordData(&code_literal_list_, target_method_idx);
+ data_target->operands[1] = WrapPointer(const_cast<DexFile*>(target_method.dex_file));
+ data_target->operands[2] = type;
}
LIR* load_pc_rel = OpPcRelLoad(TargetReg(symbolic_reg), data_target);
AppendLIR(load_pc_rel);
DCHECK_NE(cu_->instruction_set, kMips) << reinterpret_cast<void*>(data_target);
}
-void Mir2Lir::LoadMethodAddress(int dex_method_index, InvokeType type, SpecialTargetRegister symbolic_reg) {
- LIR* data_target = ScanLiteralPool(method_literal_list_, dex_method_index, 0);
+void Mir2Lir::LoadMethodAddress(const MethodReference& target_method, InvokeType type,
+ SpecialTargetRegister symbolic_reg) {
+ int target_method_idx = target_method.dex_method_index;
+ LIR* data_target = ScanLiteralPool(method_literal_list_, target_method_idx, 0);
if (data_target == NULL) {
- data_target = AddWordData(&method_literal_list_, dex_method_index);
- data_target->operands[1] = type;
+ data_target = AddWordData(&method_literal_list_, target_method_idx);
+ data_target->operands[1] = WrapPointer(const_cast<DexFile*>(target_method.dex_file));
+ data_target->operands[2] = type;
}
LIR* load_pc_rel = OpPcRelLoad(TargetReg(symbolic_reg), data_target);
AppendLIR(load_pc_rel);
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index 419d0a9..5d2886e 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -412,14 +412,12 @@ static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info,
cg->LoadConstant(cg->TargetReg(kInvokeTgt), direct_code);
}
} else if (cu->instruction_set != kX86) {
- CHECK_EQ(cu->dex_file, target_method.dex_file);
- cg->LoadCodeAddress(target_method.dex_method_index, type, kInvokeTgt);
+ cg->LoadCodeAddress(target_method, type, kInvokeTgt);
}
if (direct_method != static_cast<unsigned int>(-1)) {
cg->LoadConstant(cg->TargetReg(kArg0), direct_method);
} else {
- CHECK_EQ(cu->dex_file, target_method.dex_file);
- cg->LoadMethodAddress(target_method.dex_method_index, type, kArg0);
+ cg->LoadMethodAddress(target_method, type, kArg0);
}
break;
default:
@@ -439,9 +437,8 @@ static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info,
if (direct_code != static_cast<unsigned int>(-1)) {
cg->LoadConstant(cg->TargetReg(kInvokeTgt), direct_code);
} else if (cu->instruction_set != kX86) {
- CHECK_EQ(cu->dex_file, target_method.dex_file);
CHECK_LT(target_method.dex_method_index, target_method.dex_file->NumMethodIds());
- cg->LoadCodeAddress(target_method.dex_method_index, type, kInvokeTgt);
+ cg->LoadCodeAddress(target_method, type, kInvokeTgt);
}
}
break;
@@ -534,7 +531,6 @@ static int NextInterfaceCallInsn(CompilationUnit* cu, CallInfo* info, int state,
switch (state) {
case 0: // Set target method index in case of conflict [set kHiddenArg, kHiddenFpArg (x86)]
- CHECK_EQ(cu->dex_file, target_method.dex_file);
CHECK_LT(target_method.dex_method_index, target_method.dex_file->NumMethodIds());
cg->LoadConstant(cg->TargetReg(kHiddenArg), target_method.dex_method_index);
if (cu->instruction_set == kX86) {
@@ -1489,8 +1485,7 @@ void Mir2Lir::GenInvokeNoInline(CallInfo* info) {
if (method_info.DirectCode() == static_cast<uintptr_t>(-1)) {
// We can have the linker fixup a call relative.
call_inst =
- reinterpret_cast<X86Mir2Lir*>(this)->CallWithLinkerFixup(
- target_method.dex_method_index, info->type);
+ reinterpret_cast<X86Mir2Lir*>(this)->CallWithLinkerFixup(target_method, info->type);
} else {
call_inst = OpMem(kOpBlx, TargetReg(kArg0),
mirror::ArtMethod::EntryPointFromQuickCompiledCodeOffset().Int32Value());
diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h
index 856318f..e2326bb 100644
--- a/compiler/dex/quick/mir_to_lir.h
+++ b/compiler/dex/quick/mir_to_lir.h
@@ -752,22 +752,22 @@ class Mir2Lir : public Backend {
/*
* @brief Load the address of the dex method into the register.
- * @param dex_method_index The index of the method to be invoked.
+ * @param target_method The MethodReference of the method to be invoked.
* @param type How the method will be invoked.
* @param register that will contain the code address.
* @note register will be passed to TargetReg to get physical register.
*/
- void LoadCodeAddress(int dex_method_index, InvokeType type,
+ void LoadCodeAddress(const MethodReference& target_method, InvokeType type,
SpecialTargetRegister symbolic_reg);
/*
* @brief Load the Method* of a dex method into the register.
- * @param dex_method_index The index of the method to be invoked.
+ * @param target_method The MethodReference of the method to be invoked.
* @param type How the method will be invoked.
* @param register that will contain the code address.
* @note register will be passed to TargetReg to get physical register.
*/
- virtual void LoadMethodAddress(int dex_method_index, InvokeType type,
+ virtual void LoadMethodAddress(const MethodReference& target_method, InvokeType type,
SpecialTargetRegister symbolic_reg);
/*
diff --git a/compiler/dex/quick/x86/codegen_x86.h b/compiler/dex/quick/x86/codegen_x86.h
index 7cc2c08..8269898 100644
--- a/compiler/dex/quick/x86/codegen_x86.h
+++ b/compiler/dex/quick/x86/codegen_x86.h
@@ -274,12 +274,12 @@ class X86Mir2Lir : public Mir2Lir {
/*
* @brief Load the Method* of a dex method into the register.
- * @param dex_method_index The index of the method to be invoked.
+ * @param target_method The MethodReference of the method to be invoked.
* @param type How the method will be invoked.
* @param register that will contain the code address.
* @note register will be passed to TargetReg to get physical register.
*/
- void LoadMethodAddress(int dex_method_index, InvokeType type,
+ void LoadMethodAddress(const MethodReference& target_method, InvokeType type,
SpecialTargetRegister symbolic_reg);
/*
@@ -292,11 +292,11 @@ class X86Mir2Lir : public Mir2Lir {
/*
* @brief Generate a relative call to the method that will be patched at link time.
- * @param dex_method_index The index of the method to be invoked.
+ * @param target_method The MethodReference of the method to be invoked.
* @param type How the method will be invoked.
* @returns Call instruction
*/
- LIR * CallWithLinkerFixup(int dex_method_index, InvokeType type);
+ LIR * CallWithLinkerFixup(const MethodReference& target_method, InvokeType type);
/*
* @brief Handle x86 specific literals
diff --git a/compiler/dex/quick/x86/target_x86.cc b/compiler/dex/quick/x86/target_x86.cc
index 5b6e119..c70efa4 100644
--- a/compiler/dex/quick/x86/target_x86.cc
+++ b/compiler/dex/quick/x86/target_x86.cc
@@ -832,19 +832,22 @@ void X86Mir2Lir::Materialize() {
Mir2Lir::Materialize();
}
-void X86Mir2Lir::LoadMethodAddress(int dex_method_index, InvokeType type,
+void X86Mir2Lir::LoadMethodAddress(const MethodReference& target_method, InvokeType type,
SpecialTargetRegister symbolic_reg) {
/*
* For x86, just generate a 32 bit move immediate instruction, that will be filled
* in at 'link time'. For now, put a unique value based on target to ensure that
* code deduplication works.
*/
- const DexFile::MethodId& id = cu_->dex_file->GetMethodId(dex_method_index);
- uintptr_t ptr = reinterpret_cast<uintptr_t>(&id);
+ int target_method_idx = target_method.dex_method_index;
+ const DexFile* target_dex_file = target_method.dex_file;
+ const DexFile::MethodId& target_method_id = target_dex_file->GetMethodId(target_method_idx);
+ uintptr_t target_method_id_ptr = reinterpret_cast<uintptr_t>(&target_method_id);
- // Generate the move instruction with the unique pointer and save index and type.
+ // Generate the move instruction with the unique pointer and save index, dex_file, and type.
LIR *move = RawLIR(current_dalvik_offset_, kX86Mov32RI, TargetReg(symbolic_reg),
- static_cast<int>(ptr), dex_method_index, type);
+ static_cast<int>(target_method_id_ptr), target_method_idx,
+ WrapPointer(const_cast<DexFile*>(target_dex_file)), type);
AppendLIR(move);
method_address_insns_.Insert(move);
}
@@ -865,18 +868,20 @@ void X86Mir2Lir::LoadClassType(uint32_t type_idx, SpecialTargetRegister symbolic
class_type_address_insns_.Insert(move);
}
-LIR *X86Mir2Lir::CallWithLinkerFixup(int dex_method_index, InvokeType type) {
+LIR *X86Mir2Lir::CallWithLinkerFixup(const MethodReference& target_method, InvokeType type) {
/*
* For x86, just generate a 32 bit call relative instruction, that will be filled
* in at 'link time'. For now, put a unique value based on target to ensure that
* code deduplication works.
*/
- const DexFile::MethodId& id = cu_->dex_file->GetMethodId(dex_method_index);
- uintptr_t ptr = reinterpret_cast<uintptr_t>(&id);
-
- // Generate the call instruction with the unique pointer and save index and type.
- LIR *call = RawLIR(current_dalvik_offset_, kX86CallI, static_cast<int>(ptr), dex_method_index,
- type);
+ int target_method_idx = target_method.dex_method_index;
+ const DexFile* target_dex_file = target_method.dex_file;
+ const DexFile::MethodId& target_method_id = target_dex_file->GetMethodId(target_method_idx);
+ uintptr_t target_method_id_ptr = reinterpret_cast<uintptr_t>(&target_method_id);
+
+ // Generate the call instruction with the unique pointer and save index, dex_file, and type.
+ LIR *call = RawLIR(current_dalvik_offset_, kX86CallI, static_cast<int>(target_method_id_ptr),
+ target_method_idx, WrapPointer(const_cast<DexFile*>(target_dex_file)), type);
AppendLIR(call);
call_method_insns_.Insert(call);
return call;
@@ -892,13 +897,16 @@ void X86Mir2Lir::InstallLiteralPools() {
for (uint32_t i = 0; i < method_address_insns_.Size(); i++) {
LIR* p = method_address_insns_.Get(i);
DCHECK_EQ(p->opcode, kX86Mov32RI);
- uint32_t target = p->operands[2];
+ uint32_t target_method_idx = p->operands[2];
+ const DexFile* target_dex_file =
+ reinterpret_cast<const DexFile*>(UnwrapPointer(p->operands[3]));
// The offset to patch is the last 4 bytes of the instruction.
int patch_offset = p->offset + p->flags.size - 4;
cu_->compiler_driver->AddMethodPatch(cu_->dex_file, cu_->class_def_idx,
cu_->method_idx, cu_->invoke_type,
- target, static_cast<InvokeType>(p->operands[3]),
+ target_method_idx, target_dex_file,
+ static_cast<InvokeType>(p->operands[4]),
patch_offset);
}
@@ -906,25 +914,28 @@ void X86Mir2Lir::InstallLiteralPools() {
for (uint32_t i = 0; i < class_type_address_insns_.Size(); i++) {
LIR* p = class_type_address_insns_.Get(i);
DCHECK_EQ(p->opcode, kX86Mov32RI);
- uint32_t target = p->operands[2];
+ uint32_t target_method_idx = p->operands[2];
// The offset to patch is the last 4 bytes of the instruction.
int patch_offset = p->offset + p->flags.size - 4;
cu_->compiler_driver->AddClassPatch(cu_->dex_file, cu_->class_def_idx,
- cu_->method_idx, target, patch_offset);
+ cu_->method_idx, target_method_idx, patch_offset);
}
// And now the PC-relative calls to methods.
for (uint32_t i = 0; i < call_method_insns_.Size(); i++) {
LIR* p = call_method_insns_.Get(i);
DCHECK_EQ(p->opcode, kX86CallI);
- uint32_t target = p->operands[1];
+ uint32_t target_method_idx = p->operands[1];
+ const DexFile* target_dex_file =
+ reinterpret_cast<const DexFile*>(UnwrapPointer(p->operands[2]));
// The offset to patch is the last 4 bytes of the instruction.
int patch_offset = p->offset + p->flags.size - 4;
cu_->compiler_driver->AddRelativeCodePatch(cu_->dex_file, cu_->class_def_idx,
- cu_->method_idx, cu_->invoke_type, target,
- static_cast<InvokeType>(p->operands[2]),
+ cu_->method_idx, cu_->invoke_type,
+ target_method_idx, target_dex_file,
+ static_cast<InvokeType>(p->operands[3]),
patch_offset, -4 /* offset */);
}
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 5ee31f7..bdf31ce 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1097,8 +1097,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(
@@ -1106,6 +1104,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;
}
}
@@ -1231,6 +1233,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_);
@@ -1239,6 +1242,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));
}
@@ -1247,6 +1251,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) {
@@ -1256,6 +1261,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));
@@ -1265,6 +1271,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_);
@@ -1273,6 +1280,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 71c431d..d88b2aa 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -316,6 +316,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_);
@@ -324,6 +325,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)
@@ -333,6 +335,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_);
@@ -449,6 +452,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_;
}
@@ -472,18 +478,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;
@@ -505,12 +514,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) {
}
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 8885652..5078182 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -757,20 +757,20 @@ static ArtMethod* GetTargetMethod(const CompilerDriver::CallPatchInformation* pa
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Thread* self = Thread::Current();
- SirtRef<mirror::DexCache> dex_cache(self, class_linker->FindDexCache(patch->GetDexFile()));
+ SirtRef<mirror::DexCache> dex_cache(self, class_linker->FindDexCache(*patch->GetTargetDexFile()));
SirtRef<mirror::ClassLoader> class_loader(self, nullptr);
- ArtMethod* method = class_linker->ResolveMethod(patch->GetDexFile(),
+ ArtMethod* method = class_linker->ResolveMethod(*patch->GetTargetDexFile(),
patch->GetTargetMethodIdx(),
dex_cache,
class_loader,
NULL,
patch->GetTargetInvokeType());
CHECK(method != NULL)
- << patch->GetDexFile().GetLocation() << " " << patch->GetTargetMethodIdx();
+ << patch->GetTargetDexFile()->GetLocation() << " " << patch->GetTargetMethodIdx();
CHECK(!method->IsRuntimeMethod())
- << patch->GetDexFile().GetLocation() << " " << patch->GetTargetMethodIdx();
+ << patch->GetTargetDexFile()->GetLocation() << " " << patch->GetTargetMethodIdx();
CHECK(dex_cache->GetResolvedMethods()->Get(patch->GetTargetMethodIdx()) == method)
- << patch->GetDexFile().GetLocation() << " " << patch->GetReferrerMethodIdx() << " "
+ << patch->GetTargetDexFile()->GetLocation() << " " << patch->GetReferrerMethodIdx() << " "
<< PrettyMethod(dex_cache->GetResolvedMethods()->Get(patch->GetTargetMethodIdx())) << " "
<< PrettyMethod(method);
return method;
@@ -864,7 +864,7 @@ void ImageWriter::SetPatchLocation(const CompilerDriver::PatchInformation* patch
if (kIsDebugBuild) {
if (patch->IsCall()) {
const CompilerDriver::CallPatchInformation* cpatch = patch->AsCall();
- const DexFile::MethodId& id = cpatch->GetDexFile().GetMethodId(cpatch->GetTargetMethodIdx());
+ const DexFile::MethodId& id = cpatch->GetTargetDexFile()->GetMethodId(cpatch->GetTargetMethodIdx());
uint32_t expected = reinterpret_cast<uintptr_t>(&id) & 0xFFFFFFFF;
uint32_t actual = *patch_location;
CHECK(actual == expected || actual == value) << std::hex