Skip to content

Commit 4a22d53

Browse files
authored
Merge branch 'main' into combined_limit
2 parents e6c812c + 0912e94 commit 4a22d53

File tree

2,138 files changed

+66970
-84519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,138 files changed

+66970
-84519
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
ARG VARIANT="6.0-jammy"
66
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}
77

8+
# Set up machine requirements to build the repo and the gh CLI
9+
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
10+
RUN apt-get update \
11+
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
12+
&& apt-get install software-properties-common -y \
13+
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
14+
&& apt-get update \
15+
&& apt-get install clang-18 -y
16+
817
# Set up machine requirements to build the repo and the gh CLI
918
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1019
&& apt-get -y install --no-install-recommends \
1120
cmake \
12-
llvm \
13-
clang \
1421
build-essential \
1522
python3 \
1623
curl \

.devcontainer/wasm-multiThreaded/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
ARG VARIANT="6.0-jammy"
66
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}
77

8+
# Set up machine requirements to build the repo and the gh CLI
9+
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
10+
RUN apt-get update \
11+
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
12+
&& apt-get install software-properties-common -y \
13+
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
14+
&& apt-get update \
15+
&& apt-get install clang-18 -y
16+
817
# Set up machine requirements to build the repo and the gh CLI
918
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1019
&& apt-get -y install --no-install-recommends \
1120
cmake \
12-
llvm \
13-
clang \
1421
build-essential \
1522
python3 \
1623
curl \

.devcontainer/wasm/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ ARG VARIANT="6.0-jammy"
66
FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT}
77

88
# Set up machine requirements to build the repo and the gh CLI
9+
# Clang-16 up is required but Ubuntu 22.04 comes with clang-14 highest, so add clang-18 sources
10+
RUN apt-get update \
11+
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
12+
&& apt-get install software-properties-common -y \
13+
&& add-apt-repository "deb http://apt.llvm.org/$(lsb_release -s -c)/ llvm-toolchain-$(lsb_release -s -c)-18 main" -y \
14+
&& apt-get update \
15+
&& apt-get install clang-18 -y
16+
917
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1018
&& apt-get -y install --no-install-recommends \
1119
cmake \
12-
llvm \
13-
clang \
1420
build-essential \
1521
python3 \
1622
curl \

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@
388388
<Features>strict;nullablePublicOnly</Features>
389389
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)' == ''">true</TreatWarningsAsErrors>
390390
<!-- Warnings to always disable -->
391-
<NoWarn>$(NoWarn),CS8969</NoWarn>
391+
<NoWarn>$(NoWarn);CS8500;CS8969</NoWarn>
392392
<!-- Always pass portable to override arcade sdk which uses embedded for local builds -->
393393
<DebugType>portable</DebugType>
394394
<KeepNativeSymbols Condition="'$(KeepNativeSymbols)' == '' and '$(DotNetBuildSourceOnly)' == 'true'">true</KeepNativeSymbols>

Directory.Build.targets

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,10 @@
9797
<Error Text="The passed-in TargetOS property value '$(TargetOS)' must be lowercase." />
9898
</Target>
9999

100-
<ItemDefinitionGroup>
101-
<TargetPathWithTargetPlatformMoniker>
102-
<IsReferenceAssemblyProject>$(IsReferenceAssemblyProject)</IsReferenceAssemblyProject>
103-
</TargetPathWithTargetPlatformMoniker>
104-
</ItemDefinitionGroup>
105-
106-
<Target Name="ValidateReferenceAssemblyProjectReferencesAndTargetFramework"
107-
AfterTargets="ResolveReferences"
100+
<Target Name="ValidateReferenceAssemblyProjectTargetFramework"
101+
BeforeTargets="CoreCompile"
108102
Condition="'$(IsReferenceAssemblyProject)' == 'true' and
109103
'$(SkipValidateReferenceAssemblyProjectReferences)' != 'true'">
110-
<Error Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'."
111-
Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferencePath.IsReferenceAssemblyProject)' != 'true' and '%(ReferencePath.ReferenceAssembly)' == ''" />
112104
<Error Text="Reference assemblies must be TargetPlatform agnostic. $(MSBuildProjectName) incorrectly targets $(TargetFramework), platform: $(TargetPlatformIdentifier)."
113105
Condition="'$(TargetPlatformIdentifier)' != ''" />
114106
</Target>

