From 56c7f92745499778eac08091409c412451d680ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 23:51:19 +0000 Subject: [PATCH 1/6] Initial plan From b2ed0ce8397e65e26b0f8dfea8e53672c375478a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 00:30:47 +0000 Subject: [PATCH 2/6] Display method name in ARM64 disassembly for indirect calls (blr/br_tail) In the IF_BR_1B case of emitDispInsHelp, after displaying the register, check if idMemCookie is set and display the method name as a comment. This matches x64 behavior where indirect calls show the target method name. Also add a small FileCheck test for ARM64 specifically. Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b2a47cb3-cb3d-4479-a881-733d20b8576b --- src/coreclr/jit/emitarm64.cpp | 7 ++++++ .../JIT/opt/Calls/IndirectCallAnnotation.cs | 25 +++++++++++++++++++ .../opt/Calls/IndirectCallAnnotation.csproj | 18 +++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs create mode 100644 src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index 2dd60855390f0f..863e7ad67dbe29 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -13559,6 +13559,13 @@ void emitter::emitDispInsHelp( { emitDispReg(id->idReg3(), EA_PTRSIZE, false); } + + if (id->idDebugOnlyInfo()->idMemCookie != 0) + { + const char* methodName = + m_compiler->eeGetMethodFullName((CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); + printf(" // %s", methodName); + } break; case IF_LS_1A: // LS_1A XX...V..iiiiiiii iiiiiiiiiiittttt Rt PC imm(1MB) diff --git a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs new file mode 100644 index 00000000000000..13736b07c3aa5f --- /dev/null +++ b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using Xunit; + +public class IndirectCallAnnotation +{ + [MethodImpl(MethodImplOptions.NoInlining)] + public virtual int VirtualCallee() => 42; + + [MethodImpl(MethodImplOptions.NoInlining)] + static int Caller(IndirectCallAnnotation obj) + { + // Verify that the indirect call target is annotated with the method name. + // ARM64: blr {{.*}}VirtualCallee + return obj.VirtualCallee(); + } + + [Fact] + public static int TestEntryPoint() + { + return Caller(new IndirectCallAnnotation()) == 42 ? 100 : 0; + } +} diff --git a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj new file mode 100644 index 00000000000000..dbc3ab7f2f9596 --- /dev/null +++ b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj @@ -0,0 +1,18 @@ + + + + true + + + None + True + + + + true + + + + + + From 4915e0fe833bb737f8f16e68410c2e069aac4c8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 00:33:59 +0000 Subject: [PATCH 3/6] Refine test pattern to be more specific about method name match Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b2a47cb3-cb3d-4479-a881-733d20b8576b --- src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs index 13736b07c3aa5f..a395369b50ab1a 100644 --- a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs +++ b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs @@ -13,7 +13,7 @@ public class IndirectCallAnnotation static int Caller(IndirectCallAnnotation obj) { // Verify that the indirect call target is annotated with the method name. - // ARM64: blr {{.*}}VirtualCallee + // ARM64: blr {{.*}}VirtualCallee() return obj.VirtualCallee(); } From fc2f1f080230caed10abbf76030dca7507ab7915 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 24 Mar 2026 02:55:12 +0100 Subject: [PATCH 4/6] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/coreclr/jit/emitarm64.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index 863e7ad67dbe29..d672ffc0bde690 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -13562,8 +13562,8 @@ void emitter::emitDispInsHelp( if (id->idDebugOnlyInfo()->idMemCookie != 0) { - const char* methodName = - m_compiler->eeGetMethodFullName((CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); + methodName = m_compiler->eeGetMethodFullName( + (CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); printf(" // %s", methodName); } break; From 4c3d8438df16d9fd05f78c5835084b09339dd752 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 24 Mar 2026 10:38:16 +0100 Subject: [PATCH 5/6] Update emitarm64.cpp --- src/coreclr/jit/emitarm64.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index d672ffc0bde690..1f26f2afb5f358 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -13562,8 +13562,7 @@ void emitter::emitDispInsHelp( if (id->idDebugOnlyInfo()->idMemCookie != 0) { - methodName = m_compiler->eeGetMethodFullName( - (CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); + methodName = m_compiler->eeGetMethodFullName((CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); printf(" // %s", methodName); } break; From 43bdb17c13143587dec06a8b064cb3a327936253 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:20:38 +0000 Subject: [PATCH 6/6] Address review feedback: use emitDispCommentForHandle and remove test Use emitDispCommentForHandle instead of directly calling eeGetMethodFullName and printf, matching the pattern used by movz/movk constant annotations. Remove the FileCheck test since it would only run in checked mode where the method name already appears on the movz/movk constant instructions. Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/84a22a2e-9c3e-40ef-ab3b-97113c002f92 --- src/coreclr/jit/emitarm64.cpp | 6 +---- .../JIT/opt/Calls/IndirectCallAnnotation.cs | 25 ------------------- .../opt/Calls/IndirectCallAnnotation.csproj | 18 ------------- 3 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs delete mode 100644 src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index 1f26f2afb5f358..b5933cd3db95be 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -13560,11 +13560,7 @@ void emitter::emitDispInsHelp( emitDispReg(id->idReg3(), EA_PTRSIZE, false); } - if (id->idDebugOnlyInfo()->idMemCookie != 0) - { - methodName = m_compiler->eeGetMethodFullName((CORINFO_METHOD_HANDLE)id->idDebugOnlyInfo()->idMemCookie); - printf(" // %s", methodName); - } + emitDispCommentForHandle(0, id->idDebugOnlyInfo()->idMemCookie, GTF_ICON_FTN_ADDR); break; case IF_LS_1A: // LS_1A XX...V..iiiiiiii iiiiiiiiiiittttt Rt PC imm(1MB) diff --git a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs deleted file mode 100644 index a395369b50ab1a..00000000000000 --- a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Runtime.CompilerServices; -using Xunit; - -public class IndirectCallAnnotation -{ - [MethodImpl(MethodImplOptions.NoInlining)] - public virtual int VirtualCallee() => 42; - - [MethodImpl(MethodImplOptions.NoInlining)] - static int Caller(IndirectCallAnnotation obj) - { - // Verify that the indirect call target is annotated with the method name. - // ARM64: blr {{.*}}VirtualCallee() - return obj.VirtualCallee(); - } - - [Fact] - public static int TestEntryPoint() - { - return Caller(new IndirectCallAnnotation()) == 42 ? 100 : 0; - } -} diff --git a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj b/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj deleted file mode 100644 index dbc3ab7f2f9596..00000000000000 --- a/src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - true - - - None - True - - - - true - - - - - -