platform/upstream/dotnet/runtime.git
2 years ago[mono] Move basic w32file* and w32process* functions to eventpipe (#66731)
Alexander Köplinger [Fri, 18 Mar 2022 15:36:38 +0000 (16:36 +0100)]
[mono] Move basic w32file* and w32process* functions to eventpipe (#66731)

They are not used by the rest of the runtime and we only need a bare minimum of w32process and w32file in eventpipe (e.g. no file share/access logic).

Fix ep-test build and warnings, it was missing linking against libz and monoapi.

Fix host vs. target confusion in ep-rt-mono.c

Move initialization of num_main_args after setting main_args in object.c so we can use it as a cheap guard value (not totally thread-safe but good enough for our purposes).

Co-authored-by: Johan Lorensson <lateralusx.github@gmail.com>
2 years ago[mono] Remove unused MONO_DEBUG=dont-free-domains option. (#66817)
Zoltan Varga [Fri, 18 Mar 2022 15:30:44 +0000 (11:30 -0400)]
[mono] Remove unused MONO_DEBUG=dont-free-domains option. (#66817)

2 years ago[Group 3] Enable nullable annotations for `Microsoft.Extensions.Logging` (#65262)
Maksym Koshovyi [Fri, 18 Mar 2022 15:04:03 +0000 (17:04 +0200)]
[Group 3] Enable nullable annotations for `Microsoft.Extensions.Logging` (#65262)

* First pass

* Second pass

* Pass three

* Missed few things

* ref

* Update ProviderAliasUtilities.cs

* Update ActivityTrackingOptions.cs

* Update Microsoft.Extensions.Logging.cs

* GetRequiredService

* Update Logger.Scope

* Create CompatibilitySuppressions.xml

* Add comment to CompatibilitySuppressions.xml

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
* Delete CompatibilitySuppressions.xml

* AsyncLocal<Scope?> _currentScope

* Add assert

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
2 years ago[mono][jit] Pass generic context when ldftn of generic method (#66350)
Vlad Brezae [Fri, 18 Mar 2022 14:15:20 +0000 (16:15 +0200)]
[mono][jit] Pass generic context when ldftn of generic method (#66350)

2 years agoMake the `EventSource` generator incremental et.al. (#64579)
Theodore Tsirpanis [Fri, 18 Mar 2022 12:53:14 +0000 (14:53 +0200)]
Make the `EventSource` generator incremental et.al. (#64579)

2 years ago[mono] Hot Reload: support for reloadable types (#66749)
Aleksey Kliger (λgeek) [Fri, 18 Mar 2022 12:38:58 +0000 (08:38 -0400)]
[mono] Hot Reload: support for reloadable types (#66749)

Fully implement support for the `NewTypeDefinition` EnC capability: a hot reload edit can add a new type definition (class, struct, interface, enum) that contains new fields, methods, properties, events, and nested classes, and can have generic params.  Also add reflection support for all of the above.

This is sufficient to support hot reload of types tagged with [`CreateNewOnMetadataUpdateAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.createnewonmetadataupdateattribute?view=net-6.0).

Contributes to https://github.com/dotnet/runtime/issues/63643 and https://github.com/dotnet/runtime/issues/57365

---

The implementation introduces `MonoAddedDefSkeleton` which is a bookkeeping structure that records the metadata indexes of where to find methods, fields, properties and events for a newly-added class.  The issue is that normally `mono_class_create_from_typedef` expects to find all that stuff in a contiguous block starting at the row pointed by the `MONO_TYPEDEF_FIELD_LIST` or `MONO_TYPEDEF_METHOD_LIST` columns of the new typedef.  But in EnC deltas, those columns are zeroed out, and instead the EnCLog functions like `ENC_FUNC_ADD_METHOD` and `ENC_FUNC_ADD_FIELD` explicitly record when a new row is added that is relevant to a particular type definition.

So during the pass over the EnCLog, we start creating skeletons when we see a new row added to the typedef table.  Then when we see the add functions, we record the row indices of the field, method, etc tables.  As far as I can tell, the rows for a particular type definition are contiguous, so we just record the first index and the count.

At the end of the pass, we save the skeletons on the metadata delta, and when code finally creates the `MonoClass` for a particular freshly-added type definition, we check the skeleton and use the recorded rows to populate the fields and methods.  Event and property data is created on-demand (the demand being reflection) in basically the same way.

One important note: we try very hard not to accidentally materialize a newly-added class as a `MonoClass` during the update itself - we need to at least get through the entire EnCLog - otherwise we might not see every field/method/etc and set up the class incorrectly.

The upshot is that the newly-added `MonoClass` behaves like any other "normal" class - all its fields are laid out normally (they're stored in the object, not in a separate hash table).  It can be generic.  It can have base types, interfaces, etc.

This is different from how added fields, props and events will be implemented on existing classes - we won't modify `MonoClass:fields` or the `MonoClassPropertyInfo:properties` arrays - once they have been allocated, we don't want to mess with them.  Instead additions to existing classes with create `MonoClassMetadataUpdateField` (`MonoClassMetadataUpdateProperty` and `MonoClassMetadataUpdateEvent`) structs that are going to be stored on the `MonoClassMetadataUpdateInfo` that's associated with each `MonoClass`.  The various iterators like `mono_class_get_fields` and `mono_class_get_props` will be modified to return the added fields/props/etc after the existing ones.

This is already implemented for fields.  Props and Events will be part of a separate effort to implement reflection support for them.

---

* Checkpoint. Infrastructure for added types

* register member->parent lookups for newly-added classes and members

* fix off by one error creating class from skeleton

* AddNestedClass test works with mono now; also make it generic

* checkpoint: adding properties

   it "works" but only because we don't look very hard for the new properties anywhere.  reflection is probably pretty broken.

* Add a property to AddNestedClass test

* remove allow class/field/method/property ifdefs

   keep the instance field ifdef for now

* add event to AddNestedClass

* add DISALLOW_BROKEN_PARENT ifdef

   allow CustomAttribute row modifications to change Parent, while https://github.com/dotnet/roslyn/issues/60125 is being sorted out

* checkpoint: adding events

* Add new test ReflectionAddNewType

* Add new types to the image name cache

* Assembly.GetTypes and additional tests

* Make nested types work

* GetInterfaces on new types; also Activator.CreateInstance

* Mark mono_class_get_nested_classes_property as a component API

   also mono_class_set_nested_classes_property

* Add GetMethods, GetFields, GetMethod, GetField test

* [class] Implement added method iteration

   Change the iterator from storing MonoMethod** values to storing an iteration count. For added methods, when the iteration count is more than mono_class_get_method_count, run through the hot reload added_members list and
iterate over any relevant methods

* Implement added field iteration

* Add a GetField(BindingFlags.Static) test case

* Add Enum.GetNames and GetProperties tests - not working yet

* Mark mono_class_get_method_count as a component API

   also mono_class_get_field_count

* Enum values work

* Use GSList for added_fields (and props, events); add from_update bit

   Use GSList to simplify the concurrency story for accessing added_fields (and added_props and added_events, eventually): unlike a GPtrArray it won't resize, so we don't need to lock readers.

   Add a from_update bit to MonoProperty and MonoEvent - when props or events are added to existing classes, they will have the bit set.  That means that pointer arithmetic to figure out the prop (or event) tokens won't be usable (since
they're not allocated in one big block).

* Reflection on props in new classes works

* events on new classes work

* Add CustomAttribute reflection test

* remove test for props on existing type - it's not part of this PR

* instance field additions to existing types aren't supported yet

* rm TODO and FIXME

* store prop and event from_update bit in attrs

   The upper 16 bits aren't used for ECMA flags, so grab a bit for metadata-update

* remove instance fields from reflection test

   since Mono doesn't support them yet

* make the Browser EAT lanes happy

   Add some fields to the baseline versions of some test assemblies to keep some types that are used in the deltas from getting trimmed away

2 years agoRemove superfluous string[] and string from System.IO.Packaging.ContentType (#66764)
Stephen Toub [Fri, 18 Mar 2022 11:49:52 +0000 (07:49 -0400)]
Remove superfluous string[] and string from System.IO.Packaging.ContentType (#66764)

2 years agoUse guint64 in UCONTEXT_REG_SET_PC (arm64) (#66812)
Adeel Mujahid [Fri, 18 Mar 2022 09:29:53 +0000 (11:29 +0200)]
Use guint64 in UCONTEXT_REG_SET_PC (arm64) (#66812)

In this scope, `__uint64_t` is not available on musl based systems. Switched to `guint64`, which nearby code is using.

2 years agoDisable Windows arm32 pinvoke stress tests (#66790)
Jakob Botsch Nielsen [Fri, 18 Mar 2022 07:38:50 +0000 (08:38 +0100)]
Disable Windows arm32 pinvoke stress tests (#66790)

2 years agoReenable 4611 and 4703 (#66792)
Aaron Robinson [Fri, 18 Mar 2022 01:59:24 +0000 (21:59 -0400)]
Reenable 4611 and 4703 (#66792)

2 years agoLoad C++/CLI DLLs built against .NET 7.0+ in default ALC (#66486)
Elinor Fung [Fri, 18 Mar 2022 00:14:33 +0000 (17:14 -0700)]
Load C++/CLI DLLs built against .NET 7.0+ in default ALC (#66486)

2 years ago[main] Update dependencies from 8 repositories (#66539)
dotnet-maestro[bot] [Thu, 17 Mar 2022 23:24:40 +0000 (00:24 +0100)]
[main] Update dependencies from 8 repositories (#66539)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix emscripten-version.txt link (#66778)
Layomi Akinrinade [Thu, 17 Mar 2022 23:20:19 +0000 (16:20 -0700)]
Fix emscripten-version.txt link (#66778)

2 years agoImplement missing SymUnmanaged* interfaces (#66650)
Steve [Thu, 17 Mar 2022 22:34:22 +0000 (06:34 +0800)]
Implement missing SymUnmanaged* interfaces (#66650)

* Implement missing SymUnmanaged* interfaces

* Add try-finally around GCHandle

* Marshal interface argument to pinned pointer

* Minor fixes

* Address feedbacks from review

2 years agoReimplement stubs to improve performance (#65738)
Jan Vorlicek [Thu, 17 Mar 2022 22:19:15 +0000 (23:19 +0100)]
Reimplement stubs to improve performance (#65738)

* Reimplement stubs to improve performance

This change implements `FixupPrecodeStub`, `PrecodeStub`
and `CallCountingStub` using a new mechanism with fixed code and separate RW
data. The `LoaderHeap` was updated to support a new kind of allocation
using interleaved code and data pages to support this new mechanism.
The JIT now generates code that uses indirection slot to jump to the
methods using `FixupPrecode`, improving performance of the ASPNet
plaintext benchmark by 3-4% depending on the target platform (measured
on x64 Windows / Linux and arm64 Linux).

I have also removed the Holders, as the stubs are naturally properly
aligned due to the way they are allocated.

There is now only a single variant of each stub, there are no long /
short ones anymore as they are not needed - the indirect jumps we use
now are not range limited.

Most of the stubs stuff is now target agnostic and the originally split
implementation is now in single place for all targets. Only a few
constants are defined as target specific in these.

The code for the stubs is no longer generated as bytes by C++ code, but
rather written in asm and compiled. These precompiled templates are then
used as a source to copy the code from. The x86 is a bit more complex
than that due to the fact that it doesn't support PC relative indirect
addressing, so we need to relocate all access to the data slots when
generating the code pages.

As a further improvement, we could generate just a single page of the
code and then just map it many times. This is left for future work.

ARM64 Unix differs from the other targets / platforms - there are
various page sizes being used. So the asm templates are generated for
4k..64k page sizes and the variant is then picked at runtime based on
the page size extracted from the OS.

This also removes a lot of writeable mappings created for modifications
of the stub code when W^X is enabled, in the plaintext benchmark they
were reduced by 75%. That results in a significant reducing of the .NET
application startup time with W^X enabled.

I think the `LoaderHeap` would benefit from some refactoring, but I'd
prefer leaving it for a follow up. It seems that for the sake of the
review, it is better to keep it as is.

The change also implements logging of number of mappings and their exact
locations. This helped me to drive the work and I am planning to use it
for further changes. It can be removed in the future once we reach a
final state.

There are still opportunities for improvement, but these stubs allowed
me to scrape off the most significant portion of the mappings.

2 years agoAlways append the "dll" extension for native libraries loads on Windows (#66666)
Aaron Robinson [Thu, 17 Mar 2022 21:41:40 +0000 (17:41 -0400)]
Always append the "dll" extension for native libraries loads on Windows (#66666)

* Always append the "dll" extension for native libraries loads on Windows

Due to case-sensitive file systems on Windows the runtime will now
  always append the ".dll" extension unless the name contains a trailing
  "." or a known loadable extensions. This is an attempt to mitigate
  the default Windows behavior that appends a ".DLL" which is rarely the
  casing used for Windows shared libraries.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoEnsure the generic math interfaces are implemented implicitly where possible (#66748)
Tanner Gooding [Thu, 17 Mar 2022 21:39:57 +0000 (14:39 -0700)]
Ensure the generic math interfaces are implemented implicitly where possible (#66748)

* Updating generic math interfaces to be implicitly implemented where possible

* Resolve a build error in OdbcConnection caused by new Parse APIs

* Revert "Resolve a build error in OdbcConnection caused by new Parse APIs"

This reverts commit 6fd7ec7797cad7b28d381a695e84430c8d1081ae.

* Suppress CA1846 for System.Data.Odbc

* Updating the xml doc comments for exposed constants

2 years ago[wasm][debugger] Fix incompatibility between runtime and nuget package (#66295)
Thays Grazia [Thu, 17 Mar 2022 18:54:53 +0000 (15:54 -0300)]
[wasm][debugger] Fix incompatibility between runtime and nuget package (#66295)

* Fix incompatibility between runtime and nuget package

* Update debug.ts

2 years ago[wasm][debugger] Don't show the wasm functions on callstack when debugging managed...
Thays Grazia [Thu, 17 Mar 2022 18:54:26 +0000 (15:54 -0300)]
[wasm][debugger] Don't show the wasm functions on callstack when debugging managed code (#64223)

* Show the callstack as it's shown on net5.

* Addressing @lewing and @radical comments.

* addressing @lewing comment.

2 years agoAdd additional trace to HttpConnectionPool (#66605)
Natalia Kondratyeva [Thu, 17 Mar 2022 18:09:14 +0000 (19:09 +0100)]
Add additional trace to HttpConnectionPool (#66605)

The additional trace should help troubleshoot hanged "pending" connection issues (i.e. the reasons why new connections were not created) in HttpConnectionPool.

The issue manifests as growing number of timeouted requests. It is not easy to link a timeouted request (esp. with a small timeout) to a connection that was created 3 minutes ago but still is not connected. There are no traces of the state of HttpConnectionPool, e.g. number of pending connections, so it is unclear from existing traces why the pool decided not to create a connection.

Related to #66297

2 years agoSurface native sourcelink on CoreCLR native PDBs for easier dump debugging (#66677)
Juan Hoyos [Thu, 17 Mar 2022 18:05:31 +0000 (11:05 -0700)]
Surface native sourcelink on CoreCLR native PDBs for easier dump debugging (#66677)

* Use managed sourcelink infrastructure to allow for win native sourcelink

2 years agoTemporarily disable HttpClientTest.GetContentAsync_WhenCanNotConnect_ExceptionContain...
Radek Zikmund [Thu, 17 Mar 2022 17:49:03 +0000 (18:49 +0100)]
Temporarily disable HttpClientTest.GetContentAsync_WhenCanNotConnect_ExceptionContainsHostInfo on OSX (#66761)

2 years agoUpdate area owners to add 2 triagers (#66767)
Dan Moseley [Thu, 17 Mar 2022 17:02:19 +0000 (11:02 -0600)]
Update area owners to add 2 triagers (#66767)

2 years agoFixes Binding to non-null IEnumerable doesn't work #36390 (#66131)
Steve Dunn [Thu, 17 Mar 2022 16:15:18 +0000 (16:15 +0000)]
Fixes Binding to non-null IEnumerable doesn't work #36390 (#66131)

2 years agoStructs: Do not mark "Hidden buffer pointer" as address-exposed (#64130)
Kunal Pathak [Thu, 17 Mar 2022 15:08:05 +0000 (08:08 -0700)]
Structs: Do not mark "Hidden buffer pointer" as address-exposed (#64130)

* Preliminary changes

* Add the missing push of ssadef

* Fix an issue for call tree cloning

* formatting

* minor review comments incorporation

* Make GT_CALL as full-def

* Merge RenameCall into RenameDef

* Fix DefinesLocalAddr and lateuse arg

* Minor comments

* fix the recently added code to account that GT_CALL can also have defintion:

* clone the return buffer arg

* Another round of review comments

* Handle return buffer calls in optIsVarAssgCB

* Update locals defined by calls in NodeInfo

* Fix a case where arg can be putarg

* Restructure the cases in GetLclRetBufArgNode()

* move ivaMaskCall outside the condition

* Add back to call for DoNotEnregister which was missed for Release builds

* Retrieve the appropriate node in case of copyReload

* Added an assert

* remove assert and add comment

2 years agoReplace StringBuilder with ValueStringBuilder in AssemblyName.FullName (#66750)
Stephen Toub [Thu, 17 Mar 2022 11:30:59 +0000 (07:30 -0400)]
Replace StringBuilder with ValueStringBuilder in AssemblyName.FullName (#66750)

2 years ago[mono] Merge icall-def-netcore.h back into icall-def.h (#66730)
Alexander Köplinger [Thu, 17 Mar 2022 09:01:32 +0000 (10:01 +0100)]
[mono] Merge icall-def-netcore.h back into icall-def.h (#66730)

This was originally done in mono/mono to allow building both legacy and netcore, but we don't need this split anymore in dotnet/runtime.

2 years agoRemove dotnet6 feeds (#66447)
Viktor Hofer [Thu, 17 Mar 2022 07:42:48 +0000 (08:42 +0100)]
Remove dotnet6 feeds (#66447)

* Remove dotnet6 feeds

dotnet7 feeds are currently the target feeds for the main branch. The dotnet6 feeds shouldn't be used anymore.

* Update targetingpacks.targets

* Update prebuilt package versions

* Update NativeExports.csproj

2 years agoRemove test coverage of FeatureSIMD=0 (#66670)
Kunal Pathak [Thu, 17 Mar 2022 06:01:08 +0000 (23:01 -0700)]
Remove test coverage of FeatureSIMD=0 (#66670)

* Remove coverge of FeatureSIMD=0

* Remove COMPlus_FeatureSIMD flag

* Remove isSacalarIsa() condition

* Remove the flag from other places of VM

2 years agoReenable CA 4701 (#66676)
Aaron Robinson [Thu, 17 Mar 2022 02:30:39 +0000 (22:30 -0400)]
Reenable CA 4701 (#66676)

* Reenable 4701

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoBump next from 11.1.3 to 12.1.0 in /src/mono/sample/wasm/browser-nextjs (#65534)
dependabot[bot] [Thu, 17 Mar 2022 00:08:34 +0000 (01:08 +0100)]
Bump next from 11.1.3 to 12.1.0 in /src/mono/sample/wasm/browser-nextjs (#65534)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoAdd tracing to the Linux X509Chain implementation
Jeremy Barton [Wed, 16 Mar 2022 23:53:50 +0000 (16:53 -0700)]
Add tracing to the Linux X509Chain implementation

The tracing is heavily focused on transient behaviors, like AIA/CRL/OCSP downloads and cache interactions.

Things like applying ApplicationPolicy aren't really traced because that can be "easily" evaluated by looking at the certificates in isolation.

2 years agoFix automatic adding to all projects for issue boards as well. (#66740)
Jose Perez Rodriguez [Wed, 16 Mar 2022 23:39:00 +0000 (16:39 -0700)]
Fix automatic adding to all projects for issue boards as well. (#66740)

2 years agoRevisit PatternContext<TFrame>.PushDataFrame nullable annotation (#65598)
Maksym Koshovyi [Wed, 16 Mar 2022 22:57:58 +0000 (00:57 +0200)]
Revisit PatternContext<TFrame>.PushDataFrame nullable annotation (#65598)

TFrame non null

2 years ago[Group 3] Enable nullable annotations for `Microsoft.Extensions.Hosting.Abstractions...
Maksym Koshovyi [Wed, 16 Mar 2022 22:54:16 +0000 (00:54 +0200)]
[Group 3] Enable nullable annotations for `Microsoft.Extensions.Hosting.Abstractions` (#65403)

* First pass (src)

* Update Microsoft.Extensions.Hosting.Abstractions.cs

* Update HostBuilderContext

* Values of Properties cannot be null

2 years agoUpdate Roslyn Testing SDK (#66681)
Jeremy Koritzinsky [Wed, 16 Mar 2022 22:37:59 +0000 (15:37 -0700)]
Update Roslyn Testing SDK (#66681)

2 years agoInject existing object into MEF2 (#66364)
Huo Yaoyuan [Wed, 16 Mar 2022 22:03:41 +0000 (06:03 +0800)]
Inject existing object into MEF2 (#66364)

2 years agoMoving "Generic Math" in box and making it no longer experimental (#65731)
Tanner Gooding [Wed, 16 Mar 2022 22:01:01 +0000 (15:01 -0700)]
Moving "Generic Math" in box and making it no longer experimental (#65731)

* Moving "Generic Math" in box and making it no longer experimental

* Removing an unused using from the generic math interfaces

* Updating the ordering of the checked keyword for the commented out checked operators

2 years agoImprove NamedPipeClientStream.Connect edge cases handling (#65553)
Adam Sitnik [Wed, 16 Mar 2022 21:46:30 +0000 (22:46 +0100)]
Improve NamedPipeClientStream.Connect edge cases handling (#65553)

* don't try to call WaitNamedPipeW if we know that no instances exist and the sys-call will quit immediately

* remove code duplication

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoOnly move PRs to Done column on projects that already contain the PR when they are...
Jose Perez Rodriguez [Wed, 16 Mar 2022 21:40:55 +0000 (14:40 -0700)]
Only move PRs to Done column on projects that already contain the PR when they are moved to a different area. (#66737)

2 years agoFix beginning fixups of captures after Regex span support (#66713)
Stephen Toub [Wed, 16 Mar 2022 21:18:38 +0000 (17:18 -0400)]
Fix beginning fixups of captures after Regex span support (#66713)

The Regex span support changed the scanning infrastructure to always be based on spans.  That means that when a string is passed in by the caller, internally we still operate on it as a span.  That also means we can take advantage of slicing, and if the caller has specified via a beginning/length set of arguments that we should only process a substring, we can just slice to that substring.  That, however, then means that all offsets computed by the scanning implementation are 0-based rather than beginning-based.  The span change included a fixup for the overall match position, but not for the position of each individual capture, and that then meant that captures were providing the wrong values.  We unfortunately didn't have any tests for validating groups that also involved non-0 beginnings with string inputs.

2 years agofix pal test (#66636)
Dan Moseley [Wed, 16 Mar 2022 20:56:01 +0000 (14:56 -0600)]
fix pal test (#66636)

2 years agoFix incorrect conversion from int to size_t due to PR 66552. (#66721)
Johan Lorensson [Wed, 16 Mar 2022 20:42:36 +0000 (21:42 +0100)]
Fix incorrect conversion from int to size_t due to PR 66552. (#66721)

https://github.com/dotnet/runtime/pull/66552 did incorrect switch
to size_t from int in a sections that expects variable to go negative.

2 years agoFix mono warnings on linux arm64 (#65256)
Adeel Mujahid [Wed, 16 Mar 2022 20:20:21 +0000 (22:20 +0200)]
Fix mono warnings on linux arm64 (#65256)

2 years agoDedup SymbolicRegexMatcher construction (#66617)
Stephen Toub [Wed, 16 Mar 2022 19:02:21 +0000 (15:02 -0400)]
Dedup SymbolicRegexMatcher construction (#66617)

2 years agoneed to clear mark array bits for regions completely outside the marked range in...
Maoni Stephens [Wed, 16 Mar 2022 18:33:19 +0000 (11:33 -0700)]
need to clear mark array bits for regions completely outside the marked range in FGCs (#66696)

we are missing a case where the mark array bits need to be cleared for a region is completely outside the marked range (ie, slow/shigh) in Workstation GC.

also added verification when we return a region to free.

2 years agoUpdate fabricbot config for Libraries area pods. Scripts moved to dotnet/fabricbot...
Jeff Handley [Wed, 16 Mar 2022 18:30:09 +0000 (11:30 -0700)]
Update fabricbot config for Libraries area pods. Scripts moved to dotnet/fabricbot-config repo. (#66691)

* Update fabricbot config for Libraries area pods. Scripts moved to
dotnet/fabricbot-config repo.

* Apply the taskSource property to the generated tasks

2 years agoConsole.ReadKey should print a char, not an integer (#66609)
Adam Sitnik [Wed, 16 Mar 2022 17:02:20 +0000 (18:02 +0100)]
Console.ReadKey should print a char, not an integer (#66609)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoClose helix tag. (#66717)
Parker Bibus [Wed, 16 Mar 2022 16:23:14 +0000 (11:23 -0500)]
Close helix tag. (#66717)

Close helix work item tag in android_scenarios.proj file that is missing it.

2 years agoFix System.Text.Json tests affected by DST (#66559)
Stephen A. Imhoff [Wed, 16 Mar 2022 12:48:00 +0000 (05:48 -0700)]
Fix System.Text.Json tests affected by DST (#66559)

* Correct whitespace

* Switch DateTime.Now -> DateTime.UtcNow

* Tweak formatting

* Change references to UtcNow to a fixed date/time value.

* Add missing common file reference

2 years agoDisabled in wasm. (#66698)
Ilona Tomkowicz [Wed, 16 Mar 2022 11:01:47 +0000 (12:01 +0100)]
Disabled in wasm. (#66698)

2 years agoFix outerloop NonBacktracking test throwing argument exception (#66693)
Stephen Toub [Wed, 16 Mar 2022 10:21:09 +0000 (06:21 -0400)]
Fix outerloop NonBacktracking test throwing argument exception (#66693)

2 years ago[mono] Optimize and clean-up `System.Reflection.Emit.ILGenerator`. (#65251)
Theodore Tsirpanis [Wed, 16 Mar 2022 10:06:11 +0000 (12:06 +0200)]
[mono] Optimize and clean-up `System.Reflection.Emit.ILGenerator`. (#65251)

2 years agoEnable some ARM32 tests (#66553)
Jakob Botsch Nielsen [Wed, 16 Mar 2022 09:51:28 +0000 (10:51 +0100)]
Enable some ARM32 tests (#66553)

- Enable tests relying on implicit tailcalls
- Enable all ABI stress tests

2 years agoCondition Windows SslCertificateTrust test on Registry value (#65848)
Radek Zikmund [Wed, 16 Mar 2022 09:34:52 +0000 (10:34 +0100)]
Condition Windows SslCertificateTrust test on Registry value (#65848)

Sending trusted issuers list on Windows is problematic (depends on registry settings), so there were no tests. This PR conditionally enables existing tests on Windows if the relevant registry setting is set.

2 years agoAwait pending client authentication task before disposing (#66682)
Radek Zikmund [Wed, 16 Mar 2022 07:30:14 +0000 (08:30 +0100)]
Await pending client authentication task before disposing (#66682)

Fixes #65455.

The assert was hit due to the SslStream being disposed during handshake, while `AuthenticateAsClientAsync` was still running. This removes a rare crash in test runs with debug libraries configuration.

2 years agoAddress a few TODOs on S.S.C.Cose. (#66641)
David Cantú [Wed, 16 Mar 2022 06:48:29 +0000 (23:48 -0700)]
Address a few TODOs on S.S.C.Cose.  (#66641)

* Make HeaderMaps optionals

* Improve handling of integers larger/smaller than int32 in Alg header

2 years agoExpose `LibraryImportAttribute` (#66434)
Elinor Fung [Wed, 16 Mar 2022 03:05:50 +0000 (20:05 -0700)]
Expose `LibraryImportAttribute` (#66434)

2 years agoRemove 4267 suppression from mono (#66552)
Adeel Mujahid [Tue, 15 Mar 2022 23:00:34 +0000 (01:00 +0200)]
Remove 4267 suppression from mono (#66552)

* Remove 4267 suppression from mono

* Fix a mono warning on linux arm64

* Remove trailing whitespaces from changeset

2 years agoFix check for IsTrimmable metadata (#66658)
Jan Kotas [Tue, 15 Mar 2022 22:52:49 +0000 (15:52 -0700)]
Fix check for IsTrimmable metadata (#66658)

Fixes #66593

2 years agoAdd withAssert flag in getTierName method (#66662)
Kunal Pathak [Tue, 15 Mar 2022 22:50:02 +0000 (15:50 -0700)]
Add withAssert flag in getTierName method (#66662)

* review feedback

* Remove the DEBUG condition

2 years agoFix stepping issues with ReadyToRun and TieredCompilation (#66491)
Aaron Robinson [Tue, 15 Mar 2022 21:49:05 +0000 (17:49 -0400)]
Fix stepping issues with ReadyToRun and TieredCompilation (#66491)

* Fix stepping with ReadyToRun and TieredCompilation assemblies

Get the correct PCODE version for ReadyToRun methods when the StubManager
  is computing the address to step to.

* Update logging
Update GetJitInfoWorker to respect code versioning

2 years agoFix register conflict between freeing large stack frames and fast tailcalls on arm32...
Jakob Botsch Nielsen [Tue, 15 Mar 2022 20:40:27 +0000 (21:40 +0100)]
Fix register conflict between freeing large stack frames and fast tailcalls on arm32 (#66588)

Fix #66585

2 years agoReenable SslStreamNetworkStreamTests on OSX #46837 (#66393)
Radek Zikmund [Tue, 15 Mar 2022 20:36:10 +0000 (21:36 +0100)]
Reenable SslStreamNetworkStreamTests on OSX  #46837 (#66393)

The underlying issue has been likely fixed by other changes

2 years agoUpdate maui SDK to 6.0.3xx (#66671)
Parker Bibus [Tue, 15 Mar 2022 19:21:49 +0000 (14:21 -0500)]
Update maui SDK to 6.0.3xx (#66671)

* Update downloaded SDK for maui to 6.0.3xx

2 years agosupport WindowsPrincipal in HttpListenerWebSocketContext (#65746)
Badre BSAILA [Tue, 15 Mar 2022 19:16:41 +0000 (20:16 +0100)]
support WindowsPrincipal in HttpListenerWebSocketContext (#65746)

* support WindowsPrincipal in HttpListenerWebSocketContext

* user Identity is known as instance of WindowsIdentity

* use TARGET_WINDOWS preprocessor

2 years agoEnsure serializer reflection-dependency sentinel is accurate (#66522)
Layomi Akinrinade [Tue, 15 Mar 2022 19:14:58 +0000 (12:14 -0700)]
Ensure serializer reflection-dependency sentinel is accurate (#66522)

* Ensure serializer reflection-dependency sentinel is accurate

* Address feedback

2 years agoFix assert for ARM shuffle thunk (#66642)
Bruce Forstall [Tue, 15 Mar 2022 18:41:22 +0000 (11:41 -0700)]
Fix assert for ARM shuffle thunk (#66642)

Handle case where gap exists at the beginning of the stack
range.

Fix #13241

2 years ago[wasm] Add vector measurements to the bench Sample (#66655)
Radek Doulik [Tue, 15 Mar 2022 18:26:29 +0000 (19:26 +0100)]
[wasm] Add vector measurements to the bench Sample (#66655)

Example output, chrome:

    | measurement | time |
    |-:|-:|
    |               Vector, Create Vector128 |     0.1340us |
    |              Vector, Add 2 Vector128's |     0.6261us |
    |         Vector, Multiply 2 Vector128's |     0.6257us |

v8:

    | measurement | time |
    |-:|-:|
    |               Vector, Create Vector128 |     0.3990us |
    |              Vector, Add 2 Vector128's |     0.9154us |
    |         Vector, Multiply 2 Vector128's |     0.9127us |

2 years agoFix for assert failure in distribute free regions (#66657)
Peter Sollich [Tue, 15 Mar 2022 18:15:50 +0000 (19:15 +0100)]
Fix for assert failure in distribute free regions (#66657)

* Fix the case where a region that was decommitted due to age is also among the highest free regions, and so gets moved to the decommit list again by region_allocator::move_highest_free_regions.

The fix is simply to check whether the region is already on the to_free_list and not move it or count it if it is.

* Fix typo.

* Fix logic in move_highest_free_regions.

2 years agoBring back unused implementation of type conversions (#66597)
Simon Rozsival [Tue, 15 Mar 2022 18:13:24 +0000 (19:13 +0100)]
Bring back unused implementation of type conversions (#66597)

2 years agoImplement X500DistinguishedNameBuilder
Kevin Jones [Tue, 15 Mar 2022 16:39:53 +0000 (12:39 -0400)]
Implement X500DistinguishedNameBuilder

2 years ago[Mono] Intrinsify Vector unary plus operator (#66586)
Simon Rozsival [Tue, 15 Mar 2022 16:31:32 +0000 (17:31 +0100)]
[Mono] Intrinsify Vector unary plus operator (#66586)

* Implement unary plus

* Fix param count assertion

2 years agoSome small copy propagation changes (#66582)
SingleAccretion [Tue, 15 Mar 2022 16:13:46 +0000 (19:13 +0300)]
Some small copy propagation changes (#66582)

* Add asserts

* Remove the quirk comment, replace with a TODO-CQ

2 years ago[Mono] Intrinsify Vector dot product on arm64 (#66589)
Simon Rozsival [Tue, 15 Mar 2022 15:13:31 +0000 (16:13 +0100)]
[Mono] Intrinsify Vector dot product on arm64 (#66589)

2 years agoUse C# 10's enhanced struct initialization features (#63131)
Günther Foidl [Tue, 15 Mar 2022 13:35:23 +0000 (14:35 +0100)]
Use C# 10's enhanced struct initialization features (#63131)

* Use C# 10's enhanced struct initialization features

* Addressed usages

* Remove #pragmas

* Fixed build

Cf. https://github.com/dotnet/runtime/pull/63131#discussion_r812406673

* Update src/libraries/Common/src/System/Collections/Generic/EnumerableHelpers.Linq.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoRevert "Enable emitting intrinsics for System.Numerics.Vector<T> on arm64 (#66476...
Fan Yang [Tue, 15 Mar 2022 11:34:41 +0000 (07:34 -0400)]
Revert "Enable emitting intrinsics for System.Numerics.Vector<T> on arm64 (#66476)" (#66598)

This reverts commit 30c2cdc7dd78b9728d57796c4b37e5653e506166.

2 years agoRemove _socket field from HttpConnection (#66416)
Geoff Kizer [Tue, 15 Mar 2022 04:36:24 +0000 (21:36 -0700)]
Remove _socket field from HttpConnection  (#66416)

* remove _socket from HttpConnection

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
2 years agoAdd vcsjones to more area tags (#66628)
Kevin Jones [Tue, 15 Mar 2022 03:16:25 +0000 (23:16 -0400)]
Add vcsjones to more area tags (#66628)

2 years agoTweak SuperPMI collections (#66627)
Bruce Forstall [Tue, 15 Mar 2022 02:31:13 +0000 (19:31 -0700)]
Tweak SuperPMI collections (#66627)

1. Reduce partition size from 50MB to 25MB. This increases libraries
PMI partitions from 2 to 3 and coreclr_tests partitions to 25. Should
Allow better parallelism and tighter timeouts.
2. Reduce work item timeout of 5 hours to 3 or 2 hours,
based on Kusto data of maximum work item timeouts.
3. Exclude native msquic.dll
4. Fix issue in first_fit that ignored files too large for a "maximum size":
we want to include everything, even if something is larger than max_size.

2 years agoJIT: enable reading PGO data when switching to optimized (#66618)
Andy Ayers [Tue, 15 Mar 2022 02:16:02 +0000 (19:16 -0700)]
JIT: enable reading PGO data when switching to optimized (#66618)

When QuickJitForLoops=0 (current default) and the JIT sees a Tier0 method with
a loop, it will switch to optimizing the method instead.

When this happens we should also have set `BBOPT` so that the JIT will read and
incorporate PGO data for the method and/or its inliees. But we were not doing that.

This change sets `BBOPT`.

2 years agoAdd xarch `blsi` (#66193)
Wraith [Tue, 15 Mar 2022 00:53:39 +0000 (00:53 +0000)]
Add xarch `blsi` (#66193)

* implement blsi

* add bmi intrinsics test projects

* add using System for Console.

2 years agoSet SocketsHttpHandler's default connect timeout to 15s (#66607)
Natalia Kondratyeva [Tue, 15 Mar 2022 00:34:46 +0000 (01:34 +0100)]
Set SocketsHttpHandler's default connect timeout to 15s (#66607)

* Set default connect timeout to 15s

* Fix ConnectTimeout_Default test

2 years agoA bunch of small regex tweaks (#66572)
Stephen Toub [Tue, 15 Mar 2022 00:26:46 +0000 (20:26 -0400)]
A bunch of small regex tweaks (#66572)

* Remove extra blank comment line

EmitScope's usage was resulting in a "//" line being output.  We can just delete all remaining usage of EmitScope; it's no longer helpful.

* Fix some blocks not using EmitBlock

* Minor tweak to add some uint casts to eliminate a few bounds checks

* Avoid rematching loops already matched with the literal-after-loop find optimization

Store the end of the loop position into the unused runtrackpos, and use that to jump right to that position instead of the normal loop handling code.

* Remove unnecessary writer argument to the SliceInputSpan local function

* Make sure we have some RightToLeft culture tests

* Use a more canonical form of loop in EmitLiteralAfterAtomicLoop

* Avoid unnecessary loop in literal-after-atomic-loop for no min bound

* Add more emitted comments to TryFindNextPossibleStartingPosition

* Invert some anchor checks to make the code cleaner

* Remove stray "global::"

* Rename original_pos to matchStart

* Add an additional reduction for concats containing nothings

* Fix exception type thrown for invalid NonBacktracking options combination

* Add special-cased code emitting to EmitScan

* Avoid label in TryFindNextPossibleStartingPosition when it's unnecessary

2 years agoDisable eventpipe test on OSX/x64 (#66606)
Bruce Forstall [Mon, 14 Mar 2022 23:52:58 +0000 (16:52 -0700)]
Disable eventpipe test on OSX/x64 (#66606)

* Disable eventpipe test on OSX/x64

Also, add sections for all-arch OSX and OSX/arm64 for possible future use.

* Update src/tests/issues.targets

Move to all OSX architectures

Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
2 years ago[PERF][MAUI]dotnet-podcast startup time and size measurements (#65813)
Nathan Ricci [Mon, 14 Mar 2022 23:39:57 +0000 (19:39 -0400)]
[PERF][MAUI]dotnet-podcast startup time and size measurements (#65813)

Enable size and startup time monitoring for MAUI dotnet-podcast app on Android.

2 years agoAvoid Attribute.GetCustomAttributes() returning null for open generic type
madelson [Mon, 14 Mar 2022 22:08:17 +0000 (18:08 -0400)]
Avoid Attribute.GetCustomAttributes() returning null for open generic type

* Revert "Revert "Avoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)" (#66508)"

This reverts commit f99ba2e2b8fbf03be5058ad23e8cdce9c4a09da6.

* Make DynamicMethod.GetCustomAttributes() return well-typed arrays.

This change makes DynamicMethod.GetCustomAttributes() compatible with
Attribute.GetCustomAttributes().

2 years agoUse `wasm-tools` workload to run benchmarks for wasm (#66493)
Ankit Jain [Mon, 14 Mar 2022 21:50:33 +0000 (17:50 -0400)]
Use `wasm-tools` workload to run benchmarks for wasm (#66493)

* [wasm] perf jobs: Use workloads to build benchmark projects

This uses the new `--wasmDataDir` parameter. And `--cli` to use the
dotnet from `dotnet-workload` which has the `wasm-tools` workload
installed from artifacts.

* perf pipeline: Use a dotnet with workload installed from artifacts

.. for running the benchmarks.

* [wasm] perf pipeline: Keep only the needed bits in the BrowserWasm

.. download, instead of copying the whole `artifacts` folder.

* Skip downloading unncessary liveLibraries build

* [wasm] Skip unncessary core_root, and corelcr download

2 years agoRemove BB limit from importer_vectorization (#66534)
Egor Bogatov [Mon, 14 Mar 2022 21:05:00 +0000 (00:05 +0300)]
Remove BB limit from importer_vectorization (#66534)

2 years agoRemove 4146 from libunwind (#66427)
Aaron Robinson [Mon, 14 Mar 2022 21:00:38 +0000 (17:00 -0400)]
Remove 4146 from libunwind (#66427)

* Remove 4146 from libunwind

Use existing libunwind align macro and use casting
  when the operation's target should reflect a signed value.

2 years agoFix macOS ARM64 stack overflow detection (#66599)
Jan Vorlicek [Mon, 14 Mar 2022 20:50:46 +0000 (21:50 +0100)]
Fix macOS ARM64 stack overflow detection (#66599)

We were incorrectly using exception_data_type_t instead of mach_exception_data_type_t
in the PAL due to a missing change when we have added support for ARM64 macOS.

The wrong type was 32 bit and it caused the address of a hardware exception to have
the upper 32 bits cut off. That prevented us from detecting stack overflow correctly.

2 years ago[wasm] Use `npm` from emsdk when running `sanitize.py` (#66533)
Ankit Jain [Mon, 14 Mar 2022 19:02:48 +0000 (15:02 -0400)]
[wasm] Use `npm` from emsdk when running `sanitize.py` (#66533)

The issue manifests are build errors:
`UnhandledPromiseRejectionWarning: Error: Cannot find module 'is-fullwidth-code-point'`

.. eventually failing the build:
`*** No rule to make target 'src/cjs/runtime.cjs.iffe.js', needed by 'dotnet.js'`

2 years ago[Mono] Intrinsify Vector WidenLower and WidenUpper on Arm64 (#66512)
Simon Rozsival [Mon, 14 Mar 2022 18:44:47 +0000 (19:44 +0100)]
[Mono] Intrinsify Vector WidenLower and WidenUpper on Arm64 (#66512)

* Implement WidenLower and WidenUpper

* Restrict code only to Arm64

2 years agoARM64 - Optimizing a % b operations (#65535)
Will Smith [Mon, 14 Mar 2022 18:29:12 +0000 (11:29 -0700)]
ARM64 - Optimizing a % b operations (#65535)

* Initial work for ARM64 mod optimization

* Updated comment

* Updated comment

* Updated comment

* Fixing build

* Remove uneeded var

* Use '%' morph logic for both x64/arm64

* Adding back in divisor check for x64

* Formatting

* Update comments

* Update comments

* Fixing

* Updated comment

* Updated comment

* Tweaking x64 transformation logic for the mod opt

* Tweaking x64 transformation logic for the mod opt

* Using IntCon

* Fixed build

* Minor tweak

* Fixing x64 diffs

* Removing flag set

* Feedback

* Fixing build

* Feedback

* Fixing tests

* Fixing tests

* Fixing tests

* Formatting

* Fixing tests

* Feedback

* Fixing build

2 years agoFix JsonSerializer src-gen issues with reference handler feature (#66422)
Layomi Akinrinade [Mon, 14 Mar 2022 17:40:01 +0000 (10:40 -0700)]
Fix JsonSerializer src-gen issues with reference handler feature (#66422)

* Fix JsonSerializer src-gen issues with reference handler feature

* Add Newtonsoft.Json reference to src-gen test project

* Fix failing tests

2 years agoMake ConfigurationManager.Sources public (#66485)
fredjeck [Mon, 14 Mar 2022 17:24:58 +0000 (18:24 +0100)]
Make ConfigurationManager.Sources public (#66485)

* Make ConfigurationManager.Sources public

ConfigurationManager.Sources is now a public property rather than
an explicit interface implementation of  ConfigurationBuilder.Sources.

#61675

2 years agoAdd time prefix to superpmi.py output (#66575)
Bruce Forstall [Mon, 14 Mar 2022 16:00:26 +0000 (09:00 -0700)]
Add time prefix to superpmi.py output (#66575)

Also, add per-operation completion times for collection operations.

These two things will make it easier to see what is taking time
during SuperPMI runs, especially those run in the CI system.

2 years agoDo not assume containment (#66385)
SingleAccretion [Mon, 14 Mar 2022 10:40:48 +0000 (13:40 +0300)]
Do not assume containment (#66385)

Codegen was assuming lowering would always contain immediates
for RMW ops. It did not for some fuzzer-generated code.

Check for containment explicitly instead.

2 years agoReenable a test in stress mode (#66501)
Jakob Botsch Nielsen [Mon, 14 Mar 2022 10:05:03 +0000 (11:05 +0100)]
Reenable a test in stress mode (#66501)

The issue #35687 was closed in #59784 and I can confirm the original
repro mentioned there no longer reproduces with this test.

Fix #65934

2 years agoBetter fix for #66242 (#66335)
SingleAccretion [Mon, 14 Mar 2022 10:00:56 +0000 (13:00 +0300)]
Better fix for #66242 (#66335)

Lowering was moving nodes without checking legality first.