platform/upstream/dotnet/runtime.git
4 years agoUse one-shot hash functions where possible. (#39455)
Kevin Jones [Fri, 17 Jul 2020 00:18:40 +0000 (20:18 -0400)]
Use one-shot hash functions where possible. (#39455)

4 years agoLinking native libraries into superhost (#38684)
Vladimir Sadov [Thu, 16 Jul 2020 23:29:12 +0000 (16:29 -0700)]
Linking native libraries into superhost (#38684)

* native libs location

* pass artifacts locations as CMake variables.

* Link native libs

* use LibrariesConfiguration to discover libraries artifacts

* redirect to current exe

* remove bundled binaries from the  netcoreapp/pkg

* delete exports file

* no bundling of native libs on OSX

* only link native libs on Linux

* Support linking of coreclr on Linux only

* PR feedback

* move the shim to dllimport.cpp

* Use library names vs. file names

* removed ShouldRedirectToCurrentLibrary. NULL library name in PAL_LoadLibrary will be always considered self-referring.

4 years agoRemoving unused Resources from System.Threading.Overlapped (#39395)
Jose Perez Rodriguez [Thu, 16 Jul 2020 23:10:57 +0000 (16:10 -0700)]
Removing unused Resources from System.Threading.Overlapped (#39395)

* Removing unused Resources from System.Threading.Overlapped

* Removing unused code from S.T.O.csproj and add Resources check to test

4 years agoAdding support for constrained open generics to DI (#34393)
Jimmy Bogard [Thu, 16 Jul 2020 23:08:35 +0000 (18:08 -0500)]
Adding support for constrained open generics to DI (#34393)

4 years agoICU integration and asset loading overhaul (#37971)
Katelyn Gadd [Thu, 16 Jul 2020 23:02:10 +0000 (16:02 -0700)]
ICU integration and asset loading overhaul (#37971)

This PR overhauls runtime startup/asset loading and adds support for ICU integration.

The mono-config.js format is reworked and simplified, with new functionality added:

    Individual assets can be loaded from one or more remote sources with configurable fallback behavior
    In addition to the existing support for loading assemblies, you can now pre-load arbitrary files into the native heap or into emscripten's virtual file system. VFS support previously only existed in runtime-test.js but now is available to any consumer of dotnet.js.
    Assets can have a virtual path set so that their application-facing path does not necessarily have to match their path on the server.
    One or more ICU data archives can be added to the assets list and will be automatically loaded and used to enable ICU-based globalization support.
    Many configuration knobs that previously required API calls can now be set declaratively in the configuration file (environment variables, etc.)

WasmAppBuilder is updated to add ICUDataFiles and RemoteSources parameters that can be used to add the associated information to the config file declaratively from a msbuild project.

Various adjustments are made to existing tests and test cases so that they will pass with the addition of ICU integration.

Co-authored-by: EgorBo <egorbo@gmail.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
4 years agoAdvSimd support for System.Text.Unicode.Utf16Utility.GetPointerToFirstInvalidChar...
Carlos Sanchez Lopez [Thu, 16 Jul 2020 22:57:39 +0000 (15:57 -0700)]
AdvSimd support for System.Text.Unicode.Utf16Utility.GetPointerToFirstInvalidChar (#39050)

* AdvSimd support for System.Text.Unicode.Utf16Utility.GetPointerToFirstInvalidChar

* Move using directive outside #if.
Improve Arm64MoveMask.

* Change overloads

* UIn64 in Arm64MoveMask

* Build error implicit conversion fix

* Rename method and use simpler version

* Use ShiftRightArithmetic instead of CompareEqual + And.

* Remove unnecessary comment

* Add missing shims causing Linux build to fail

4 years agoMove libraries test build to product build (#39402)
Santiago Fernandez Madero [Thu, 16 Jul 2020 22:02:32 +0000 (15:02 -0700)]
Move libraries test build to product build (#39402)

* Move libraries test build to product build

* Publish artifacts needed by coreclr tests

* Don't build corelib anymore since it is a P2P from libraries now

4 years agoAdd tests for runtimepack type RuntimeLibraries. (#37397)
Sean Hall [Thu, 16 Jul 2020 22:01:55 +0000 (08:01 +1000)]
Add tests for runtimepack type RuntimeLibraries. (#37397)

Add documentation to contructor in RuntimeLibrary.

4 years agoThrow when Rfc2898DeriveBytes extract limit has been exceeded
Kevin Jones [Thu, 16 Jul 2020 21:08:53 +0000 (17:08 -0400)]
Throw when Rfc2898DeriveBytes extract limit has been exceeded

4 years agoFix inadvertently case sensitive Boyer-Moore (#39420)
Dan Moseley [Thu, 16 Jul 2020 20:58:01 +0000 (13:58 -0700)]
Fix inadvertently case sensitive Boyer-Moore (#39420)

* Unit test

* Fix

* Typo

* CR feedback

4 years agoWASM: enable System.Runtime.Tests (#39344)
Santiago Fernandez Madero [Thu, 16 Jul 2020 20:46:03 +0000 (13:46 -0700)]
WASM: enable System.Runtime.Tests (#39344)

* WASM: fix System.Runtime.Tests

* Enable System.Runtime.Tests

* Disable test and don't strip link attributes on all product assemblies

* PR feedback

4 years agoUpdate API doc on AddSimpleConsole (#39426)
Sourabh Shirhatti [Thu, 16 Jul 2020 19:37:56 +0000 (12:37 -0700)]
Update API doc on AddSimpleConsole (#39426)

4 years agoMake "services.ConfigureOptions" register validations (#38513)
Loïc Sharma [Thu, 16 Jul 2020 18:56:40 +0000 (11:56 -0700)]
Make "services.ConfigureOptions" register validations (#38513)

* Add validation to ConfigureOptions

* Improve comments

4 years agoFix issue with Trimming tests on Windows (#39307)
Jose Perez Rodriguez [Thu, 16 Jul 2020 18:52:59 +0000 (11:52 -0700)]
Fix issue with Trimming tests on Windows (#39307)

* Fix issue with Trimming tests on Windows

* Update the IsSymbolFile metadata calculation

4 years agoAdd tests to ensure the right exception is thrown for an invalid token after metadata...
David Cantu [Thu, 16 Jul 2020 18:39:46 +0000 (11:39 -0700)]
Add tests to ensure the right exception is thrown for an invalid token after metadata properties (#39254)

4 years agoAdd logic for non-generic Stack/Queue to share add-method delegates (#39151)
Layomi Akinrinade [Thu, 16 Jul 2020 18:15:01 +0000 (11:15 -0700)]
Add logic for non-generic Stack/Queue to share add-method delegates (#39151)

4 years agoForce bindingRedirect for System.Resources.Extensions (#39386)
Eric StJohn [Thu, 16 Jul 2020 17:48:45 +0000 (10:48 -0700)]
Force bindingRedirect for System.Resources.Extensions (#39386)

System.Resources.Extensions writes a type-reference into the .resources
file it writes but RAR will never see this when considering conflicts
for bindingRedirects.

Force a bindingRedirect whenever this package is used.

4 years agoEnable logging for CI runs (#39381)
Bill Wert [Thu, 16 Jul 2020 17:33:46 +0000 (10:33 -0700)]
Enable logging for CI runs (#39381)

* Enable logging for CI runs

* mistaken variable name

* realized I was fixing the wrong thing. This should just set logging params for CI jobs.

* fix indent

* mistakenly moved variable groups to the wrong block.

* remove newline

* remove newline

4 years agoMmap R2R images at and non-page-boundary (#38951)
Vladimir Sadov [Thu, 16 Jul 2020 17:32:45 +0000 (10:32 -0700)]
Mmap R2R images at and non-page-boundary (#38951)

* Mmap R2R images at and non-page-boundary

Assemblies embedded within a single-file are aligned at 16 byte boundaries.

However, currently MappedImageLayout assumes that assemblies are mapped at 4K offsets.
This results in map failure and subsequent failure to load the image in a mapped layout.
Subsequently, the image was loaded as IL as a fallback.

The change fixes this problem by:

mmap() pages containing sections/headers using appropriate ROUND_DOWN and ROUND_UP operations
Load sections at unaligned offsets in MAPMapPEFile.

Fixes: #38061

* Relaxing map alignment check to 16 bytes

* do not round up header size

* asserts

* reject sections where data and VA hint have different page alignment

* PR feedback

* revert init of loadedHeaderBase and add a comment

Co-authored-by: Swaroop Sridhar <swaroop.sridhar@microsoft.com>
4 years agoRemaining cleanup work on Microsoft.Extensions.Logging.Console (#39407)
Maryam Ariyan [Thu, 16 Jul 2020 17:30:41 +0000 (10:30 -0700)]
Remaining cleanup work on Microsoft.Extensions.Logging.Console (#39407)

* Remove and sort usings

* Remove AnsiSystemConsole

* Remove and sort usings on tests

* flip ifdefs

* Add missing xml docs

* PR feedback

4 years agoBump Intellisense nupkg version to Prev7 (#39383)
Carlos Sanchez Lopez [Thu, 16 Jul 2020 17:28:49 +0000 (10:28 -0700)]
Bump Intellisense nupkg version to Prev7 (#39383)

4 years agoAdd one more -sroa pass for llvm-jit (#38659)
Egor Bogatov [Thu, 16 Jul 2020 17:08:24 +0000 (20:08 +0300)]
Add one more -sroa pass for llvm-jit (#38659)

4 years agoFix crash on invariant mode when calling GetCultureInfo(name, true) (#39408)
Santiago Fernandez Madero [Thu, 16 Jul 2020 16:41:07 +0000 (09:41 -0700)]
Fix crash on invariant mode when calling GetCultureInfo(name, true) (#39408)

4 years agoUse implicit system configuration for EncryptionPolicy.RequireEncryption
Tom Deseyn [Thu, 16 Jul 2020 16:30:26 +0000 (18:30 +0200)]
Use implicit system configuration for EncryptionPolicy.RequireEncryption

4 years agoAdd RequiresUnreferencedCodeAttribute to CryptoConfig
Jeremy Barton [Thu, 16 Jul 2020 16:23:54 +0000 (09:23 -0700)]
Add RequiresUnreferencedCodeAttribute to CryptoConfig

4 years agoReduce allocations and P/Invokes in one-shot hashes
Kevin Jones [Thu, 16 Jul 2020 16:21:09 +0000 (12:21 -0400)]
Reduce allocations and P/Invokes in one-shot hashes

4 years agoMemoryCache: Size calculation with expired Entries (#39189)
Christian Hiersekorn [Thu, 16 Jul 2020 16:06:12 +0000 (18:06 +0200)]
MemoryCache: Size calculation with expired Entries (#39189)

4 years agoImprove SuppressGCTransitionAttribute docs (#39410)
Jan Kotas [Thu, 16 Jul 2020 15:56:17 +0000 (08:56 -0700)]
Improve SuppressGCTransitionAttribute docs (#39410)

4 years agoMake ILBlittablePtrMarshaler participate in marshaller inheritance (#39389)
Aaron Robinson [Thu, 16 Jul 2020 15:50:54 +0000 (08:50 -0700)]
Make ILBlittablePtrMarshaler participate in marshaller inheritance (#39389)

* Make ILBlittablePtrMarshaler participate in marshaller inheritance

* Add test for class layout with Out attribute scenario.

4 years agoAllow building libs tests for all configurations (#38993)
Viktor Hofer [Thu, 16 Jul 2020 15:09:28 +0000 (17:09 +0200)]
Allow building libs tests for all configurations (#38993)

* Allow building libs tests for all configurations

Building libraries tests and passing in the -allconfigurations switch
results in the libraries packages being built and tested. Conditioning
the packages build/test on the /p:TestPackages switch.

4 years agoSprinkle SuppressGCTransition across Unix shim P/Invokes (#39206)
Stephen Toub [Thu, 16 Jul 2020 14:57:47 +0000 (10:57 -0400)]
Sprinkle SuppressGCTransition across Unix shim P/Invokes (#39206)

* Sprinkle SuppressGCTransition across Unix shim P/Invokes

Did a quick audit and added it to all the trivial functions that just return a constant or return some static or map one value to another or such things.

* Address PR feedback

* Update src/libraries/Native/Unix/System.Native/pal_io.c

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
4 years ago[wasm] Enable the library test suites that have no failures at the moment (#39427)
Maxim Lipnin [Thu, 16 Jul 2020 13:21:13 +0000 (16:21 +0300)]
[wasm] Enable the library test suites that have no failures at the moment (#39427)

4 years agoFix non-windows test failure on Microsoft.Extensions.Hosting.HostTests.CreateDefaultB...
Maryam Ariyan [Thu, 16 Jul 2020 12:24:20 +0000 (05:24 -0700)]
Fix non-windows test failure on Microsoft.Extensions.Hosting.HostTests.CreateDefaultBuilder_RegistersEventSourceLogger (#39411)

* ifdefing SuppressGCTransition out of Logging.Console

Fixes #39404

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
4 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20200714.3 (#39392)
dotnet-maestro[bot] [Thu, 16 Jul 2020 11:01:09 +0000 (13:01 +0200)]
Update dependencies from https://github.com/dotnet/arcade build 20200714.3 (#39392)

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat
 From Version 5.0.0-beta.20330.3 -> To Version 5.0.0-beta.20364.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoupdate branding to rc1 (#39418)
Jan Jahoda [Thu, 16 Jul 2020 10:41:53 +0000 (12:41 +0200)]
update branding to rc1 (#39418)

* update branding to rc1

* update branding to rc1

Co-authored-by: Jan Jahoda <jajahoda@.microsoft.com>
4 years agoFix source build (CLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE) (#39391)
Mike McLaughlin [Thu, 16 Jul 2020 06:09:04 +0000 (23:09 -0700)]
Fix source build (CLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE) (#39391)

Fixes issue #https://github.com/dotnet/runtime/issues/2014

Adds back ELF unwind info parsing code that has been around since 3.0 so it is fairly well tested. It is conditional on CLR_CMAKE_USE_SYSTEM_LIBUNWIND, otherwise, PAL_VirtualUnwindOutOfProc uses the new libunwind8 _OOP_find_proc_info function.

4 years agoIntroduce BinaryFormatter enablement switch; disable on wasm (#38963)
Levi Broderick [Thu, 16 Jul 2020 05:26:32 +0000 (22:26 -0700)]
Introduce BinaryFormatter enablement switch; disable on wasm (#38963)

Applications are given the option of disabling BinaryFormatter.Serialize and BinaryFormatter.Deserialize, meaning they'll throw NotSupportedException if anybody tries calling them. WASM projects always disable these APIs via a hardcoded mechanism; there is no re-enablement mechanism for those projects.

This commit only introduces the switch. It does not disable it in any project types by default. (Exception: wasm, as mentioned above.) The related PR https://github.com/dotnet/sdk/pull/12434 causes aspnet 5.0+ applications to disable BinaryFormatter functionality by default, but apps can re-enable if needed.

4 years agoAdd JsonIgnoreCondition.WhenWritingNull (#39388)
Layomi Akinrinade [Thu, 16 Jul 2020 03:49:09 +0000 (20:49 -0700)]
Add JsonIgnoreCondition.WhenWritingNull (#39388)

* Add JsonIgnoreCondition.WhenWritingNull

* Address review feedback

4 years agoInterpret DOTNET_BUNDLE_EXTRACT_BASE_DIR without dir separator as relative path ...
Mateo Torres-Ruiz [Thu, 16 Jul 2020 03:48:52 +0000 (20:48 -0700)]
Interpret DOTNET_BUNDLE_EXTRACT_BASE_DIR without dir separator as relative path (#39331)

* Get absolute path

4 years agoAdd support for GCPOLL_INLINE for crossgen (#39376)
Jan Kotas [Thu, 16 Jul 2020 01:34:48 +0000 (18:34 -0700)]
Add support for GCPOLL_INLINE for crossgen (#39376)

Fixes #13591

4 years agoMove ICU dependency to product (#39382)
Matt Mitchell [Thu, 16 Jul 2020 00:59:13 +0000 (17:59 -0700)]
Move ICU dependency to product (#39382)

4 years agoUse more consistent manifest attributes (#39360)
Matt Mitchell [Wed, 15 Jul 2020 23:41:53 +0000 (16:41 -0700)]
Use more consistent manifest attributes (#39360)

Create manifest attributes that are consistent with arcade's usage.

4 years agoAllow ctor parameters to exactly match property name (#38959)
Steve Harter [Wed, 15 Jul 2020 22:43:07 +0000 (17:43 -0500)]
Allow ctor parameters to exactly match property name (#38959)

4 years agoMicro optimizations for serialization (#39323)
Steve Harter [Wed, 15 Jul 2020 22:27:54 +0000 (17:27 -0500)]
Micro optimizations for serialization (#39323)

4 years agouse new API on new windows to get TLS13 (#37888)
Tomas Weinfurt [Wed, 15 Jul 2020 22:07:32 +0000 (15:07 -0700)]
use new API on new windows to get TLS13 (#37888)

* use new API on new windows to get TLS13

* use unmanaged ref to avoid copy

* feedback from review

* feedback from review

* feedback from review

* kick the build

4 years agoFix 2 noRetypingRegressions. (#39345)
Sergey Andreenko [Wed, 15 Jul 2020 21:57:39 +0000 (14:57 -0700)]
Fix 2 noRetypingRegressions. (#39345)

* don't mark stack indir as 'X'.

* Fold OBJ(ADDR(x)) under ASG when possible.

* FIx issues found by Carol

4 years agoQuiet crossgen2 output (#39340)
David Wrighton [Wed, 15 Jul 2020 21:43:31 +0000 (14:43 -0700)]
Quiet crossgen2 output (#39340)

Crossgen2 currently prints many unnecessary details to the console using strings that are regarded as temporary

- Update the type system exceptions to use descriptive strings instead of [TEMPORARY ERROR MESSAGE]XXX
- Do not print any error when a method isn't compiled due to lack of IL code
  - This is common, and not a failure of any form
- Tie logging of non-compiled methods to the --verbose switch
  - We may wish to provide variable logging levels, but that can easily be done in the future

4 years agoVxsort (#37159)
Peter Sollich [Wed, 15 Jul 2020 20:57:01 +0000 (22:57 +0200)]
Vxsort (#37159)

* Initial snapshort of vxsort implementation incorporating source code from Dan Shechter.

* Bug fix from Dan.

* Use bigger mark list for experiments.

* Give up if the mark list size is bigger than a reasonable fraction of the ephemeral space.

* Latest version from Dan, disable for ARM64.

* Fixes for Linux compile, ended up disabling vxsort for Linux for now.

* Experimenting with 32-bit sort - the variation that gathers mark list entries pertaining to the local heap by reading the mark lists from all the heaps appears to be too slow and scales very badly with increasing number of heaps.

* 32-bit sort - preserve failing case.

* Do the pointer compression/decompression in place, to improve performance, optionally write mark lists and associated information to binary files for further analysis.

* Introduce runtime check whether CPU supports AVX2 instruction set.

* Implement mark list growth.

* Integrate new version including AVX512 code path.

* Implement runtime test for AVX512 support.

* Move the files for the vectorized sort to their own directory, add stubs to call AVX2 or AVX512 flavor of the sort.

* Get rid of unneeded #include statement in two files.

* Address codereview feedback to specifically say AVX512F instead of just AVX512 as there are multiple subsets.

* Fix CMakeLists.tx files for non-x64 non-Windows targets, introduce separate max mark list sizes for WKS, remove dead code from grow_mark_list, add #ifdef to AVX512 detection to make the other architectures build.

* Instead of modifying the tool-generated header file corinfoinstructionset.h, modify InstructionSetDesc.txt that it is generated from, and run the tools that generates all the files from it.

* Move AVX2/AVX512 instruction set detection to GC side.

* Use vectorized packer, switch packed range from uint32_t to int32_t, because that makes the sorting a bit more efficient.

* Add GCConfig setting to turn vectorized sorting off, streamline ISA detection (but require initialization), rename to IsSupportedInstructionSet.

* Several small improvements:
 - Don't waste time sorting the mark list if background GC is running as we are not going to use it.
 - Use smaller max mark list size if we cannot use AVX2/AVX512 instruction sets
 - Fix mark list overflow detection for server GC.

* Address codereview feedback - add constants for the thresholds above which we use AVX/AVX512F instruction sets.

Add space before parameter lists as per GC codebase coding conventions.

Improve some comments.

* Add license headers and entry in THIRD-PARTY_NOTICES.TXT for Dan's vectorized sorting code.

* Update license headers

* Address code review feedback:
 - fix typo in comment in InitSupportedInstructionSet
 - move test for full GC to beginning of sort_mark_list
 - in WKS GC, we can use the tighter range shigh - slow for the surviving objects instead of the full ephemeral range.
 - make the description for the new config setting GCEnabledInstructionSets more explicit by enumerating the legal values and their meanings.

* Snapshot for Linux changes

* Add more definitions to immintrinh.h

* Fix cmake warnings about mismatched endif clauses.

* Disable Linux support for now due to multiple compile & link errors.

* Address code review feedback:
 - add instructions to bitonic_gen.py
 - centralize range and instruction set checks in do_vxsort
 - add parentheses around expressions.
 - removed some printfs, converted others to dprintf
 - strengthened assert

4 years agoMove wasm queue to one that has more capacity and condition it (#39373)
Santiago Fernandez Madero [Wed, 15 Jul 2020 20:54:15 +0000 (13:54 -0700)]
Move wasm queue to one that has more capacity and condition it (#39373)

4 years agoMake CreateHMAC(ReadOnlySpan<byte> key) public.
Kevin Jones [Wed, 15 Jul 2020 20:50:49 +0000 (16:50 -0400)]
Make CreateHMAC(ReadOnlySpan<byte> key) public.

4 years ago[Test] EventPipe test enhancements (#39212)
John Salem [Wed, 15 Jul 2020 20:27:59 +0000 (13:27 -0700)]
[Test] EventPipe test enhancements (#39212)

4 years agoWASM: Fix System.IO.MemoryMappedFiles tests (#39355)
Alexander Köplinger [Wed, 15 Jul 2020 20:22:04 +0000 (22:22 +0200)]
WASM: Fix System.IO.MemoryMappedFiles tests (#39355)

4 years agoApply CA2016: Forward CancellationToken to methods that can take it (#37607)
Carlos Sanchez Lopez [Wed, 15 Jul 2020 20:10:46 +0000 (13:10 -0700)]
Apply CA2016: Forward CancellationToken to methods that can take it (#37607)

* Forward CancellationToken to methods that can take it

* Address suggestions

* address suggestions

* Revert using

* Make rule 2016 a warning in runtime

* Extra cases found

* Revert changes that should not pass a token, change rule to info to verify build and test CI results

* Pass CancellationToken.None to base.CreateContentReadStreamAsync, as in its default overload

* Address stack overflow in MultipartContent

* HostingAbstractionsHostExtensions address using

* Update nuget package version to latest, Info->Warning again, fix one more case.

* System.Diagnostics.ProcessWaitState.Unix token

* Remove two unnecessary tokens

4 years agoFix `fgOptimizeBranch` when run late. (#39320)
Eugene Rozenfeld [Wed, 15 Jul 2020 19:51:05 +0000 (12:51 -0700)]
Fix `fgOptimizeBranch` when run late. (#39320)

`fgOptimizeBranch` can now run during fgInsertGCPolls() so
it needs additional processing for newly-created statements.

Fixes #39308.

4 years ago[mono] Improve RuntimeConstructorInfo.ToString (#38451)
Alexis Christoforides [Wed, 15 Jul 2020 18:40:46 +0000 (14:40 -0400)]
[mono] Improve RuntimeConstructorInfo.ToString (#38451)

* [mono] Improve RuntimeConstructorInfo.ToString

Use CoreCLR's code. Fixes https://github.com/dotnet/runtime/issues/36688

* Use CoreCLR's code for RuntimeMethodInfo too

4 years agoMake IgnoreNullValues apply only to reference types (#39147)
Layomi Akinrinade [Wed, 15 Jul 2020 18:36:59 +0000 (11:36 -0700)]
Make IgnoreNullValues apply only to reference types (#39147)

4 years agoexception from PerformWriteAsync should be asynchronous (#39325)
Geoff Kizer [Wed, 15 Jul 2020 17:41:27 +0000 (10:41 -0700)]
exception from PerformWriteAsync should be asynchronous (#39325)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
4 years agoFix `ASG struct (copy)` with different src and dst sizes after global morph. (#39137)
Sergey Andreenko [Wed, 15 Jul 2020 17:23:28 +0000 (10:23 -0700)]
Fix `ASG struct (copy)` with different src and dst sizes after global morph. (#39137)

* Fix the issue.

* add an IL repo.

* reenable the optimization.

* Don't do the transformation when optimizations are disabled.

4 years agoJIT: avoid crashing on unexpected types for brtrue/brfalse (#39312)
Andy Ayers [Wed, 15 Jul 2020 17:16:52 +0000 (10:16 -0700)]
JIT: avoid crashing on unexpected types for brtrue/brfalse (#39312)

Abort jitting with BADCODE if there's a type the jit can't handle,
rather than allowing an AV in the jit.

Closes #38956.

4 years agoHandle 'unmanaged' calling convention value (#39030)
Elinor Fung [Wed, 15 Jul 2020 17:13:45 +0000 (10:13 -0700)]
Handle 'unmanaged' calling convention value (#39030)

4 years agoFix up trimming tests for new SDK (#39334)
Eric Erhardt [Wed, 15 Jul 2020 17:08:00 +0000 (12:08 -0500)]
Fix up trimming tests for new SDK (#39334)

Now that we have a new SDK with the latest linker settings, we need to change how we invoke the linker during the trimming tests.

4 years agoAdds Console Log Formatting APIs (#38616)
Maryam Ariyan [Wed, 15 Jul 2020 17:05:09 +0000 (10:05 -0700)]
Adds Console Log Formatting APIs (#38616)

4 years ago[wasm] Modify System.Net.Security to throw PNSE (#39358)
Maxim Lipnin [Wed, 15 Jul 2020 17:00:26 +0000 (20:00 +0300)]
[wasm] Modify System.Net.Security to throw PNSE (#39358)

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
4 years agoDisable eventpipe/gcdump test against #39361 (#39362)
Jan Kotas [Wed, 15 Jul 2020 16:48:54 +0000 (09:48 -0700)]
Disable eventpipe/gcdump test against #39361 (#39362)

4 years ago[interp] Intrinsify span ctor (#39195)
Vlad Brezae [Wed, 15 Jul 2020 16:37:07 +0000 (19:37 +0300)]
[interp] Intrinsify span ctor (#39195)

* [interp] Fix definition of instruction

* [interp] Intrinsify span ctor

It is heavily used in bcl for static read only spans.

In the future we should do copy propagation through its fields so we avoid creating the span in the first place and remove other unecessary opcodes.

* [interp] Allow method inlining if constructor is intrinsified

* Fix case where has_references is not yet initialized

4 years agoGenerate only unique entries in wasm pinvoke table generator (#39356)
Marek Safar [Wed, 15 Jul 2020 16:21:50 +0000 (18:21 +0200)]
Generate only unique entries in wasm pinvoke table generator (#39356)

4 years agoRemove debug only attributes when Debugger.IsSupported is false. (#39237)
Eric Erhardt [Wed, 15 Jul 2020 15:46:04 +0000 (10:46 -0500)]
Remove debug only attributes when Debugger.IsSupported is false. (#39237)

* Remove debug only attributes when Debugger.IsSupported is false.

Contributes to https://github.com/mono/linker/issues/1093

* Move debug only attributes to shared CoreLib.

4 years agoApply arm64 intrinsics to System.Text.Encodings.Web (#38707)
Eirik Tsarpalis [Wed, 15 Jul 2020 14:50:48 +0000 (15:50 +0100)]
Apply arm64 intrinsics to System.Text.Encodings.Web (#38707)

* use arm64 intrinsics in FindFirstCharacterToEncodeUtf8

* remove whitespace

* shim intrinsics apis for netstandard & netcoreapp targets

* use shimmed APIs in DefaultJavascripEncoder.cs

* implement MoveMask over AdvSimd

* Fix build and remove x86 shims

* remove stub goto labels

* implement optimizations for FindFirstCharacterToEncodeUtf8

* optimize FindFirstCharacterToEncode

* fix bug

* implement optimizations for FindFirstCharacterToEncodeUtf8

* remove goto labels

* optimize FindFirstCharacterToEncode

* Optimiize FindFirstCharacterToEncodeUtf8

* bug fix

* add missing shim methods

* fix bug

* minor cleanups

* cleanup and add comments

* address feedback

* address feedback and add checks for endianness

* address feedback

* Use shims from CoreLib

* Remove AdvSimdHelper.MoveMask and factor non-ascii byte locator logic into architecture-specific helper methods

* address feedback

* reinstate goto labels

* revert removed goto labels

* revert more changes

* address feedback

* address feedback

* further optimize GetIndexOfFirstNonAsciiByte

* add TODO comment

4 years agoAdd PlatformNotSupportedException for Browser version of System.Net.Sockets (#39346)
Marek Safar [Wed, 15 Jul 2020 14:49:05 +0000 (16:49 +0200)]
Add PlatformNotSupportedException for Browser version of System.Net.Sockets (#39346)

4 years ago[Crossgen2] Add DelayLoadMethodCallThunks table, fix stack walks containing thunks...
Simon Nattress [Wed, 15 Jul 2020 14:45:24 +0000 (07:45 -0700)]
[Crossgen2] Add DelayLoadMethodCallThunks table, fix stack walks containing thunks (#39063)

* [Crossgen2] Add DelayLoadMethodCallThunks table, fix stack walks containing thunks

GC stress runs with Crossgen2 binaries frequently see AVs with stack-walk failures. This occurs when a delay load thunk is being executed as a stack-walk is performed. The runtime resolves any thunk address to the code info for the last managed method in the runtime functions table.

Use the `DelayLoadMethodCallThunks` header entry to avoid finding an R2R method when the actual IP address is for a stub. The issue is that the binary search algorithm in `NativeUnwindInfoLookupTable::LookupUnwindInfoForMethod` which doesn't correctly return -1 if the code address being searched for is larger than any present. That issue cannot easily be fixed inside of that routine as identifying the end of a function via the `RUNTIME_FUNCTION` structure is slow on some platforms and impossible on others (Windows X86). This old bug was not hit because Crossgen emits stubs earlier in the image than managed code, whereas the two are reversed with Crossgen2.

Fix generation of the RuntimeFunctionsTable so that the terminating sentinel node is not treated as part of the table in the R2R header entry for the table. This was causing the sentinel node to be treated as its own runtime function by the runtime and could lead to reading beyond the table bounds in `NativeUnwindInfoLookupTable::LookupUnwindInfoForMethod`. The bug in the binary search of the table hid this bug until now.

Add the `DelayLoadMethodCallThunks` header entry. `DelayLoadMethodCallThunkNodeRange` is a placeholder node (not an `ObjectNode`) to provide a symbol to relocate against from the header. It represents the range of import thunks. Add support to the object writer for defining a range between two symbols in the same section. The relocation phase can then resolve the difference between the two symbols to determine the range size.

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

Co-authored-by: David Wrighton <davidwr@microsoft.com>
4 years agoAdd static one-shot hashing methods
Kevin Jones [Wed, 15 Jul 2020 14:01:24 +0000 (10:01 -0400)]
Add static one-shot hashing methods

With this change:

* Building up hashes, piecemeal: IncrementalHash
* One-shot hashes, polymorphically: HashAlgorithm.ComputeHash
* One-shot hashes, statically: [Algorithm].HashData

4 years ago[wasm] Remove ActiveIssue for issue #38337. Add a ConditionalFact instead, since...
Zoltan Varga [Wed, 15 Jul 2020 12:25:46 +0000 (08:25 -0400)]
[wasm] Remove ActiveIssue for issue #38337. Add a ConditionalFact instead, since the test still fails. (#39348)

4 years agoAdd .cfi annotation to CONTEXT_CaptureContext and RtlCaptureContext (#39280)
Jan Vorlicek [Wed, 15 Jul 2020 11:54:22 +0000 (13:54 +0200)]
Add .cfi annotation to CONTEXT_CaptureContext and RtlCaptureContext (#39280)

This change ensures correct unwinding of stack when stepping through
these methods under a debugger.

4 years agoThumb2 uses the Arm registers (#39318)
David Wrighton [Wed, 15 Jul 2020 11:44:35 +0000 (04:44 -0700)]
Thumb2 uses the Arm registers (#39318)

4 years agoAdd loader heap enumeration api's (ICorDebugProcess11) (#39124)
Juan Hoyos [Wed, 15 Jul 2020 10:12:51 +0000 (03:12 -0700)]
Add loader heap enumeration api's (ICorDebugProcess11) (#39124)

* IDL Change

* Store generated code for ICorDebugProcess11

* Implement ICorDebugProcess11

* PR Feedback

* Fix clang builds

4 years ago[master] Update dependencies from mono/linker dotnet/icu (#39286)
dotnet-maestro[bot] [Wed, 15 Jul 2020 09:39:26 +0000 (09:39 +0000)]
[master] Update dependencies from mono/linker dotnet/icu (#39286)

* Update dependencies from https://github.com/mono/linker build 20200713.5

Microsoft.NET.ILLink.Tasks
 From Version 5.0.0-preview.3.20361.1 -> To Version 5.0.0-preview.3.20363.5

* Update dependencies from https://github.com/dotnet/icu build 20200714.1

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 5.0.0-preview.8.20359.7 -> To Version 5.0.0-preview.8.20364.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years agoWASM: Enable System.Memory tests (#39319)
Alexander Köplinger [Wed, 15 Jul 2020 09:20:59 +0000 (11:20 +0200)]
WASM: Enable System.Memory tests (#39319)

One test failed with an issue: https://github.com/dotnet/runtime/issues/39311

Also noticed that StringTests.cs is included from the CommonPath, this is a historical artifact from when System.Memory built for netfx/netstandard so we could run tests on those configs.
We no longer need it since StringTests.cs is already ran in System.Runtime.Tests.

4 years agoFix location of gcdump test (#39057)
Juan Hoyos [Wed, 15 Jul 2020 08:56:45 +0000 (01:56 -0700)]
Fix location of gcdump test (#39057)

4 years agoDisallow unrestricted polymorphic deserialization in DataSet (#39304)
Levi Broderick [Wed, 15 Jul 2020 06:50:33 +0000 (23:50 -0700)]
Disallow unrestricted polymorphic deserialization in DataSet (#39304)

Fixes CVE-2020-1147
https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2020-1147
See also https://go.microsoft.com/fwlink/?linkid=2132227.

4 years agoObsolete BinaryFormatter.Serialize and BinaryFormatter.Deserialize (#39324)
Levi Broderick [Wed, 15 Jul 2020 06:32:07 +0000 (23:32 -0700)]
Obsolete BinaryFormatter.Serialize and BinaryFormatter.Deserialize (#39324)

4 years ago[wasm] Fix the propagation of exceptions through runtime invokes. (#39316)
monojenkins [Wed, 15 Jul 2020 06:22:10 +0000 (02:22 -0400)]
[wasm] Fix the propagation of exceptions through runtime invokes. (#39316)

The previous code would convert exceptions into errors which would
be rethrown later, clearing the resume state.

Hopefully fixes https://github.com/dotnet/runtime/issues/38337.

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years agoPAL_VirtualUnwindOutOfProc for MacOS (#39213)
Mike McLaughlin [Wed, 15 Jul 2020 06:08:26 +0000 (23:08 -0700)]
PAL_VirtualUnwindOutOfProc for MacOS (#39213)

PAL_VirtualUnwindOutOfProc for MacOS

Add MacOS compact unwind section parsing (__unwind_info) and stepping: SearchCompactEncodingSection, SearchDwarfSection, GetProcInfo, StepWithCompactEncoding*.

Add back some (from a previous commit) of the dwarf unwind info parsing functions to use for the dwarf unwind info (__eh_frame section): ReadValue*, ReadULEB128, ReadSLEB128, ReadEncodedPointer, ParseCie, ExtractFde, ExtractProcInfoFromFde. These functions were used and fairly well tested in 3.x.

Build libunwind8 source on MacOS for those dwarf unwind info cases.

The methoddesc's enum memory region code needed add more of the code version manager's data to the coredump.

4 years agoDisable System.Net.HttpListener.Tests for TailcallStress (#39315)
Bruce Forstall [Wed, 15 Jul 2020 05:38:42 +0000 (22:38 -0700)]
Disable System.Net.HttpListener.Tests for TailcallStress (#39315)

Issue: https://github.com/dotnet/runtime/issues/39309

4 years agoImprove Activity API usability and OpenTelemetry integration (Part 2) (#39087)
Tarek Mahmoud Sayed [Wed, 15 Jul 2020 05:06:57 +0000 (22:06 -0700)]
Improve Activity API usability and OpenTelemetry integration (Part 2) (#39087)

4 years agoAdd NetFramework Configurations to OOB packages (#39099)
Jose Perez Rodriguez [Wed, 15 Jul 2020 04:59:55 +0000 (21:59 -0700)]
Add NetFramework Configurations to OOB packages (#39099)

* Porting new netfx configurations for packages

* Add Netfx configurations to Microsoft.Extensions and missing System packages

* Making sure net461 configurations build against targeting pack assembly versions

* Undo changes to add netfx configurations on reference projects that don't ship in their package

* Fix issue with M.E.FP.P package by removing NetStandard.Library metapackage dependency

* Fix issues with depending on higher version than the one available in net461

* Disable UTF8String verifyClosure on package

* Undo changes to Microsoft.XmlSerializer.Generator

* Update src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
4 years agoUpdate Mono's implementation of Vector<T> intrinsics. (#39322)
imhameed [Wed, 15 Jul 2020 04:40:09 +0000 (21:40 -0700)]
Update Mono's implementation of Vector<T> intrinsics. (#39322)

Recognize `get_AllBitsSet` instead of `get_AllOnes`; this internal
intrinsic was renamed in https://github.com/dotnet/runtime/pull/36579
(1c66ad1b71bb84a16b71bb5efcef1fa999c1c8bc).

Implement `Vector<T>.One` as an intrinsic.

4 years agoStruct, arg and float reg cleanup (#39284)
Carol Eidt [Wed, 15 Jul 2020 04:28:02 +0000 (21:28 -0700)]
Struct, arg and float reg cleanup (#39284)

- Unify the handling of promoted args when assigning offsets; there's no need to handle independent vs. dependent promotion separately.
- Use `varTypeUsesFloatReg` where appropriate.
- Some minor refactoring of initial reg assignment.
- Add a 'Clear' method to `StructPromotionHelper` for use after inlining (not yet in use, as it produces diffs).
- Wrap a SIMD field node in `GT_OBJ` only if needed.
These changes are preparatory to improved struct promotion for args.

4 years agoAdd TryReadTo(out ReadOnlySpan<T> span, ReadOnlySpan<T> delimiter (#39048)
Ben Adams [Wed, 15 Jul 2020 04:25:06 +0000 (05:25 +0100)]
Add TryReadTo(out ReadOnlySpan<T> span, ReadOnlySpan<T> delimiter (#39048)

* Add TryReadTo(out ReadOnlySpan<T> span, ReadOnlySpan<T> delimiter

* Tweaks

4 years ago[crossgen2] Use Alignment to calculate class Offset (#38962)
t-mustafin [Wed, 15 Jul 2020 03:56:31 +0000 (06:56 +0300)]
[crossgen2] Use Alignment to calculate class Offset (#38962)

ComputeAutoFieldLayout() function ignores calculated fieldSizeAndAlignment.Alignment and uses context.Target.LayoutPointerSize instead. It produces a problems if fieldSizeAndAlignment.Alignment > context.Target.LayoutPointerSize on arm for example.
I suggest to use maximum of that values to calculate offset.
Fixes Issue #38822

Signed-off-by: Timur <t.mustafin@partner.samsung.com>
4 years agoDisable libraries tailcallstress testing on Linux arm32 (#39317)
Bruce Forstall [Wed, 15 Jul 2020 01:34:52 +0000 (18:34 -0700)]
Disable libraries tailcallstress testing on Linux arm32 (#39317)

Issue: https://github.com/dotnet/runtime/issues/38892

4 years agoFix TestOnStartWithArgsThenStop and make service tests more reliable (#39153)
Dan Moseley [Wed, 15 Jul 2020 00:33:14 +0000 (17:33 -0700)]
Fix TestOnStartWithArgsThenStop and make service tests more reliable (#39153)

* Comment dispose

* Fix service tests

* typo

4 years ago2 small cleanup: 2 printf formatiing typos and 1 function header. (#39321)
Sergey Andreenko [Tue, 14 Jul 2020 23:52:20 +0000 (16:52 -0700)]
2 small cleanup: 2 printf formatiing typos and 1 function header. (#39321)

* Fix 2 cases of wrong prinf formatting.

old typos.

* Change `fgIsIndirOfAddrOfLocal` return type to the precise.

4 years agoAssembly.Location should return empty string for assemblies loaded from single-file...
Vitek Karas [Tue, 14 Jul 2020 23:45:15 +0000 (16:45 -0700)]
Assembly.Location should return empty string for assemblies loaded from single-file bundle (#39275)

Changes made to PEFile to report empty string for path when it comes directly from the bundle.

I experimented with changing the PEImage m_path to empty string, but way too many things break. It is valid for the m_path to be empty, but we only use it to memory-loaded assemblies where the assembly loaded via PEImage::LoadFlat which does things very differently. The bundle still relies on opening the assembly as a file (file handle and offset).

The end result is that internally the assembly's PEImage has a non-existent m_path (it points to the base directory and the file name of the assembly, but no such file will normally exist). I don't think anything will actually use the path to access the file though.

Also changed how we load CoreLib from bundle. We used to give it path "System.Private.CoreLib.dll" which causes asserts in the runtime in couple of places (the one I hit was when trying to load assembly from memory - it gets CoreLib as its creator and we call GetPath on the creator and then validate the path in debug builds). As far as I can tell this change should not make any observable effect, other than fixing the fact that we expect the m_path of a PEImage to be either empty or absolute path.

4 years ago[wasm] Address System.Runtime.Loader failures (#39306)
Mitchell Hwang [Tue, 14 Jul 2020 21:27:24 +0000 (17:27 -0400)]
[wasm] Address System.Runtime.Loader failures (#39306)

* [wasm] Condition Finalizer_CollectibleWithNoAssemblyLoaded with precise gc supported

* [wasm] Modify SatelliteAssemblies member data and condition on NonInvariantGlobalization

* [libraries] Remove System.Runtime.Loader project from exclusions

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
4 years agoWASM: run tests on CI only in rolling and/or when libraries/tests.proj is changed...
Santiago Fernandez Madero [Tue, 14 Jul 2020 21:25:03 +0000 (14:25 -0700)]
WASM: run tests on CI only in rolling and/or when libraries/tests.proj is changed (#39239)

* WASM: run tests on CI only in rolling and/or when libraries/tests.proj is changed

* Fix build

* Test change in tests.proj

* Fix build

* Flow variables from platform-matrix to jobTemplate

* Fix installer base template variables propagation

* Pass variables as array

4 years agoJIT: Don't emit some unnecessary tests (#38586)
nathan-moore [Tue, 14 Jul 2020 20:49:54 +0000 (16:49 -0400)]
JIT: Don't emit some unnecessary tests (#38586)

* Remove some unnecessary tests

* Handle more cases

* Fix some bugs

* Fix some comments

* fix up docs some

* add fallthrough

* Formatting

4 years agoDelete APM fallback from Socket task operations (#39248)
Stephen Toub [Tue, 14 Jul 2020 20:44:28 +0000 (16:44 -0400)]
Delete APM fallback from Socket task operations (#39248)

* Fix static field names

* Remove CachedEventArgs wrapper

This was put in place initially when the Task-based APIs were new, and we wanted to make them pay-for-play such that other uses of Socket wouldn't incur the extra fields.  But at this point, the Task-based APIs are the primary/recommended way to use Socket, and when they are used, the wrapper adds overhead (both in size and CPU).  Deleting it.

* Delete APM fallback from AcceptAsync

* Delete APM fallbacks for Receive/SendAsync with tasks

4 years agoWASM: Fix System.IO.FileSystem.DriveInfo and Microsoft.VisualBasic.Core tests (#39276)
Alexander Köplinger [Tue, 14 Jul 2020 20:40:02 +0000 (22:40 +0200)]
WASM: Fix System.IO.FileSystem.DriveInfo and Microsoft.VisualBasic.Core tests (#39276)

* WASM: Fix System.IO.FileSystem.DriveInfo

* WASM: Fix Microsoft.VisualBasic.Core tests

Some tests need culture data.

* Fix test that was accidentally reversed for non-Browser

4 years agoPreserve DebuggerTypeProxyAttribute classes (#39126)
Eric Erhardt [Tue, 14 Jul 2020 20:37:48 +0000 (15:37 -0500)]
Preserve DebuggerTypeProxyAttribute classes (#39126)

* Preserve DebuggerTypeProxyAttribute classes

Also, ensure the test app assembly is linked, and not copied during trimming tests, which was a bug in our test infrastructure.

Fix #37307

* Add test for DebuggerTypeProxy string overload.

* Update ref to match impl.

4 years ago[Arm64] ASIMD StorePair StorePairNonTemporal (#39240)
Egor Chesakov [Tue, 14 Jul 2020 20:22:55 +0000 (13:22 -0700)]
[Arm64] ASIMD StorePair StorePairNonTemporal (#39240)

* StorePair

* StorePairNonTemporal

* StorePairScalar

* StorePairScalarNonTemporal