You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: release-notes/10.0/preview/preview1/runtime.md
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,13 +52,28 @@ The JIT can now devirtualize and inline array interface methods, thanks to work
52
52
53
53
In .NET 9, the JIT gained the ability to allocate objects on the stack, when the object is guaranteed to not outlive its parent method. Not only does stack allocation reduce the number of objects the GC has to track, but it also unlocks other optimizations: For example, after an object has been stack-allocated, the JIT can consider replacing it entirely with its scalar values. Because of this, stack allocation is key to reducing the abstraction penalty of reference types.
54
54
55
-
Thanks to [contributions](https://github.com/dotnet/runtime/pull/104906)from @hez2010, the JIT will now stack-allocate small, fixed-sized arrays of value types that don't contain GC pointers when it can make the same lifetime guarantees described above. Among other [stack allocation enhancements](https://github.com/dotnet/runtime/issues/104936), we plan to expand this ability to arrays of reference types in the coming previews.
55
+
Thanks to [dotnet/runtime #104906](https://github.com/dotnet/runtime/pull/104906)(credit: [@hez2010](https://github.com/hez2010)), the JIT will now stack-allocate small, fixed-sized arrays of value types that don't contain GC pointers when it can make the same lifetime guarantees described above. Consider the following example:
56
56
57
+
```csharp
58
+
static void Sum()
59
+
{
60
+
int[] numbers = {1, 2, 3};
61
+
int sum = 0;
62
+
for (int i = 0; i < numbers.Length; i++)
63
+
{
64
+
sum += numbers[i];
65
+
}
66
+
Console.WriteLine(sum);
67
+
}
68
+
```
57
69
58
-
## AVX10.2 Support
70
+
Because the JIT knows `numbers` is an array of only three integers at compile-time, and it does not outlive a call to `Sum`, it will now allocate it on the stack.
59
71
60
-
Preview 1 enables support for the Advanced Vector Extensions (AVX) 10.2 for x64-based processors, thanks to [contributions](https://github.com/dotnet/runtime/pull/111209) from @khushal1996. .NET developers can try out the new intrinsics available in the `System.Runtime.Intrinsics.X86.Avx10v2` class once capable hardware is available. In the next several previews, we plan to further incorporate AVX10.2 support into the JIT's emitter to take full advantage of the instruction set's features.
72
+
Among other [stack allocation enhancements](https://github.com/dotnet/runtime/issues/104936), we plan to expand this ability to arrays of reference types in the coming previews.
61
73
62
74
63
-
Because AVX10.2-enabled hardware is not yet available, the JIT's support for AVX10.2 is disabled by default for now. We plan to enable it once we have thoroughly tested it.
75
+
## AVX10.2 Support
64
76
77
+
[dotnet/runtime #111209](https://github.com/dotnet/runtime/pull/111209) (credit: [@khushal1996](https://github.com/khushal1996)) enables support for the Advanced Vector Extensions (AVX) 10.2 for x64-based processors. The new intrinsics available in the `System.Runtime.Intrinsics.X86.Avx10v2` class can be tested once capable hardware is available. In the next several previews, we plan to further incorporate AVX10.2 support into the JIT's emitter to take full advantage of the instruction set's features.
78
+
79
+
Because AVX10.2-enabled hardware is not yet available, the JIT's support for AVX10.2 is disabled by default for now. We plan to enable it once we have thoroughly tested it.
0 commit comments