Allocate and remove compiler threads on demand depending on the compile queue lengths and available memory.
The VM currently starts a large number of compiler threads on systems with many CPUs regardless of available memory and number of compilation requests. This leads to inefficient use of resources. They consume memory even if they are idle almost all of the time.
A similar issue regarding GC was addressed with the option UseDynamicNumberOfGCThreads which is now active by default.
Change the implementation to start only one compiler thread of each type during startup and handle the start and shutdown of further threads dynamically controlled by a new command line flag:
This is the main flag which controls this feature. It is on by default.
product(bool, UseDynamicNumberOfCompilerThreads, true, \
"Dynamically choose the number of parallel compiler threads") \