summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-03-03 16:11:42 -0800
committerMathieu Chartier <mathieuc@google.com>2014-03-03 16:40:42 -0800
commitc2f4d0240b3a9b905dff5b546924865f15241481 (patch)
tree133e39fac183d8ea0818f93b8e5e88f4221b9555 /runtime
parent6b8c503c6df887ff30f478ab58bdfdb223492f45 (diff)
downloadart-c2f4d0240b3a9b905dff5b546924865f15241481.zip
art-c2f4d0240b3a9b905dff5b546924865f15241481.tar.gz
art-c2f4d0240b3a9b905dff5b546924865f15241481.tar.bz2
Fix SafePrettyTypeOf to never call VerifyObject.
Calling VerifyObject from the segfault handler caused another segfault. Change-Id: I459646594d830cbb110a4ac2bac25a7b90794854
Diffstat (limited to 'runtime')
-rw-r--r--runtime/gc/accounting/card_table-inl.h1
-rw-r--r--runtime/gc/heap.cc8
-rw-r--r--runtime/mirror/class-inl.h3
-rw-r--r--runtime/mirror/class.h5
-rw-r--r--runtime/runtime_android.cc4
-rw-r--r--runtime/runtime_linux.cc4
6 files changed, 17 insertions, 8 deletions
diff --git a/runtime/gc/accounting/card_table-inl.h b/runtime/gc/accounting/card_table-inl.h
index 841f4ae..564168e 100644
--- a/runtime/gc/accounting/card_table-inl.h
+++ b/runtime/gc/accounting/card_table-inl.h
@@ -154,6 +154,7 @@ inline void CardTable::ModifyCardsAtomic(byte* scan_begin, byte* scan_end, const
// Now we have the words, we can process words in parallel.
uintptr_t* word_cur = reinterpret_cast<uintptr_t*>(card_cur);
uintptr_t* word_end = reinterpret_cast<uintptr_t*>(card_end);
+ // TODO: This is not big endian safe.
union {
uintptr_t expected_word;
uint8_t expected_bytes[sizeof(uintptr_t)];
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 9ad21cf..af6e3b0 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -329,10 +329,10 @@ std::string Heap::SafeGetClassDescriptor(mirror::Class* klass) {
return result;
} else if (UNLIKELY(klass->IsPrimitive<kVerifyNone>())) {
return Primitive::Descriptor(klass->GetPrimitiveType<kVerifyNone>());
- } else if (UNLIKELY(klass->IsProxyClass())) {
+ } else if (UNLIKELY(klass->IsProxyClass<kVerifyNone>())) {
return Runtime::Current()->GetClassLinker()->GetDescriptorForProxy(klass);
} else {
- mirror::DexCache* dex_cache = klass->GetDexCache();
+ mirror::DexCache* dex_cache = klass->GetDexCache<kVerifyNone>();
if (!IsValidContinuousSpaceObjectAddress(dex_cache)) {
return StringPrintf("<non heap address dex_cache %p>", dex_cache);
}
@@ -357,7 +357,7 @@ std::string Heap::SafePrettyTypeOf(mirror::Object* obj) {
}
std::string result(SafeGetClassDescriptor(klass));
if (obj->IsClass()) {
- result += "<" + SafeGetClassDescriptor(obj->AsClass()) + ">";
+ result += "<" + SafeGetClassDescriptor(obj->AsClass<kVerifyNone>()) + ">";
}
return result;
}
@@ -393,7 +393,7 @@ void Heap::DumpObject(std::ostream& stream, mirror::Object* obj) {
if (space != nullptr) {
stream << " in space " << *space;
}
- mirror::Class* klass = obj->GetClass();
+ mirror::Class* klass = obj->GetClass<kVerifyNone>();
stream << "\nclass=" << klass;
if (klass != nullptr) {
stream << " type= " << SafePrettyTypeOf(obj);
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index e82c393..e3f4eed 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -49,8 +49,9 @@ inline ClassLoader* Class::GetClassLoader() {
return GetFieldObject<ClassLoader>(OFFSET_OF_OBJECT_MEMBER(Class, class_loader_), false);
}
+template<VerifyObjectFlags kVerifyFlags>
inline DexCache* Class::GetDexCache() {
- return GetFieldObject<DexCache>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), false);
+ return GetFieldObject<DexCache, kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), false);
}
inline ObjectArray<ArtMethod>* Class::GetDirectMethods() {
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 43db996..f9a5ea2 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -276,11 +276,13 @@ class MANAGED Class : public Object {
// Computes the name, then sets the cached value.
String* ComputeName() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsProxyClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
// Read access flags without using getter as whether something is a proxy can be check in
// any loaded state
// TODO: switch to a check if the super class is java.lang.reflect.Proxy?
- uint32_t access_flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
+ uint32_t access_flags = GetField32<kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_),
+ false);
return (access_flags & kAccClassIsProxy) != 0;
}
@@ -567,6 +569,7 @@ class MANAGED Class : public Object {
void DumpClass(std::ostream& os, int flags) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void SetDexCache(DexCache* new_dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
diff --git a/runtime/runtime_android.cc b/runtime/runtime_android.cc
index 14e5574..a237722 100644
--- a/runtime/runtime_android.cc
+++ b/runtime/runtime_android.cc
@@ -27,6 +27,8 @@
namespace art {
+static constexpr bool kDumpHeapObjectOnSigsevg = false;
+
struct sigaction old_action;
void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_context) {
static bool handlingUnexpectedSignal = false;
@@ -44,7 +46,7 @@ void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_contex
// Print this out first in case DumpObject faults.
LOG(INTERNAL_FATAL) << "Fault message: " << runtime->GetFaultMessage();
gc::Heap* heap = runtime->GetHeap();
- if (heap != nullptr && info != nullptr) {
+ if (kDumpHeapObjectOnSigsevg && heap != nullptr && info != nullptr) {
LOG(INTERNAL_FATAL) << "Dump heap object at fault address: ";
heap->DumpObject(LOG(INTERNAL_FATAL), reinterpret_cast<mirror::Object*>(info->si_addr));
}
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc
index f15e0bf..da1b2ca 100644
--- a/runtime/runtime_linux.cc
+++ b/runtime/runtime_linux.cc
@@ -29,6 +29,8 @@
namespace art {
+static constexpr bool kDumpHeapObjectOnSigsevg = false;
+
struct Backtrace {
void Dump(std::ostream& os) {
DumpNativeStack(os, GetTid(), "\t", true);
@@ -309,7 +311,7 @@ void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_contex
if (runtime != nullptr) {
gc::Heap* heap = runtime->GetHeap();
LOG(INTERNAL_FATAL) << "Fault message: " << runtime->GetFaultMessage();
- if (heap != nullptr && info != nullptr) {
+ if (kDumpHeapObjectOnSigsevg && heap != nullptr && info != nullptr) {
LOG(INTERNAL_FATAL) << "Dump heap object at fault address: ";
heap->DumpObject(LOG(INTERNAL_FATAL), reinterpret_cast<mirror::Object*>(info->si_addr));
}