summaryrefslogtreecommitdiffstats
path: root/runtime/gc
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2015-05-21 12:05:27 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2015-05-22 11:42:29 -0700
commit08d1b5f2296c0f51507b8b443f4e39dfc161572c (patch)
tree90e2c9952949faa8ba8a24285d8afa03e3d8b04c /runtime/gc
parentd58a6deedabf98e7996634bca6d94c6eb2ac3861 (diff)
downloadart-08d1b5f2296c0f51507b8b443f4e39dfc161572c.zip
art-08d1b5f2296c0f51507b8b443f4e39dfc161572c.tar.gz
art-08d1b5f2296c0f51507b8b443f4e39dfc161572c.tar.bz2
Fix for potential moving GC bugs around proxy class.
- Handlerize proxy_class which is live across multiple allocation points in ClassLinker::CreateProxyClass(). - In ClassLinker::CreateProxyClass(), insert a proxy class into the class table before creating ArtFields for it (and update it later in LinkClass()) because the field roots (ArtField::declaring_class_) won't be updated by GC unless the class is in the class table. If GC happens before they are updated by FixupTemporaryDeclaringClass() from LinkClass(), FixupTemporaryDeclaringClass() may not update the field roots correctly because the old class may already be moved but the fields roots may not. Reduce a window of time where the fields roots could be stale. - In ClassLinker::LinkClass(), directly wrap a new class in a handle to avoid a window of time where new_class may be potentially stale. - Print more diagnostic info about the holder of the field upon a mark sweep invalid ref crash. - Add an additional sanity check in Field::GetArtField(). Bug: 20557050 Change-Id: I9ad32d304922da96b7e1fad262d97de21cbac776
Diffstat (limited to 'runtime/gc')
-rw-r--r--runtime/gc/collector/mark_sweep.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 5401b56..2db5650 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -389,6 +389,9 @@ class MarkSweepMarkObjectSlowPath {
ArtField* field = holder_->FindFieldByOffset(offset_);
LOG(INTERNAL_FATAL) << "Field info: "
<< " holder=" << holder_
+ << " holder is "
+ << (mark_sweep_->GetHeap()->IsLiveObjectLocked(holder_)
+ ? "alive" : "dead")
<< " holder_size=" << holder_size
<< " holder_type=" << PrettyTypeOf(holder_)
<< " offset=" << offset_.Uint32Value()
@@ -404,6 +407,12 @@ class MarkSweepMarkObjectSlowPath {
? holder_->AsClass()->NumReferenceStaticFields()
: holder_->GetClass()->NumReferenceInstanceFields())
<< "\n";
+ // Print the memory content of the holder.
+ for (size_t i = 0; i < holder_size / sizeof(uint32_t); ++i) {
+ uint32_t* p = reinterpret_cast<uint32_t*>(holder_);
+ LOG(INTERNAL_FATAL) << &p[i] << ": " << "holder+" << (i * sizeof(uint32_t)) << " = "
+ << std::hex << p[i];
+ }
}
PrintFileToLog("/proc/self/maps", LogSeverity::INTERNAL_FATAL);
MemMap::DumpMaps(LOG(INTERNAL_FATAL), true);