Skip to content

Undo a non-determinism workaround. #272

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

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/pmi/pmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,15 +1326,6 @@ private static int Usage()
return 101;
}

private static void EnsureGetCurrentProcessorIdIsDeterministic()
{
#if NETCOREAPP
var type = typeof(System.Threading.Thread);
var field = type.GetField("s_isProcessorNumberReallyFast", BindingFlags.NonPublic | BindingFlags.Static);
field.SetValue(null, true);
#endif
}

private static void EnsureGen2GcCallbackFuncIsJitted()
{
#if NETCOREAPP
Expand All @@ -1355,13 +1346,6 @@ public static int Main(string[] args)
return Usage();
}

// System.Threading.Thread.s_isProcessorNumberReallyFast can have different
// values on two invocations of the process on the same machine. That causes
// non-determinism in generated code in methods inlining System.Threading.Thread.GetCurrentProcessorId().
// This methods uses reflection to set the value of System.Threading.Thread.s_isProcessorNumberReallyFast
// to true.
EnsureGetCurrentProcessorIdIsDeterministic();

// TlsOverPerCoreLockedStacksArrayPool.Return registers Gen2GcCallbackFunc on Gen2GcCallback.
// Gen2GcCallbackFunc is then called from Gen2GcCallback finalizer after a gc.
// For output determinism we force the registration of Gen2GcCallbackFunc and then force a gc
Expand Down