platform/upstream/dotnet/runtime.git
3 years agoUse a separate thread for tiered compilation background work (#45901)
Koundinya Veluri [Tue, 26 Jan 2021 15:51:37 +0000 (07:51 -0800)]
Use a separate thread for tiered compilation background work (#45901)

Use a separate thread for tiered compilation background work

- Makes it easier to manage how much time is spend for performing background work like rejitting and allows yielding more frequently with just Sleep without incurring thread pool overhead, which is useful in CPU-limited cases
- A min/max range is determined for how long background work will be done before yielding the thread. The max is the same as before, 50 ms. For now the min is `processor count` ms (capped to the max), such that in CPU-limited cases the thread would yield more frequently in order to not monopolize too much of the limited CPU resources for background work, and in cases with a larger number of processors where the background work is typically less intrusive to foreground work it would yield less frequently.
- At the same time, progress should be made on background work such that steady-state perf would be reached in reasonable time. Yielding too frequently can slow down the background work too much. The sleep duration is measured to identify oversubscribed situations to yield less frequently and make faster progress on the background work.
- Due to less time spent rejitting in some CPU-limited cases, steady-state performance may be reached a bit later in favor of fewer spikes along the way
- When the portable thread pool is enabled, a side effect of using a managed worker thread for tiering background work was that several GC-heavy microbenchmarks regressed. Tiering was the only thing using the thread pool in those tests and stack-walking the managed thread was slower due to the presence of GC refs. It's not too concerning, the benchmarks are just measuring something different from before, but in any case this change also resolves that issue. Fixes https://github.com/dotnet/runtime/issues/44211.

3 years ago[master] Update dependencies from mono/linker (#47411)
dotnet-maestro[bot] [Tue, 26 Jan 2021 15:14:31 +0000 (16:14 +0100)]
[master] Update dependencies from mono/linker (#47411)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoSystem.Random performance tuning. (#47390)
Colin Green [Tue, 26 Jan 2021 14:50:55 +0000 (14:50 +0000)]
System.Random performance tuning. (#47390)

* Performance tuning Xoshiro pseudo random number generators. Move PRNG state from the heap onto the stack before performong PRNG generation and mxing operations.

* Declare PRNG state method variables on single line (code review feedback nit).

3 years ago[wasm] Handle Top-Level style entry point mangling too (#47405)
Larry Ewing [Tue, 26 Jan 2021 14:22:44 +0000 (08:22 -0600)]
[wasm] Handle Top-Level style entry point mangling too (#47405)

* [wasm] Handle Top-Level style entry point mangling too

This adds a check for '<Main>$' in addition to 'Main' when
looking for the async entry point.

Fixes #47404

3 years agoSearch libgdiplus in macports install location (#47373)
Adeel Mujahid [Tue, 26 Jan 2021 13:18:12 +0000 (15:18 +0200)]
Search libgdiplus in macports install location (#47373)

When `libgdiplus` is installed via macports, `System.TypeInitializationException` exception is thrown.
This is because macports installs the library in `/opt/local/lib`.

```sh
$ port install libgdiplus
$ port contents libgdiplus
Port libgdiplus contains:
  /opt/local/lib/libgdiplus.0.dylib
  /opt/local/lib/libgdiplus.a
  /opt/local/lib/libgdiplus.dylib
  /opt/local/lib/pkgconfig/libgdiplus.pc
  /opt/local/share/doc/libgdiplus/AUTHORS
  /opt/local/share/doc/libgdiplus/COPYING
  /opt/local/share/doc/libgdiplus/ChangeLog
  /opt/local/share/doc/libgdiplus/LICENSE
  /opt/local/share/doc/libgdiplus/NEWS
  /opt/local/share/doc/libgdiplus/README.md
  /opt/local/share/doc/libgdiplus/TODO
```

PR adds `/opt/local/lib/libgdiplus.dylib` as a well-known probing path.

3 years ago[wasm] Emit some wrappers with linkonce linkage. (#47384)
monojenkins [Tue, 26 Jan 2021 09:41:40 +0000 (04:41 -0500)]
[wasm] Emit some wrappers with linkonce linkage. (#47384)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
3 years agoadded the exports (#47451)
Vladimir Sadov [Tue, 26 Jan 2021 06:06:11 +0000 (22:06 -0800)]
added the exports (#47451)

3 years agoFix for 46529 - Unexpected behaviour of ulong -> int cast (#47418)
Brian Sullivan [Tue, 26 Jan 2021 05:15:03 +0000 (21:15 -0800)]
Fix for 46529  - Unexpected behaviour of ulong -> int cast (#47418)

* Fix for issue 46529
Move check for side-effect and don't push the cast for shifts of 32 to 63
Added test Runtime_46239.cs

* clang format

3 years agoFix #46123 - make the subProtocol nullable for HttpListenerContext::AcceptWebSocketAs...
Euan [Tue, 26 Jan 2021 03:30:39 +0000 (03:30 +0000)]
Fix #46123 - make the subProtocol nullable for HttpListenerContext::AcceptWebSocketAsync  (#47402)

* Fix #46123 - make `subProtocol` nullable when dealing with WebSockets in HttpListener.

* Update ref for System.Net.HttpListener

3 years agoJIT: split up some parts of flowgraph.cpp (#47072)
Andy Ayers [Tue, 26 Jan 2021 02:37:11 +0000 (18:37 -0800)]
JIT: split up some parts of flowgraph.cpp (#47072)

Create a number of smaller files with cohesive sets of methods.

3 years agoDebugging Crossgen2 documentation (#47363)
David Wrighton [Tue, 26 Jan 2021 02:21:48 +0000 (18:21 -0800)]
Debugging Crossgen2 documentation (#47363)

* Debugging Crossgen2 documentation and such
- Also new --print-repro-instructions command line switch to crossgen2 as requested by the JIT team

3 years agoHTTP Compression - Improve/fix support for user-specified Accept-Encoding encodings...
Eaton [Tue, 26 Jan 2021 00:33:46 +0000 (19:33 -0500)]
HTTP Compression - Improve/fix support for user-specified Accept-Encoding encodings (#47000)

Improve support for user-specified Accept-Encoding encodings

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoGet rid of StreamWriter usage in HTTP loopback server and fix HTTP/1.1 loopback imple...
Geoff Kizer [Tue, 26 Jan 2021 00:30:29 +0000 (16:30 -0800)]
Get rid of StreamWriter usage in HTTP loopback server and fix HTTP/1.1 loopback implementation of SendResponseBodyAsync (#47364)

Get rid of StreamWriter usage in HTTP loopback server and fix HTTP/1.1 loopback implementation of SendResponseBodyAsync

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoResolve ILLink warnings in System.Security.Cryptography.X509Certificates (#47345)
Eric Erhardt [Tue, 26 Jan 2021 00:04:12 +0000 (18:04 -0600)]
Resolve ILLink warnings in System.Security.Cryptography.X509Certificates (#47345)

* Resolve ILLink warnings in System.Security.Cryptography.X509Certificates

Contributes to #45623

* Use ConstructorInfo to create HttpRequestMessage instances.

3 years agoupdate branding to preview22 (#47429)
Anirudh Agnihotry [Mon, 25 Jan 2021 22:54:24 +0000 (14:54 -0800)]
update branding to preview22 (#47429)

3 years ago[wasm] WasmApp.targets: Separate `obj`, and `bin` parts of the build process (#47253)
Ankit Jain [Mon, 25 Jan 2021 22:53:51 +0000 (17:53 -0500)]
[wasm] WasmApp.targets: Separate `obj`, and `bin` parts of the build process (#47253)

We want to use a separate directory for intermediate build outputs, that aren't needed
in the app bundle, and reduce unclear internal dependencies during a build.

# TL;DR

## Changes:
1. `$(WasmBuildDir)` removed
2. Reasonable defaults set for most properties
3. To generate a wasm app for a project, the minimum you need to set:
    a. `$(WasmMainJS)`,
    b. and `@(WasmAssembliesToBundle)`

# Details:

Though it is a bit tricky, because the current targets assume:

- that they are being run after `Publish`
- that the publish directory has:
  - some required files copied over from the runtime pack (eg. `libmono*`),
  - and includes the assemblies
- that the targets emit all the intermediate output files like `driver.o`, or the bitcode files, into the same
   directory

- And there are assumptions about where to pick which files from (eg. whether to take `dotnet.wasm`
  from the runtime pack, or from the publish dir), based on unclear rules.

## What does this PR change?

- All the assets meant to be from the runtime pack (like `libmono*`, `icudt.dat`) are always taken
  only from the runtime pack
  - and this logic is moved out of the tasks, to the targets
- `$(WasmBuildDir)` is removed completely. Instead, we use an intermediate path based on `$(IntermediateOutputPath)`
  - and emit all the intermediate bits there, like the bitcode files
- Add reasonable defaults for various properties, like `$(WasmAppDir)`

Effectively:

1. To generate a wasm app for a project, the minimum you need to set:
    a. `$(WasmMainJS)`,
    b. and `@(WasmAssembliesToBundle)`

2. The targets don't depend on publish dir at all
    (in a future PR, we could remove triggering based on `Publish` target also)
* [wasm] WasmAppBuilder - move the list of native assets, and logic out

.. to the targets.

- New property: `NativeAssets`, populated by `@(WasmNativeAsset)`
- Remove property `MicrosoftNetCoreAppRuntimePackRidDir`
- Also, add the `icudt.dat` file from the targets

* [wasm] Simplify handling of dotnet.{js,wasm}

WasmAppBuilder has (non-obvious) logic to:

1. if AOT'ing, then use the *generated* dotnet.{js,wasm};
2. else use the one from the runtime pack

This depends on Publish having copied those files from the runtime pack
to the publish directory, and then comparing paths in the builder to
decide which one to use.

Instead, make this the intention obvious, and clear.

----
Commits:
* [wasm] Always get the native libs from the runtime pack (eg.libmono*)

We were getting these from the publish directory, instead we can get
them directly from the runtime pack.

This includes icudt.dt, and dotnet.timezones.blat .

* [wasm] MonoAOTCompiler: add `OutputDir` property

.. where we can emit the generated native files. Since these files are
meant only for generating the final `dotnet.wasm`, we don't want them to
put them in the bin directory.

* [wasm] Use existing list of assemblies - @(_WasmAssemblies)

.. instead of trying to find them in the build dir. This build directory
will become a directory for intermediate build output in upcoming
commits.

* [wasm] Replace $(WasmMainAssemblyPath) with $(WasmMainAssemblyFileName)

- Instead of having a special $(WasmMainAssemblyPath), and then adding
  it to the wasm assemblies ourselves
  - let the user project add all the relevant assemblies to
    `@(WasmAssembliesToBundle)`, which is usually as simple as
    `$(OutDir)\*.dll`.

- This helps to simplify lot of things.
- And we just need the main assembly filename for generating the
  run-v8.sh script.

* [wasm] Rename WasmBuildDir -> _WasmIntermediateOutputPath

Based on the changes in previous commits, we can now remove
`$(WasmBuildDir)`, and replace that with an internal
`$(_WasmIntermediateOutputPath)`. This path will have all the build
artifacts generated that aren't required in the app bundle.

Earlier, we were using the publish directory for that, which resulted in
it being littered with unncessary files, and files getting copied to the
app bundle from unclear sources, and for non-obvious reasons.

* [wasm] add default value for $(WasmAppDir)

* [wasm] WasmApp.targets - misc cleanup

* [wasm] WasmAppBuilder: validate Assemblies property

* [wasm] WasmTestRunner - rename TestAssembly->TestAssemblyFileName, to correctly reflect the value

* [wasm] Fix make clean, for samples

* [wasm] WasmApp.targets: Add new $(MonoAotCrossCompilerPath)

* [wasm] update comments/docs

* Address review feedback from @mdh1418

3 years agoAdded C# implementation of System.Math.ScaleB and System.MathF.ScaleB… (#42476)
Alex Covington [Mon, 25 Jan 2021 22:11:45 +0000 (14:11 -0800)]
Added C# implementation of System.Math.ScaleB and System.MathF.ScaleB… (#42476)

* Added C# implementation of System.Math.ScaleB and System.MathF.ScaleB, removed old bindings, added test cases.

* Moved tests into System.Runtime.Extensions tests.

* Removed unmanaged scalbn and scalbnf from pal and mono

* Update src/libraries/System.Private.CoreLib/src/System/Math.cs

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
* Styling changes.

* Conditionally include ScaleB for Mono.

* Update src/mono/mono/metadata/sysmath.c

Tabs, not spaces.

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
* Removing more scalb from PAL

* Completely removed ScaleB from Mono

* Cleaning up more scalbn

* Added comments for ScaleB, updated licenses for musl and Sun

* Fixed whitespace.

* Removing old references, fixing double ScaleB definition that merge didn't resolve

Co-authored-by: Adeel Mujahid <adeelbm@outlook.com>
3 years agoComWrappers cleanup (#47312)
Aaron Robinson [Mon, 25 Jan 2021 21:23:35 +0000 (13:23 -0800)]
ComWrappers cleanup (#47312)

* Clean up interop shared data types with the DAC.

* Feedback from preview CR.

* Create specific CRST for the managed object wrapper map.

3 years agoUse correct CoreLib configuration for shared framework linker trimming (#45821)
Layomi Akinrinade [Mon, 25 Jan 2021 21:09:26 +0000 (13:09 -0800)]
Use correct CoreLib configuration for shared framework linker trimming (#45821)

* Use correct CoreLib configuration for shared framework linker trimming

* Add IL subdir to CoreLib path unconditionally

* Go back to using GetTargetPath, but flow rc to it

* Update CoreLibProject properties only when necessary

* Add link to CoreLib bin-placing issue and update RuntimeConfiguration in comment

3 years agoReturn accurate size of addressing mode dsp/dsp+cnst instr descriptor (#47284)
Kunal Pathak [Mon, 25 Jan 2021 20:25:03 +0000 (12:25 -0800)]
Return accurate size of addressing mode dsp/dsp+cnst instr descriptor (#47284)

* return accurate size for amd dsp and amd dsp+cnst

* fix the condition

3 years agoUpdate Environment.ProcessorCount on Windows to take into account the processor affin...
Koundinya Veluri [Mon, 25 Jan 2021 20:21:48 +0000 (12:21 -0800)]
Update Environment.ProcessorCount on Windows to take into account the processor affinity mask (#45943)

- Similarly to cases on Unixes where sched_getaffinity is available
- If `GCCpuGroup` and `Thread_UseAllCpuGroups` are both enabled, I'm not sure if the `CPUGroupInfo` count of active processors takes affinity into account as the docs are not clear, for now I'm not modifying that path until I can verify it
- Otherwise, a process that is started with a specific processor affinity mask still shows full CPU count
- This is one of the differences in the portable managed thread pool implementation, which relies on Environment.ProcessorCount, as opposed to the native thread pool, which uses the affinity mask
- After this change, in affinitized cases on Windows the behavior is consistent perf-wise with Linux in similar situations:
  - The portable thread pool uses the same worker thread count as the native thread pool
  - `Environment.ProcessorCount` returns the number of processors the the process is affinitized to, which may be less than it would have returned before

3 years agobandaid for #44072 (#47285)
John Salem [Mon, 25 Jan 2021 18:44:40 +0000 (10:44 -0800)]
bandaid for #44072 (#47285)

* real fix needs to happen in TraceEvent

3 years agoEnable COMPlus_JitDisasmWithGC with SuperPMI asm diffs (#46966)
Bruce Forstall [Mon, 25 Jan 2021 18:17:37 +0000 (08:17 -1000)]
Enable COMPlus_JitDisasmWithGC with SuperPMI asm diffs (#46966)

All SPMI asm diffs (generated using superpmi.py) will
display interleaved GC info.

Note that you can also pass the `--gcinfo` option
to get traditional end-of-code asm dump, but that also
requires adding per-instruction offset output, which can lead
to excessive textual diffs.

3 years agoFix cancellation race condition in Parallel.ForEachAsync (#47396)
Stephen Toub [Mon, 25 Jan 2021 17:00:57 +0000 (12:00 -0500)]
Fix cancellation race condition in Parallel.ForEachAsync (#47396)

If cancellation is requested at just the "wrong" time, we may end up canceling the operation but reporting it as a successful completion, due to our relying on _registration.Token being the caller-provided token, but that not being the case if cancellation was requested prior to UnsafeRegister being called, in which case it'll return a default registration.

3 years agoupdate ownership (#47414)
Jeff Schwartz [Mon, 25 Jan 2021 16:56:15 +0000 (08:56 -0800)]
update ownership (#47414)

3 years agoAdd support for Arm intrinsics Sha256 (#47337)
Fan Yang [Mon, 25 Jan 2021 16:34:17 +0000 (11:34 -0500)]
Add support for Arm intrinsics Sha256 (#47337)

* Initial change for sha256

* Handles intrinsics with 3 parameters

* Fix condition

* Revert test change to HelloWorld sample

* Update src/mono/mono/mini/mini-llvm.c

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
* Fixed format

Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
3 years agoRemove -Wc++-compat option when building Mono as C++ (#47370)
monojenkins [Mon, 25 Jan 2021 14:29:57 +0000 (09:29 -0500)]
Remove -Wc++-compat option when building Mono as C++ (#47370)

It causes a build warning on some newer compilers:

```
cc1plus: warning: command line option '-Wc++-compat' is valid for C/ObjC but not for C++
```

Co-authored-by: akoeplinger <akoeplinger@users.noreply.github.com>
3 years agoAdded Span overloads for Socket.SendFile (#47230)
Günther Foidl [Mon, 25 Jan 2021 09:52:51 +0000 (10:52 +0100)]
Added Span overloads for Socket.SendFile (#47230)

* Added Span overloads for Socket.SendFile

* Updated ref

* Fixed doc comments

* Tests

* Remove test for non-blocking

Cf. https://github.com/dotnet/runtime/pull/47230#discussion_r561983960

3 years agoVectorize HexConverter.EncodeToUtf16 using SSSE3 (#44111)
Egor Bogatov [Sun, 24 Jan 2021 19:30:51 +0000 (22:30 +0300)]
Vectorize HexConverter.EncodeToUtf16 using SSSE3 (#44111)

Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
3 years agofix merp arm64 (#47331)
monojenkins [Sun, 24 Jan 2021 10:05:48 +0000 (05:05 -0500)]
fix merp arm64 (#47331)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
3 years agoMove Interlocked.CompareExchange/Exchange to shared (#47368)
Egor Bogatov [Sat, 23 Jan 2021 21:04:55 +0000 (00:04 +0300)]
Move Interlocked.CompareExchange/Exchange to shared (#47368)

* Optimize Interlocked.Exchange and Interlocked.CompareExchange for IntPtr

* Address feedback

3 years agoFixed compilation for libicu 68. (#47352)
Marie Píchová [Sat, 23 Jan 2021 21:02:51 +0000 (22:02 +0100)]
Fixed compilation for libicu 68. (#47352)

* Fixed compilation for libicu 68.

* Fixed missing include.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoFix offset + globalization issues in StringSegment (#45022)
Levi Broderick [Sat, 23 Jan 2021 19:40:51 +0000 (11:40 -0800)]
Fix offset + globalization issues in StringSegment (#45022)

3 years ago[master] Update dependencies from mono/linker (#47357)
dotnet-maestro[bot] [Sat, 23 Jan 2021 19:02:34 +0000 (19:02 +0000)]
[master] Update dependencies from mono/linker (#47357)

[master] Update dependencies from mono/linker

3 years agoUpdate area-System.DirectoryServices lead (#47369)
Marek Safar [Sat, 23 Jan 2021 17:17:50 +0000 (18:17 +0100)]
Update area-System.DirectoryServices lead (#47369)

3 years agoFix race conditions with resolving singletons in DI (#47310)
Maryam Ariyan [Sat, 23 Jan 2021 03:28:53 +0000 (22:28 -0500)]
Fix race conditions with resolving singletons in DI (#47310)

3 years agoFold casts of constants in the importer (#47133)
SingleAccretion [Sat, 23 Jan 2021 02:00:21 +0000 (05:00 +0300)]
Fold casts of constants in the importer (#47133)

* Fold casts of constants in the importer

* Do not use a separate local for the cast operand

* Do not try to access the operation that has been folded

* Condition the call to CheckDivideByConstOptimized on success of the folding

3 years agoRemove dead code around x86 delegate interop. (#47355)
Jeremy Koritzinsky [Sat, 23 Jan 2021 01:33:11 +0000 (17:33 -0800)]
Remove dead code around x86 delegate interop. (#47355)

* Remove dead code around x86 delegate interop.

* Simplify GetUMEntryThunk.

3 years agoClean up `aspnetcore` casing in ref to that repo (#47347)
Doug Bunting [Fri, 22 Jan 2021 22:43:06 +0000 (14:43 -0800)]
Clean up `aspnetcore` casing in ref to that repo (#47347)

- address difference I introduced in dotnet/aspnetcore#29511 and more
    - conflict detected in dotnet/aspnetcore#29520
- also s|aspnet/aspnetcore|dotnet/aspnetcore|

3 years agoRemove excess allocations in Uri.ReCreateParts (#34864)
Miha Zupan [Fri, 22 Jan 2021 22:35:33 +0000 (23:35 +0100)]
Remove excess allocations in Uri.ReCreateParts (#34864)

* Remove excess allocations in Uri.ReCreateParts

* Fix Compression offset

* Revert VSB optimizations

* Use noEscape.Length

* Simplify TryGetUnicodeEquivalent

* Remove ValueStringBuilderExtensions

* Index into chars instead of dest

* Remove unreachable code block

* Use StackallocThreshold constant

* Add comments about why MemoryMarshal is used to recreate the span

3 years agoDelete custom FastRandom from ThreadPool (#47338)
Stephen Toub [Fri, 22 Jan 2021 21:45:42 +0000 (16:45 -0500)]
Delete custom FastRandom from ThreadPool (#47338)

* Delete custom FastRandom from ThreadPool

- Consolidates 128/256-bit variants of Xoshiro** into the same class name
- Uses that from ThreadPool instead of its custom xorshift-based algorithm

Throughput stays the same (~2.5ns per next random value) and incurs just one additional object allocation per thread pool thread.

* Consolidate TARGET_64/32BIT DefineConstants

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210122.1 (#47332)
dotnet-maestro[bot] [Fri, 22 Jan 2021 21:00:15 +0000 (21:00 +0000)]
Update dependencies from https://github.com/mono/linker build 20210122.1 (#47332)

[master] Update dependencies from mono/linker

3 years agoRefactor some HTTP remote server tests (#47252)
Geoff Kizer [Fri, 22 Jan 2021 20:43:37 +0000 (12:43 -0800)]
Refactor some HTTP remote server tests (#47252)

move existing remote server tests in HttpClientHandlerTest.cs into a new file, HttpClientHandlerTest.RemoteServer.cs

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoWindows build.cmd doesn't support -cmakeargs. (#46195)
Johan Lorensson [Fri, 22 Jan 2021 19:26:58 +0000 (20:26 +0100)]
Windows build.cmd doesn't support -cmakeargs. (#46195)

build.sh supports -cmakeargs making it is possible to pass custom
cmake arguments down to native cmake steps, but this feature is missing
on Windows when using build.cmd. Trying to do:

.\build.cmd -subset clr -c release -cmakeargs "-DFEATURE_PERFTRACING_C_LIB=1"

on Windows will result in an error since -cmakeargs is not a known command
in build.ps1.

Commit adds support for -cmakeargs in build.cmd making sure it gets
passed down to runtime build on both CoreClr as well as Mono.

3 years agoFix crash in SuperPMI PGO apis (#47305)
Bruce Forstall [Fri, 22 Jan 2021 18:56:18 +0000 (08:56 -1000)]
Fix crash in SuperPMI PGO apis (#47305)

The real fix is a trivial fix in the linked list handling
of AllocJitTempBuffer.

The rest of the changes are making the code conform more to SuperPMI
conventions, adding comments, and improving SPMI dumping.

3 years agoNameResolutionPal.Unix: fixed loss of address family information in async lookup...
Günther Foidl [Fri, 22 Jan 2021 18:08:02 +0000 (19:08 +0100)]
NameResolutionPal.Unix: fixed loss of address family information in async lookup (#47171)

* Removed dead code from SystemNative_GetHostEntryForNameAsync

* Fixed loss of address-family

3 years agoCapture AVX context when redirecting threads for suspension (#47212)
Vladimir Sadov [Fri, 22 Jan 2021 17:53:12 +0000 (09:53 -0800)]
Capture AVX context when redirecting threads for suspension (#47212)

* Save avx regs during SuspendThread

* few more changes and comments

* fix build on windows arm

* fix build on Unix

* Use new[] instead of malloc

* fix for Unix

* Use InitializeContext2 to enable context compaction.

* PR feedback

* Reverted CONTEXT_COMPLETE  change.

* Use `CopyContext` in RedirectCurrentThreadAtHandledJITCase

Co-authored-by: Manish Godse <61718172+mangod9@users.noreply.github.com>
3 years agoFaster EventSource attribute lookup (#45621)
Ben Adams [Fri, 22 Jan 2021 17:37:26 +0000 (17:37 +0000)]
Faster EventSource attribute lookup (#45621)

* Use faster single attribute lookup for Eventsource

* Update src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
* Add debug assert for type

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoAdd ActivitySource.StartActivity overload and support CallerMemberNameAttribute for...
Tarek Mahmoud Sayed [Fri, 22 Jan 2021 17:23:12 +0000 (09:23 -0800)]
Add ActivitySource.StartActivity overload and support CallerMemberNameAttribute for name parameter (#47192)

3 years agoResolve ILLink warnings in System.Security.Cryptography.Algorithms
Eric Erhardt [Fri, 22 Jan 2021 17:17:03 +0000 (11:17 -0600)]
Resolve ILLink warnings in System.Security.Cryptography.Algorithms

3 years agoDisable sourcelink locally consistently (#47297)
Viktor Hofer [Fri, 22 Jan 2021 16:27:39 +0000 (17:27 +0100)]
Disable sourcelink locally consistently (#47297)

3 years agoRevert "Re-enable RunThreadLocalTest8_Values on Mono (#47277)" (#47324)
Alexander Köplinger [Fri, 22 Jan 2021 14:30:12 +0000 (15:30 +0100)]
Revert "Re-enable RunThreadLocalTest8_Values on Mono (#47277)" (#47324)

This reverts commit f3cd4c6af763d35b9633dc01729a3c02942f941d.

3 years agoMove some Threading classes over from NativeAOT (#47327)
Ryan Lucia [Fri, 22 Jan 2021 14:27:45 +0000 (09:27 -0500)]
Move some Threading classes over from NativeAOT (#47327)

This PR intentionally does not include any of the modifications on top of them or other files that will be needed to wire them up to the build.

3 years agoMisc changes from runtimelab:NativeAOT (#47323)
Michal Strehovský [Fri, 22 Jan 2021 14:26:12 +0000 (15:26 +0100)]
Misc changes from runtimelab:NativeAOT (#47323)

* Improved logger for the AOT compiler. The logic is mostly taken from IL Linker where prople spent a bunch of time on it.
* Bunch of other changes.

3 years agoDelete extraneous nullable suppression in CertificatePal.Import.cs (#47311)
Stephen Toub [Fri, 22 Jan 2021 12:28:11 +0000 (07:28 -0500)]
Delete extraneous nullable suppression in CertificatePal.Import.cs (#47311)

3 years agoSupply file version info for the jitinterface native library (#47300)
Tomáš Rylek [Fri, 22 Jan 2021 11:37:13 +0000 (12:37 +0100)]
Supply file version info for the jitinterface native library (#47300)

During my work on switching over framework library crossgenning
to use Crossgen2 I noticed that jitinterface is missing the
file version information. This change fixes the issue.

Thanks

Tomas

3 years agoResolves error in initNonPortableDistroRid when your local directory name contains...
Steve Pfister [Fri, 22 Jan 2021 11:14:29 +0000 (06:14 -0500)]
Resolves error in initNonPortableDistroRid when your local directory name contains android (#47045)

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
3 years agoParse method call chain model file and resolve methods (#47302)
Simon Nattress [Fri, 22 Jan 2021 04:57:23 +0000 (20:57 -0800)]
Parse method call chain model file and resolve methods (#47302)

* Parse method call chain model file and resolve methods
* Resolve methods from Azure profile trace building a list of caller->callees with counts to use in compilation heuristics
* Resolves the two main forms of methods we see in the traces:

```
System.Core.ni.dll!System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.__Canon,System.__Canon].MoveNext
Microsoft.Azure.Monitoring.WarmPath.FrontEnd.Middleware.SecurityMiddlewareBase`1+<Invoke>d__6[System.__Canon]!MoveNext
```

3 years agoupdate branding from alpha to preview1 (#47282)
Anirudh Agnihotry [Fri, 22 Jan 2021 04:14:18 +0000 (20:14 -0800)]
update branding from alpha to preview1 (#47282)

3 years agoExport DotNetRuntimeInfo symbol from singlefile host (#47299)
Vladimir Sadov [Fri, 22 Jan 2021 03:57:38 +0000 (19:57 -0800)]
Export DotNetRuntimeInfo symbol from singlefile host (#47299)

* Exporting DotNetRuntimeInfo from singlefilehost

* move runtimeinfo into a separate lib

* enable runtimeinfo on macOS

* export only runtimeinfo

* fix FreeBSD build

* revert DLLEXPORT change

3 years agoReact to dotnet/aspnetcore master -> main renaming (#47306)
Doug Bunting [Fri, 22 Jan 2021 02:31:36 +0000 (18:31 -0800)]
React to dotnet/aspnetcore master -> main renaming (#47306)

3 years agoFix typo in LoggerMessage.cs (#47293)
Daniel Chalmers [Fri, 22 Jan 2021 01:04:43 +0000 (19:04 -0600)]
Fix typo in LoggerMessage.cs (#47293)

'sisxth' -> 'sixth'
Fixes #47292

3 years agoReduce allocations in System.Threading.Channels for netstandard2.* and net461 (#46458)
Kornei Dontsov [Fri, 22 Jan 2021 01:02:04 +0000 (03:02 +0200)]
Reduce allocations in System.Threading.Channels for netstandard2.* and net461 (#46458)

* Reduce allocations in System.Threading.Channels for netstandard2.* and net461

System.Threading.Channels.AsyncOperation<TResult> is well optimized for .NET Core, but there are no optimizations for .NET Standard 2.0 and .NET Framework. They use the same code as .NET Standard 1.3.

* Remove execution flow suppression as redundant

* Rollback QueueUserWorkItem

3 years agoReplace two uses of TaskCreationOptions.LongRunning (#47296)
Stephen Toub [Fri, 22 Jan 2021 00:55:23 +0000 (19:55 -0500)]
Replace two uses of TaskCreationOptions.LongRunning (#47296)

3 years agoBump Linux arm64 Helix docker image (#47254)
Alexander Köplinger [Fri, 22 Jan 2021 00:46:01 +0000 (01:46 +0100)]
Bump Linux arm64 Helix docker image (#47254)

Looks like it was never bumped to bring in https://github.com/dotnet/core-eng/issues/10033#issuecomment-655807795

3 years agoOptimize Activity Ids (#46890)
Tarek Mahmoud Sayed [Thu, 21 Jan 2021 23:20:04 +0000 (15:20 -0800)]
Optimize Activity Ids (#46890)

* Optimize Activity Ids

* Generate long random numbers and make the generator object a threadstatic

* Addnew line at the end of the file

* Update the Random number generator

* Fix Full Framework failure

* Address the feedback regarding ranomizing Guid bits

* address more Feedback

* Address more feedback

3 years agoNameResolution-Tests: enable GetHostEntryAsync_InvalidHost_LogsError on Windows ...
Günther Foidl [Thu, 21 Jan 2021 22:31:41 +0000 (23:31 +0100)]
NameResolution-Tests: enable GetHostEntryAsync_InvalidHost_LogsError on Windows (#47034)

* Enable GetHostEntryAsync_InvalidHost_LogsError on Windows too

* Use WaitForErrorEventAsync instead of a naive Task.Delay

Cf. https://github.com/dotnet/runtime/pull/47034#discussion_r558728557

3 years agoMake File.Move(..., ..., overwrite: true) more efficient. (#47118)
Konstantin Gukov [Thu, 21 Jan 2021 22:04:36 +0000 (23:04 +0100)]
Make File.Move(..., ..., overwrite: true) more efficient. (#47118)

The current implementation has an inefficiency. When moving a file across volumes, and when
the target file doesn't exist, the "rename" syscall will be called twice (unsuccesfully) instead of once.

By branching on "overwrite" from the beginning, we avoid calling the first "rename" in vain.

Co-authored-by: Konstantin Gukov <kgukov@microsoft.com>
3 years agoUse CorInfoCallConvExtension throughout runtime interop code (#47251)
Jeremy Koritzinsky [Thu, 21 Jan 2021 21:57:55 +0000 (13:57 -0800)]
Use CorInfoCallConvExtension throughout runtime interop code (#47251)

* First pass to move the vm to use CorInfoCallConvExtension for all IL-stub-related calling convention needs.

* Use CorInfoCallConvExtension all the way down to the native function signature emit stage.

* PR feedback.

* Fix variable name.

* Update src/coreclr/vm/dllimport.cpp

3 years agoArm64 apple vm fixes for arg alignment. (#46665)
Sergey Andreenko [Thu, 21 Jan 2021 21:37:42 +0000 (13:37 -0800)]
Arm64 apple vm fixes for arg alignment. (#46665)

* Add `MarshalInfo::IsValueClass`.

* Add `TypeHandle* pTypeHandle` to `SizeOf`.

* Add a few asserts/start using inline function instead of macro.

* use TARGET_POINTER_SIZE instead of STACK_ELEM_SIZE.

* Use `m_curOfs` instead of `m_idxStack` in `ArgIteratorBase` on all platforms.

Before some platforms were using stackSlots, some curOfs in bytes.

* Use byte sizes and offsets in `ArgLocDesc`.

Fix arm32.

x86 fixes.

use StackSize on ArgSizes

Add `GetStackArgumentByteIndexFromOffset` and return back the old values for asserts.

another fix

* Stop using `#define STACK_ELEM_SIZE`

* Add `isFloatHfa`.

* delete checking code.

because it won't pass on arm64 apple.

* arm64 apple fixes.

* roundUp the stack size.

* Add a reflection test.

* Return byte offset from `GetNextOfs`.

It is not a complete fix for arm64 apple, but covers most cases.

* Add `FLOAT_REGISTER_SIZE`

* Use StackElemSize for ` pLoc->m_byteStackSize`.

* replace `assert` with `_ASSERTE`.

* Use `ALIGN_UP` in the code that I have changed.

* rename `m_curOfs` as `m_ofsStack`.

* delete "ceremony " from `StackElemSize`.

* Delete `cSlots` and don't call `StackElemSize` on `GetArgSize`.

* Fix an assert.

* Fix nit.

* fix wrong return for hfa<float>.

* fix nit.

* Fix crossgen job.

3 years agoLinux: don't use deprecated sysctl (#45753)
Tom Deseyn [Thu, 21 Jan 2021 21:11:49 +0000 (22:11 +0100)]
Linux: don't use deprecated sysctl (#45753)

* Linux: don't use deprecated sysctl

* Handle deprecated sysctl in coreclr, gc, corehost.

3 years agoAdd interned string support to the JS<->WASM bindings layer (#44518)
Katelyn Gadd [Thu, 21 Jan 2021 20:54:31 +0000 (12:54 -0800)]
Add interned string support to the JS<->WASM bindings layer (#44518)

This PR introduces interned string support to the bindings layer along with some related changes:
    The JS bindings layer maintains a pair of string intern tables, one mapping JS string -> managed pointer and the other mapping managed pointer -> JS string.
    Any interned managed string is automatically added to the JS intern tables when it crosses the bindings boundary, to avoid duplicate allocations + reduce time spent copying/decoding text.
    Signatures gain a new type token S which specifies that the argument is an interned string. If the string passed is not already interned, the JS bindings will automatically intern it on both sides.
    The bindings layer logic for creating a new managed string will automatically look it up in the local intern table (unless it is large) and use the existing managed string if an interned string is found.
    mono_wasm_get_obj_type and similar APIs now return a distinct type ID for interned strings. The logic for this is awkward but doing it in the driver is much faster than trying to do it from JS.
    Partial support for converting JS Symbol instances to interned managed strings in the bindings layer. I didn't finish this yet because v8 shell's Symbol support is broken, but it's a good way to achieve interning because the JS runtime exposes interning for symbols.

3 years agoRe-enable RunThreadLocalTest8_Values on Mono (#47277)
Aleksey Kliger (λgeek) [Thu, 21 Jan 2021 20:07:48 +0000 (15:07 -0500)]
Re-enable RunThreadLocalTest8_Values on Mono (#47277)

This is possibly fixed by https://github.com/dotnet/runtime/pull/44124
Since that PR mono will throw a ThreadStartException instead of an
ExecutionEngineException if thread creation fails. The threadpool
already catches ThreadStartException and can deal with thread creation failure.

Related to https://github.com/dotnet/runtime/issues/43981

3 years agoReplace HttpMethod dictionary with switch (#47281)
Stephen Toub [Thu, 21 Jan 2021 19:49:38 +0000 (14:49 -0500)]
Replace HttpMethod dictionary with switch (#47281)

3 years agoLibraries shims build fixes (#47127)
Jan Kotas [Thu, 21 Jan 2021 17:18:21 +0000 (09:18 -0800)]
Libraries shims build fixes (#47127)

* On Windows, both dynamic and static libraries are producing .lib file (export library vs. actual static library). We need to make sure that these .lib file have different name to avoid build race conditions.
* Fix System.Globalization.Native too for consistency
* Delete unnecessary ifdef

3 years agoClean up test in System.Threading to use PlatformDetection instead of PlatformSpecifi...
Kenneth Pouncey [Thu, 21 Jan 2021 17:09:07 +0000 (18:09 +0100)]
Clean up test in System.Threading to use PlatformDetection instead of PlatformSpecific. (#47260)

- Add `[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]`

3 years agoFix building symbols archive (#47271)
Alexander Köplinger [Thu, 21 Jan 2021 17:05:33 +0000 (18:05 +0100)]
Fix building symbols archive (#47271)

When passing `/p:CreateSymbolsArchive=true` the build complained about missing `PublishSymbolsToDisk` targets.

3 years ago[mbr] [wasm] Don't automatically turn off inlining (#47246)
Aleksey Kliger (λgeek) [Thu, 21 Jan 2021 17:01:40 +0000 (12:01 -0500)]
[mbr] [wasm] Don't automatically turn off inlining (#47246)

Instead of turning off inlining whenever ENABLE_METADATA_UPDATE is defined in
the code, only turn it off when MONO_METADATA_UPDATE is set in the environment.

Update the browser MBR sample to use the env var

3 years agoEventPipe C library CoreClr ep_rt_object_array_alloc should zero init. (#47111)
Johan Lorensson [Thu, 21 Jan 2021 15:33:45 +0000 (16:33 +0100)]
EventPipe C library CoreClr ep_rt_object_array_alloc should zero init. (#47111)

EventPipe C library is defensive in its type allocators:

ep_rt_object_alloc
ep_rt_object_array_alloc

meaning that they will zero init memory before returned. On Mono this is
done through use of g_new0 and on CoreClr we use C++11 zero init feature
when allocating struct (only type allocated through these functions).

On CoreClr this was only applied for ep_rt_object_alloc but not for
ep_rt_object_array_alloc meaning that ep_rt_object_array_alloc would
return arrays of allocated objects but not zero initialized.

PR makes sure we call new (nothrow) utilizing C++11's zero initialization
capabilities of non-class types without constructors.

3 years ago[aot] Avoid creating runtime invoke wrappers for methods which return a byreflike...
Zoltan Varga [Thu, 21 Jan 2021 15:06:37 +0000 (10:06 -0500)]
[aot] Avoid creating runtime invoke wrappers for methods which return a byreflike type, the return value cannot be boxed. (#47033)

3 years ago[wasm][docs] Add docs for using AOT profiler (#47170)
Tammy Qiu [Thu, 21 Jan 2021 12:05:04 +0000 (07:05 -0500)]
[wasm][docs] Add docs for using AOT profiler (#47170)

* add instructions for using profiler

* [wasm][docs] add link to wasm/build/README.md

3 years agoFix call to GcWeakPtrScanBySingleThread (#47225)
Peter Sollich [Thu, 21 Jan 2021 07:59:28 +0000 (08:59 +0100)]
Fix call to GcWeakPtrScanBySingleThread (#47225)

When running with MARK_LIST not defined, I noticed a crash due an incorrect #ifdef, which caused GcWeakPtrScanBySingleThread to be executed by multiple threads. The #endif is in the wrong place - we didn't notice because we usually have MARK_LIST defined.

3 years agoUpdate the ComWrappers API (#47073)
Aaron Robinson [Thu, 21 Jan 2021 06:29:51 +0000 (22:29 -0800)]
Update the ComWrappers API (#47073)

* Update the ComWrappers API

Add support for the new Aggregated and Unwrap flags in ComWrappers.

* ARM/ARM64 build issues.
Add missing contracts.

* Add test for unwrap logic.
Remove extra AddRef() in ComWrappers global marshalling scenario.

* Review feedback.

* Add negative test for passing non-null inner without indicating
  the scenario is for aggregation.

3 years agoOnly pass the method context when tracking transitions. (#47238)
Jeremy Koritzinsky [Thu, 21 Jan 2021 02:48:04 +0000 (18:48 -0800)]
Only pass the method context when tracking transitions. (#47238)

* Only pass the method context when tracking transitions.

* Add another separate helper for exit. use a jitflag to signify when to track transitions

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Wire up R2R helpers.

* Revert "Wire up R2R helpers."

This reverts commit 80a4749232312a89752518bcb8741a2b8e0129cc.

* Update CorInfoHelpFunc to have the new entries. Don't handle the new helpers since they won't be used.

* Simplify if check since CORProfilerTrackTransitions is process-wide.

* Remove unneeded assignment.

* Fix formatting.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoFixes DI deadlock when resolving singletons (#46157)
Maryam Ariyan [Thu, 21 Jan 2021 02:18:58 +0000 (21:18 -0500)]
Fixes DI deadlock when resolving singletons  (#46157)

3 years agoImprove Random (performance, APIs, ...) (#47085)
Stephen Toub [Thu, 21 Jan 2021 01:26:55 +0000 (20:26 -0500)]
Improve Random (performance, APIs, ...) (#47085)

* Improve Random (performance, APIs, ...)

- Changes the algorithm used by `new Random()` to be one that's smaller and faster and produces better results
- Refactors the implementation to make it internally pluggable
- Moves the existing implementation to be used when it's necessary for back compat
- Adds NextInt64 and NextSingle methods

3 years agoBump timeout of iOS job in runtime-staging.yml (#47241)
Alexander Köplinger [Thu, 21 Jan 2021 00:17:07 +0000 (01:17 +0100)]
Bump timeout of iOS job in runtime-staging.yml (#47241)

We saw it running into the 2hr timeout in https://dev.azure.com/dnceng/public/_build/results?buildId=958281&view=logs&j=8580ecfb-912a-5dbd-35ce-e64d0d51ddbf even though the build progressed fine (albeit slowly).

3 years agosrc/installer support osx-arm64 (#47247)
Steve MacLean [Wed, 20 Jan 2021 23:29:57 +0000 (18:29 -0500)]
src/installer support osx-arm64 (#47247)

3 years agoInclude crossgen2 when crossgening SPC. (#47216)
Sergey Andreenko [Wed, 20 Jan 2021 23:05:48 +0000 (15:05 -0800)]
Include crossgen2 when crossgening SPC. (#47216)

3 years ago[master] Update dependencies from mono/linker (#47108)
dotnet-maestro[bot] [Wed, 20 Jan 2021 22:22:15 +0000 (22:22 +0000)]
[master] Update dependencies from mono/linker (#47108)

[master] Update dependencies from mono/linker

 - Reflect linker changes

 - Reflect linker changes

 - Reflect linker changes

 - Merge branch 'darc-master-cda9432a-2250-4c6f-822a-6016b38faef1' of github.com:dotnet/runtime into darc-master-cda9432a-2250-4c6f-822a-6016b38faef1

 - fix msbuild logic

3 years agoUpdate SafeHandle types to have public parameterless constructors and add InitHandle...
Jeremy Koritzinsky [Wed, 20 Jan 2021 22:01:09 +0000 (14:01 -0800)]
Update SafeHandle types to have public parameterless constructors and add InitHandle API (#47189)

* Update public SafeHandle types to have public parameterless constructors.

Remove now-unneeded ILLink trim files.

Make public abstract SafeHandle constructors protected.

Remove comment on SafeWaitHandle

* Make SafeHandle constructors public for internal types.

Make internal abstract SafeHandle default constructors protected. Make non-abstract internal SafeHandles sealed when possible.

More internal SafeHandle types.

* Add new Marshal.InitHandle API.

Fix SetHandle accessibility

Fix test.

Use Marshal.InitHandle.

* PR feedback.

* Remove trailing whitespace.

3 years agodefine HttpVersion.Version30 and use where appropriate (#47208)
Geoff Kizer [Wed, 20 Jan 2021 21:37:58 +0000 (13:37 -0800)]
define HttpVersion.Version30 and use where appropriate (#47208)

* define HttpVersion.Version30 and use where appropriate

* add xmldoc to HttpVersion

* fix debug references

* readd HttpVersion30 to HttpClientHandlerTestBase

* revert changes to HttpClientHandlerTest.cs

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years ago[mono] Add basic Vector128 support for arm64. (#47028)
imhameed [Wed, 20 Jan 2021 21:12:27 +0000 (13:12 -0800)]
[mono] Add basic Vector128 support for arm64. (#47028)

This change:

- Unpacks SIMD parameters passed via multiple GPRs (`LLVMArgVtypeAsIArgs`) into
local LLVM SSA vector-typed values on function entry. The calling convention we
use on arm and arm64 has "large" value types passed in multiple GPRs when
possible, and the way this is currently encoded in the LLVM IR we emit is by
using parameters with the LLVM type `[Size x {i32 or i64}]`, where the
resulting size of this type, in bytes, is at least as large as the size of the
value type encoded within.

- Packs SIMD return values into multiple GPRs (`LLVMArgVtypeAsScalar`); the way
this is currently encoded in the LLVM IR we emit for arm64 (but not arm) is by
using a "wide" LLVM integer type (e.g. `i128`).

- Makes `OP_LDADDR` aware of our special-case handling of SIMD value types:
SIMD value types passed via an indirection (`LLVMArgVtypeAddr` or
`LLVMArgVtypeByRef`) are loaded from memory to an LLVM SSA value in the initial
basic block, but `OP_LDADDR` had previously assumed that any value type passed
via an indirection had an associated LLVM SSA value containing an indirection
rather than the actual value.

- Adds a debugging utility function (`mono_llvm_dump_type`).

- Gives greppable names to some allocas.

- Makes some formerly amd64-specific SIMD-related opcodes also work on arm64.

3 years ago[wasm][debugger][tests] Update tests to track harness changes (#46968)
Ankit Jain [Wed, 20 Jan 2021 19:45:22 +0000 (14:45 -0500)]
[wasm][debugger][tests] Update tests to track harness changes (#46968)

* [wasm][debugger][tests] Move all the tests to `SingleSessionTestBase`

And thus move to remove the use to `insp.Ready`:

So, old code:
```csharp
        [Fact]
        public async Task BrowserClose()
        {
            var insp = new Inspector();
            var scripts = SubscribeToScripts(insp);
            await Ready();
            await insp.Ready(async (cli, token) => {
                 await Assert.ThrowsAsync<WebSocketException>(async () =>
                        await SendCommandAndCheck(null, "Browser.close", null, -1, -1, null));
            });
       }
```

.. becomes:

```csharp
        [Fact]
        public async Task BrowserClose() => await Assert.ThrowsAsync<WebSocketException>(async () =>
                await SendCommandAndCheck(null, "Browser.close", null, -1, -1, null));
```

* [wasm][debugger][tests] Run `dotnet format` on the test files

* [wasm][debugger][tests] Merge SingleSessionTestBase=>DebuggerTestBase

.. since it isn't required any more.

* [wasm][debugger][tests] Remove DebugTestContext

This isn't required anymore.

* [wasm][debugger][tests] Remove unused insp.Ready method

* [wasm][debugger][tests] Re-apply old commit to expand console args

In the previous merge, this commit got lost:

```
commit 22e9f6ef0e45bba65e927341f09279a697aae56f
Author: Larry Ewing <lewing@microsoft.com>
Date:   Wed Dec 9 15:48:09 2020 -0600

    expand console arguments when writing them out (#44632)

    * expand cosole arguments when writing them out

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

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

Co-authored-by: Ankit Jain <radical@gmail.com>
```

Update, and re-apply it.

* [wasm][debugger][tests] remove debug statement

3 years agoFix unrolling for LocateLastFoundChar and LocateLastFoundByte in SpanHelpers (#46977)
SingleAccretion [Wed, 20 Jan 2021 19:29:43 +0000 (22:29 +0300)]
Fix unrolling for LocateLastFoundChar and LocateLastFoundByte in SpanHelpers (#46977)

3 years ago[jit] Emit a null check for stelem instructions. (#46817)
Zoltan Varga [Wed, 20 Jan 2021 18:38:59 +0000 (13:38 -0500)]
[jit] Emit a null check for stelem instructions. (#46817)

Part of the fix for https://github.com/dotnet/runtime/issues/46766.

3 years agoclean up some issues in header classes around immutability and readonly fields (...
Geoff Kizer [Wed, 20 Jan 2021 18:26:54 +0000 (10:26 -0800)]
clean up some issues in header classes around immutability and readonly fields (#47205)

* clean up some issues in header classes around immutability and readonly fields

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoClassify type with empty base as non-blittable (#46769)
Adeel Mujahid [Wed, 20 Jan 2021 18:13:59 +0000 (20:13 +0200)]
Classify type with empty base as non-blittable (#46769)

* Add tests for MarshalUtils.IsBillitableType

* Classify type with empty base as non-blittable

* Add tests for IsZeroSizedReferenceType

* Rename local variables in tests

3 years agoInitial new-style iOS/tvOS cross compiler (#47184)
Jo Shields [Wed, 20 Jan 2021 17:43:27 +0000 (12:43 -0500)]
Initial new-style iOS/tvOS cross compiler (#47184)

* Allow no EMSDK for cross-compiler

* Don't try to include file not made during AOT on Browser

* Move BuildMonoCrossAOT from a bool to a Subset-esque string

* Generate wasm offsets

* Add new offset generation to non-official builds too. Oops

* Deal with default case when generating offsets only

* We override the OS, so can't switch on it

* We're being skipped again

* Grr

* Try another time. Merges passing in the night.

* Try and make the yaml consume both offsets

* Clean up last commit, which went surprisingly well

* Actually consume all offsets from parameter

* Yaml 🤷‍♂️

* It's not crossandroid any more, is it?

* Official version

* Fix typo

* Fix typo in typo

* Cleanups

* Variable rename suggestion from Alex

* More better variable names from Alex

* Initial new-style AOT for iOS. Need to disable Linux builds selectively though.

* Split Linux & Mac AOT

* fix error in official builds

3 years agoUpdate StackBehaviour.cs (#47234)
AnakinSklavenwalker [Wed, 20 Jan 2021 17:32:05 +0000 (18:32 +0100)]
Update StackBehaviour.cs (#47234)