summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lokesh Gidra <lokeshgidra@google.com> 2023-03-31 16:20:11 +0000
committer Lokesh Gidra <lokeshgidra@google.com> 2023-03-31 16:22:10 +0000
commit07798c2e898a8c3344cac123f9873a50ad2e075d (patch)
tree74b569b0ad199002ee099af2c6b08edd2d4f2a26
parentdafd2f03766ca6259e96ab19a9a86dea83295bd2 (diff)
Log null interned string in SweepInterpreterCache() in debug-mode
Bug: 275005060 Test: manual Change-Id: I5224125e36759005e9611bcb1cc284272af1bb71
-rw-r--r--runtime/thread.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 335b365d72..094da2efec 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -4477,22 +4477,19 @@ static void SweepCacheEntry(IsMarkedVisitor* visitor, const Instruction* inst, s
mirror::Object* new_object = visitor->IsMarked(object);
// We know the string is marked because it's a strongly-interned string that
// is always alive (see b/117621117 for trying to make those strings weak).
- if (new_object == nullptr) {
+ if (kIsDebugBuild && new_object == nullptr) {
// (b/275005060) Currently the problem is reported only on CC GC.
// Therefore we log it with more information. But since the failure rate
// is quite high, sampling it.
if (gUseReadBarrier) {
- static constexpr size_t kSampleRate = 5;
- if (MilliTime() % kSampleRate == 0) {
- Runtime* runtime = Runtime::Current();
- gc::collector::ConcurrentCopying* cc = runtime->GetHeap()->ConcurrentCopyingCollector();
- CHECK_NE(cc, nullptr);
- LOG(FATAL) << cc->DumpReferenceInfo(object, "string")
- << " string interned: " << std::boolalpha
- << runtime->GetInternTable()->LookupStrong(
- Thread::Current(), down_cast<mirror::String*>(object))
- << std::noboolalpha;
- }
+ Runtime* runtime = Runtime::Current();
+ gc::collector::ConcurrentCopying* cc = runtime->GetHeap()->ConcurrentCopyingCollector();
+ CHECK_NE(cc, nullptr);
+ LOG(FATAL) << cc->DumpReferenceInfo(object, "string")
+ << " string interned: " << std::boolalpha
+ << runtime->GetInternTable()->LookupStrong(Thread::Current(),
+ down_cast<mirror::String*>(object))
+ << std::noboolalpha;
} else {
// Other GCs
LOG(FATAL) << __FUNCTION__