THIRD-PARTY-NOTICES.TXT

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,38 +66,6 @@ shall not be used in advertising or otherwise to promote the sale,
6666
use or other dealings in these Data Files or Software without prior
6767
written authorization of the copyright holder.
6868

69-
License notice for Zlib
70-
-----------------------
71-
72-
https://github.com/madler/zlib
73-
https://zlib.net/zlib_license.html
74-
75-
/* zlib.h -- interface of the 'zlib' general purpose compression library
76-
version 1.3.1, January 22nd, 2024
77-
78-
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
79-
80-
This software is provided 'as-is', without any express or implied
81-
warranty. In no event will the authors be held liable for any damages
82-
arising from the use of this software.
83-
84-
Permission is granted to anyone to use this software for any purpose,
85-
including commercial applications, and to alter it and redistribute it
86-
freely, subject to the following restrictions:
87-
88-
1. The origin of this software must not be misrepresented; you must not
89-
claim that you wrote the original software. If you use this software
90-
in a product, an acknowledgment in the product documentation would be
91-
appreciated but is not required.
92-
2. Altered source versions must be plainly marked as such, and must not be
93-
misrepresented as being the original software.
94-
3. This notice may not be removed or altered from any source distribution.
95-
96-
Jean-loup Gailly Mark Adler
97-
jloup@gzip.org madler@alumni.caltech.edu
98-
99-
*/
100-
10169
License notice for zlib-ng
10270
-----------------------
10371

docs/coding-guidelines/api-guidelines/nullability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ However, for existing virtual APIs that do not have any such strong guarantee do
6767
4. How common is it in the case of (3) for such invocations to then dereference the result rather than passing it off to something else that accepts a `T?`?
6868

