Avoid unnecessary return val copying in tailcall-via-help (#72720)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Sun, 24 Jul 2022 17:37:50 +0000 (19:37 +0200)
committerGitHub <noreply@github.com>
Sun, 24 Jul 2022 17:37:50 +0000 (19:37 +0200)
commitc9c27d46406664327827aa47e37c7fe8a52f1ca0
tree9b47c396d2183044666624e275e7bcb39a0a6e9b
parentc22f7f8c73766830b3262b72ae73e1015d4ed9ee
Avoid unnecessary return val copying in tailcall-via-help (#72720)

The initial implementation of this did not handle the fact that retbuf
can point to GC heap during reflection invoke. It was fixed in #39815,
but the way it was fixed was by copying it into a local. This changes
the fix so that we simply report the return value pointer as a byref
throughout the mechanism, which simplifies the JIT's handling and is a
perf improvement as well.
docs/design/features/tailcalls-with-helpers.md
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
src/coreclr/jit/morph.cpp
src/coreclr/vm/tailcallhelp.cpp