Use virtual dispatch for `ThreadGroup.add(Thread)`.
The method is package-private and unlikely to be ever
overridden but we should use the correct dispatch anyway.
The non-virtual dispatch was introduced in
https://android-review.googlesource.com/602174 .
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: Ic0b37d632e2affdb14c630a2ea197336351d8345
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 19c2ce8..87f7359 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2435,9 +2435,7 @@
CHECK(thread_group_object == soa.Decode<mirror::Object>(thread_group));
}
}
- // TODO: Why are we calling the non-final method `ThreadGroup.add(Thread)` directly
- // instead of using the virtual dispatch? (Preserved from old code.)
- WellKnownClasses::java_lang_ThreadGroup_add->InvokeInstance<'V', 'L'>(
+ WellKnownClasses::java_lang_ThreadGroup_add->InvokeVirtual<'V', 'L'>(
soa.Self(), thread_group_object, thread_object);
}