Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit crossgen2 instantiating depth (dotnet#791)
Two coreclr pri1 tests were causing the crossgen2 to run until all memory was depleeted due to the fact that we were not limiting depth of instantiations of methods and those tests had recursive instantiation. An example taken from one of the tests is this: ``` private static T meth<T>(int v, T x) { //Recursive generic return ((v >= 0) ? meth<Tuple<T, T>>(v - 1, new Tuple<T, T>(x, x)).Field0 : x); } ``` This change fixes it by adding the instantiation depth check for function calls. If the level of instantiation for any of the generic parameters exceeds a preset value (currently 10, taken from old crossgen), the caller is not compiled by crossgen2. Such a method will be compiled at runtime by JIT instead.
- Loading branch information