Skip to content

Commit c4bc754

Browse files
authored
Merge branch 'master' into feature/solaris/coreclr-port-without-libunwind-changes
2 parents d5ef2f9 + 6f7a89f commit c4bc754

File tree

142 files changed

+5961
-1633
lines changed

Some content is hidden

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

142 files changed

+5961
-1633
lines changed

docs/area-owners.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Below table shows the combined area owners on this repository:
3838
| area-Codegen-JIT-mono | @SamMonoRT | |
3939
| area-Codegen-AOT-mono | @SamMonoRT | |
4040
| area-Codegen-Interpreter-mono | @BrzVlad | |
41+
| area-CodeGen-LLVM-mono | @imhameed | |
4142
| area-CoreLib-mono | @steveisok | |
4243
| area-GC-mono | @BrzVlad | |
4344
| area-Build-mono | @akoeplinger | |
@@ -47,6 +48,17 @@ Below table shows the combined area owners on this repository:
4748
| area-Threading-mono | @lambdageek | |
4849
| area-Tracing-mono | @lambdageek | |
4950
| area-Performance-mono | @SamMonoRT | |
51+
| ** Extensions namespaces ** | | |
52+
| area-Extensions-Caching | @maryamariyan | |
53+
| area-Extensions-Configuration | @maryamariyan | |
54+
| area-Extensions-DependencyInjection | @maryamariyan | |
55+
| area-Extensions-FileSystem | @maryamariyan | |
56+
| area-Extensions-Hosting | @maryamariyan | |
57+
| area-Extensions-HttpClientFactory | @maryamariyan | |
58+
| area-Extensions-Logging | @maryamariyan | |
59+
| area-Extensions-Options | @maryamariyan | |
60+
| area-Extensions-Primitives | @maryamariyan | |
61+
| area-Microsoft.Extensions | @maryamariyan | |
5062
| **System namespaces** | | |
5163
| area-System.Buffers | @tannergooding @GrabYourPitchforks @pgovind | |
5264
| area-System.CodeDom | @buyaa-n @krwq | |
@@ -58,6 +70,8 @@ Below table shows the combined area owners on this repository:
5870
| area-System.Configuration | @maryamariyan @safern | |
5971
| area-System.Console | @carlossanlop @eiriktsarpalis | |
6072
| area-System.Data | @ajcvickers @cheenamalhotra @david-engel | <ul><li>Odbc, OleDb - [@saurabh500](https://github.com/saurabh500)</li></ul> |
73+
| area-System.Data.Odbc | @ajcvickers | |
74+
| area-System.Data.OleDB | @ajcvickers | |
6175
| area-System.Data.SqlClient | @cheenamalhotra @david-engel @karinazhou @JRahnama | Archived component - limited churn/contributions (see https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/) |
6276
| area-System.Diagnostics | @tommcdon @krwq | <ul><li>System.Diagnostics.EventLog - [@Anipik](https://github.com/Anipik)</li></ul> |
6377
| area-System.Diagnostics.Process | @adamsitnik @eiriktsarpalis | |

docs/design/coreclr/botr/shared-generics.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ Shared generics is a runtime+JIT feature aimed at reducing the amount of code th
1212
Consider the following C# code sample:
1313

1414
``` c#
15-
string Func<T>()
15+
string Method<T>()
1616
{
1717
return typeof(List<T>).ToString();
1818
}
1919
```
2020

21-
Without shared generics, the code for instantiations like `Func<object>` or `Func<string>` would look identical except for one single instruction: the one that loads the correct TypeHandle of type `List<T>`:
21+
Without shared generics, the code for instantiations like `Method<object>` or `Method<string>` would look identical except for one single instruction: the one that loads the correct TypeHandle of type `List<T>`:
2222
``` asm
2323
mov rcx, type handle of List<string> or List<object>
2424
call ToString()
2525
ret
2626
```
2727

28-
With shared generics, the canonical code will not have any hard-coded versions of the type handle of List<T>, but instead looks up the exact type handle either through a call to a runtime helper API, or by loading it up from the *generic dictionary* of the instantiation of Func<T> that is executing. The code would look more like the following:
28+
With shared generics, the canonical code will not have any hard-coded versions of the type handle of List<T>, but instead looks up the exact type handle either through a call to a runtime helper API, or by loading it up from the *generic dictionary* of the instantiation of Method<T> that is executing. The code would look more like the following:
2929
``` asm
30-
mov rcx, generic context // MethodDesc of Func<string> or Func<object>
30+
mov rcx, generic context // MethodDesc of Method<string> or Method<object>
3131
mov rcx, [rcx + offset of InstantiatedMethodDesc::m_pPerInstInfo] // This is the generic dictionary
3232
mov rcx, [rcx + dictionary slot containing type handle of List<T>]
3333
call ToString()
3434
ret
3535
```
3636

37-
The generic context in this example is the InstantiatedMethodDesc of `Func<object>` or `Func<string>`. The generic dictionary is a data structure used by shared generic code to fetch instantiation-specific information. It is basically an array where the entries are instantiation-specific type handles, method handles, field handles, method entry points, etc... The "PerInstInfo" fields on MethodTable and InstantiatedMethodDesc structures point at the generic dictionary structure for a generic type and method respectively.
37+
The generic context in this example is the InstantiatedMethodDesc of `Method<object>` or `Method<string>`. The generic dictionary is a data structure used by shared generic code to fetch instantiation-specific information. It is basically an array where the entries are instantiation-specific type handles, method handles, field handles, method entry points, etc... The "PerInstInfo" fields on MethodTable and InstantiatedMethodDesc structures point at the generic dictionary structure for a generic type and method respectively.
3838

39-
In this example, the generic dictionary for Func<object> will contain a slot with the type handle for type List<object>, and the generic dictionary for Func<string> will contain a slot with the type handle for type List<string>.
39+
In this example, the generic dictionary for Method<object> will contain a slot with the type handle for type List<object>, and the generic dictionary for Method<string> will contain a slot with the type handle for type List<string>.
4040

4141
This feature is currently only supported for instantiations over reference types because they all have the same size/properties/layout/etc... For instantiations over primitive types or value types, the runtime will generate separate code bodies for each instantiation.
4242

@@ -93,9 +93,9 @@ As described earlier, a generic dictionary is an array of multiple slots contain
9393

9494
The first N slots in an instantiation of N arguments are always going to be the type handles of the instantiation type arguments (this is kind of an optimization as well). The slots that follow contain instantiation-based information.
9595

96-
For instance, here is an example of the contents of the generic dictionary for our `Func<string>` example:
96+
For instance, here is an example of the contents of the generic dictionary for our `Method<string>` example:
9797

98-
| `Func<string>'s dicionary` |
98+
| `Method<string>'s dicionary` |
9999
|--------------------------|
100100
| slot[0]: TypeHandle(`string`) |
101101
| slot[1]: Total dictionary size |
@@ -116,7 +116,7 @@ When generating shared generic code, the JIT knows which slots to use for the va
116116
### Dictionary Layouts
117117

118118
The `DictionaryLayout` structure is what tells the JIT which slot to use when performing a dictionary lookup. This `DictionaryLayout` structure has a couple of important properties:
119-
- It is shared across all compatible instantiations of a certain type of method. In other words, a dictionary layout is associated with the canonical instantiation of a type or a method. For instance, in our example above, `Func<object>` and `Func<string>` are compatible instantiations, each with their own **separate dictionaries**, however they all share the **same dictionary layout**, which is associated with the canonical instantiation `Func<__Canon>`.
119+
- It is shared across all compatible instantiations of a certain type of method. In other words, a dictionary layout is associated with the canonical instantiation of a type or a method. For instance, in our example above, `Method<object>` and `Method<string>` are compatible instantiations, each with their own **separate dictionaries**, however they all share the **same dictionary layout**, which is associated with the canonical instantiation `Method<__Canon>`.
120120
- The dictionaries of generic types or methods have the same number of slots as their dictionary layouts. Note: historically before the introduction of the dynamic dictionary expansion feature, the generic dictionaries could be smaller than their layouts, meaning that for certain lookups, we had to use invoke some runtime helper APIs (slow path).
121121

122122
When a generic type or method is first created, its dictionary layout contains 'unassigned' slots. Assignments happen as part of code generation, whenever the JIT needs to emit a dictionary lookup sequence. This assignment happens during the calls to the `DictionaryLayout::FindToken(...)` APIs. Once a slot has been assigned, it becomes associated with a certain signature, which describes the kind of value that will go in every instantiated dictionary at that slot index.
@@ -160,7 +160,7 @@ The feature is simple in concept: change dictionary layouts from a linked list o
160160
- For types, the generic dictionary is part of the `MethodTable` structure, which can't be reallocated (already in use by managed code)
161161
- For methods, the generic dictionary is not part of the `MethodDesc` structure, but can still be in use by some generic code.
162162
- We can't have multiple MethodTables or MethodDescs for the same type or method anyways, so reallocations are not an option.
163-
- We can't just resize the generic dictionary for a single instantiation. For instance, in our example above, let's say we wanted to expand the dictionary for `Func<string>`. The resizing of the layout would have an impact on the shared canonical code that the JIT generates for `Func<__Canon>`. If we only resized the dictionary of `Func<string>`, the shared generic code would work for that instantiation only, but when we attempt to use it with another instantiation like `Func<object>`, the jitted instructions would no longer match the size of the dictionary structure, and would cause access violations.
163+
- We can't just resize the generic dictionary for a single instantiation. For instance, in our example above, let's say we wanted to expand the dictionary for `Method<string>`. The resizing of the layout would have an impact on the shared canonical code that the JIT generates for `Method<__Canon>`. If we only resized the dictionary of `Method<string>`, the shared generic code would work for that instantiation only, but when we attempt to use it with another instantiation like `Method<object>`, the jitted instructions would no longer match the size of the dictionary structure, and would cause access violations.
164164
- The runtime is multi-threaded, which adds to the complexity.
165165

166166
The current implementation expands the dictionary layout and the actual dictionaries separately to keep things simple:

eng/Subsets.props

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</PropertyGroup>
5656

5757
<PropertyGroup>
58-
<DefaultCoreClrSubsets>clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.buildtools+clr.packages</DefaultCoreClrSubsets>
58+
<DefaultCoreClrSubsets>clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages</DefaultCoreClrSubsets>
5959

6060
<DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
6161
<DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib</DefaultMonoSubsets>
@@ -85,7 +85,6 @@
8585
<SubsetName Include="Clr.CoreLib" Description="The managed System.Private.CoreLib library for CoreCLR." />
8686
<SubsetName Include="Clr.NativeCoreLib" Description="Run crossgen on System.Private.CoreLib library for CoreCLR." />
8787
<SubsetName Include="Clr.Tools" Description="Managed tools that support CoreCLR development and testing." />
88-
<SubsetName Include="Clr.BuildTools" Description="Tools needed for the native CoreCLR build." />
8988
<SubsetName Include="Clr.Packages" Description="The projects that produce NuGet packages for the CoreCLR runtime, crossgen, and IL tools." />
9089

9190
<!-- Mono -->
@@ -146,10 +145,6 @@
146145
</ItemDefinitionGroup>
147146

148147
<!-- CoreClr sets -->
149-
<ItemGroup Condition="$(_subset.Contains('+clr.buildtools+'))">
150-
<CoreClrProject Include="$(CoreClrProjectRoot)src\tools\GetModuleIndex\GetModuleIndex.csproj" />
151-
</ItemGroup>
152-
153148
<ItemGroup Condition="$(_subset.Contains('+clr.corelib+'))">
154149
<CoreClrProject Include="$(CoreClrProjectRoot)src\System.Private.CoreLib\System.Private.CoreLib.csproj" />
155150
</ItemGroup>

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@
174174
<Uri>https://github.com/mono/linker</Uri>
175175
<Sha>8caef57d1f3bc7a188e5dd26d43a2d34151223f9</Sha>
176176
</Dependency>
177-
<Dependency Name="Microsoft.DotNet.XHarness.Tests.Runners" Version="1.0.0-prerelease.20214.2">
177+
<Dependency Name="Microsoft.DotNet.XHarness.Tests.Runners" Version="1.0.0-prerelease.20220.2">
178178
<Uri>https://github.com/dotnet/xharness</Uri>
179-
<Sha>b5bfc4fcd431ab1fd560bdea7642c7998e30f24d</Sha>
179+
<Sha>e9223bfb694b252b44a4e5a0c72afa016f676c5e</Sha>
180180
</Dependency>
181181
</ToolsetDependencies>
182182
</Dependencies>

eng/Versions.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
<!-- CoreClr dependencies -->
7878
<MicrosoftNETCoreILAsmVersion>5.0.0-preview.4.20202.18</MicrosoftNETCoreILAsmVersion>
7979
<MicrosoftNETSdkILVersion>5.0.0-preview.4.20202.18</MicrosoftNETSdkILVersion>
80-
<MicrosoftFileFormatsVersion>1.0.120601</MicrosoftFileFormatsVersion>
8180
<!-- Libraries dependencies -->
8281
<SystemTextJsonVersion>5.0.0-preview.4.20202.18</SystemTextJsonVersion>
8382
<runtimenativeSystemIOPortsVersion>5.0.0-alpha.1.19563.3</runtimenativeSystemIOPortsVersion>
@@ -115,7 +114,7 @@
115114
<SystemDataSqlClientVersion>4.8.0</SystemDataSqlClientVersion>
116115
<!-- Testing -->
117116
<MicrosoftNETTestSdkVersion>16.7.0-preview-20200416-02</MicrosoftNETTestSdkVersion>
118-
<MicrosoftDotNetXHarnessTestsRunnersVersion>1.0.0-prerelease.20214.2</MicrosoftDotNetXHarnessTestsRunnersVersion>
117+
<MicrosoftDotNetXHarnessTestsRunnersVersion>1.0.0-prerelease.20220.2</MicrosoftDotNetXHarnessTestsRunnersVersion>
119118
<XUnitVersion>2.4.1</XUnitVersion>
120119
<TraceEventVersion>2.0.5</TraceEventVersion>
121120
<NewtonsoftJsonVersion>12.0.3</NewtonsoftJsonVersion>

eng/native/functions.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,28 @@ endfunction()
415415
function(add_executable_clr)
416416
_add_executable(${ARGV})
417417
endfunction()
418+
419+
function(generate_module_index Target ModuleIndexFile)
420+
if(CLR_CMAKE_HOST_WIN32)
421+
set(scriptExt ".cmd")
422+
else()
423+
set(scriptExt ".sh")
424+
endif()
425+
426+
add_custom_command(
427+
OUTPUT ${ModuleIndexFile}
428+
COMMAND ${CLR_ENG_NATIVE_DIR}/genmoduleindex${scriptExt} $<TARGET_FILE:${Target}> ${ModuleIndexFile}
429+
DEPENDS ${Target}
430+
COMMENT "Generating ${Target} module index file -> ${ModuleIndexFile}"
431+
)
432+
433+
set_source_files_properties(
434+
${ModuleIndexFile}
435+
PROPERTIES GENERATED TRUE
436+
)
437+
438+
add_custom_target(
439+
${Target}_module_index_header
440+
DEPENDS ${ModuleIndexFile}
441+
)
442+
endfunction(generate_module_index)

eng/native/genmoduleindex.cmd

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@echo off
2+
REM Generate module index header
3+
4+
if [%1]==[] goto :Usage
5+
if [%2]==[] goto :Usage
6+
7+
setlocal
8+
for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"size of image"') do set imagesize=%%i
9+
REM Pad the extracted size to 8 hex digits
10+
set imagesize=00000000%imagesize%
11+
set imagesize=%imagesize:~-8%
12+
13+
for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"time date"') do set timestamp=%%i
14+
REM Pad the extracted time stamp to 8 hex digits
15+
set timestamp=00000000%timestamp%
16+
set timestamp=%timestamp:~-8%
17+
18+
echo 0x08, 0x%timestamp:~6,2%, 0x%timestamp:~4,2%, 0x%timestamp:~2,2%, 0x%timestamp:~0,2%, 0x%imagesize:~6,2%, 0x%imagesize:~4,2%, 0x%imagesize:~2,2%, 0x%imagesize:~0,2%, > %2
19+
20+
endlocal
21+
exit /b 0
22+
23+
:Usage
24+
echo Usage: genmoduleindex.cmd ModuleBinaryFile IndexHeaderFile
25+
exit /b 1

eng/native/genmoduleindex.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Generate module index header
4+
#
5+
set -euo pipefail
6+
7+
if [[ "$#" -lt 2 ]]; then
8+
echo "Usage: genmoduleindex.sh ModuleBinaryFile IndexHeaderFile"
9+
exit 1
10+
fi
11+
12+
OSName=$(uname -s)
13+
14+
case "$OSName" in
15+
Darwin)
16+
# Extract the build id and prefix it with its length in bytes
17+
dwarfdump -u $1 |
18+
awk '/UUID:/ { gsub(/\-/,"", $2); printf("%02x", length($2)/2); print $2}' |
19+
# Convert each byte of the id to 0x prefixed constant followed by comma
20+
sed -E s/\(\.\.\)/0x\\1,\ /g > $2
21+
;;
22+
*)
23+
# Extract the build id and prefix it with its length in bytes
24+
readelf -n $1 |
25+
awk '/Build ID:/ { printf("%02x", length($3)/2); print $3 }' |
26+
# Convert each byte of the id to 0x prefixed constant followed by comma
27+
sed -E s/\(\.\.\)/0x\\1,\ /g > $2
28+
;;
29+
esac

