Implement icall used by RuntimeHelpers.EnsureSufficientExecutionStack on netcore...
authorJohan Lorensson <lateralusx.github@gmail.com>
Tue, 24 Mar 2020 07:22:46 +0000 (08:22 +0100)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 07:22:46 +0000 (08:22 +0100)
commitb020c37f2e05421000eaad98e2a904ba0c2808ba
treead0f17bd22a1daba8a5e3e6db604c7227d3f95f8
parent4464edd5a50aa86f9eeb2e620dca2c4896224656
Implement icall used by RuntimeHelpers.EnsureSufficientExecutionStack on netcore Mono. (#33857)

Current implementation always returned true for Windows/Linux/Android.
There are however use of this API in Task library to make sure recursive
tasks won't hit stackoverflow. There are several tests in System.Threading.Tasks
that currently hit this, at least on Windows, causing test failures.

Fix use stack limits already setup in register_thread and used by GC when
doing conservative stack scan. If the limits have not been setup or is not
supported on platform, we will use old defaults, always assume there is
enough stack space available. Heuristics around size of minimum execution
stack needed are picked from corresponding CoreCLR implementation.
src/mono/mono/metadata/icall.c