From 88dc829f7482116c4b9c883fc6a5edbee150f11f Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 25 Nov 2024 21:42:39 +0000 Subject: [PATCH] [vm] Fix clobbered THR/R14 in StoreReleaseLoadAcquire[1204] tests. 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 Reviewed-by: Alexander Aprelev --- .../compiler/assembler/assembler_x64_test.cc | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/runtime/vm/compiler/assembler/assembler_x64_test.cc b/runtime/vm/compiler/assembler/assembler_x64_test.cc index efc142991ab1..eba0a6af9a6f 100644 --- a/runtime/vm/compiler/assembler/assembler_x64_test.cc +++ b/runtime/vm/compiler/assembler/assembler_x64_test.cc @@ -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); @@ -6299,6 +6297,7 @@ ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire, assembler) { __ LoadAcquireFromOffset(CallingConventions::kReturnReg, RSP, 0); __ popq(RCX); __ popq(RCX); + __ popq(THR); __ ret(); } @@ -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); @@ -6323,6 +6320,7 @@ ASSEMBLER_TEST_GENERATE(StoreReleaseLoadAcquire1024, assembler) { __ addq(RSP, Immediate(1024)); __ popq(RCX); __ popq(RCX); + __ popq(THR); __ ret(); } @@ -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" @@ -6340,6 +6340,7 @@ ASSEMBLER_TEST_RUN(StoreReleaseLoadAcquire1024, test) { "addq rsp,0x400\n" "pop rcx\n" "pop rcx\n" + "pop thr\n" "ret\n"); } }