diff options
author | Alex Light <allight@google.com> | 2020-07-17 18:13:17 -0700 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2020-07-20 18:07:41 +0000 |
commit | c06e07f96e2c54b2ca740da447b65bb8b1bfd253 (patch) | |
tree | 41801694c506e817b18e88450770127f196e1cb0 /openjdkjvmti | |
parent | 9735ccc81e25ffe2dd88d053dc7065028264d344 (diff) |
Correctly use handles for JVMTI heap iteration.
We were incorrectly using an ObjPtr to store the filter-class in
IterateThroughHeap and FollowReferences. This could cause issues if GC
was occurring during the early parts of the call. Fix this issues by
properly handlerizing the pointer.
Test: ./test.py --host
Bug: 161574896
Change-Id: I2ed8e3e4b7af8fded69e8d86adf2049e907289e8
Diffstat (limited to 'openjdkjvmti')
-rw-r--r-- | openjdkjvmti/ti_heap.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc index 905ed9535b..f4e34dddc1 100644 --- a/openjdkjvmti/ti_heap.cc +++ b/openjdkjvmti/ti_heap.cc @@ -759,7 +759,8 @@ static jvmtiError DoIterateThroughHeap(T fn, bool stop_reports = false; const HeapFilter heap_filter(heap_filter_int); - art::ObjPtr<art::mirror::Class> filter_klass = soa.Decode<art::mirror::Class>(klass); + art::StackHandleScope<1> hs(self); + art::Handle<art::mirror::Class> filter_klass(hs.NewHandle(soa.Decode<art::mirror::Class>(klass))); auto visitor = [&](art::mirror::Object* obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { // Early return, as we can't really stop visiting. if (stop_reports) { @@ -781,7 +782,7 @@ static jvmtiError DoIterateThroughHeap(T fn, } if (filter_klass != nullptr) { - if (filter_klass != klass) { + if (filter_klass.Get() != klass) { return; } } |