platform/upstream/dotnet/runtime.git
3 years agoAdded LoggerMessage.Define overloads to disable IsEnabled check (#50334)
Günther Foidl [Mon, 29 Mar 2021 13:37:10 +0000 (15:37 +0200)]
Added LoggerMessage.Define overloads to disable IsEnabled check (#50334)

- LoggerMessage.Define with overload to disable IsEnabled check
- Hoist skipEnabledCheck

3 years agoAlways clear the local buffer in ArrayBuffer (#49573)
David Fowler [Mon, 29 Mar 2021 04:15:47 +0000 (21:15 -0700)]
Always clear the local buffer in ArrayBuffer (#49573)

- SslStream was holding onto a 4K byte[] after the handshake was complete. This was because the ArrayBuffer struct doesn't clear the local buffer field in dispose. This changes that.

3 years agoIncrease test coverage for Exception.TargetSite (#50275)
Michal Strehovský [Mon, 29 Mar 2021 03:03:45 +0000 (05:03 +0200)]
Increase test coverage for Exception.TargetSite (#50275)

* Increase test coverage for Exception.TargetSite

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agocatch exceptions in callbacks from native code on OSX in SafeDeleteSslContext (#49945)
Tomas Weinfurt [Mon, 29 Mar 2021 01:01:19 +0000 (18:01 -0700)]
catch exceptions in callbacks from native code on OSX in SafeDeleteSslContext (#49945)

* catch exceptions in callbacks from native code

* style update

* add traces for failures

* add comment

3 years agoUse random file names in the TZ tests (#50339)
Tarek Mahmoud Sayed [Mon, 29 Mar 2021 00:24:24 +0000 (17:24 -0700)]
Use random file names in the TZ tests (#50339)

3 years agoAdd documentation on ILLink files (#50302)
Eric Erhardt [Sun, 28 Mar 2021 21:52:37 +0000 (16:52 -0500)]
Add documentation on ILLink files (#50302)

* Add documentation on ILLink files

* Add link to ILLink-files from project-guidelines

3 years ago[main] Update dependencies from dotnet/arcade dotnet/xharness (#50278)
dotnet-maestro[bot] [Sun, 28 Mar 2021 20:34:59 +0000 (20:34 +0000)]
[main] Update dependencies from dotnet/arcade dotnet/xharness (#50278)

[main] Update dependencies from dotnet/arcade dotnet/xharness

 - reintroduce publishing branch workarounds.

Required while https://github.com/dotnet/arcade/issues/6987 is fixed

 - fix whitespace in publish-using-darc script

 - re-introduce publishing branch workaround

https://github.com/dotnet/arcade/issues/698

3 years agoAdd check for JsonConverterFactory (#50219) (#50329)
Sychev Vadim [Sun, 28 Mar 2021 12:46:02 +0000 (15:46 +0300)]
Add check for JsonConverterFactory (#50219) (#50329)

3 years ago[mono] Reduce usage of the domain lock (#50313)
Zoltan Varga [Sat, 27 Mar 2021 18:06:39 +0000 (14:06 -0400)]
[mono] Reduce usage of the domain lock (#50313)

* [mono] Add a separate lock for the method_to_dyn_method hashtable.

* Use the jit memory manager lock instead of the domain lock in the arm64 patch code.

* Remove usage of the domain lock from the interpreter code.

* Use a separate lock to protect the jit info table.

* Fix the build.

3 years agoHarden SuperPMI replay against missing data (#50307)
Bruce Forstall [Sat, 27 Mar 2021 16:30:11 +0000 (09:30 -0700)]
Harden SuperPMI replay against missing data (#50307)

When generating disasm for an SPMI replay, we can call
`eeGetMethodFullName` for callees for which we are missing data.
Fix `MethodContext::repGetArgNext` to raise an appropriate exception,
and not crash, when it encounters missing data.

3 years agoResolve remaining Xslt-related warnings (round 2) (#50211)
Jose Perez Rodriguez [Sat, 27 Mar 2021 15:59:20 +0000 (08:59 -0700)]
Resolve remaining Xslt-related warnings (round 2) (#50211)

* Resolve remaining Xslt-related warnings

* Addressing final linker warning and adding annotations to ref assembly

* Update src/libraries/System.Private.Xml/src/System/Xml/Xsl/IlGen/GenerateHelper.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Update src/libraries/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Addressing PR feedback

* kept -> preserved

* Address remaining feedback

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
3 years agoFix PKCS Crypto tests on Android (#50252)
Jeremy Koritzinsky [Sat, 27 Mar 2021 07:11:34 +0000 (00:11 -0700)]
Fix PKCS Crypto tests on Android (#50252)

* Handle the fact that on Android, more validation failures are treated as PartialChain when doing CMS signing.

* Fix copy-paste error for RSA SHA-512 PKCS1 padding

* Change condition so we have it in netstandard builds.

3 years agoImprove performance of DateTime.UtcNow on Windows (#50263)
Levi Broderick [Sat, 27 Mar 2021 04:52:19 +0000 (21:52 -0700)]
Improve performance of DateTime.UtcNow on Windows (#50263)

Optimizes leap-second handling by avoiding calls to FileTimeToSystemTime when possible

3 years agoDelete unreachable code for emitting PE fixups and obj files (#50259)
Jan Kotas [Sat, 27 Mar 2021 03:02:35 +0000 (20:02 -0700)]
Delete unreachable code for emitting PE fixups and obj files (#50259)

* Delete unrechable code for emitting PE fixups and obj files

* Fold ICeeGen into ICeeGenInternal and change IID

3 years agoAdd CoreCLR implementation of CallConvMemberFunction. (#47828)
Jeremy Koritzinsky [Sat, 27 Mar 2021 01:53:10 +0000 (18:53 -0700)]
Add CoreCLR implementation of CallConvMemberFunction. (#47828)

* Add CoreCLR implementation of CallConvMemberFunction.

* Add tests and make a few fixes to get them passing.

* Fix Clang build

* Fix argument ordering for calling a cdecl or stdcall instance method from managed.

* Update src/coreclr/dlls/mscorrc/mscorrc.rc

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Fix UnmanagedCallersOnly instance method calls for stdcall and cdecl.

* Update issues.targets.

* Fix formatting.

* Add dummy param to validate param order. Rewrite traversal to second-to-last argument.

* Merge implementations of call conv modopt name comparison.

Use a macro-based implementation initially since it allows us to add new calling conventions by adding one line and the macro-ized code is relatively small.

* Fix assignment alignment.

* SAL and contracts.

* Add assert

* Fix UnmanagedCallersOnly parsing in the refactored parser.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoAdd more support for Julian time zones POSIX rules (#50131)
Tarek Mahmoud Sayed [Sat, 27 Mar 2021 01:51:55 +0000 (18:51 -0700)]
Add more support for Julian time zones POSIX rules (#50131)

3 years agoUse IGenericSharedAPI test harness in PriorityQueue (#50291)
Eirik Tsarpalis [Sat, 27 Mar 2021 00:31:05 +0000 (00:31 +0000)]
Use IGenericSharedAPI test harness in PriorityQueue (#50291)

* Use IGenericSharedAPI test harness in PriorityQueue

* remove dead code

* remove index check from IEnumerator.Current

* Update src/libraries/System.Collections/tests/Generic/PriorityQueue/PriorityQueue.Generic.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/libraries/System.Collections/tests/Generic/PriorityQueue/PriorityQueue.Generic.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoAdd PGD files to runtime package (#50296)
Andy Gocke [Sat, 27 Mar 2021 00:07:49 +0000 (17:07 -0700)]
Add PGD files to runtime package (#50296)

3 years agoFix superpmi.py setting of environment (#50304)
Bruce Forstall [Fri, 26 Mar 2021 23:13:26 +0000 (16:13 -0700)]
Fix superpmi.py setting of environment (#50304)

Especially, fix the setting of environment when generating asm diffs
artifacts.

Before, we were setting the global environment before generating textual
dasm or dump files, and not resetting it. Because we currently loop over
all the MCH files doing (1) `superpmi -a` to determine binary diffs,
then (2) generating textual dasm; after the the environment was set in
(2), if there were further MCH files to process, then the variables would
get picked up in (1). This seemed to work ok, except made the diff process
extremely slow because the baseline and diff JIT were generating textual
dasm for every single MC, which was ignored, then we would re-generate it
for any binary diffs.

Thus, for multiple MCH files, and diffs, things are MUCH faster now.

3 years agoUse SPMI_CACHE_DIRECTORY for sharing mch files across repos (#50298)
Kunal Pathak [Fri, 26 Mar 2021 21:34:13 +0000 (14:34 -0700)]
Use SPMI_CACHE_DIRECTORY for sharing mch files across repos (#50298)

* Use SPMI_LOCATION

* Rename to SUPERPMI_CACHE_DIRECTORY

3 years agoEnsure System.Resources.Extensions targets are applied transitively (#50288)
Eric StJohn [Fri, 26 Mar 2021 21:21:16 +0000 (14:21 -0700)]
Ensure System.Resources.Extensions targets are applied transitively (#50288)

Copy targets to buildTransitive so that they will be applied from
transitive package/project references.  We maintain build folder so that
old nuget clients can still get the build targets.

3 years agoWrap ArgumentException with CryptographicException for incorrect key in EnvelopedCms
Kevin Jones [Fri, 26 Mar 2021 21:15:58 +0000 (17:15 -0400)]
Wrap ArgumentException with CryptographicException for incorrect key in EnvelopedCms

If an incorrect asymmetric key is used to decrypt a symmetric key
in enveloped data, and the decryption is successful but produces
an invalid symmetric key, wrap that as a CryptographicException.

3 years agoRename ILLinkTrim files to ILLink.Descriptors (#50216)
Eric Erhardt [Fri, 26 Mar 2021 20:22:38 +0000 (15:22 -0500)]
Rename ILLinkTrim files to ILLink.Descriptors (#50216)

* Rename ILLinkTrim files to ILLink.Descriptors.

Fix #37651

3 years agoAdd missing Windows Android cross compilers (#50118)
Jo Shields [Fri, 26 Mar 2021 19:56:11 +0000 (15:56 -0400)]
Add missing Windows Android cross compilers (#50118)

Previously, only android-x64 cross compilers have been produced for running on windows-x64.

This PR introduces the three missing android RID targets.

3 years agoJIT: Don't allocate string literals inside potential BBJ_THROW candidates (#50112)
Egor Bogatov [Fri, 26 Mar 2021 19:21:29 +0000 (22:21 +0300)]
JIT: Don't allocate string literals inside potential BBJ_THROW candidates (#50112)

3 years agoFix buffering bug (#50277)
Adam Sitnik [Fri, 26 Mar 2021 18:57:14 +0000 (19:57 +0100)]
Fix buffering bug (#50277)

Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoRemove some assemblies from ASP.NETCore transport package (#50284)
Eric StJohn [Fri, 26 Mar 2021 18:32:19 +0000 (11:32 -0700)]
Remove some assemblies from ASP.NETCore transport package (#50284)

3 years ago[QUIC] API Update (#49823)
Marie Píchová [Fri, 26 Mar 2021 17:21:28 +0000 (18:21 +0100)]
[QUIC] API Update (#49823)

* Cherry picked change from scalablecory/msquic-update.

* Enum rename _FLAG --> _FLAGS to follow msquic naming.

* Enums updated

* Updated interop, compilable project.

* Somewhat working update of msquic API

* Post-merge compilation fixes.

* Fixed most of the tests, one turned into ActiveIssue

* Comments.

* Regenerated ref sources.

* Addressed some feedback.

* Added readme.

* QUIC_ADDRESS_FAMILY

3 years agoImplement ISpanFormattable on Rune and Char (#50272)
Stephen Toub [Fri, 26 Mar 2021 16:29:28 +0000 (12:29 -0400)]
Implement ISpanFormattable on Rune and Char (#50272)

* Implement ISpanFormattable on Rune and Char

For now, this helps reduce allocation if a rune or char is used as an argument to string.Format.  Once ISpanFormattable (or whatever we decide to do as part of API review) is public as part of the improved support for interpolated strings, it'll help there as well.

* Address PR feedback

3 years agomove NonDisposedSocket_SafeHandlesCollected to a non-parallel test collection (#50279)
Anton Firszov [Fri, 26 Mar 2021 16:28:24 +0000 (17:28 +0100)]
move NonDisposedSocket_SafeHandlesCollected to a non-parallel test collection (#50279)

3 years agoAdd SIMD instructions not emitted in simd-intrinsics.c for decompose. (#50168)
Johan Lorensson [Fri, 26 Mar 2021 15:45:16 +0000 (16:45 +0100)]
Add SIMD instructions not emitted in simd-intrinsics.c for decompose. (#50168)

Mono codegen emits a couple of SIMD instructions in regular codegen.
Add them to list of instructions to check for vtype decompose.

With this fix all tests under System.Numerics.Vectors pass on Windows.

3 years ago[mono] Runtime cleanup functions removal (#49639)
Ryan Lucia [Fri, 26 Mar 2021 15:34:16 +0000 (11:34 -0400)]
[mono] Runtime cleanup functions removal (#49639)

* Remove DISABLE_CLEANUP define

* Remove the rest of the cleanup functions

* Readd profiler APIs

3 years agoAdd tests validating collections drop references (#50258)
Stephen Toub [Fri, 26 Mar 2021 10:54:17 +0000 (06:54 -0400)]
Add tests validating collections drop references (#50258)

3 years agoLock region allocator (#49990)
Peter Sollich [Fri, 26 Mar 2021 09:11:05 +0000 (10:11 +0100)]
Lock region allocator (#49990)

Make region_allocator multi-thread safe by wrapping a dedicated lock around region_allocator::allocate and region_allocator:delete_region. Added a few ASSERT_HOLDING_SPIN_LOCK to guard against future bitrot.

3 years agoFix pointer tearing in JIT_MemSet helper on ARM64 (#50273)
Jan Kotas [Fri, 26 Mar 2021 09:06:22 +0000 (02:06 -0700)]
Fix pointer tearing in JIT_MemSet helper on ARM64 (#50273)

3 years agoPrint reason why EH Var was not enregistered (#50215)
Kunal Pathak [Fri, 26 Mar 2021 07:26:55 +0000 (00:26 -0700)]
Print reason why EH Var was not enregistered (#50215)

* zero init

* add indicator why EH-var did not get enregistered

* jit format

* review comments

3 years agoDelete a test method that produces an error during compilation. (#50208)
Sergey Andreenko [Fri, 26 Mar 2021 06:46:57 +0000 (23:46 -0700)]
Delete a test method that produces an error during compilation. (#50208)

* Delete a method that produces an error.

The error was:
```
[  4%] Building CXX object Interop/PInvoke/Miscellaneous/ThisCall/CMakeFiles/ThisCallNative.dir/ThisCallNative.cpp.o
/Users/seandree/git/runtime/src/tests/Common/Platform/platformdefines.cpp:356:12: error: cast to smaller integer type 'unsigned int' from '_opaque_pthread_t *' [-Werror,-Wpointer-to-int-cast]
    return (DWORD)*tThread;
           ^~~~~~~~~~~~~~~
1 error generated.
```

* Delete TP_JoinThread

3 years ago[mono] Fix HOST_WASM -> TARGET_WASM in llvm code. (#50269)
Zoltan Varga [Fri, 26 Mar 2021 05:31:09 +0000 (01:31 -0400)]
[mono] Fix HOST_WASM -> TARGET_WASM in llvm code. (#50269)

3 years agoCredentials fix (#50230)
Jan Jahoda [Fri, 26 Mar 2021 04:18:38 +0000 (05:18 +0100)]
Credentials fix (#50230)

* Port of https://github.com/dotnet/corefx/pull/43051

* Shrink suppression file

* Fix another bugs

* Bump System.Net.TestData version

* Fix typo

* Revert casing in connection string

* Fix connection string case

* more fixes

* Change suppression messages

* Fix typo

* Remove false positive

* Fix usersecrets

Co-authored-by: Dan Moseley <danmose@microsoft.com>
3 years ago Block debugger attach after any ApplyUpdate changes (#50200)
Mike McLaughlin [Fri, 26 Mar 2021 01:39:14 +0000 (18:39 -0700)]
 Block debugger attach after any ApplyUpdate changes (#50200)

* Block debugger attach after any ApplyUpdate changes

* Add better error message for ApplyUpdate while debugging

* Code review feedback

* Fix arm32/arm64 builds

* Code review feedback

* Code review feedback

3 years agoAdd PropertyItem tests (#46794)
Hugh Bellamy [Fri, 26 Mar 2021 01:05:47 +0000 (01:05 +0000)]
Add PropertyItem tests (#46794)

* Refactor PropertyItem image code

* Refactor PropertyItemInternal

* Use Windows implementation of PropertyItem in Unix

* PR feedback

* Use ArrayPool

3 years agoremove repetitions ';' (#50236)
kronic [Fri, 26 Mar 2021 00:59:08 +0000 (03:59 +0300)]
remove repetitions ';' (#50236)

Co-authored-by: kronic <kronic@softland.ru>
3 years agoSeal internal types in libraries (#50225)
Stephen Toub [Fri, 26 Mar 2021 00:50:33 +0000 (20:50 -0400)]
Seal internal types in libraries (#50225)

3 years agoMake tests target overwrite any existing xunit-excludes.txt file when building test...
Elinor Fung [Fri, 26 Mar 2021 00:22:53 +0000 (17:22 -0700)]
Make tests target overwrite any existing xunit-excludes.txt file when building test app (#50183)

3 years ago[mbr] Fix encmap boundary and method RVA lookup. (#50248)
Aleksey Kliger (λgeek) [Fri, 26 Mar 2021 00:21:14 +0000 (20:21 -0400)]
[mbr] Fix encmap boundary and method RVA lookup. (#50248)

Two separate issues:

1. When we process the EnC map, any tables after the last one that has an
update gets an "enc_recs" pointer that's one past the last row of the
table.  (the enc_recs pointer is used to speed up relative address lookup).  So
at lookup time if enc_recs says to look past the end of the EnC map table, we
know there won't be any updates - return -1.

2. When looking for the updated RVA of a method, we need to go through every
delta and find the latest one that has an update for the given method.  The
problem is that if a later generation doesn't have an update, we would take the
NULL return value at face value and it would look like the method had no
updates to its body - we would go back to using the original version from
before any updates were applied.  Instead now ignore lookup table misses and
remember the last successful lookup.  Fixes
https://github.com/dotnet/runtime/issues/50190

3 years agoRemoving suspension prioritization scheme for GC threads vs. non-GC (#49378)
Vladimir Sadov [Thu, 25 Mar 2021 23:45:58 +0000 (16:45 -0700)]
Removing suspension prioritization scheme for GC threads vs. non-GC (#49378)

* remove nonfunctional suspension prioritization scheme for GC threads

* remove cntCollideRetry statistics counter

3 years agoDo not set predecessor for throw block (#50115)
Kunal Pathak [Thu, 25 Mar 2021 23:38:43 +0000 (16:38 -0700)]
Do not set predecessor for throw block (#50115)

* Do not set predecessor for throw block

* jit format

* added comments

* delete BBF_SHARED_THROW

3 years agoRemove unused JNI objects (#50224)
Elinor Fung [Thu, 25 Mar 2021 22:43:44 +0000 (15:43 -0700)]
Remove unused JNI objects (#50224)

3 years ago[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets...
dotnet-maestro[bot] [Thu, 25 Mar 2021 22:41:48 +0000 (22:41 +0000)]
[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets (#50231)

[main] Update dependencies from dotnet/arcade dotnet/xharness dotnet/runtime-assets

 - Re-introduce publishing workaround

Required while https://github.com/dotnet/arcade/issues/6987 is resolved

3 years agoAdd arch specifier for AOT unpack path (#50194)
Drew Scoggins [Thu, 25 Mar 2021 21:37:18 +0000 (14:37 -0700)]
Add arch specifier for AOT unpack path (#50194)

3 years agoRemove GETTHREAD_ALLOWED tracking (#50080)
Vladimir Sadov [Thu, 25 Mar 2021 21:26:44 +0000 (14:26 -0700)]
Remove GETTHREAD_ALLOWED tracking (#50080)

* Remove GETTHREAD_ALLOWED tracking

* removed EE_THREAD_NOT_REQUIRED

* removed EE_THREAD_REQUIRED

* step1

* more changes

* fix Unix build

* more changes

* GetThread in pinvokestubs.S

* build fix for dac

* PInvokeGetThreadHelper

* more changes (dac)

* more (cordbe)

* more (nearly all?)

* Couple places that were mistakengly set to use `GetThreaNotOk` (should use `GetThreadNULLOk`)

* Renamed GetThread() -> GetThreadDoNotUse()

* Missed a few uses of GetThread()

* One more case of GetThread

* Bring GetThread() back - now with an assert in it.

* Renamed PInvokeGetThreadHelper -> JitGetThreadHelper

* One place that should use GetThreadNULLOk (otherwise there are asserts)

* Apply suggestions from code review

Jan's 74 suggestions.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* remove SetFiberMode - it is dead code

* Make `EE_THREAD_NOT_REQUIRED` a noop and revert its removal.

* `GetThreadNULLOk()` should be used here.

* PR review suggestion

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* renamed JitGetThreadHelper -> GetThreadHelper

* One more place that should use `GetThreadNULLOk()`.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years ago[debugger] Removing call to jit_done to help debug multithread (#50240)
Thays Grazia [Thu, 25 Mar 2021 19:40:00 +0000 (16:40 -0300)]
[debugger] Removing call to jit_done to help debug multithread (#50240)

It was causing a side effect on Unity, I will study it again while implement multithread on icordebug.

Reverting part of this PR #19103
Mirror of this PR https://github.com/mono/mono/pull/20970

3 years agoDispose the ContentFileProvider when the host is disposed (#50181)
David Fowler [Thu, 25 Mar 2021 19:09:20 +0000 (12:09 -0700)]
Dispose the ContentFileProvider when the host is disposed (#50181)

* Dispose the ContentFileProvider when the host is disposed
- Today we don't and it results in a leak when hosts are created and destroyed.

* Added test

3 years agoImprove Linux root certificate store change detection involving symlinks
Tomas Weinfurt [Thu, 25 Mar 2021 16:08:57 +0000 (09:08 -0700)]
Improve Linux root certificate store change detection involving symlinks

3 years agoPort misc changes from feature/NativeAOT (#50212)
Jan Kotas [Thu, 25 Mar 2021 14:45:51 +0000 (07:45 -0700)]
Port misc changes from feature/NativeAOT (#50212)

3 years agoFix incorrect optimization of Activator.CreateInstance (#50228)
Michal Strehovský [Thu, 25 Mar 2021 14:39:41 +0000 (15:39 +0100)]
Fix incorrect optimization of Activator.CreateInstance (#50228)

We should not return "default" if there's a private parameterless constructor. GetDefaultConstructor only calls the default constructor in the C# sense (public parameterless ctor on a non-abstract class).

3 years ago[wasm] Build AOT cross-compiler on windows (#50113)
Radek Doulik [Thu, 25 Mar 2021 14:13:57 +0000 (15:13 +0100)]
[wasm] Build AOT cross-compiler on windows (#50113)

Enable `BuildMonoAOTCrossCompiler ` on windows/wasm.

Update `offsets-tool` to add few emscripten include locations.

Use emscripten's `python` to run the `offsets-tool`.

* Add few debug prints

* Show libclang file on windows

* Use c:/dev/LLVM/bin/libclang.dll in CI builds

* Use emsdk's python

* Revert "Add few debug prints"

This reverts commit b3133cfa04a45d64cb07defb8841e8643bf5f0cc.

* Build wasm/windows as Release configuration

The debug has problems of mixing debug/release like:

    LLVMDemangle.lib(ItaniumDemangle.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)
    LLVMDemangle.lib(ItaniumDemangle.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in monosgen-2.0.lib(mini-llvm-cpp.cpp.obj)

Need to further look into this

* Add `-c $(_BuildConfig)`

3 years agoUse Length property instead of GetFileInformationByHandleEx for Seek(SeekOrigin.End...
David Cantú [Thu, 25 Mar 2021 08:45:24 +0000 (01:45 -0700)]
Use Length property instead of GetFileInformationByHandleEx for Seek(SeekOrigin.End) (#50218)

3 years agoMove PGO support to Common (#50083)
Michal Strehovský [Thu, 25 Mar 2021 08:41:38 +0000 (09:41 +0100)]
Move PGO support to Common (#50083)

This part is shareable with other CorInfo implementers.

3 years ago[mono] Fix an assert. (#50220)
Zoltan Varga [Thu, 25 Mar 2021 04:29:33 +0000 (00:29 -0400)]
[mono] Fix an assert. (#50220)

3 years ago[wasm] Copy native ICU libraries to native bin dir (#50184)
Radek Doulik [Thu, 25 Mar 2021 04:09:05 +0000 (05:09 +0100)]
[wasm] Copy native ICU libraries to native bin dir (#50184)

We were missing these in built artifacts on windows, resulting in this
error, when building wasm projects:

    Compiling native assets with emcc. This may take a while ...
    emcc: error: C:\...\artifacts\bin\microsoft.netcore.app.runtime.browser-wasm\Release\runtimes\browser-wasm\native\libicuuc.a: No such file or directory ("C:\Users\rodo\git\winwasm2\artifacts\bin\microsoft.netcore.app.runtime.browser-wasm\Release\runtimes\browser-wasm\native\libicuuc.a" was expected to be an input file, based on the commandline arguments provided)

3 years agoFix more copy-paste errors in host_context_test.cpp (#50147)
Omair Majid [Thu, 25 Mar 2021 02:14:29 +0000 (22:14 -0400)]
Fix more copy-paste errors in host_context_test.cpp (#50147)

I missed a whole bunch of duplicate code when fixing
https://github.com/dotnet/runtime/pull/47430, this fixes that.

3 years agoEnsure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases (#49503)
Tanner Gooding [Thu, 25 Mar 2021 02:12:07 +0000 (19:12 -0700)]
Ensure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases (#49503)

* Ensure Vector<T>.op_Multiply is handled as an intrinsic in appropriate cases

* Applying formatting patch

* Ensure TYP_BYTE and TYP_UBYTE are handled for Vector<T>.op_Multiply on ARM64

* Ensure broadcast nodes are inserted for all `operator *(Vector<T>, T)`

* Ensure ARM64 uses MultiplyByScalar when its available

* Applying formatting patch

* Ensure the scalar for op_Multiply is op2 on ARM64

* Ensure we do a full multiply for `Vector<T> * Vector<T>` on ARM64

* Applying formatting patch

3 years agoFix leak of app variable on assert in hostpolicy (#50199)
Omair Majid [Thu, 25 Mar 2021 02:04:22 +0000 (22:04 -0400)]
Fix leak of app variable on assert in hostpolicy (#50199)

This was caught by a static anlyzer that pointed out that if the assert
is hit and the method returns, app is never deallocated.

3 years agoPropagate extra string data passed to Android instrumentation app as managed args...
Elinor Fung [Thu, 25 Mar 2021 01:58:53 +0000 (18:58 -0700)]
Propagate extra string data passed to Android instrumentation app as managed args (#50203)

3 years agoWhen marshalling a layout class, fall-back to dynamically marshalling the type if...
Jeremy Koritzinsky [Wed, 24 Mar 2021 23:42:59 +0000 (16:42 -0700)]
When marshalling a layout class, fall-back to dynamically marshalling the type if it doesn't match the static type in the signature. (#50137)

3 years agoMake DSACryptoServiceProvider set legal key sizes to most restrictive for platform...
Elinor Fung [Wed, 24 Mar 2021 23:25:26 +0000 (16:25 -0700)]
Make DSACryptoServiceProvider set legal key sizes to most restrictive for platform (#50192)

3 years agoLoop inversion throughput improvements (#50154)
Bruce Forstall [Wed, 24 Mar 2021 23:23:42 +0000 (16:23 -0700)]
Loop inversion throughput improvements (#50154)

A few minor changes that should improve throughput:
1. Move the `fgForwardBranch` check lower, after all the
cheaper checks, since it does a linear walk of the basic
block list.
2. Don't do a tree walk to count shared static helpers if we
already know it's cheap enough to do the optimization.

Also, removed the not-too-useful `optFindLoopTermTest`,
and added more use of FMT_WT.

3 years agoAlign dictionary key converter/metadata retrieval with pattern for collection element...
Layomi Akinrinade [Wed, 24 Mar 2021 22:54:44 +0000 (15:54 -0700)]
Align dictionary key converter/metadata retrieval with pattern for collection elements (#50074)

* Align dictionary key converter/metadata retrieval with pattern for collection elements

* Address review feedback

3 years agoFix CoreCLR runtime in the presence of 1-file composite images (#50188)
Tomáš Rylek [Wed, 24 Mar 2021 22:50:08 +0000 (15:50 -0700)]
Fix CoreCLR runtime in the presence of 1-file composite images (#50188)

I hit this while creating a regression test for the issue #49982.
In the initial composite R2R design I proposed slightly different
organization of the header tables when the composite image
only comprises a single file; later on I removed this special
casing as it was confusing and making the format more complicated
but apparently I forgot to fix this runtime bit. When there's a
composite image with only one component in it, we weren't properly
initializing the component header table and so we were unable to
resolve any R2R methods for the composite image.

Thanks

Tomas

3 years agoInclude the iOS, Android, and macCatalyst supported platforms (#50143)
Jeff Handley [Wed, 24 Mar 2021 22:16:38 +0000 (15:16 -0700)]
Include the iOS, Android, and macCatalyst supported platforms (#50143)

3 years agoAvoid multiple exceptions at startup from MsQuic support tests (#49973)
Stephen Toub [Wed, 24 Mar 2021 21:24:43 +0000 (17:24 -0400)]
Avoid multiple exceptions at startup from MsQuic support tests (#49973)

3 years ago[mbr] Fix null ptr use (#50173)
Aleksey Kliger (λgeek) [Wed, 24 Mar 2021 21:23:24 +0000 (17:23 -0400)]
[mbr] Fix null ptr use (#50173)

g_getenv can return NULL if the env var is unset

3 years ago[wasm] Add support for using emscripten from packages (#50077)
Ankit Jain [Wed, 24 Mar 2021 21:15:34 +0000 (17:15 -0400)]
[wasm] Add support for using emscripten from packages (#50077)

* [wasm] Add support for using emscripten from packages

When using a workload that has the emscripten packages, certain
properties get set. If that isn't set then we fallback to using
`$(EMSDK_PATH)`.

This should allow being able to use emscripten from workloads, but for
other cases where we depend on an installed emscripten, that should work
too.

* Fix setting PATH on windows

* Using msbuild NormalizeDirectory to construct dir path

* fix setting PATH on windows, when paths have trailing slash

* [wasm] Improve checking emscripten from workload, and EMSDK_PATH

- If a workload pack is being used, then ignore `EMSDK_PATH`
- And error in that order too
- Emit better error messages

Example messages:
- Missing python dir when relinking:

`warning : Specified Emscripten sdk at $(EMSDK_PATH)=. is missing some paths: $(EmscriptenPythonToolsPath)=/Users/radical/dev/r3/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/e10djxv0.wdr/python/3.7.4-2_64bit/ . Emscripten SDK is required for building native files.`

- Missing node directory, or the wrong version dir:

`warning : Specified Emscripten sdk at $(EMSDK_PATH)=/Users/radical/dev/r3/src/mono/wasm/emsdk is missing some paths: $(EmscriptenNodeToolsPath)=/Users/radical/dev/r3/src/mono/wasm/emsdk/node/12.18.1_64bit/ . Emscripten SDK is required for building native files.`

- Empty `EMSDK_PATH`

`Error : Could not find Emscripten sdk at $(EMSDK_PATH)=/Users/radical/dev/r3/src/mono/wasm/emsdk/. Emscripten SDK is required for AOT'ing assemblies.`

- Bad `EMSDK_PATH`

`error : Specified Emscripten sdk at $(EMSDK_PATH)=. is missing some paths: $(EmscriptenPythonToolsPath)=/Users/radical/dev/r3/artifacts/bin/Wasm.Build.Tests/net6.0-Release/browser-wasm/l2mcsipf.isn/python/3.7.4-2_64bit/ . Emscripten SDK is required for AOT'ing assemblies.`

* [wasm] Don't hardcode versions for python/node bundled in emsdk

.. and listen to @lewing's suggestions!

* [wasm] GetDirectories doesn't like non-existant paths

* Fix the earlier fix

* improve errors when some paths are missing

* cleanup

* debugging on ci

* [wasm] emscripten uses system python on linux, so don't try to find it in emscripten sdk

3 years agoFix PriorityQueue not deleting references to dequeued elements (#50182)
Eirik Tsarpalis [Wed, 24 Mar 2021 21:13:15 +0000 (21:13 +0000)]
Fix PriorityQueue not deleting references to dequeued elements (#50182)

* Fix #50114

* add debug assertions to MoveUp/Down methods

3 years agoDisable a failing test. (#50160)
Sergey Andreenko [Wed, 24 Mar 2021 18:20:11 +0000 (11:20 -0700)]
Disable a failing test. (#50160)

3 years agoFix string.Remove exception message (#50176)
Eric Erhardt [Wed, 24 Mar 2021 17:57:08 +0000 (12:57 -0500)]
Fix string.Remove exception message (#50176)

Follow up from #50096

3 years agoFix cross compilation of XmlSerializer.Generator tests (#50180)
Jeremy Barton [Wed, 24 Mar 2021 17:52:14 +0000 (10:52 -0700)]
Fix cross compilation of XmlSerializer.Generator tests (#50180)

3 years agoUse EVP_PKEY for RSA Decrypt
Jeremy Barton [Wed, 24 Mar 2021 17:27:42 +0000 (10:27 -0700)]
Use EVP_PKEY for RSA Decrypt

3 years ago[llvm] Mark stores for reference variables volatile on wasm to avoid llvm moving...
Zoltan Varga [Wed, 24 Mar 2021 15:49:01 +0000 (11:49 -0400)]
[llvm] Mark stores for reference variables volatile on wasm to avoid llvm moving them. (#50159)

Fixes some GC crashes on WASM+aot.

3 years agoimprove 'optRemoveRedundantZeroInits' (#50155)
Sergey Andreenko [Wed, 24 Mar 2021 15:48:08 +0000 (08:48 -0700)]
improve 'optRemoveRedundantZeroInits' (#50155)

It covers cases like:
```
N006 ( 13, 12) [000019] -A-XG---R---              *  ASG       struct (copy)
N005 (  9,  9) [000018] n-----------              +--*  OBJ       struct<System.Threading.Tasks.ValueTask, 16>
N004 (  3,  5) [000017] ------------              |  \--*  ADDR      byref
N003 (  3,  4) [000014] D------N----              |     \--*  LCL_FLD   struct V03 tmp1         [+0] Fseq[_value]
N002 (  3,  2) [000015] ---XG-------              \--*  IND       struct
N001 (  1,  1) [000000] ------------                 \--*  LCL_VAR   byref  V00 this
```

3 years agoPick new version of Microsoft.DotNet.Build.Tasks.Installers (#50153)
Nikola Milosavljevic [Wed, 24 Mar 2021 15:31:18 +0000 (08:31 -0700)]
Pick new version of Microsoft.DotNet.Build.Tasks.Installers (#50153)

3 years agoFix Alpine 3.13 ARM build (#50105)
Jan Vorlicek [Wed, 24 Mar 2021 14:31:24 +0000 (15:31 +0100)]
Fix Alpine 3.13 ARM build (#50105)

* Fix Alpine 3.13 ARM build

Alpine 3.13 is the first version of Alpine Linux that uses 64 bit time_t
on both 64 and 32 bit platforms. That breaks the build as we assumed
that 32 bit platforms use always 32 bit time_t.

This change fixes it by making the PAL time_t type always 64 bit.
Everything still works fine on non-Alpine ARM / x86 Linuxes, since
it only changes the time_t type size outside of PAL.

* Fix case when time function gets NULL argument

3 years agoResolve ILLink warnings in System.ComponentModel.Annotations (#49901)
Eric Erhardt [Wed, 24 Mar 2021 13:33:38 +0000 (08:33 -0500)]
Resolve ILLink warnings in System.ComponentModel.Annotations (#49901)

* Resolve ILLink warnings in System.ComponentModel.Annotations

Contributes to #45623

* PR feedback

3 years agoSystem.Xml.NameTable optimizations (#49988)
kronic [Wed, 24 Mar 2021 13:32:28 +0000 (16:32 +0300)]
System.Xml.NameTable optimizations  (#49988)

* Slight simplification and acceleration

* use SequenceEqual

* fix nullability

* innline TextEquals

* Inline ComputeHash32

* remove using

* fix nullability

Co-authored-by: kronic <kronic@softland.ru>
3 years agoMake it possible to condition tests on line number support (#50165)
Michal Strehovský [Wed, 24 Mar 2021 13:20:04 +0000 (14:20 +0100)]
Make it possible to condition tests on line number support (#50165)

* Update PlatformDetection.cs

* Update ExceptionTests.cs

* Update PlatformDetection.cs

3 years agoImprove NonDisposedSocket_SafeHandlesCollected test (#50104)
Anton Firszov [Wed, 24 Mar 2021 11:46:32 +0000 (12:46 +0100)]
Improve NonDisposedSocket_SafeHandlesCollected test (#50104)

Apply timeouts in NonDisposedSocket_SafeHandlesCollected

3 years agofix BasicTest_AccessInstanceProperties_NoExceptions_Bsd
wfurt [Wed, 24 Mar 2021 01:01:36 +0000 (18:01 -0700)]
fix BasicTest_AccessInstanceProperties_NoExceptions_Bsd

3 years agofixes the https://github.com/dotnet/runtime/issues/48062
jaymin suthar [Mon, 22 Feb 2021 16:03:32 +0000 (21:33 +0530)]
fixes the https://github.com/dotnet/runtime/issues/48062

3 years agoJIT: Add rootTreeOp to DumpFg (#50119)
Egor Bogatov [Wed, 24 Mar 2021 09:55:13 +0000 (12:55 +0300)]
JIT: Add rootTreeOp to DumpFg (#50119)

3 years agoBig-endian fixes: networking stack (#48398)
Ulrich Weigand [Wed, 24 Mar 2021 09:29:35 +0000 (10:29 +0100)]
Big-endian fixes: networking stack (#48398)

* Fix various places that assumed host byte order was little-endian,
  use appropriate host <-> network byte order conversion instead.

* This in particular affects handling of IPv4 addresses, which
  are stored internally in network order.

* Fix endian assumptions in socket option code (GetSockOpt).

* Update test cases and provide /proc test files from a
  big-endian system.

3 years agoFix mono_simd_decompose_intrinsic to only decompose SIMD instructions. (#50109)
Johan Lorensson [Wed, 24 Mar 2021 08:34:12 +0000 (09:34 +0100)]
Fix mono_simd_decompose_intrinsic to only decompose SIMD instructions. (#50109)

Current implemention of mono_simd_decompose_intrinsic was a little too
imprecise when decomposing SIMD instructions. If we add one SIMD
instruction in emit_simd_intrinsics, we flagged complete cfg to be
investigate for SIMD instructions that needs decomposition on Windows.

In mono/mono that worked well enough, but in dotnet/runtime there are
more scenarios where this can cause issues and very hard to debug
issue together with additional set of SIMD intrinsics.

If we for example emit SN_get_Count and SN_get_IsHardwareAccelerated
that won't add any specific SIMD instructions, we still flag cfg that
it includes SIMD instructions that needs to be evaluated for decomposition.
If we then for example had a call using SIMD type directly reusing argument
from method, it would be incorrectly decomposed causing codegen error.

An example where this was observed was in SpanHelpers.Char LocateFirstFoundChar
that triggered an error returning incorrect value from method, causing
IndexOf to report incorrect index in some specific cases. Since it uses
count on Vector type, the cfg will be flagged to use SIMD instructions
that may need decomposition and when function is not inlined (debug build)
call to AsVectorUInt64 will directly take match from argument list, so
code thinks it needs to decompose that value type before passing it to
AsVectorUInt64, that is just a regular method taking value type as argument
so it already handles the case (unlike the SIMD intrinsics).

Fix makes the check if we should decompose source/dest regs more precise
and will only apply to registers that are xregs, meaning that they are
part of a SIMD instruction.

3 years agoSet default features flags to match to iOS SDK defaults (#49635)
Maxim Lipnin [Wed, 24 Mar 2021 08:06:24 +0000 (11:06 +0300)]
Set default features flags to match to iOS SDK defaults (#49635)

Contributes to #43865.

Based on https://github.com/xamarin/xamarin-macios/blob/834b0888853210ca01d5e8f5ce2c65fe9c55fc10/dotnet/targets/Xamarin.Shared.Sdk.targets#L138-L146

The changes:
- added a property group with iOS/iOSSimulator default feature flags;
- aligned the conditions to check the properties activating the defaults for true in order to follow better msbuild practice.

3 years agoAdd test coverage for Module.GetMethod/s (#50076)
Eric Rafalovsky [Wed, 24 Mar 2021 07:58:52 +0000 (03:58 -0400)]
Add test coverage for Module.GetMethod/s (#50076)

Fix dotnet/runtime#49926

3 years agoPut back DiaSymReader library for cross-arch crossgen to package (#50149)
Anton Lapounov [Wed, 24 Mar 2021 07:23:29 +0000 (00:23 -0700)]
Put back DiaSymReader library for cross-arch crossgen to package (#50149)

3 years agomove gen[]s to compiler.cpp as they are declared in compiler.h/hpp (#50141)
yowl [Wed, 24 Mar 2021 07:13:53 +0000 (02:13 -0500)]
move gen[]s to compiler.cpp as they are declared in compiler.h/hpp (#50141)

3 years agoDon't bundle the LLVM optimizer on wasm we use the emscripten version (#50132)
Larry Ewing [Wed, 24 Mar 2021 02:56:04 +0000 (21:56 -0500)]
Don't bundle the LLVM optimizer on wasm we use the emscripten version (#50132)

3 years agoImprove time zone display names on Unix (#48931)
Matt Johnson-Pint [Wed, 24 Mar 2021 01:34:09 +0000 (18:34 -0700)]
Improve time zone display names on Unix (#48931)

3 years agoSkip ninja and cmake errors in aotcrossonly mode (#50140)
Larry Ewing [Wed, 24 Mar 2021 01:05:08 +0000 (20:05 -0500)]
Skip ninja and cmake errors in aotcrossonly mode (#50140)

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210322.2 (#50090)
dotnet-maestro[bot] [Tue, 23 Mar 2021 22:11:00 +0000 (23:11 +0100)]
Update dependencies from https://github.com/mono/linker build 20210322.2 (#50090)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.2.21169.4 -> To Version 6.0.100-preview.2.21172.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>