Use ResetTlab instead of setting to null
Added a function ResetTlab to reset the TLAB to empty. This is
in case the empty TLAB doesn't have null values.
Bug: 139805154
Test: make
Change-Id: Ife2225fc534999e53f2ecad41fc29e46c90a8817
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 6e57ec6..c3e4afe 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2322,6 +2322,7 @@
tlsPtr_.thread_local_mark_stack = nullptr;
tls32_.is_transitioning_to_runnable = false;
tls32_.use_mterp = false;
+ ResetTlab();
}
void Thread::NotifyInTheadList() {
@@ -4169,8 +4170,12 @@
tlsPtr_.thread_local_objects = 0;
}
+void Thread::ResetTlab() {
+ SetTlab(nullptr, nullptr, nullptr);
+}
+
bool Thread::HasTlab() const {
- bool has_tlab = tlsPtr_.thread_local_pos != nullptr;
+ const bool has_tlab = tlsPtr_.thread_local_pos != nullptr;
if (has_tlab) {
DCHECK(tlsPtr_.thread_local_start != nullptr && tlsPtr_.thread_local_end != nullptr);
} else {