summaryrefslogtreecommitdiff
path: root/runtime/entrypoints_order_test.cc
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2023-04-10 23:25:19 +0000
committer Hans Boehm <hboehm@google.com> 2023-08-14 13:47:49 -0700
commit2caa640269faabd2455ec29cfe6ad330d442b715 (patch)
treeda8f0aa24a829573c51c4c0abedd9b567586265e /runtime/entrypoints_order_test.cc
parent15de3b7e4f69d0d9b7cea3c8f06d6aafad6de0f3 (diff)
Revert^10 "Thread suspension cleanup and deadlock fix"""
This reverts commit 63af30b8fe8d4e1dc32db4dcb5e5dae1efdc7f31. master (aosp/2530206) PS1 is identical to aosp/2377951 . master (aosp/2530206) PS2 is a rebase. At this point, master branch was replaced by main, and this CL moved. PS1: Restructure documentation for the IncrementSuspendCount handshake to install a suspend barrier. Document a couple of additional mutator lock assumptions. Add some DCHECKs to check that suspended threads really are suspended. Weaken seq_cst memory order in a couple of places where it really didn't make sense here. Clearly not a correctness fix. Includes a rebase and merge with aosp/2587606. PS2: Another rebase. Fix thumb assembler test to compensate for Thread structure layout changes. PS3: Messy rebase, primarily to handle aosp/2670108, which included both new fixes around this and a few small snippets of this CL. Call EnsureFlipFunctionStarted without a state-and-flags argument only when we actually hold the mutator lock, as promised. PS4: Minor rebase, some lint fixes. PS5: Another minor lint fix that I had missed in PS4. PS6: Fix for RunCheckpoint bug introduced around PS3. Fix expectations in jni_cfi_test to compensate for thread structure layout changes. PS7: In PS3+, EnsureFlipFunctionStarted could access a destroyed "this" thread. Fix that, and make the function static to make this constraint more explicit. (And running a method on a potentially destroyed object just seemed unclean.) PS8: Address reviewer comments. The major issue was that we released the suspend_count_lock too early in FlipThreadRoots, potentially allowing an intervening SuspendAll to block us. The fix involved a very minor extention of the mutex API. PS9: Comment typo fix. PS10: Address new reviewer comments. Rebase. MUST_SLEEP for 129_ThreadGetId debug output. Test: Treehugger. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 (and more) Change-Id: I0f2450e394c03c17eece3698286b2f3e45727967
Diffstat (limited to 'runtime/entrypoints_order_test.cc')
-rw-r--r--runtime/entrypoints_order_test.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/runtime/entrypoints_order_test.cc b/runtime/entrypoints_order_test.cc
index 9b4af663a0..a2d5a436d0 100644
--- a/runtime/entrypoints_order_test.cc
+++ b/runtime/entrypoints_order_test.cc
@@ -70,7 +70,6 @@ class EntrypointsOrderTest : public CommonArtTest {
EXPECT_OFFSET_DIFFP(Thread, tls32_, daemon, throwing_OutOfMemoryError, 4);
EXPECT_OFFSET_DIFFP(Thread, tls32_, throwing_OutOfMemoryError, no_thread_suspension, 4);
EXPECT_OFFSET_DIFFP(Thread, tls32_, no_thread_suspension, thread_exit_check_count, 4);
- EXPECT_OFFSET_DIFFP(Thread, tls32_, thread_exit_check_count, is_transitioning_to_runnable, 4);
// TODO: Better connection. Take alignment into account.
EXPECT_OFFSET_DIFF_GT3(Thread, tls32_.thread_exit_check_count, tls64_.trace_clock_base, 4,
@@ -108,13 +107,14 @@ class EntrypointsOrderTest : public CommonArtTest {
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, name, pthread_self, sizeof(void*));
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, pthread_self, last_no_thread_suspension_cause,
sizeof(void*));
- EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, last_no_thread_suspension_cause, active_suspend_barriers,
- sizeof(void*));
- EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, active_suspend_barriers, thread_local_start,
- sizeof(Thread::tls_ptr_sized_values::active_suspend_barriers));
- EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_start, thread_local_pos, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, last_no_thread_suspension_cause,
+ active_suspendall_barrier, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, active_suspendall_barrier,
+ active_suspend1_barriers, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, active_suspend1_barriers, thread_local_pos, sizeof(void*));
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_pos, thread_local_end, sizeof(void*));
- EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_end, thread_local_limit, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_end, thread_local_start, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_start, thread_local_limit, sizeof(void*));
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_limit, thread_local_objects, sizeof(void*));
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, thread_local_objects, checkpoint_function, sizeof(size_t));
EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, checkpoint_function, jni_entrypoints,
@@ -137,11 +137,12 @@ class EntrypointsOrderTest : public CommonArtTest {
Thread, tlsPtr_, top_reflective_handle_scope, method_trace_buffer, sizeof(void*));
EXPECT_OFFSET_DIFFP(
Thread, tlsPtr_, method_trace_buffer, method_trace_buffer_index, sizeof(void*));
+ EXPECT_OFFSET_DIFFP(
+ Thread, tlsPtr_, method_trace_buffer_index, thread_exit_flags, sizeof(void*));
// The first field after tlsPtr_ is forced to a 16 byte alignment so it might have some space.
auto offset_tlsptr_end = OFFSETOF_MEMBER(Thread, tlsPtr_) +
sizeof(decltype(reinterpret_cast<Thread*>(16)->tlsPtr_));
- CHECKED(offset_tlsptr_end - OFFSETOF_MEMBER(Thread, tlsPtr_.method_trace_buffer_index) ==
- sizeof(void*),
+ CHECKED(offset_tlsptr_end - OFFSETOF_MEMBER(Thread, tlsPtr_.thread_exit_flags) == sizeof(void*),
"async_exception last field");
}