Skip to content

Commit

Permalink
[vm] Fix clobbered THR/R14 in StoreReleaseLoadAcquire[1204] tests.
Browse files Browse the repository at this point in the history
Also adjust expected disassembly.

TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-tsan-linux-release-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try
Change-Id: I3949145b04c84d48d98fd1629ca98b7cce617410
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397440
Commit-Queue: Ryan Macnak <[email protected]>
Reviewed-by: Alexander Aprelev <[email protected]>
  • Loading branch information
rmacnak-google authored and Commit Queue committed Nov 25, 2024
1 parent af3bfaa commit 88dc829
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions runtime/vm/compiler/assembler/assembler_x64_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6229,12 +6229,10 @@ IMMEDIATE_TEST(AddrImmRAXByte,
__ popq(RAX))

ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire, assembler) {
if (FLAG_target_thread_sanitizer) {
// On TSAN builds StoreRelease/LoadAcquire will do a runtime
// call to tell TSAN about our action.
__ MoveRegister(THR, CallingConventions::kArg2Reg);
}

// On TSAN builds StoreRelease/LoadAcquire will do a runtime
// call to tell TSAN about our action.
__ pushq(THR);
__ MoveRegister(THR, CallingConventions::kArg2Reg);
__ pushq(RCX);
__ xorq(RCX, RCX);
__ pushq(RCX);
Expand Down Expand Up @@ -6299,6 +6297,7 @@ ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire, assembler) {
__ LoadAcquireFromOffset(CallingConventions::kReturnReg, RSP, 0);
__ popq(RCX);
__ popq(RCX);
__ popq(THR);
__ ret();
}

Expand All @@ -6308,12 +6307,10 @@ ASSEMBLER_TEST_RUN(StoreReleaseLoadAcquire, test) {
}

ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire1024, assembler) {
if (FLAG_target_thread_sanitizer) {
// On TSAN builds StoreRelease/LoadAcquire will do a runtime
// call to tell TSAN about our action.
__ MoveRegister(THR, CallingConventions::kArg2Reg);
}

// On TSAN builds StoreRelease/LoadAcquire will do a runtime
// call to tell TSAN about our action.
__ pushq(THR);
__ MoveRegister(THR, CallingConventions::kArg2Reg);
__ pushq(RCX);
__ xorq(RCX, RCX);
__ pushq(RCX);
Expand All @@ -6323,6 +6320,7 @@ ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire1024, assembler) {
__ addq(RSP, Immediate(1024));
__ popq(RCX);
__ popq(RCX);
__ popq(THR);
__ ret();
}

Expand All @@ -6331,6 +6329,8 @@ ASSEMBLER_TEST_RUN(StoreReleaseLoadAcquire1024, test) {
EXPECT_EQ(123, res);
if (!FLAG_target_thread_sanitizer) {
EXPECT_DISASSEMBLY_NOT_WINDOWS(
"push thr\n"
"movq thr,rsi\n"
"push rcx\n"
"xorq rcx,rcx\n"
"push rcx\n"
Expand All @@ -6340,6 +6340,7 @@ ASSEMBLER_TEST_RUN(StoreReleaseLoadAcquire1024, test) {
"addq rsp,0x400\n"
"pop rcx\n"
"pop rcx\n"
"pop thr\n"
"ret\n");
}
}
Expand Down

0 comments on commit 88dc829

Please sign in to comment.