Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Reduce time taken to test StackGuard and move to innerloop. #14444

Merged
merged 1 commit into from
Dec 13, 2016

Conversation

JonHanna
Copy link
Contributor

We have a test that verifies that Expression compilation is protected against stack overflow in the case of compiling deep expression trees, but forcing a case that would cause such a problem by necessity requires a large tree that takes a long time to compile, so the test is outerloop only.

Forcing the compilation to happen on the smallest possible stack reduces the size of tree that would risk a stack overflow, and so can test the same functionality in less than a second.

Do this, and move the test to innerloop.

@JonHanna
Copy link
Contributor Author

@bartdesmet changing your test of your functionality here, so PTAL

@JonHanna
Copy link
Contributor Author

@dotnet-bot test code coverage

@JonHanna
Copy link
Contributor Author

(And I just remembered that code coverage isn't going to show anything useful due to the existing issue there 😞 )

Copy link
Contributor

@bartdesmet bartdesmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

// This reduces the size of tree needed to risk a stack overflow.
Thread t = new Thread(() => f = Expression.Lambda<Func<int>>(e).Compile(useInterpreter), 1);
t.Start();
t.Join();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the previous code overflow more than once? Presumably this new version won't, so maybe we still need the old test as outerloop in addition to the new one as inner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

We have a test that verifies that Expression compilation is protected
against stack overflow in the case of compiling deep expression trees,
but forcing a case that would cause such a problem by necessity
requires a large tree that takes a long time to compiile, so the test
is outerloop only.

Forcing the compilation to happen on the smallest possible stack
reduces the size of tree that would risk a stack overflow, and so can
test the same functionality in less than a second.

Do this, and move the test to innerloop.
@JonHanna
Copy link
Contributor Author

Brought the old version back beside the new, to test the multiple-overflow case.

@JonHanna
Copy link
Contributor Author

Test Innerloop OSX Release Build and Test

@stephentoub stephentoub merged commit bdfe654 into dotnet:master Dec 13, 2016
@JonHanna JonHanna deleted the test_stackguard_innerloop branch December 13, 2016 12:51
@karelz karelz modified the milestone: 2.0.0 Dec 14, 2016
jakobbotsch added a commit to jakobbotsch/runtime that referenced this pull request May 27, 2021
The manually assigned 128 KiB stack here is bordering on the amount of
stack space that release JIT needs to JIT functions with deep trees.
Since the JIT already has a limit on the depth of trees it creates

https://github.com/dotnet/runtime/blob/44f050acc0f7791d6cd7ac772945444912bcf299/src/coreclr/jit/importer.cpp#L11234-L11252

it seems unnecessary to pressimize the JIT further to allow this test to
pass. Also, the test was originally added as a
faster equivalent to the test above it that could run in inner loop
(dotnet/corefx#14444), but it was subsequently
moved to outer loop (dotnet/corefx#19563), so
now it does not seem like there's much point in retaining it.

Fix dotnet#53309
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…innerloop

Reduce time taken to test StackGuard and move to innerloop.

Commit migrated from dotnet/corefx@bdfe654
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants