Skip to content

Tiered compilation fails to elide value type null check #1713

@sharwell

Description

@sharwell

AsyncMethodBuilderCore is implemented with the assumption that value type state machines will not be boxed for a runtime comparison with null:

if (stateMachine == null) // TStateMachines are generally non-nullable value types, so this check will be elided
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.stateMachine);
}

This assumption does not hold for Tier 0 compilation. For a release build of Roslyn, execution of analyzers on Roslyn.sln produces 20% (70GB) of its total allocations boxing state machines for this null check.

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions