Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fast codegen-free generic object instantiation + improve Activator.CreateInstance perf #1

Closed
wants to merge 193 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
d0bde83
Fast object instantiation, take two
GrabYourPitchforks May 9, 2020
67539c2
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Jul 8, 2020
edf3858
PR feedback
GrabYourPitchforks Jul 7, 2020
c5ae79f
Re-enable analyzers in project
GrabYourPitchforks Jul 8, 2020
e09e91b
Don't run COM tests on non-Windows
GrabYourPitchforks Jul 8, 2020
17a3bde
PR feedback
GrabYourPitchforks Jul 8, 2020
2467fdd
Fix mergeMerge remote-tracking branch 'origin/master' into fast_creat…
GrabYourPitchforks Nov 17, 2020
eb368eb
Cleanup + PR feedback
GrabYourPitchforks Nov 17, 2020
b85fb74
Merge remote-tracking branch 'origin/master' into fast_createinstance
GrabYourPitchforks Nov 18, 2020
7426c10
Remove closure allocations from ServiceCollectionDescriptorExtensions…
benaadams Nov 18, 2020
faeef8c
Remove 'unwrapNullable' parameter
GrabYourPitchforks Nov 18, 2020
4204aa9
Avoid string.Split in LoggerRuleSelector.IsBetter (#44753)
stephentoub Nov 18, 2020
14c0440
Change SuperPMI collection to not use altjit mechanism (#44834)
BruceForstall Nov 18, 2020
a60137c
Fix ComponentDocumentDesigner references in DesignerAttribute to incl…
safern Nov 18, 2020
bdb403a
Quick GetDefaultCtor helper
GrabYourPitchforks Nov 18, 2020
4e5463d
Fix nullable annotations on HttpClient.Post/Put/PatchAsync (#44880)
stephentoub Nov 18, 2020
e28dbe9
Remove some allocations from ManifestBuilder.CreateManifestString (#4…
stephentoub Nov 18, 2020
42ffc8f
Delete now unused target in crossgen2.csproj. (#44888)
jkoritzinsky Nov 18, 2020
0fad9d6
Remove unnecessary GetTypeInfo from Microsoft.Extensions. (#44891)
eerhardt Nov 18, 2020
722fb86
Add test for Timer.Elapsed DateTime (#44881)
stephentoub Nov 18, 2020
7e3b310
Fix discuss #44785:optimize constructor of ElapsedEventArgs (#44853)
LeaFrock Nov 18, 2020
514079d
Improve dumping GC info in R2RDump (#44857)
AntonLapounov Nov 18, 2020
cb3ecbb
Fix illumos managed build (#44386)
am11 Nov 18, 2020
21f32f0
Make minor change to corinfo.h to test SuperPMI AzDO job trigger (#44…
BruceForstall Nov 18, 2020
c173fda
Remove unmanaged Allocate / CreateInstance
GrabYourPitchforks Nov 18, 2020
044ee8c
Change gtGetThisArg not to return nullptr. (#44398)
Nov 19, 2020
5c52acd
Fix GetDefaultConstructor signature
GrabYourPitchforks Nov 19, 2020
0cb3cfd
Verify that OCSP and CRL checks fall back.
vcsjones Nov 19, 2020
a1c362c
Fix AV in allocator
GrabYourPitchforks Nov 19, 2020
999785e
For x86/x64, call a stack probe helper for all frame sizes equal or o…
echesakov Nov 19, 2020
3ce9c41
Fix indentation
GrabYourPitchforks Nov 19, 2020
496bc88
Fix ListSeparator with ICU (#44732)
tarekgh Nov 19, 2020
904b25d
Fix COM instantiation
GrabYourPitchforks Nov 19, 2020
1f6434a
Remove COM allocator special-case
GrabYourPitchforks Nov 19, 2020
1eb8d17
Sync SPC File.cs implementation with full the implementation in SIF (…
marek-safar Nov 19, 2020
c1ecb07
Fix mono build break; quick code cleanup
GrabYourPitchforks Nov 19, 2020
ffc0b7a
Ensure Debugging assets are signed. (#44915)
hoyosjs Nov 19, 2020
a7040b0
Fix regression in XDocumentType (#44868)
krwq Nov 19, 2020
f2feed9
Use simple array for AggregateException inner exceptions storage (#44…
marek-safar Nov 19, 2020
1821d9c
Fix s390x unwinding and remove need for backchain pointer (#44927)
monojenkins Nov 19, 2020
88c4a46
Add AOT support for the EntryPoint property for UnmanagedCallersOnly.…
vargaz Nov 19, 2020
01c8d63
Move EventPipe C library into shared location. (#44791)
lateralusX Nov 19, 2020
cb8c8ec
Increment breaking change no for doubly linked freelists (#44800)
PeterSolMS Nov 19, 2020
b5dffeb
[mono] Unconditionally check llvm::Expected<T> for success (#44908)
imhameed Nov 19, 2020
eb7a815
[mono] Re-enable /JIT/HardwareIntrinsics/General/NotSupported_{r,ro}/…
imhameed Nov 19, 2020
c17ecbd
Delete coreconsole test hosts (#44933)
jkotas Nov 19, 2020
5b48cae
Speed up Crossgen2 by 10% (#44917)
nattress Nov 19, 2020
d3e5aa8
Fix issue 44646 - ILAsm incorrectly handles method .custom attribute …
briansull Nov 19, 2020
2b41889
Fix SoD input path (#44954)
DrewScoggins Nov 19, 2020
75c0b99
Consolidate RID and native file naming in MSBuild scripts (#43804)
am11 Nov 19, 2020
8bbbf6d
Delete NetEventSource.IsEnabled (#44901)
stephentoub Nov 19, 2020
cb035a3
Fix NRE on EmitCalli (#44452)
wzchua Nov 19, 2020
3c5b4a6
Remove temporary SuperPMI scripting code (#44962)
BruceForstall Nov 19, 2020
3f97ea6
Mark stress log critical section as compatible with shutdown (#44937)
trylek Nov 19, 2020
0897d4a
Use multibyte character path for bundle_probe (#44466)
am11 Nov 19, 2020
63923b5
Custom attribute properties were not always applied correctly (#44813)
steveharter Nov 19, 2020
a071262
Rename GetNewobjHelperFnPtr -> GetAllocatorFtn
GrabYourPitchforks Nov 19, 2020
dc417fd
Cleanup in the allocator routines
GrabYourPitchforks Nov 19, 2020
6904495
Fix linker failures, add asserts
GrabYourPitchforks Nov 19, 2020
05c35a8
Remove unwanted CreateInstanceDefaultCtor overload
GrabYourPitchforks Nov 19, 2020
3d8515a
Use WeakRef in ActivatorCache
GrabYourPitchforks Nov 19, 2020
3440021
Run class cctor in RuntimeHelpers.GetUninitializedObject(type). (#44898)
vargaz Nov 19, 2020
b58991b
Fix post build signing props and enable post build signing. (#44951)
jkoritzinsky Nov 19, 2020
705533e
Move xunit test harness to its own directory under core_root (#44921)
nattress Nov 19, 2020
20aa7ad
Use simple convert method for internal bool to ulong enum conversion …
marek-safar Nov 19, 2020
b851613
Enables the interpreter on iOS (#44911)
steveisok Nov 19, 2020
0f64477
Fix syntax error in Signing.props (#44971)
ViktorHofer Nov 19, 2020
5acef41
Reintroduce COM specialization
GrabYourPitchforks Nov 20, 2020
adfae42
Allow runtime to create unboxing stub on my behalf
GrabYourPitchforks Nov 20, 2020
49a8de1
Fix linker warning
GrabYourPitchforks Nov 20, 2020
98c7941
Update error conditions
GrabYourPitchforks Nov 20, 2020
0a443c2
Friendlier exception messages when activation fails
GrabYourPitchforks Nov 20, 2020
3b34ae6
Cleanup usings
GrabYourPitchforks Nov 20, 2020
cb80f85
Fix handling of \G in Regex.Split/Replace (#44975)
stephentoub Nov 20, 2020
6e1b7cd
Move friendly exception messages to common place
GrabYourPitchforks Nov 20, 2020
b588d5d
Fix TIE wrappers
GrabYourPitchforks Nov 20, 2020
55aa128
Update unit tests
GrabYourPitchforks Nov 20, 2020
0ef275c
Call CreateInstanceCheckThis for better exception handling
GrabYourPitchforks Nov 20, 2020
4c1f5dd
PR feedback + fix failing coreclr unit tests
GrabYourPitchforks Nov 20, 2020
97f5f60
Fix build breaks
GrabYourPitchforks Nov 20, 2020
867bdc0
Merge remote-tracking branch 'levib/fast_createinstance' into fast_cr…
GrabYourPitchforks Nov 20, 2020
2e44013
Fix strings.resx whitespace
GrabYourPitchforks Nov 20, 2020
3ecf9db
Build osx-x64 Crossgen2 package (#44984)
AntonLapounov Nov 20, 2020
9c267fd
Fix build breaks on mono & non-Windows
GrabYourPitchforks Nov 20, 2020
e2312e1
Removed unwanted ManualResetEvent from ServiceController (#44716)
ShreyasJejurkar Nov 20, 2020
70c51bb
Fix pal cgroup v2 implementation (#44990)
tmds Nov 20, 2020
d85f060
Preserve symbols in dbgshim (#44970)
hoyosjs Nov 20, 2020
46b8b22
Increase Hosting test delay to fix flaky BackgroundServiceAsyncExcept…
eerhardt Nov 20, 2020
8df6fe7
Fix parsed RID condition for VS (#44998)
am11 Nov 20, 2020
a61b054
Use substitute SHA-1 implementation in wasm (#44982)
GrabYourPitchforks Nov 20, 2020
f22d7c5
Use TryParseUInt32HexNumberStyle directly from Guid.TryParse (#44918)
stephentoub Nov 20, 2020
38c9b98
Disable on Server Core a couple tests that use notepad (#44972)
danmoseley Nov 20, 2020
2f18501
Fix CFB8 with Zero padding
vcsjones Nov 20, 2020
5301748
Fix add user secrets (#44838)
galakt Nov 20, 2020
b9630c4
[mono] Define ENABLE_MONOTOUCH and MONOTOUCH when building iOS/tvOS A…
imhameed Nov 20, 2020
a6b3b23
Updated mono testing doc (#44360)
fanyang-mono Nov 20, 2020
2b6d79a
Add Linux ARM64 runs (#44887)
DrewScoggins Nov 20, 2020
aca7af9
Add chmod for the SoD tool (#45014)
DrewScoggins Nov 20, 2020
58667e7
Add missing XML docs to System.Security.* (#44461)
krwq Nov 20, 2020
07193b8
Register allocation cleanup (#44977)
kunalspathak Nov 20, 2020
bead4c6
PR feedback
GrabYourPitchforks Nov 20, 2020
c409a32
Fix buffer comparison in stream conformance tests (#45012)
geoffkizer Nov 20, 2020
f2e83d7
Remove Convert.ToByte usage from Enum (#45004)
stephentoub Nov 20, 2020
8d38285
Remove LINQ usage from EnvironmentVariablesConfigurationProvider (#44…
stephentoub Nov 20, 2020
f9a8abc
Remove more LINQ usage from various dotnet/runtime libraries (#44964)
stephentoub Nov 20, 2020
028cde2
Add GetCiphertextLength for CBC, CFB, and ECB.
vcsjones Nov 21, 2020
8f12dd8
Fix GC hole in AllocateComObject
GrabYourPitchforks Nov 21, 2020
99e9cbc
Hide DispatchTailCalls helper in stacktraces (#45019)
jkotas Nov 21, 2020
0a14898
[browser][tests] Standup System.Net.WebSockets.Client.Tests in CI (#4…
kjpou1 Nov 21, 2020
6c80a3d
Use OutputRid for host packs (#45041)
am11 Nov 21, 2020
2f8959a
Correct nullability annotation for IDataRecord (#44938)
roji Nov 21, 2020
8a3dc16
Implement getMethodModule (#45046)
BruceForstall Nov 21, 2020
eb5df0d
Handle non-ASCII strings in GetNonRandomizedHashCodeOrdinalIgnoreCase…
EgorBo Nov 21, 2020
c4c3981
Use HexConverter directly when producing hex representation of enum v…
marek-safar Nov 21, 2020
3a2021d
Refactor GetActivationInfo
GrabYourPitchforks Nov 22, 2020
46ed0b8
Refactor RunClassConstructor
GrabYourPitchforks Nov 22, 2020
d3bc632
Update GetUninitializedObject to call the new APIs
GrabYourPitchforks Nov 22, 2020
3f362f2
Hook up ActivatorCache to new system
GrabYourPitchforks Nov 22, 2020
879937b
Fix typo causing build break
GrabYourPitchforks Nov 22, 2020
93bcedb
Change GetActivationInfo to QCALL
GrabYourPitchforks Nov 22, 2020
e04401f
Simplify some call sites
GrabYourPitchforks Nov 22, 2020
9887e9a
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Nov 22, 2020
186fd83
Fix failing tests
GrabYourPitchforks Nov 22, 2020
4d3d9db
Fix bad assert
GrabYourPitchforks Nov 22, 2020
036cbf0
Add managed _AllocateComObject member to make FCall checks happier
GrabYourPitchforks Nov 22, 2020
bb492cb
Drop Convert static constructor dependency from RuntimeType (#45054)
marek-safar Nov 22, 2020
882b63e
Avoid using GetEEFuncEntryPoint
GrabYourPitchforks Nov 22, 2020
f67389f
Fix Typos (#45024)
Nov 22, 2020
0b0c8db
Fix build error in ecalllist.h
GrabYourPitchforks Nov 22, 2020
12ae956
Delete unused WinRT related strings (#45067)
jkotas Nov 22, 2020
c50d287
Update COM invocation unit tests
GrabYourPitchforks Nov 22, 2020
e2235cc
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Nov 22, 2020
cebbf48
Allow propagation of PNSE in RuntimeHandles
GrabYourPitchforks Nov 22, 2020
bf302de
Improve throughput of Environment.GetEnvironmentVariables() (#45057)
stephentoub Nov 22, 2020
7218577
Create cancellation token registration wrapper only when it's needed …
marek-safar Nov 23, 2020
e8c4f22
disable ReadWrite_Success_Large test for CryptoStream because it take…
geoffkizer Nov 23, 2020
8861c41
Skip Invariant initialization test for CultureData.Invariant (#45064)
benaadams Nov 23, 2020
65d42f0
[Android] Introduce AndroidApkFileReplacerTask task (#44993)
EgorBo Nov 23, 2020
e274015
Add support for stack walks on wasm for the reflection methods which …
vargaz Nov 23, 2020
78adc93
Use `argIsInvariant` instead of `argNode->OperIsConst()` for inlining…
Nov 23, 2020
e2099f6
Use Type.EmptyTypes consistently (#45112)
stephentoub Nov 23, 2020
202f6e1
Update ILVerify readme (#45123)
jkotas Nov 23, 2020
3f89665
Remove most uses of RuntimeTypeHandle.Allocate (#45085)
GrabYourPitchforks Nov 23, 2020
d373fe7
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Nov 24, 2020
12b4578
Remove _AllocateComObject sentinel
GrabYourPitchforks Nov 24, 2020
a7fa617
PR feedback
GrabYourPitchforks Nov 24, 2020
89383aa
Fix native build on arm and arm64. (#45131)
Nov 24, 2020
1fa2054
Fix CoreRT frozen strings handling. (#45095)
Nov 24, 2020
aebd598
Update nullability.md
stephentoub Nov 24, 2020
664b962
Reduce RuntimeType.MakeGenericType overheads (#45137)
stephentoub Nov 24, 2020
2e8c4c7
Handle inconsistent \0 in Pkcs9Document{Name|Description}
bartonjs Nov 24, 2020
d73c65e
add support for less standard serial port speeds on macOS (#44052)
wfurt Nov 24, 2020
f3acf03
Delay initialization of Task related properties which are rarely used…
marek-safar Nov 24, 2020
62f55e1
Fix Full Width Chars Casing (#45079)
tarekgh Nov 24, 2020
7031456
JIT: change basic block weight to float (#45052)
AndyAyersMS Nov 24, 2020
e04274e
Reduce SafeHandle allocation in CertEnumCertificatesInStore (#45166)
stephentoub Nov 24, 2020
50c4607
Fix work item exit code for helix tests (#45164)
alexperovich Nov 24, 2020
3e65d68
Keep precise argument sizes between import and morph. (#43130)
Nov 25, 2020
93cbc09
Remove ForceAsync from CryptoStream (#45150)
stephentoub Nov 25, 2020
3e9438c
PR feedback - simplify GetActivationInfo out params
GrabYourPitchforks Nov 25, 2020
9c20d84
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Nov 25, 2020
fa367a3
Remove redundant ExecutionContext private ctor parameter (#45173)
marek-safar Nov 25, 2020
4b38b6c
Add missing ifdef around _AllocateComInterop
GrabYourPitchforks Nov 25, 2020
9ed2b9b
Final inspection + code cleanup
GrabYourPitchforks Nov 25, 2020
fe80a77
Fix Activity Start Time Precision (#45175)
tarekgh Nov 25, 2020
0ebebd6
Fix compilation error on non-Windows
GrabYourPitchforks Nov 25, 2020
e08358f
Skip some PKCS9 tests on NetFx (#45199)
GrabYourPitchforks Nov 25, 2020
0262b49
Fix Socket telemetry outerloop test failures (#45170)
stephentoub Nov 25, 2020
837785f
Implement TCP Keep-Alive for WinHttpHandler (#44889)
antonfirsov Nov 25, 2020
2c155c2
Fix spelling of OverideEventProvider (#45113)
stephentoub Nov 25, 2020
96a49a1
[master] Update dependencies from dotnet/icu dotnet/llvm-project dot…
dotnet-maestro[bot] Nov 25, 2020
d6b9adb
[wasm] change filtering system timezones from zone.tab as a task para…
tqiu8 Nov 25, 2020
f066972
Remove unused Enum::InternalFlagsFormat parameter (#45196)
marek-safar Nov 25, 2020
23f7fbc
Mono: switch to CMake build on Windows (#44976)
akoeplinger Nov 25, 2020
854fde6
Fix ninja package name (#45217)
jkoritzinsky Nov 25, 2020
ffc141a
Disabled test, fixed some typos as well. (#45212)
ManickaP Nov 25, 2020
5a6c21c
Initial version of class profiling for PGO (#45133)
AndyAyersMS Nov 25, 2020
abc525d
Handle unsupported browser warnings (#43363)
buyaa-n Nov 25, 2020
f48c8d5
Disabled Http2_PingKeepAlive (#45214)
ManickaP Nov 25, 2020
9f6b9d1
Remove allocations from `OptionsCache<T>` (#45229)
stephentoub Nov 25, 2020
b8faf45
Reduce allocation in OptionsManager (#45231)
stephentoub Nov 25, 2020
db9fe14
Update dependencies from https://github.com/dotnet/xharness build 202…
dotnet-maestro[bot] Nov 25, 2020
374cf34
Code cleanup & PR feedback
GrabYourPitchforks Nov 25, 2020
6b23817
Merge remote-tracking branch 'origin/master' into fast_createinstance…
GrabYourPitchforks Nov 25, 2020
11be754
More code cleanup
GrabYourPitchforks Nov 26, 2020
5d43a91
Rename ActivatorCache source file
GrabYourPitchforks Nov 26, 2020
0635399
Remove unnecessary asserts, underscores, indentation
GrabYourPitchforks Nov 26, 2020
9ac3c3f
Fix [DynamicallyAccessedMembers] annotations
GrabYourPitchforks Nov 26, 2020
a06ef73
Fix bad assert
GrabYourPitchforks Nov 26, 2020
1b1261f
Update src/coreclr/src/vm/reflectioninvocation.cpp
GrabYourPitchforks Nov 26, 2020
94f8614
PR feedback
GrabYourPitchforks Nov 26, 2020
c73e9fa
Update src/coreclr/src/vm/reflectioninvocation.cpp
jkotas Nov 26, 2020
359a588
Remove incorrect assert in ActivatorCache
GrabYourPitchforks Nov 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "1.0.0-prerelease.20559.2",
"version": "1.0.0-prerelease.20575.2",
"commands": [
"xharness"
]
Expand Down
4 changes: 1 addition & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppCurrent)', 'publish'))</WasmAppBuilderDir>
<WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(NetCoreAppCurrent)', 'publish'))</WasmBuildTasksDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppCurrent)'))</MonoAOTCompilerDir>

<AppleAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll'))</AppleAppBuilderTasksAssemblyPath>
<AndroidAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll'))</AndroidAppBuilderTasksAssemblyPath>
<WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
Expand Down Expand Up @@ -105,8 +105,6 @@
</PropertyGroup>

<PropertyGroup>
<!-- Default to portable build if not explicitly set -->
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
<!-- Default to discarding symbols if not explicitly set -->
<KeepNativeSymbols Condition="'$(KeepNativeSymbols)' == ''">false</KeepNativeSymbols>
<!-- Used for launchSettings.json and runtime config files. -->
Expand Down
16 changes: 8 additions & 8 deletions docs/coding-guidelines/api-guidelines/nullability.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Nullability annotations

C# 8 provides an opt-in feature that allows for the compiler to track reference type nullability in order to catch potential null dereferences. We are adopting that feature across .NET's libraries, working up from the bottom of the stack. We're doing this for three primary reasons, in order of importance:
As of C# 8 and improved in C# 9, the C# language provides an opt-in feature that allows the compiler to track reference type nullability in order to catch potential null dereferences. We have adopted that feature set across .NET's libraries, working up from the bottom of the stack. We've done this (and continue to do so for all new library development) for three primary reasons, in order of importance:

- **To annotate the .NET surface area with appropriate nullability annotations.** While this could be done solely in the reference assemblies, we're doing it first in the implementation to help validate the selected annotations.
- **To help validate the nullability feature itself.** With millions of lines of C# code, we have a very large and robust codebase with which to try out the feature and find areas in which it shines and areas in which we can improve it. The work to annotate System.Private.CoreLib in .NET Core 3.0 helped to improve the feature as shipped in C# 8, and annotating the rest of the libraries will continue to be helpful in this regard.
- **To find null-related bugs in .NET Runtime itself.** We expect to find relatively few meaningful bugs, due to how relatively well-tested the codebases are and how long they've been around.
- **To annotate the .NET surface area with appropriate nullability annotations.** While this could be done solely in the reference assemblies, we do it in the implementation to help validate the selected annotations.
- **To help validate the nullability feature itself.** With millions of lines of C# code, we have a very large and robust codebase with which to try out features and find areas in which it shines and areas in which we can improve it. The work to annotate System.Private.CoreLib in .NET Core 3.0 helped to improve the feature as shipped in C# 8, and the rest of the core libraries being annotated in .NET 5 helped to further flesh out the design for C# 9.
- **To find null-related bugs in .NET Runtime itself.** We have found few meaningful bugs, due to how relatively well-tested the codebases are and how long they've been around. However, for new code, the annotations do help to highlight places where null values may be erroneously dereferenced, helping to avoid NullReferenceExceptions in places testing may not yet be adequate.

## Breaking Change Guidance

We are striving to get annotations correct the "first time" and are doing due-diligence in an attempt to do so. However, we acknowledge that we are likely to need to augment and change some annotations in the future:
We strive to get annotations correct the "first time" and do due-diligence in an attempt to do so. However, we acknowledge that we are likely to need to augment and change some annotations in the future:

- **Mistakes.** Given the sheer number of APIs being reviewed and annotated, we are likely to make some errors, and we'd like to be able to fix them so that long-term customers get the greatest benefit.
- **Breadth.** Annotation takes time, so annotations will roll out over time rather than being released all at once.
- **Breadth.** Annotation takes time, so annotations have rolled out and will continue to roll out over time rather than all at once for the whole stack.
- **Feedback.** We may need to revisit some "gray area" decisions as to whether a parameter or return type should be nullable or non-nullable (more details later).

Any such additions or changes to annotations can impact the warnings consuming code receives if that code has opted in to nullability analysis and warnings. Even so, for at least the foreseeable future we may still do so. We will be very thoughtful about when and how we do.
Any such additions or changes to annotations can impact the warnings consuming code receives if that code has opted-in to nullability analysis and warnings. Even so, for at least the foreseeable future we may still do so, and we will be very thoughtful about when and how we do.

## Annotation Guidance

Expand All @@ -23,7 +23,7 @@ Nullability annotations are considered to represent intent: they represent the n
- **DO** annotate all new APIs with the desired contract.
- **CONSIDER** changing that contract if overwhelming use suggests a different de facto contract. This is particularly relevant to virtual/abstract/interface methods defined in a library where all implementations may not be under your control, and derived implementations may not have adhered to the original intent.
- **DO** respect documented behaviors. Nullability annotations are about codifying a contract, and documentation is a description of that contract. If, for example, a base abstract or virtual method says that it may throw an exception if `null` is passed in, that dictates that the argument should be non-nullable.
- **DO** continue to validate all arguments as you would have prior to nullability warnings. In particular, if you would have checked an argument for `null` and thrown an `ArgumentNullException` if it was `null`, continue to do so, even if the parameter is defined as non-nullable. Many consumers will not have nullability checked enabled, either because they're using a language other than C#, they're using an older version of C#, they simply haven't opted-in to nullability analysis, or the compiler isn't able to detect the misuse.
- **DO** continue to validate all arguments as you would have prior to nullability warnings. In particular, if you would have checked an argument for `null` and thrown an `ArgumentNullException` if it was `null`, continue to do so, even if the parameter is defined as non-nullable. Many consumers will not have nullability checked enabled, either because they're using a language other than C#, they're using an older version of C#, they simply haven't opted-in to nullability analysis, they've explicitly suppressed warnings, or the compiler isn't able to detect the misuse.
- **DO NOT** remove existing argument validation when annotating existing public/protected APIs. If through the course of annotating it becomes clear that internal/private surface area is unnecessarily checking for nulls when nulls aren't possible (i.e. you found dead code), such use can be removed or replaced by asserts.
- **AVOID** making any changes while annotating that substantively impact the generated IL for an implementation (e.g. `some.Method()` to `some?.Method()`). Any such changes should be thoroughly analyzed and reviewed as a bug fix. In some cases, such changes may be warranted, but they're a red flag that should be scrutinized heavily.

Expand Down
8 changes: 4 additions & 4 deletions docs/design/coreclr/jit/lsra-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ well as supporting components) in more depth.
- `LinearScan::identifyCandidates`

- This mostly duplicates what is done in
`Compiler::lvaMarkLocalVars(). There are differences in what
`Compiler::lvaMarkLocalVars()`. There are differences in what
constitutes a register candidate vs. what is tracked, but we
should probably handle them in `Compiler::lvaMarkLocalVars()`
when it is called after `Lowering`.
Expand Down Expand Up @@ -445,7 +445,7 @@ node, which builds `RefPositions` according to the liveness model described abov

- First, we create `RefPosition`s to define any internal registers that are required.
As we create new `Interval`s for these, we add the definition `RefPosition` to an array,
`InternalDefs`. This allows us to create the corresponding uses of these internal
`internalDefs`. This allows us to create the corresponding uses of these internal
registers later.

- Then we create `RefPosition`s for each use in the instruction.
Expand Down Expand Up @@ -474,7 +474,7 @@ node, which builds `RefPositions` according to the liveness model described abov
we need to ensure that the other source isn't given the same register as the
target. For this, we annotate the use `RefPosition` with `delayRegFree`.

- Next we create the uses of the internal registers, using the `InternalDefs` array.
- Next we create the uses of the internal registers, using the `internalDefs` array.
This is cleared before the next instruction is handled.

- Next, any registers in the kill set for the instruction are killed. This is performed
Expand Down Expand Up @@ -652,7 +652,7 @@ LinearScanAllocation(List<RefPosition> refPositions)
- When `COMPlus_EnableEHWriteThru == 0`, any variable that's
live in to an exception region is always referenced on the stack.

- See [Enable EHWriteThru by default](#enable-EHWriteThru-by-default).
- See [Enable EHWriteThru by default](#enable-ehwritethru-by-default).

- Code generation (genGenerateCode)

Expand Down
4 changes: 2 additions & 2 deletions docs/workflow/requirements/linux-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Install the following packages for the toolchain:
- libkrb5-dev
- libnuma-dev (optional, enables numa support)
- zlib1g-dev
- ninja (optional, enables building native code with ninja instead of make)
- ninja-build (optional, enables building native code with ninja instead of make)

The following dependencies are needed if Mono Runtime is enabled (default behavior):

Expand All @@ -62,7 +62,7 @@ The following dependencies are needed if Mono Runtime is enabled (default behavi
sudo apt-get install -y cmake llvm-9 clang-9 autoconf automake \
libtool build-essential python curl git lldb-6.0 liblldb-6.0-dev \
libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev \
libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja
libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja-build
```

You now have all the required components.
108 changes: 81 additions & 27 deletions docs/workflow/testing/mono/testing.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,108 @@
# Running Tests using Mono Runtime
# Running test suites using Mono

## Running Runtime Tests
We currently only support running tests against coreclr. There are additional mono runtime tests in mono/mono, but they
have not been moved over yet. Simply run the following command:
Before running tests, [build Mono](../../building/mono/README.md) using the desired configuration.

## Runtime Tests
### Desktop Mono:

To build the runtime tests for Mono JIT or interpreter, execute the following command from `$(REPO_ROOT)/src/tests`
```
./build.sh excludemonofailures <release|debug>
```

Run individual test:
```
cd ../mono/netcore
make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
```

Run all tests:
```
cd ../mono/netcore
make run-tests-coreclr-all
```

### WebAssembly:
Build the runtime tests for WebAssembly
```
$(REPO_ROOT)/src/tests/build.sh -skipstressdependencies -excludemonofailures os Browser wasm <Release/Debug>
```

The last few lines of the build log should contain something like this:
```
dotnet build /t:RunCoreClrTests $(REPO_ROOT)/src/mono/mono.proj
--------------------------------------------------
Example run.sh command

src/tests/run.sh --coreOverlayDir=<repo_root>artifacts/tests/coreclr/Browser.wasm.Release/Tests/Core_Root --testNativeBinDir=<repo_root>/artifacts/obj/coreclr/Browser.wasm.Release/tests --testRootDir=<repo_root>/artifacts/tests/coreclr/Browser.wasm.Release --copyNativeTestBin Release
--------------------------------------------------
```

If you want to run individual tests, execute this command:
To run all tests, execute that command, adding `wasm` to the end.

### Android:
Build the runtime tests for Android x64
```
$(REPO_ROOT)/src/tests/build.sh -skipstressdependencies -excludemonofailures os Android x64 <Release/Debug>
```
dotnet build /t:RunCoreClrTest /p:CoreClrTest="<TestName>" $(REPO_ROOT)/src/mono/mono.proj

The last few lines of the build log should contain something like this:
```
--------------------------------------------------
Example run.sh command

## Running Library Tests
Running library tests against Mono is straightforward regardless of configuration. Simply run the following commands:
src/tests/run.sh --coreOverlayDir=<repo_root>artifacts/tests/coreclr/Android.x64.Release/Tests/Core_Root --testNativeBinDir=<repo_root>/artifacts/obj/coreclr/Android.x64.Release/tests --testRootDir=<repo_root>/artifacts/tests/coreclr/Android.x64.Release --copyNativeTestBin Release
--------------------------------------------------
```
To run all tests, execute that command, adding `Android` at the end.

1. Build and set the RuntimeFlavor
### Additional Documents
For more details about internals of the runtime tests, please refer to the [CoreCLR testing documents](../coreclr)

```bash
./build.sh /p:RuntimeFlavor=mono
## Libraries tests
### Desktop Mono
Build and run library tests against Mono JIT or interpreter
```
$(REPO_ROOT)/dotnet.sh build /t:Test /p:RuntimeFlavor=mono /p:Configuration=<Release/Debug> $(REPO_ROOT)/src/libraries/<library>/tests
```
or on Windows
```bat
build.cmd /p:RuntimeFlavor=mono
Alternatively, you could execute the following command from `$(REPO_ROOT)/src/mono/netcore`
```
make run-tests-corefx-<library>
```
For example, the following command is for running System.Runtime tests:
```
make run-tests-corefx-System.Runtime
```
### Mobile targets and WebAssembly
Build and run library tests against Webassembly, Android or iOS. See instructions located in [Library testing document folder](../libraries/)

2. cd into the test library of your choice (`cd src/libraries/<library>/tests`)
# Running the Mono samples
There are a few convenient samples located in `$(REPO_ROOT)/src/mono/netcore/sample`, which could help you test your program easily with different flavors of Mono or do a sanity check on the build. The samples are set up to work with a specific configuration; please refer to the relevant Makefile for specifics. If you would like to work with a different configuration, you can edit the Makefile.

3. Run the tests
## Desktop Mono
To run the desktop Mono sample, cd to `HelloWorld` and execute:

```
dotnet build /t:Test /p:RuntimeFlavor=mono
make run
```
Note that the default configuration of this sample is LLVM JIT.

# Patching Local dotnet (.dotnet-mono)
Another way to test mono out is by 'patching' a local dotnet with our runtime bits. This is a good way to write simple
test programs and get a glimpse of how mono will work with the dotnet tooling.
## WebAssembly
To run the WebAssembly sample, cd to `wasm`. There are two sub-folders `browser` and `console`. One is set up to run the progam in browser, the other is set up to run the program in console. Enter the desirable sub-folder and execute

```
make build && make run
```

To generate a local .dotnet-mono, execute this command:
## Android
To run the Android sample, cd to `Android` and execute

```
dotnet build /t:PatchLocalMonoDotnet $(REPO_ROOT)/src/mono/mono.proj
make run
```

You can then, for example, run our HelloWorld sample via:
## iOS
To run the iOS sample, cd to `iOS` and execute

```
dotnet build -c Release $(REPO_ROOT)/src/mono/netcore/sample/HelloWorld
MONO_ENV_OPTIONS="" COMPlus_DebugWriteToStdErr=1 \
$(REPO_ROOT)/.dotnet-mono/dotnet $(REPO_ROOT)/src/mono/netcore/sample/HelloWorld/bin/HelloWorld.dll
make run
```
Loading