-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for profiler test arm64 #102066
Fix for profiler test arm64 #102066
Conversation
Tagging subscribers to this area: @tommcdon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend explicitly caching that delegate, otherwise LGTM
public static int RunTest(String[] args) | ||
{ | ||
ManualResetEvent _profilerDone = new ManualResetEvent(false); | ||
PassCallbackToProfiler(() => _profilerDone.Set()); | ||
PassCallbackToProfiler(ProfilerDone); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would explicitly cache this delegate given the correctness of the test depends on it. Right now we are relying on the C# compiler to do that caching implicitly. Some versions of the C# compiler (C# 11) do cache it in practice but this is not considered guaranteed behavior by the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will push changes to explicitly cache the delegate because explicit is better, but isn't that link just talking about whether the C# compiler caches and reuses the same delegate in multiple callsites? It could still keep the delegate rooted even if it never uses the same one twice in old versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
While trying to investigate #100114 I found an unrelated issue, the delegate that we pass to the profiler can be garbage collected and cause the process to crash. This fixes that issue, as well as adds code to read all of the profilee's stdout.