JIT: Avoid folding returned null-stored Task in async versions - #133741
jakobbotsch with Copilot wants to merge 3 commits into
Conversation
|
Azure Pipelines: 16 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
|
@copilot Please rephrase the code and the PR description to more specifically refer to the fact that this has to do with the folding optimization, and not generally awaiting null tasks. General null task awaits should be throwing except in the very specific case where an async version ends with |
Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
Renamed the regression to I couldn't update the live PR body with the available tools. Could you replace its summary with:
|
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
PTAL @EgorBo There is a pattern match for |
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes JIT folding of null Task references in async methods and adds regression coverage.
Changes:
- Restricts zero-value folding to
TYP_INTconstants. - Adds null
TaskandTask<int>regression tests.
File summaries
| File | Description |
|---|---|
src/tests/async/returns/returns.cs |
Adds null-task regression tests. |
src/coreclr/jit/importer.cpp |
Prevents folding typed null references. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
Runtime-async await folding mistakes a null
Taskreference for a zero-initializedValueTask, completing successfully instead of throwingNullReferenceException.impFoldAwaitedTopOfStackto beTYP_INT, rejectingTYP_REFnulls.TaskandTask<int>cases using the parameter-store pattern that triggers the incorrect fold.