[runtime] Initialize thread suspend policy at startup, inline getter (#16149)
commit592de53a1f687d115fef86978e56a7fe7b4340c2
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Tue, 13 Aug 2019 19:16:05 +0000 (13 15:16 -0400)
committerGitHub <noreply@github.com>
Tue, 13 Aug 2019 19:16:05 +0000 (13 15:16 -0400)
treece9a427484992b6f43922dc1142dafdc33cdbfb7
parentff77b427f4f0c9ef7f926a302564ee239619e471
[runtime] Initialize thread suspend policy at startup, inline getter (#16149)

* [runtime] Initialize thread suspend policy at startup, inline getter

On some benchmarks we saw mono_threads_suspend_policy() using a lot of CPU
time.

Rather than doing an init-on-first-use, initialize the policy once upfront when
the JIT it starting up and make the getter method static inline.

* move mono_threads_suspend_policy_init into mono_thread_info_init

* [mini] Initialize suspend policy for `mono --version`

Need to initialize the suspend policy before printing its name.  Otherwise the
suspend policy is unset since no other runtime initialization is done for `--version`.
mono/mini/driver.c
mono/utils/mono-threads-coop.c
mono/utils/mono-threads-coop.h
mono/utils/mono-threads.c