From c263bf889e6ee88a593634d1ab2fc7c9e9105543 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 29 Apr 2015 09:57:48 -0700 Subject: Only print IRT remove local warning if CheckJNI is enabled Less spammy. (cherry picked from commit c5adebc9327bd5ca223a5faf99d904cc202a1627) Bug: 17405090 Change-Id: Ib78d0d7bc31a88182cb9d85ddba9b469bd50324b --- runtime/indirect_reference_table.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runtime/indirect_reference_table.cc b/runtime/indirect_reference_table.cc index e2b95599a6..0ef58ea067 100644 --- a/runtime/indirect_reference_table.cc +++ b/runtime/indirect_reference_table.cc @@ -175,10 +175,16 @@ bool IndirectReferenceTable::Remove(uint32_t cookie, IndirectRef iref) { DCHECK(table_ != nullptr); DCHECK_GE(segment_state_.parts.numHoles, prevState.parts.numHoles); - if (GetIndirectRefKind(iref) == kHandleScopeOrInvalid && - Thread::Current()->HandleScopeContains(reinterpret_cast(iref))) { - LOG(WARNING) << "Attempt to remove local handle scope entry from IRT, ignoring"; - return true; + if (GetIndirectRefKind(iref) == kHandleScopeOrInvalid) { + auto* self = Thread::Current(); + if (self->HandleScopeContains(reinterpret_cast(iref))) { + auto* env = self->GetJniEnv(); + DCHECK(env != nullptr); + if (env->check_jni) { + LOG(WARNING) << "Attempt to remove local handle scope entry from IRT, ignoring"; + } + return true; + } } const int idx = ExtractIndex(iref); if (idx < bottomIndex) { -- cgit v1.2.3-59-g8ed1b