eng/pipelines/coreclr/templates/build-job.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ jobs:
118118
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
119119
- template: /eng/pipelines/common/restore-internal-tools.yml
120120

121-
# Build CoreCLR tools needed by the native runtime build
122-
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.buildtools $(crossArg) -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci /bl:$(Build.SourcesDirectory)/artifacts/log/clr.buildtools.binlog
123-
displayName: Build CoreCLR Diagnostic Tools
124-
125121
# Build CoreCLR Runtime
126122
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
127123
- script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(officialBuildIdArg)

src/coreclr/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ set(GENERATED_EVENTING_DIR ${CMAKE_CURRENT_BINARY_DIR}/Eventing)
2525
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c")
2626
set(PAL_REDEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/dlls/mscordac/palredefines.S)
2727

28-
if(CLR_CMAKE_HOST_UNIX)
29-
set(CLR_DOTNET_COMMAND ${CLR_REPO_ROOT_DIR}/dotnet.sh)
30-
elseif(CLR_CMAKE_HOST_WIN32)
31-
set(CLR_DOTNET_COMMAND ${CLR_REPO_ROOT_DIR}/dotnet.cmd)
32-
endif(CLR_CMAKE_HOST_UNIX)
33-
3428
# Avoid logging when skipping up-to-date copies
3529
set(CMAKE_INSTALL_MESSAGE LAZY)
3630

0 commit comments

Comments
 (0)