summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/common_throws.cc20
-rw-r--r--runtime/entrypoints/quick/quick_trampoline_entrypoints.cc4
2 files changed, 9 insertions, 15 deletions
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 7a08cb3df4..0dc07231b6 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -436,20 +436,15 @@ static void ThrowNullPointerExceptionForMethodAccessImpl(uint32_t method_idx,
ThrowException("Ljava/lang/NullPointerException;", nullptr, msg.str().c_str());
}
-void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx,
- InvokeType type) {
- ObjPtr<mirror::DexCache> dex_cache =
- Thread::Current()->GetCurrentMethod(nullptr)->GetDeclaringClass()->GetDexCache();
- const DexFile& dex_file = *dex_cache->GetDexFile();
+void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx, InvokeType type) {
+ const DexFile& dex_file = *Thread::Current()->GetCurrentMethod(nullptr)->GetDexFile();
ThrowNullPointerExceptionForMethodAccessImpl(method_idx, dex_file, type);
}
-void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method,
- InvokeType type) {
- ObjPtr<mirror::DexCache> dex_cache = method->GetDeclaringClass()->GetDexCache();
- const DexFile& dex_file = *dex_cache->GetDexFile();
+void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method, InvokeType type) {
ThrowNullPointerExceptionForMethodAccessImpl(method->GetDexMethodIndex(),
- dex_file, type);
+ *method->GetDexFile(),
+ type);
}
static bool IsValidReadBarrierImplicitCheck(uintptr_t addr) {
@@ -577,7 +572,7 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) {
CHECK_LT(throw_dex_pc, accessor.InsnsSizeInCodeUnits());
const Instruction& instr = accessor.InstructionAt(throw_dex_pc);
if (check_address && !IsValidImplicitCheck(addr, instr)) {
- const DexFile* dex_file = method->GetDeclaringClass()->GetDexCache()->GetDexFile();
+ const DexFile* dex_file = method->GetDexFile();
LOG(FATAL) << "Invalid address for an implicit NullPointerException check: "
<< "0x" << std::hex << addr << std::dec
<< ", at "
@@ -717,8 +712,7 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) {
break;
}
default: {
- const DexFile* dex_file =
- method->GetDeclaringClass()->GetDexCache()->GetDexFile();
+ const DexFile* dex_file = method->GetDexFile();
LOG(FATAL) << "NullPointerException at an unexpected instruction: "
<< instr.DumpString(dex_file)
<< " in "
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 147249000f..c7fa109e31 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2515,7 +2515,7 @@ static TwoWordReturn artInvokeCommon(uint32_t method_idx,
ArtMethod* caller_method = QuickArgumentVisitor::GetCallingMethod(sp);
ArtMethod* method = FindMethodFast<type, access_check>(method_idx, this_object, caller_method);
if (UNLIKELY(method == nullptr)) {
- const DexFile* dex_file = caller_method->GetDeclaringClass()->GetDexCache()->GetDexFile();
+ const DexFile* dex_file = caller_method->GetDexFile();
uint32_t shorty_len;
const char* shorty = dex_file->GetMethodShorty(dex_file->GetMethodId(method_idx), &shorty_len);
{
@@ -2648,7 +2648,7 @@ extern "C" TwoWordReturn artInvokeInterfaceTrampoline(ArtMethod* interface_metho
dex_method_idx = instr.VRegB_3rc();
}
- const DexFile& dex_file = caller_method->GetDeclaringClass()->GetDexFile();
+ const DexFile& dex_file = *caller_method->GetDexFile();
uint32_t shorty_len;
const char* shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(dex_method_idx),
&shorty_len);