Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][interp] When local space overflows, retry compilation with optimization enabled #94381

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Nov 5, 2023

The unoptimized version of a method allocates all vars outside of the execution stack as global. Some operations, like array[,].Set, need to reorder values on the execution stack and they do this by allocating temporary vars. These vars would be logically dead after the operation, but since we don't do any optimization they occupy the stack space for the entire method execution. Patterns where thousands of such calls are inlined in a single method by code generators can be quite common, in EFCore for example.

When the local space overflows, in addition to disabling inlining, we also try to compile with optimizations enabled.

…imization enabled

The unoptimized version of a method allocates all vars outside of the execution stack as global. Some operations, like `array[,].Set`, need to reorder values on the execution stack and they do this by allocating temporary vars. These vars would be logically dead after the operation, but since we don't do any optimization they occupy the stack space for the entire method execution. Patterns where thousands of such calls are inlined in a single method by code generators can be quite common, in EFCore for example.

When the local space overflows, in addition to disabling inlining, we also try to compile with optimizations enabled.
@ghost
Copy link

ghost commented Nov 5, 2023

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

The unoptimized version of a method allocates all vars outside of the execution stack as global. Some operations, like array[,].Set, need to reorder values on the execution stack and they do this by allocating temporary vars. These vars would be logically dead after the operation, but since we don't do any optimization they occupy the stack space for the entire method execution. Patterns where thousands of such calls are inlined in a single method by code generators can be quite common, in EFCore for example.

When the local space overflows, in addition to disabling inlining, we also try to compile with optimizations enabled.

Author: BrzVlad
Assignees: -
Labels:

area-Codegen-Interpreter-mono

Milestone: -

@BrzVlad BrzVlad merged commit b4a8ddf into dotnet:main Nov 6, 2023
108 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Dec 6, 2023
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.

2 participants