Skip to content

stackalloc expressions have limited syntax #22046

@OmarTawfik

Description

@OmarTawfik

Due to a CLR spec limitation, stackalloc instructions cannot be executed unless the evaluation stack is cleared of other items. This means that the following code will not be executed at run-time:

DoSomething(obj1, stackalloc int[10]);

For that to happen, we need to save (spill) all prior values on the evaluation stack to temps before executing this instruction. For now, in feature branch freatures/readonly-ref, the scope of this instruction is constricted to either (1) initialization statements or (2) ternary conditional operators.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions