diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/jni_internal.cc | 4 | ||||
-rw-r--r-- | runtime/mirror/class-inl.h | 2 | ||||
-rw-r--r-- | runtime/oat.cc | 2 | ||||
-rw-r--r-- | runtime/thread.cc | 52 |
4 files changed, 34 insertions, 26 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index 412f96e4af..df863f07b7 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -291,8 +291,8 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con Class* field_type; ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); if (sig[1] != '\0') { - ClassLoader* cl = GetClassLoader(soa); - field_type = class_linker->FindClass(sig, cl); + SirtRef<mirror::ClassLoader> class_loader(soa.Self(), c->GetClassLoader()); + field_type = class_linker->FindClass(sig, class_loader.get()); } else { field_type = class_linker->FindPrimitiveClass(*sig); } diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h index 1e1138745d..998ebe1a8f 100644 --- a/runtime/mirror/class-inl.h +++ b/runtime/mirror/class-inl.h @@ -241,7 +241,7 @@ inline ArtMethod* Class::FindVirtualMethodForVirtualOrInterface(ArtMethod* metho if (method->IsDirect()) { return method; } - if (method->GetDeclaringClass()->IsInterface()) { + if (method->GetDeclaringClass()->IsInterface() && !method->IsMiranda()) { return FindVirtualMethodForInterface(method); } return FindVirtualMethodForVirtual(method); diff --git a/runtime/oat.cc b/runtime/oat.cc index c01f77c364..6fe5d1097b 100644 --- a/runtime/oat.cc +++ b/runtime/oat.cc @@ -22,7 +22,7 @@ namespace art { const uint8_t OatHeader::kOatMagic[] = { 'o', 'a', 't', '\n' }; -const uint8_t OatHeader::kOatVersion[] = { '0', '0', '7', '\0' }; +const uint8_t OatHeader::kOatVersion[] = { '0', '0', '8', '\0' }; OatHeader::OatHeader() { memset(this, 0, sizeof(*this)); diff --git a/runtime/thread.cc b/runtime/thread.cc index 60a3bf8196..25418a9758 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1332,7 +1332,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { return true; // Ignore runtime frames (in particular callee save). } method_trace_->Set(count_, m); - dex_pc_trace_->Set(count_, GetDexPc()); + dex_pc_trace_->Set(count_, m->IsProxyMethod() ? DexFile::kDexNoIndex : GetDexPc()); ++count_; return true; } @@ -1384,7 +1384,6 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job mirror::ObjectArray<mirror::Object>* method_trace = soa.Decode<mirror::ObjectArray<mirror::Object>*>(internal); int32_t depth = method_trace->GetLength() - 1; - mirror::IntArray* pc_trace = down_cast<mirror::IntArray*>(method_trace->Get(depth)); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -1413,19 +1412,34 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job for (int32_t i = 0; i < depth; ++i) { // Prepare parameters for StackTraceElement(String cls, String method, String file, int line) mirror::ArtMethod* method = down_cast<mirror::ArtMethod*>(method_trace->Get(i)); - mh.ChangeMethod(method); - uint32_t dex_pc = pc_trace->Get(i); - int32_t line_number = mh.GetLineNumFromDexPC(dex_pc); - // Allocate element, potentially triggering GC - // TODO: reuse class_name_object via Class::name_? - const char* descriptor = mh.GetDeclaringClassDescriptor(); - CHECK(descriptor != NULL); - std::string class_name(PrettyDescriptor(descriptor)); - SirtRef<mirror::String> class_name_object(soa.Self(), - mirror::String::AllocFromModifiedUtf8(soa.Self(), - class_name.c_str())); - if (class_name_object.get() == NULL) { - return NULL; + MethodHelper mh(method); + int32_t line_number; + SirtRef<mirror::String> class_name_object(soa.Self(), nullptr); + SirtRef<mirror::String> source_name_object(soa.Self(), nullptr); + if (method->IsProxyMethod()) { + line_number = -1; + class_name_object.reset(method->GetDeclaringClass()->GetName()); + // source_name_object intentionally left null for proxy methods + } else { + mirror::IntArray* pc_trace = down_cast<mirror::IntArray*>(method_trace->Get(depth)); + uint32_t dex_pc = pc_trace->Get(i); + line_number = mh.GetLineNumFromDexPC(dex_pc); + // Allocate element, potentially triggering GC + // TODO: reuse class_name_object via Class::name_? + const char* descriptor = mh.GetDeclaringClassDescriptor(); + CHECK(descriptor != nullptr); + std::string class_name(PrettyDescriptor(descriptor)); + class_name_object.reset(mirror::String::AllocFromModifiedUtf8(soa.Self(), class_name.c_str())); + if (class_name_object.get() == nullptr) { + return nullptr; + } + const char* source_file = mh.GetDeclaringClassSourceFile(); + if (source_file != nullptr) { + source_name_object.reset(mirror::String::AllocFromModifiedUtf8(soa.Self(), source_file)); + if (source_name_object.get() == nullptr) { + return nullptr; + } + } } const char* method_name = mh.GetName(); CHECK(method_name != NULL); @@ -1435,14 +1449,8 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job if (method_name_object.get() == NULL) { return NULL; } - const char* source_file = mh.GetDeclaringClassSourceFile(); - SirtRef<mirror::String> source_name_object(soa.Self(), mirror::String::AllocFromModifiedUtf8(soa.Self(), - source_file)); mirror::StackTraceElement* obj = mirror::StackTraceElement::Alloc(soa.Self(), - class_name_object.get(), - method_name_object.get(), - source_name_object.get(), - line_number); + class_name_object.get(), method_name_object.get(), source_name_object.get(), line_number); if (obj == NULL) { return NULL; } |