6969
`Object.ToString` is arguably the most extreme case. Answering the above questions:
70-
1. It is fairly easy in any reasonably-sized code base to find cases, intentional or otherwise, where `ToString` returns `null` in some cases (we've found examples in dotnet/corefx, dotnet/roslyn, NuGet/NuGet.Client, dotnet/aspnetcore, and so on). One of the most prevalent conditions for this are types that just return the value in a string field which may contain its default value of `null`, and in particular for structs where a ctor may not have even had a chance to run and validate an input. Guidance in the docs suggests that `ToString` shouldn't return `null` or `string.Empty`, but even the docs don't follow its own guidance.
70+
1. It is fairly easy in any reasonably-sized code base to find cases, intentional or otherwise, where `ToString` returns `null` in some cases (we've found examples in dotnet/runtime, dotnet/roslyn, NuGet/NuGet.Client, dotnet/aspnetcore, and so on). One of the most prevalent conditions for this are types that just return the value in a string field which may contain its default value of `null`, and in particular for structs where a ctor may not have even had a chance to run and validate an input. Guidance in the docs suggests that `ToString` shouldn't return `null` or `string.Empty`, but even the docs don't follow its own guidance.
7171
2. Thousands upon thousands of types we don't control override this method today.
7272
3. It's common for helper routines to invoke via the base `object.ToString`, but many `ToString` uses are actually on derived types. This is particularly true when working in a code base that both defines a type and consumes its `ToString`.
7373
4. Based on examination of several large code bases, we believe it to be relatively rare that the result of an `Object.ToString` call (made on the base) to be directly dereferenced. It's much more common to pass it to another method that accepts `string?`, such as `String.Concat`, `String.Format`, `Console.WriteLine`, logging utilities, and so on. And while we advocate that `ToString` results shouldn't be assumed to be in a particular machine-readable format and parsed, it's certainly the case that code bases do, such as using `Substring` on the result, but in such cases, the caller needs to understand the format of what's being rendered, which generally means they're working with a derived type rather than calling through the base `Object.ToString`.

docs/design/coreclr/botr/method-descriptor.md

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ DWORD MethodDesc::GetAttrs()
8585
Method Slots
8686
------------
8787

88-
Each MethodDesc has a slot, which contains the entry point of the method. The slot and entry point must exist for all methods, even the ones that never run like abstract methods. There are multiple places in the runtime that depend on the 1:1 mapping between entry points and MethodDescs, making this relationship an invariant.
88+
Each MethodDesc has a slot, which contains the current entry point of the method. The slot must exist for all methods, even the ones that never run like abstract methods. There are multiple places in the runtime that depend on mapping between entry points and MethodDescs.
89+
90+
Each MethodDesc logically has an entry point, but we do not allocate these eagerly at MethodDesc creation time. The invariant is that once the method is identified as a method to run, or is used in virtual overriding, we will allocate the entrypoint.
8991

9092
The slot is either in MethodTable or in MethodDesc itself. The location of the slot is determined by `mdcHasNonVtableSlot` bit on MethodDesc.
9193

@@ -185,8 +187,6 @@ The target of the temporary entry point is a PreStub, which is a special kind of
185187

186188
The **stable entry point** is either the native code or the precode. The **native code** is either jitted code or code saved in NGen image. It is common to talk about jitted code when we actually mean native code.
187189

188-
Temporary entry points are never saved into NGen images. All entry points in NGen images are stable entry points that are never changed. It is an important optimization that reduced private working set.
189-
190190
![Figure 2](images/methoddesc-fig2.png)
191191

192192
Figure 2 Entry Point State Diagram
@@ -208,6 +208,7 @@ The methods to get callable entry points from MethodDesc are:
208208

209209
- `MethodDesc::GetSingleCallableAddrOfCode`
210210
- `MethodDesc::GetMultiCallableAddrOfCode`
211+
- `MethodDesc::TryGetMultiCallableAddrOfCode`
211212
- `MethodDesc::GetSingleCallableAddrOfVirtualizedCode`
212213
- `MethodDesc::GetMultiCallableAddrOfVirtualizedCode`
213214

@@ -220,7 +221,7 @@ The type of precode has to be cheaply computable from the instruction sequence.
220221

221222
**StubPrecode**
222223

223-
StubPrecode is the basic precode type. It loads MethodDesc into a scratch register and then jumps. It must be implemented for precodes to work. It is used as fallback when no other specialized precode type is available.
224+
StubPrecode is the basic precode type. It loads MethodDesc into a scratch register<sup>2</sup> and then jumps. It must be implemented for precodes to work. It is used as fallback when no other specialized precode type is available.
224225

225226
All other precodes types are optional optimizations that the platform specific files turn on via HAS\_XXX\_PRECODE defines.
226227

@@ -236,7 +237,7 @@ StubPrecode looks like this on x86:
236237

237238
FixupPrecode is used when the final target does not require MethodDesc in scratch register<sup>2</sup>. The FixupPrecode saves a few cycles by avoiding loading MethodDesc into the scratch register.
238239

239-
The most common usage of FixupPrecode is for method fixups in NGen images.
240+
Most stubs used are the more efficient form, we currently can use this form for everything but interop methods when a specialized form of Precode is not required.
240241

241242
The initial state of the FixupPrecode on x86:
242243

@@ -254,67 +255,6 @@ Once it has been patched to point to final target:
254255

255256
<sup>2</sup> Passing MethodDesc in scratch register is sometimes referred to as **MethodDesc Calling Convention**.
256257

257-
**FixupPrecode chunks**
258-
259-
FixupPrecode chunk is a space efficient representation of multiple FixupPrecodes. It mirrors the idea of MethodDescChunk by hoisting the similar MethodDesc pointers from multiple FixupPrecodes to a shared area.
260-
261-
The FixupPrecode chunk saves space and improves code density of the precodes. The code density improvement from FixupPrecode chunks resulted in 1% - 2% gain in big server scenarios on x64.
262-
263-
The FixupPrecode chunks looks like this on x86:
264-
265-
jmp Target2
266-
pop edi // dummy instruction that marks the type of the precode
267-
db MethodDescChunkIndex
268-
db 2 (PrecodeChunkIndex)
269-
270-
jmp Target1
271-
pop edi
272-
db MethodDescChunkIndex
273-
db 1 (PrecodeChunkIndex)
274-
275-
jmp Target0
276-
pop edi
277-
db MethodDescChunkIndex
278-
db 0 (PrecodeChunkIndex)
279-
280-
dw pMethodDescBase
281-
282-
One FixupPrecode chunk corresponds to one MethodDescChunk. There is no 1:1 mapping between the FixupPrecodes in the chunk and MethodDescs in MethodDescChunk though. Each FixupPrecode has index of the method it belongs to. It allows allocating the FixupPrecode in the chunk only for methods that need it.
283-
284-
**Compact entry points**
285-
286-
Compact entry point is a space efficient implementation of temporary entry points.
287-
288-
Temporary entry points implemented using StubPrecode or FixupPrecode can be patched to point to the actual code. Jitted code can call temporary entry point directly. The temporary entry point can be multicallable entry points in this case.
289-
290-
Compact entry points cannot be patched to point to the actual code. Jitted code cannot call them directly. They are trading off speed for size. Calls to these entry points are indirected via slots in a table (FuncPtrStubs) that are patched to point to the actual entry point eventually. A request for a multicallable entry point allocates a StubPrecode or FixupPrecode on demand in this case.
291-
292-
The raw speed difference is the cost of an indirect call for a compact entry point vs. the cost of one direct call and one direct jump on the given platform. The later used to be faster by a few percent in large server scenario since it can be predicted by the hardware better (2005). It is not always the case on current (2015) hardware.
293-
294-
The compact entry points have been historically implemented on x86 only. Their additional complexity, space vs. speed trade-off and hardware advancements made them unjustified on other platforms.
295-
296-
The compact entry point on x86 looks like this:
297-
298-
entrypoint0:
299-
mov al,0
300-
jmp short Dispatch
301-
302-
entrypoint1:
303-
mov al,1
304-
jmp short Dispatch
305-
306-
entrypoint2:
307-
mov al,2
308-
jmp short Dispatch
309-
310-
Dispatch:
311-
movzx eax,al
312-
shl eax, 3
313-
add eax, pBaseMD
314-
jmp PreStub
315-
316-
The allocation of temporary entry points always tries to pick the smallest temporary entry point from the available choices. For example, a single compact entry point is bigger than a single StubPrecode on x86. The StubPrecode will be preferred over the compact entry point in this case. The allocation of the precode for a stable entry point will try to reuse an allocated temporary entry point precode if one exists of the matching type.
317-
318258
**ThisPtrRetBufPrecode**
319259

320260
ThisPtrRetBufPrecode is used to switch a return buffer and the this pointer for open instance delegates returning valuetypes. It is used to convert the calling convention of MyValueType Bar(Foo x) to the calling convention of MyValueType Foo::Bar().

docs/design/coreclr/jit/JitOptimizerTodoAssessment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ the code quality improvements, though most have issues associated with them.
4949
We may well be able to find some additional benchmarks or real-world-code with some looking,
5050
though it may be the case that current performance-sensitive code avoids structs.
5151

52-
There's also work going on in corefx to use `Span<T>` more broadly. We should
52+
There's also work going on to use `Span<T>` more broadly. We should
5353
make sure we are expanding our span benchmarks appropriately to track and
5454
respond to any particular issues that come out of that work.
5555

docs/design/coreclr/jit/object-stack-allocation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ with version reseliency.
8383
**Pros:**
8484
* ILLInk can afford to spend more time for escape analysis.
8585
* For self-contained apps, ILLink has access to all of application's code and can do full interprocedural analysis.
86-
* ILLink is already a part of System.Private.CoreLib and CoreFX build toolchain so the assemblies built there can benefit
86+
* ILLink is already a part of System.Private.CoreLib and core libraries build toolchain so the assemblies built there can benefit
8787
from this.
8888

8989
**Cons:**

0 commit comments

Comments
 (0)