platform/upstream/dotnet/runtime.git
2 years agoFix stack overflow with X509Certificate FriendlyName
Kevin Jones [Thu, 6 Jan 2022 21:15:18 +0000 (16:15 -0500)]
Fix stack overflow with X509Certificate FriendlyName

A FriendlyName in Windows' length is a DWORD, an unsigned integer. We
however marshal it as a signed integer, so a friendly name with a
length greater than int.MaxValue would wrap around to negative. This
in turn would be "below" the stackalloc threshold, and attempt to stackalloc
a negative value. stackalloc treats this value as unsigned, so it results
in allocating too much on the stack.

2 years agoEnsure UserSecretsIdAttribute is added to assembly (#63415)
Eric Erhardt [Thu, 6 Jan 2022 20:54:23 +0000 (14:54 -0600)]
Ensure UserSecretsIdAttribute is added to assembly (#63415)

When Microsoft.Extensions.Configuration.UserSecrets is referenced transitively, for example through Extensions.Hosting, the UserSecretsIdAttribute isn't getting added to the built assembly. This is because the logic is contained in a `build` folder which is excluded by the dependency from Extensions.Hosting.

The fix is to move the logic to `buildTransitive`, so it gets picked up by NuGet. One wrinkle is that the logic now conflicts with the netstandard compatibility logic added by the library infrastructure. In order to make progress, disable that logic for this package and rely on its dependencies to raise the compat error.

Contributes to #63246

2 years agoRefactor DllImports in Microsoft.Extensions.Hosting.Systemd (#63421)
Matt Kotsenas [Thu, 6 Jan 2022 20:18:04 +0000 (12:18 -0800)]
Refactor DllImports in Microsoft.Extensions.Hosting.Systemd (#63421)

2 years agoFix time reporting for the merged tests (#63452)
Tomáš Rylek [Thu, 6 Jan 2022 20:13:47 +0000 (21:13 +0100)]
Fix time reporting for the merged tests (#63452)

In XUnitWrapperGenerator we need to initialize the stopwatch
variable using Stopwatch.StartNew(), not just new Stopwatch(),
otherwise the stopwatch never starts to run, that's why all the
test case times showed as zero. (Alternatively we could use
new Stopwatch() followed by stopwatch.Start() but I believe that
Stopwatch.StartNew() is generally considered to be more
performant.)

After applying this fix, some short test times started reporting
their running time in scientific notation (e.g. 5.5e-5) so I
modified the formatting to F6 - in the Methodical suite I see
a test running for 55 microseconds.

Thanks

Tomas

2 years agoMake DllImportGenerator unit tests' compilations use live refs (#63410)
Elinor Fung [Thu, 6 Jan 2022 19:36:54 +0000 (14:36 -0500)]
Make DllImportGenerator unit tests' compilations use live refs (#63410)

2 years ago[wasm] Fix test filtering for debugger tests on windows (#63380)
Ankit Jain [Thu, 6 Jan 2022 16:51:33 +0000 (11:51 -0500)]
[wasm] Fix test filtering for debugger tests on windows (#63380)

This caused the disabled ArrayTests to run on windows, causing the builds to fail. With this change, the tests should correctly get skipped on windows.

2 years agoInclude properties on records for (de)serialization in source-gen (#62668)
Layomi Akinrinade [Thu, 6 Jan 2022 16:01:27 +0000 (11:01 -0500)]
Include properties on records for (de)serialization in source-gen (#62668)

2 years ago[wasm][debugger] GetProperties broken on chrome (#63403)
Thays Grazia [Thu, 6 Jan 2022 07:33:43 +0000 (04:33 -0300)]
[wasm][debugger] GetProperties broken on chrome (#63403)

* Fixing how we test and the implementation after #62627

* Passing null to name.

2 years agoConvert SAL1 to SAL2 (#63333)
NN [Thu, 6 Jan 2022 06:49:08 +0000 (08:49 +0200)]
Convert SAL1 to SAL2 (#63333)

2 years agoArm64: Memory barrier improvements (#62895)
Kunal Pathak [Wed, 5 Jan 2022 23:37:43 +0000 (15:37 -0800)]
Arm64: Memory barrier improvements (#62895)

* Use ishst instead of ish

* Do not contain address of volatile fields

* Do not contain address only for Arm64

* Remove ishst

2 years agoJIT: refactor fields of GenTreeCall (#63402)
Andy Ayers [Wed, 5 Jan 2022 23:34:19 +0000 (15:34 -0800)]
JIT: refactor fields of GenTreeCall (#63402)

Move `gtStubCallStubAddr` out of the union it shares with class probe,
inline, and guarded devirt information, so that we no longer need to
save and restore the stub address when we want to probe, guardedly
devirtualize, or inline calls.

Delete all the code that did saving and restoring, and the field in the
inline info struct that held the saved copy.

2 years agoHandle race condition when HttpListener is stopped or closed (#63394)
Kevin Gosse [Wed, 5 Jan 2022 18:46:20 +0000 (19:46 +0100)]
Handle race condition when HttpListener is stopped or closed (#63394)

* Throw a HttpListenerException if the session is null

* Add similar check to BeginGetContext

* Address PR feedback

* Remove trailing spaces

2 years agoFix the MacOS remote unwinder for VS4Mac (#63378)
Mike McLaughlin [Wed, 5 Jan 2022 18:39:27 +0000 (10:39 -0800)]
Fix the MacOS remote unwinder for VS4Mac (#63378)

The wrong module was being passed to the remote unwinder because the load bias for shared modules
was being calculated incorrectly.

2 years agoFix MethodDesc::CbStackPop for string ctors on x86 (#63391)
Jan Vorlicek [Wed, 5 Jan 2022 16:19:16 +0000 (17:19 +0100)]
Fix MethodDesc::CbStackPop for string ctors on x86 (#63391)

This method was not taking into account the fact that string ctors
don't have dummy this argument after a recent change. Stack walking
in cases where prestub for the ctor was invoked resulted in a wrong
unwinding of ESP for ctors with more than one argument.

This change fixes it by removing "has this" flag from the signature
before getting the stack arguments size.

2 years agoDelete __SkipCrossgenFramework (#63390)
Michal Strehovský [Wed, 5 Jan 2022 14:18:40 +0000 (23:18 +0900)]
Delete __SkipCrossgenFramework (#63390)

This has been unused ever since crossgenning framework moved to build.proj.

2 years agoRemove some unnecessary duplicated checks (#63341)
Stephen Toub [Wed, 5 Jan 2022 11:42:27 +0000 (06:42 -0500)]
Remove some unnecessary duplicated checks (#63341)

* Remove unnecessary duplicate check in DeflateManagedStream ctor

* Remove duplicate null check in JsonSerializer.Deserialize

* Delete duplicate check in XmlSerializationWriterILGen.WriteQualifiedNameElement

* Delete duplicate rule check in XmlTreeGen.AutoGenerated

2 years agoSimplify condition in System.Private.CoreLib.Shared.projitems (#63388)
Jan Kotas [Wed, 5 Jan 2022 11:41:47 +0000 (03:41 -0800)]
Simplify condition in System.Private.CoreLib.Shared.projitems (#63388)

2 years agoRemove dead code in OdbcCommandBuilder.UnquoteIdentifier (#63363)
Stephen Toub [Wed, 5 Jan 2022 11:38:37 +0000 (06:38 -0500)]
Remove dead code in OdbcCommandBuilder.UnquoteIdentifier (#63363)

Exact same pattern was previously changed in OleDbCommandBuilder.

2 years ago[main] Update dependencies from dotnet/linker (#63336)
dotnet-maestro[bot] [Wed, 5 Jan 2022 10:53:59 +0000 (11:53 +0100)]
[main] Update dependencies from dotnet/linker (#63336)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[main] Update dependencies from 6 repositories (#63252)
dotnet-maestro[bot] [Wed, 5 Jan 2022 10:53:30 +0000 (11:53 +0100)]
[main] Update dependencies from 6 repositories (#63252)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoReplace name with type and codepage in EncodingConversionOverflow exception (#62910)
Marek Safar [Wed, 5 Jan 2022 09:32:09 +0000 (10:32 +0100)]
Replace name with type and codepage in EncodingConversionOverflow exception (#62910)

2 years agoFix running WASM tests locally on Windows (#63334)
Marek Fišera [Wed, 5 Jan 2022 07:59:55 +0000 (08:59 +0100)]
Fix running WASM tests locally on Windows (#63334)

Set BROWSER_PATH variable only when HELIX_CORRELATION_PAYLOAD variable is set.

Fixes change in the https://github.com/dotnet/runtime/pull/62779.

2 years agoRemove dependency of type system tests on ILCompiler.ReadyToRun (#63323)
Michal Strehovský [Wed, 5 Jan 2022 06:15:52 +0000 (15:15 +0900)]
Remove dependency of type system tests on ILCompiler.ReadyToRun (#63323)

This is now shared unit test project that is not AOT/JIT specific.

The recently added MarshalUtilsTests.cs created a dependency on these.

2 years agoImplement IEquatable<T> on the runtime handle types. (#63358)
Theodore Tsirpanis [Wed, 5 Jan 2022 02:20:03 +0000 (04:20 +0200)]
Implement IEquatable<T> on the runtime handle types. (#63358)

2 years agoMove HttpRequestStream.{Begin}Read argument logging to after validation (#63362)
Stephen Toub [Wed, 5 Jan 2022 01:05:34 +0000 (20:05 -0500)]
Move HttpRequestStream.{Begin}Read argument logging to after validation (#63362)

It's after validation on the HttpResponseStream corresponding methods, and having it before the validation means it'll null ref if a null buffer is erroneously provided.

2 years agoFix null ref for null Stream input in Icon.Save (#63369)
Stephen Toub [Wed, 5 Jan 2022 01:05:12 +0000 (20:05 -0500)]
Fix null ref for null Stream input in Icon.Save (#63369)

2 years agoRemove unnecessary field writes in MimePart.SetContent (#63368)
Stephen Toub [Wed, 5 Jan 2022 01:04:35 +0000 (20:04 -0500)]
Remove unnecessary field writes in MimePart.SetContent (#63368)

2 years agoFix LazyMemberInfo.Equals to return false for null (#63372)
Stephen Toub [Wed, 5 Jan 2022 01:04:14 +0000 (20:04 -0500)]
Fix LazyMemberInfo.Equals to return false for null (#63372)

2 years agoUpdate Codespaces instructions for latest (#63376)
Eric Erhardt [Tue, 4 Jan 2022 23:58:26 +0000 (17:58 -0600)]
Update Codespaces instructions for latest (#63376)

2 years agoPass configuration as a parameter for local Apple mobile test runs (#63348)
Steve Pfister [Tue, 4 Jan 2022 20:57:06 +0000 (12:57 -0800)]
Pass configuration as a parameter for local Apple mobile test runs (#63348)

Reverts #62549 as the configuration parameter is needed to let xharness know where the iOS/tvOS/MacCatalyst test app is.

For example, a debug test app will be under Debug-iphoneos and a release one will be under Release-iphoneos. Xharness won't be able to tell unless provided the right info.

2 years agoclean up header collection property implementations (#63308)
Geoff Kizer [Tue, 4 Jan 2022 20:37:02 +0000 (12:37 -0800)]
clean up header collection property implementations (#63308)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
2 years agoAdd comment about using source-generated p/invokes to interop guidelines (#63350)
Elinor Fung [Tue, 4 Jan 2022 20:29:44 +0000 (15:29 -0500)]
Add comment about using source-generated p/invokes to interop guidelines (#63350)

2 years agoEnable support for nint/nuint for Vector64/128/256<T> (#63329)
Tanner Gooding [Tue, 4 Jan 2022 20:02:37 +0000 (12:02 -0800)]
Enable support for nint/nuint for Vector64/128/256<T> (#63329)

* Enable support for nint/nuint for Vector64/128/256<T>

* Adding the additional Vector64/128/256<T> APIs required to support nint/nuint

* Removing the "NotSupported" tests for nint/nuint of Vector64/128/256<T>

2 years agoDisable console test for jitstressreg mode (#63349)
Dan Moseley [Tue, 4 Jan 2022 19:50:12 +0000 (12:50 -0700)]
Disable console test for jitstressreg mode (#63349)

* Revert "logging (#63326)"

This reverts commit 312c66f1fc2f749f56612999cb1adab9ca7fde59.

* disable test for jit stress regs

2 years agoFix order of line number/position arguments to XsltException ctor (#63344)
Stephen Toub [Tue, 4 Jan 2022 17:49:50 +0000 (12:49 -0500)]
Fix order of line number/position arguments to XsltException ctor (#63344)

2 years agoFix Instrument.ts_tags to be static in .NET Framework build (#63343)
Stephen Toub [Tue, 4 Jan 2022 17:33:13 +0000 (12:33 -0500)]
Fix Instrument.ts_tags to be static in .NET Framework build (#63343)

2 years agoDivide properties into: public, private, protected. (#62627)
Ilona Tomkowicz [Tue, 4 Jan 2022 15:12:26 +0000 (16:12 +0100)]
Divide properties into: public, private, protected. (#62627)

* Description of DebuggerBrowsable behavior.

* Added test for browse attributes.

* Corrected typos in the doc.

* Added Browse Never feature. Corrected Collapse test. ToDo: RootHidden.

* Draft of RootHidden solution.

* Added Array to test cases as it behaves differently than Collection.

* Added name concatenation to make array/list elemetns in debug window unique.

* Update docs/design/mono/debugger.md

Co-authored-by: Ankit Jain <radical@gmail.com>
* Applied PR review suggestions.

* Added a reference to regular Browsable attribute behavior in .net.

* Applied most of review suggestions.

* Stopping GetFieldsValue early.

* Remove unintentional change to the original code.

* Do not skip fields that don't have browsable attributes.

* Changing the expected behavior to match Console Application. EventHandlers are Browsable.Never by default.

* Changed the place of checking if objetc is an array.

* Update src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Removed unused variables.

* Removing space and unused import.

* Draft - parameter for choosing sorted and unsorted returned value version.

* Working version.

* Added "protected internal" and "private protected" cases. Changed field name to be consistant with the value.

* Changed approach: placed sorting at the end of the function, not in the middle.

* Fix for tests that use GetProperties.

* Fixed most tests (31 failing).

* Removed whitespaces.

* Fixed CheckAccessorsOnObjectsWithCFO tests.

* Fix for InspectTypeInheritedMembers.

* Revert unnecessary indent change.

* Partially addressed @radical comments.

* Addressed the comment about extension instead of Union.

* Removed string cultural vunerability.

* Added Properties dictionary, the same as for fields.

* Fixed the bug I made by using dynamc.

* Applying @radical comments about refactoring.

* Corrected typo.

* Added tests for properties.

* Draft of changes for properties handling - never and root hidden failing.

* Fix for RootHidden properties.

* Added tests for static fields decorated with Browsable.

* Correct a typo.

* Undo merge unintentional changes.

* Changing expected behavior for MulticastDelegateTest - in Console Application EventHandler is Browsable.Never by default so we should not expect it to be visible in the debug window.

* Removing not relevant changes created after merge with main.

* Remove file added in merge with main.

* Revert "Removing not relevant changes created after merge with main."

This reverts commit b1acf8b546d1b95bea101290c25ec7f15cb78799.

* Revert.

* Revert revert.

* One broken test for custom getter.

* Ugly fix to make all the tests work.

* Refactored JArray aggregation to Dictionary.

* Better naming.

* Add skipped change from merge.

* Fix getters testing.

* Removed unnecessary doubled execution.

* Decreased complexity by replacing a loop with data aggregation.

* Replaced O(nm) Linq with O(n) loop through dictionary.

* Remove comment, flip conditions.

* Removed not intended comments and changes.

* Missing removal for previous commit.

* Added tests for protection levels.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years ago[DllImportGenerator] Update buffer size field for custom marshalling (#63316)
Elinor Fung [Tue, 4 Jan 2022 14:22:35 +0000 (09:22 -0500)]
[DllImportGenerator] Update buffer size field for custom marshalling (#63316)

2 years agologging (#63326)
Dan Moseley [Tue, 4 Jan 2022 06:37:56 +0000 (23:37 -0700)]
logging (#63326)

2 years agoAccelerate additional cross platform hardware intrinsics (#61649)
Tanner Gooding [Tue, 4 Jan 2022 03:56:15 +0000 (19:56 -0800)]
Accelerate additional cross platform hardware intrinsics (#61649)

* Updating Vector64/128/256.IsHardwareAccelerated to be treated as a constant and return true where supported

* Accelerate the CmpOpAll intrinsics

* Accelerate the CmpOpAny intrinsics

* Accelerate the ConverToDouble/Int32/Int64/Single/UInt32/UInt64 intrinsics

* Applying formatting patch

* Fixing ConvertToInt32 and ConvertToSingle to use the right intrinsic

* Fixing some issues and assert types are correct

* Updating ConvertToDouble and ConvertToSingle to have correct vectorized versions on x86/x64

* Ensure Vector<T>.ConvertToDouble/Single are accelerated

* Swap operands and invert immediate so the constant can be contained on blend

* Restrict ConvertToDouble(Vector128<UInt64>) tests to inputs no more than long.MaxValue

* Ensure that we create a long/ulong rather than a uint

2 years agoFix GetSpanDataFrom (#63306)
David Wrighton [Tue, 4 Jan 2022 03:22:00 +0000 (19:22 -0800)]
Fix GetSpanDataFrom (#63306)

- GC Protect the type parameter
- set data to value before asserting that it isn't NULL

Fixes #62285

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
2 years agoFix missing space in literal
Stephen Toub [Tue, 4 Jan 2022 02:24:22 +0000 (21:24 -0500)]
Fix missing space in literal

2 years agoAdd some diagnostics for EFS tests (#63243)
Dan Moseley [Tue, 4 Jan 2022 01:55:18 +0000 (18:55 -0700)]
Add some diagnostics for EFS tests (#63243)

* diagnostics

* make outerloop

* fix linux build

* space

* feedback

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoRevert SafeBuffer change around pointer initialization (#63289)
Stephen Toub [Tue, 4 Jan 2022 01:38:58 +0000 (20:38 -0500)]
Revert SafeBuffer change around pointer initialization (#63289)

2 years agoA few minor tweaks to Regex source generator rendering (#63276)
Stephen Toub [Tue, 4 Jan 2022 01:38:43 +0000 (20:38 -0500)]
A few minor tweaks to Regex source generator rendering (#63276)

* Do addition for EndZ matching at compile time

* Tweak rendering of optional loops to say "Optional" rather than "Loop optionally"

* Remove "at least X" from loop description when X is 0

* Add a missing blank line at the beginning of a back reference

* Rename ReturnFalse to NoStartingPositionFound

* Delete stale comments

* Address PR feedback

2 years agoExtend case optimization in MatchCharacterClass to all chars that differ by one bit...
Stephen Toub [Tue, 4 Jan 2022 01:38:30 +0000 (20:38 -0500)]
Extend case optimization in MatchCharacterClass to all chars that differ by one bit (#63275)

2 years agoExtend CPU capabilities detection for osx-arm64 (#62832) (#62958)
neon-sunset [Tue, 4 Jan 2022 01:12:39 +0000 (03:12 +0200)]
Extend CPU capabilities detection for osx-arm64 (#62832) (#62958)

* Extend CPU capabilities detection for osx-arm64 (#62832)

* Revert uncoditional enable for dczva on osx-arm64

2 years agoRobustify a name resolution test (#63259)
Dan Moseley [Tue, 4 Jan 2022 01:05:10 +0000 (18:05 -0700)]
Robustify a name resolution test (#63259)

* fix TryGetAddrInfo_HostName_TryGetNameInfo()

* Fix network test

2 years agomake sure OpenSSL is initialized before Tls13Supported code runs (#62973)
Tomas Weinfurt [Tue, 4 Jan 2022 00:37:46 +0000 (16:37 -0800)]
make sure OpenSSL is initialized before Tls13Supported code runs (#62973)

* make sure OpenSSL is initialized before Tls13Supported code runs

* feedback from review

* Update src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoDelete ILCompiler.TypeSystem.ReadyToRun project (#63313)
Michal Strehovský [Tue, 4 Jan 2022 00:31:00 +0000 (09:31 +0900)]
Delete ILCompiler.TypeSystem.ReadyToRun project (#63313)

Replaced with a single ILCompiler.TypeSystem shared between crossgen2 and ilc.

2 years agoUpdate COM host to match RegAsm registration behavior (#63292)
Aaron Robinson [Mon, 3 Jan 2022 23:36:50 +0000 (15:36 -0800)]
Update COM host to match RegAsm registration behavior (#63292)

* Update COM host to match RegAsm registration behavior

2 years agoFixed ILVerify incorrectly flagging valid default interface implementations (#61185)
Benjamin Bartels [Mon, 3 Jan 2022 23:36:18 +0000 (23:36 +0000)]
Fixed ILVerify incorrectly flagging valid default interface implementations (#61185)

* Added logic for default interface method traversal to ILVerify method discovery

* Added Tests for DefaultImplFix

* Moved call to default interface impl resolution outside of ResolveInterfaceMethodTarget

2 years agotransform sgen_get_descriptor to parallel safe version in job_major_mod_union_preclea...
monojenkins [Mon, 3 Jan 2022 21:54:19 +0000 (16:54 -0500)]
transform sgen_get_descriptor to parallel safe version in job_major_mod_union_preclean (#63293)

Fixes mono/mono#21369
Related to https://github.com/xamarin/xamarin-android/issues/6546

job_major_mod_union_preclean can race with the tarjan bridge
implementation that changes the vtable pointer by settings the three
lower bits. this results in invalid loading of the vtable
(shifted by 7 bytes)  which in turn give a wrong desc to the scan
functions

This change is released under the MIT license.

Co-authored-by: tmijieux <tmijieux@users.noreply.github.com>
2 years agoDo not create non-null assertions from location nodes (#62743)
SingleAccretion [Mon, 3 Jan 2022 21:03:55 +0000 (00:03 +0300)]
Do not create non-null assertions from location nodes (#62743)

2 years agoUse SAL2 _In_, _Out_ to prevent conflicts (#63261)
NN [Mon, 3 Jan 2022 20:29:30 +0000 (22:29 +0200)]
Use SAL2 _In_, _Out_ to prevent conflicts (#63261)

2 years agoUnify threading between crossgen2 and ilc (#63282)
Michal Strehovský [Mon, 3 Jan 2022 20:00:43 +0000 (05:00 +0900)]
Unify threading between crossgen2 and ilc (#63282)

They don't have to differ in the `--parallelism` vs `--singlethreaded` argument.

2 years agoFix user => use typo in comments (#63288)
Stephen Toub [Mon, 3 Jan 2022 19:56:44 +0000 (14:56 -0500)]
Fix user => use typo in comments (#63288)

2 years agoUse pattern matching to reduce some duplication (#63278)
Stephen Toub [Mon, 3 Jan 2022 19:02:58 +0000 (14:02 -0500)]
Use pattern matching to reduce some duplication (#63278)

2 years ago[mono] Don't access MonoClassField:parent directly (#63081)
Aleksey Kliger (λgeek) [Mon, 3 Jan 2022 19:01:21 +0000 (14:01 -0500)]
[mono] Don't access MonoClassField:parent directly (#63081)

Rename it to parent_ and add m_field_get_parent / m_field_set_parent accessors.

(The intention is to borrow the bottom bit of the pointer for an EnC metadata
update flag)

2 years agoMark Go override as SkipLocalsInit if possible (#63277)
Stephen Toub [Mon, 3 Jan 2022 18:32:34 +0000 (13:32 -0500)]
Mark Go override as SkipLocalsInit if possible (#63277)

It can have so many locals that zero-initing is measurable.

2 years agoadd missing PTEST docs (#62122)
Clinton Ingram [Mon, 3 Jan 2022 18:17:32 +0000 (10:17 -0800)]
add missing PTEST docs (#62122)

2 years agoLast ILCompiler.TypeSystem <-> ILCompiler.TypeSystem.ReadyToRun diff (#63281)
Michal Strehovský [Mon, 3 Jan 2022 16:28:03 +0000 (01:28 +0900)]
Last ILCompiler.TypeSystem <-> ILCompiler.TypeSystem.ReadyToRun diff (#63281)

After this and dotnet/runtime#63280 there will be no differences between ILCompiler.TypeSystem and ILCompiler.TypeSystem.ReadyToRun and we can unify them.

2 years agoFix issues in PAL (#62625)
Andrii Kurdiumov [Mon, 3 Jan 2022 13:54:45 +0000 (19:54 +0600)]
Fix issues in PAL (#62625)

2 years ago[wasm][debugger] Add Browsable Attribute support. (#62045)
Ilona Tomkowicz [Mon, 3 Jan 2022 12:43:26 +0000 (13:43 +0100)]
[wasm][debugger] Add Browsable Attribute support. (#62045)

* Description of DebuggerBrowsable behavior.

* Added test for browse attributes.

* Corrected typos in the doc.

* Added Browse Never feature. Corrected Collapse test. ToDo: RootHidden.

* Draft of RootHidden solution.

* Added Array to test cases as it behaves differently than Collection.

* Added name concatenation to make array/list elemetns in debug window unique.

* Update docs/design/mono/debugger.md

Co-authored-by: Ankit Jain <radical@gmail.com>
* Applied PR review suggestions.

* Added a reference to regular Browsable attribute behavior in .net.

* Applied most of review suggestions.

* Stopping GetFieldsValue early.

* Remove unintentional change to the original code.

* Do not skip fields that don't have browsable attributes.

* Changing the expected behavior to match Console Application. EventHandlers are Browsable.Never by default.

* Changed the place of checking if objetc is an array.

* Update src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Removed unused variables.

* Removing space and unused import.

* Partially addressed @radical comments.

* Addressed the comment about extension instead of Union.

* Removed string cultural vunerability.

* Added Properties dictionary, the same as for fields.

* Fixed the bug I made by using dynamc.

* Applying @radical comments about refactoring.

* Corrected typo.

* Added tests for properties.

* Draft of changes for properties handling - never and root hidden failing.

* Fix for RootHidden properties.

* Added tests for static fields decorated with Browsable.

* Correct a typo.

* Undo merge unintentional changes.

* Changing expected behavior for MulticastDelegateTest - in Console Application EventHandler is Browsable.Never by default so we should not expect it to be visible in the debug window.

* Removing not relevant changes created after merge with main.

* Remove file added in merge with main.

* Revert "Removing not relevant changes created after merge with main."

This reverts commit b1acf8b546d1b95bea101290c25ec7f15cb78799.

* Revert.

* Revert revert.

* One broken test for custom getter.

* Ugly fix to make all the tests work.

* Refactored JArray aggregation to Dictionary.

* Better naming.

* Remove not connected to PR file.

* Applied @thaystg suggestions.

* Removed comments.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoMove things from ILCompiler.TypeSystem to ILCompiler.Compiler (#63280)
Michal Strehovský [Mon, 3 Jan 2022 11:52:46 +0000 (20:52 +0900)]
Move things from ILCompiler.TypeSystem to ILCompiler.Compiler (#63280)

IL generation (stubs/thunks) is not part of the core type system and these files are not included in ILCompiler.TypeSystem.ReadyToRun. Somehow we accumulated them in ILCompiler.TypeSystem but they can be pretty cleanly moved to ILCompiler.Compiler (left one TODO for a subsequent cleanup since some of what's in Common\TypeSystem should actually be in ILCompiler.Compiler proper).

2 years ago[mono][wasm] Allow methods with finally clauses to be AOTed. (#63065)
Zoltan Varga [Mon, 3 Jan 2022 11:44:48 +0000 (06:44 -0500)]
[mono][wasm] Allow methods with finally clauses to be AOTed. (#63065)

* [mono][wasm] Allow methods with finally clauses to be AOTed.

This is implemented by running the finally clause with the interpreter.
Methods with clauses have additional code generated, which:
* Saves the IL state (pc+arguments+locals) into a MonoMethodILState
structure.
* Pushes an LMF frame on the LMF stack of type MONO_LMFEXT_IL_STATE.
  The LMF frame points to the il state.

During EH, if such an LMF frame is found, and the IL pc in the
il state points inside a clause, then an interpreted version
of the method is created, and the finally clause is ran using
the interpreter using the il state as the starting state.

* Disable a few test suites which now cause emscripten to OOM when building with AOT.

2 years ago[main] Update dependencies from dotnet/linker (#63166)
dotnet-maestro[bot] [Mon, 3 Jan 2022 10:31:41 +0000 (11:31 +0100)]
[main] Update dependencies from dotnet/linker (#63166)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix nullability annotations on ProcessModule.FileName/ModuleName (#63272)
Stephen Toub [Mon, 3 Jan 2022 09:32:09 +0000 (04:32 -0500)]
Fix nullability annotations on ProcessModule.FileName/ModuleName (#63272)

2 years agoUse interpolated strings in place of `StringBuilder.AppendFormat` where possible...
Theodore Tsirpanis [Mon, 3 Jan 2022 08:10:38 +0000 (10:10 +0200)]
Use interpolated strings in place of `StringBuilder.AppendFormat` where possible. (#62160)

2 years agoImplement DiagnosticName in NativeAOT code (#63271)
Michal Strehovský [Mon, 3 Jan 2022 06:03:03 +0000 (15:03 +0900)]
Implement DiagnosticName in NativeAOT code (#63271)

When `DiagnosticName` was introduced into the type system, I didn't want to deal with it and compiled it out of the NativeAOT version of the type system.

In order to have a single ILCompiler.TypeSystem assembly that can be used with both crossgen2 and ILC, this needs to be implemented.

I've also reduced the number of diffs between ILCompiler.TypeSystem.csproj and ILCompiler.TypeSystem.ReadyToRun.csproj.

2 years agoFix strings typo (#63269)
Dan Moseley [Mon, 3 Jan 2022 04:56:39 +0000 (21:56 -0700)]
Fix strings typo (#63269)

2 years ago[mono][wasm] Remove unused targets from wasm/Makefile. (#63263)
Zoltan Varga [Sun, 2 Jan 2022 18:26:27 +0000 (13:26 -0500)]
[mono][wasm] Remove unused targets from wasm/Makefile. (#63263)

The real build now happens in runtime/CMakeLists.txt, the Makefile
contains only helper targets now.

2 years agoUpdate issue suppressions (#63248)
Michal Strehovský [Sat, 1 Jan 2022 18:33:38 +0000 (03:33 +0900)]
Update issue suppressions (#63248)

The test got renamed in #63178.

Should fix the Mono AOT CI failures seen in #63232.

2 years agoImprove SuperPMI error message for JIT asserts (#63229)
Bruce Forstall [Fri, 31 Dec 2021 23:58:15 +0000 (15:58 -0800)]
Improve SuperPMI error message for JIT asserts (#63229)

Currently, the method context numbers are output for each failure,
but the assert message is output separately, so if there are multiple
asserts that fire, and you want to investigate a particular one,
it's hard to figure out which method context number to use.

Add the method context number to the assert message, so the relationship
between the method context number and the assert is obvious.

E.g., you always get messages like the following (both before this change
and after):
```
ERROR: Exception thrown: DebugBreak or AV Exception 123
ERROR: main method 16501 of size 286 failed to load and compile correctly.
```

Before you might see an assert like:
```
ISSUE: <ASSERT> C:\gh\runtime6\src\coreclr\jit\fgbasic.cpp (4699) - Assertion failed '!"unexpected case 1"' in 'CancellationTokenSource:ExecuteCallbackHandlers(bool):this' during 'Update flow graph opt pass' (IL size 286)
```

Now, it will look like:
```
ISSUE: <ASSERT> #16501 C:\gh\runtime6\src\coreclr\jit\fgbasic.cpp (4699) - Assertion failed '!"unexpected case 1"' in 'CancellationTokenSource:ExecuteCallbackHandlers(bool):this' during 'Update flow graph opt pass' (IL size 286)
```

2 years agoBring over ILCompiler.Compiler unit tests (#63232)
Michal Strehovský [Fri, 31 Dec 2021 23:42:31 +0000 (08:42 +0900)]
Bring over ILCompiler.Compiler unit tests (#63232)

...from CoreRT repo since we skipped them in runtimelab.

2 years agoavoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame...
Tomas Weinfurt [Fri, 31 Dec 2021 23:02:24 +0000 (15:02 -0800)]
avoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame (#63184)

* avoid ArgumentOutOfRangeException while processing invalid or incomplete TLS frame

* feedback from review

2 years agoSpeed up crossgen2 by a couple percent (#63234)
Michal Strehovský [Fri, 31 Dec 2021 21:21:42 +0000 (06:21 +0900)]
Speed up crossgen2 by a couple percent (#63234)

I ran crossgen2 compiling a Release CoreLib under a profiler and this stood out quite a bit. The JIT-based CoreLib doesn't have the `Array<T>` type so `GetType` was walking all types in CoreLib.

I split this logic out to an ILC-specific file. I don't remember this showing up in the profiles for ILC, but I added a cache nevertheless.

2 years agoSwitch to objwriter from the dotnet/llvm-project repo (#63177)
Michal Strehovský [Fri, 31 Dec 2021 04:34:33 +0000 (13:34 +0900)]
Switch to objwriter from the dotnet/llvm-project repo (#63177)

2 years agoAdd ILLink.Shared project to Native AOT (#63230)
Tlakaelel Axayakatl Ceja [Fri, 31 Dec 2021 02:54:35 +0000 (18:54 -0800)]
Add ILLink.Shared project to Native AOT (#63230)

Change diagnostics to use ILLink.Shared utilities
Update ReferenceSource folder
Add method to obtain Requires attribute named argument URL

2 years agoAllow managed type system tests on Alpine (#63207)
Michal Strehovský [Thu, 30 Dec 2021 23:58:23 +0000 (08:58 +0900)]
Allow managed type system tests on Alpine (#63207)

This was disabled in https://github.com/dotnet/runtime/pull/38128/commits/d98d9a2f52f16a87fdc8a28a252e94eca796abb2. I don't think those problems exist anymore - targets are written differently, and we would likely see musl-arm64 failures if this was still a problem.

2 years agoRename test suppressions (#63210)
Michal Strehovský [Thu, 30 Dec 2021 23:56:58 +0000 (08:56 +0900)]
Rename test suppressions (#63210)

The tests were renamed in dotnet/runtime#63178.

Fixes #63202 (and also the CI breaks in Mono leg seen in e.g. dotnet/runtime#63207).

2 years agoFix ILVerify.ILVerifyTypeSystemContext.VerifyModuleName throws NullReferenceException...
masonwheeler [Thu, 30 Dec 2021 19:07:48 +0000 (12:07 -0700)]
Fix ILVerify.ILVerifyTypeSystemContext.VerifyModuleName throws NullReferenceException (#63222)

Fixes #62711

2 years agoFix regex test OOM (#63092)
Dan Moseley [Thu, 30 Dec 2021 18:36:50 +0000 (11:36 -0700)]
Fix regex test OOM (#63092)

2 years agoFix typos in comments (#63220)
Michael Ganss [Thu, 30 Dec 2021 16:25:32 +0000 (17:25 +0100)]
Fix typos in comments (#63220)

2 years agoDefine MCREGs for ARM64 macOS (#63209)
Michal Strehovský [Thu, 30 Dec 2021 16:06:10 +0000 (01:06 +0900)]
Define MCREGs for ARM64 macOS (#63209)

2 years agoAllow using ILCompiler without an IlcPath (#63211)
Michal Strehovský [Thu, 30 Dec 2021 15:34:41 +0000 (00:34 +0900)]
Allow using ILCompiler without an IlcPath (#63211)

This will allow specifying disjoint paths for the various inputs to ILC. We'll need this if we want to run ILC as part of the build to either build crossgen2 with ILC or selfhost ILC. Separate properties avoid having to lay out things on the file system the way IlcPath expects.

2 years agoFix NativeAOT multifile test run (#63183)
Michal Strehovský [Thu, 30 Dec 2021 08:07:40 +0000 (17:07 +0900)]
Fix NativeAOT multifile test run (#63183)

2 years agoCleanup in NativeAOT from x86 attempt (#63182)
Andrii Kurdiumov [Thu, 30 Dec 2021 08:06:35 +0000 (14:06 +0600)]
Cleanup in NativeAOT from x86 attempt (#63182)

This is retrofitting parts of https://github.com/dotnet/runtimelab/pull/1531

2 years ago[mono] Use Xcode path from xcode-select instead of hardcoding (#63076)
Alexander Köplinger [Wed, 29 Dec 2021 19:59:47 +0000 (20:59 +0100)]
[mono] Use Xcode path from xcode-select instead of hardcoding (#63076)

Fixes https://github.com/dotnet/runtime/issues/36536

2 years agoFix _il suffix for _d/_r-variant ilproj tests (#63178)
Tomáš Rylek [Wed, 29 Dec 2021 16:01:07 +0000 (17:01 +0100)]
Fix _il suffix for _d/_r-variant ilproj tests (#63178)

2 years agoRemove unneeded ifdefs (#63160)
Bruce Forstall [Tue, 28 Dec 2021 23:22:34 +0000 (15:22 -0800)]
Remove unneeded ifdefs (#63160)

Remove ifdefs for always-on values: ASSERTION_PROP,
LOCAL_ASSERTION_PROP, OPT_BOOL_OPS, LARGE_EXPSET,
REDUNDANT_LOAD.

2 years agoUnify build mode for one previously missed form _opt_dbg / _opt_rel (#63175)
Tomáš Rylek [Tue, 28 Dec 2021 23:11:01 +0000 (00:11 +0100)]
Unify build mode for one previously missed form _opt_dbg / _opt_rel (#63175)

2 years agoUse shared strings for Array:Copy exception messages (#63163)
Marek Safar [Tue, 28 Dec 2021 21:20:30 +0000 (22:20 +0100)]
Use shared strings for Array:Copy exception messages (#63163)

2 years agoUse SIMD operations in InitBlkUnroll/CopyBlkUnroll and increase unroll limit up to...
Egor Chesakov [Tue, 28 Dec 2021 18:18:01 +0000 (10:18 -0800)]
Use SIMD operations in InitBlkUnroll/CopyBlkUnroll and increase unroll limit up to 128 bytes (#61030)

* Use SIMD operations in CodeGen::genCodeForInitBlkUnroll()

* Use SIMD operations in CodeGen::genCodeForCpBlkUnroll()

* Remove restrictions on offset values in Lowering::ContainBlockStoreAddress()

* Remove unused macros in src/coreclr/jit/instr.h

2 years agoDeduplicate JIT/Methodical/tailcall tests and make them mergeable (#63031)
Tomáš Rylek [Tue, 28 Dec 2021 08:42:38 +0000 (09:42 +0100)]
Deduplicate JIT/Methodical/tailcall tests and make them mergeable (#63031)

This change fixes mergeability of tailcall tests: apart from simple
deduplication of the test class names and visibility fixes
I have modified the pointer and reference tests to stop using
Environment.Exit for exiting the test as that kills the merged
wrapper in in-proc execution; I have also fixed them to have main
within a class. In two cases (recurse_ep_void and test_virt)
I found out that I had previously put the Fact attribute on the
wrong method so I fixed that too. I renamed the two C# test
projects to better match the test of tests (widen to widen_r to
indicate it's a release test and thread-race_il_r to thread-race_r
as it's not an IL test).

Thanks

Tomas

2 years agoImprove auto-formatting of ref/System.Runtime (#63139)
Jan Kotas [Tue, 28 Dec 2021 04:54:18 +0000 (18:54 -1000)]
Improve auto-formatting of ref/System.Runtime (#63139)

Run `dotnet build /t:GenerateReferenceSource` and kept the good deltas

2 years agoFixup some formatting in shared code (#63156)
Pranav K [Mon, 27 Dec 2021 23:08:58 +0000 (15:08 -0800)]
Fixup some formatting in shared code (#63156)

2 years agoMove System.Runtime.InteropServices.RuntimeInformation to CoreLib (#63140)
Jan Kotas [Mon, 27 Dec 2021 18:07:34 +0000 (08:07 -1000)]
Move System.Runtime.InteropServices.RuntimeInformation to CoreLib (#63140)

- Makes RuntimeInformation.ProcessArchitecture a JIT/AOT-time constant (constant returning property)
- Eliminates tiny netcoreapp assembly with just a few types

Fixes #57152
Contributes to #2138

2 years ago[mono] Fix a regression caused by 9ddd58a58d14a7bec5ed6eb777c6703c48aca15d. (#63084)
Zoltan Varga [Mon, 27 Dec 2021 06:47:12 +0000 (01:47 -0500)]
[mono] Fix a regression caused by 9ddd58a58d14a7bec5ed6eb777c6703c48aca15d. (#63084)

Fixes https://github.com/dotnet/runtime/issues/63079.

2 years agoNativeAOT: Do not run Vector version of Hardware Intrinsics when AVX2… (#62951)
Andrii Kurdiumov [Mon, 27 Dec 2021 00:37:17 +0000 (06:37 +0600)]
NativeAOT: Do not run Vector version of Hardware Intrinsics when AVX2… (#62951)