platform/upstream/dotnet/runtime.git
3 years agoGtneg mul divoptimizations (#45604)
Alex Covington [Tue, 12 Jan 2021 02:30:28 +0000 (18:30 -0800)]
Gtneg mul divoptimizations (#45604)

* GT_NEG optimization for multiplication and division

* Distribute negation over parenthetical multiplication or division.

* Removing duplicate logic that I had put in accidently.

* Check overflow and other conditions before performing morph

* Resolved merge conflict and cleanup morph.cpp

* Formatting morph.cpp

* Returning tree after performing smpop again to fix flags

* Formatting

* Added check for optimizations, formatting.

* Using gtIsActiveCSE_Candidate instead of fgGlobalMorph

* Update src/coreclr/jit/morph.cpp

Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
* Formatting

* delete formatting changes.

* Add a test.

* Change the conditions a bit.

* Better names for the tests.

Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
3 years agoR2RDump improvements (#46833)
Simon Nattress [Tue, 12 Jan 2021 02:20:04 +0000 (18:20 -0800)]
R2RDump improvements (#46833)

* Fix handling of module override token in signature parser. When the override is present, a new SignatureDecoder is created and used as the decoder for the final signature with the fixup kind (and module override flag which is stored in the upper bit of the fixup kind byte) already parsed. This causes the remainder of the signature to be parsed as a full R2R signature which is now missing the fixup type.
* Instead of creating a new decoder when a module override is present, set up the initial decoder's metadata reader in the constructor by detecting the module override up front.
* Fix `TryLocateNativeReadyToRunHeader` to swallow `BadImageFormatException` and return true / false whether the image has a native R2R header (for composite images).
* Running R2RDump on IL assemblies with no R2R now emits an error message that the assembly is not R2R instead of an unhelpful error about some RVA offset conversion failing.

3 years agoRemove unnecessary .sln file in System.Runtime.Serialization.Formatters (#46839)
Eric Erhardt [Tue, 12 Jan 2021 02:17:20 +0000 (20:17 -0600)]
Remove unnecessary .sln file in System.Runtime.Serialization.Formatters (#46839)

3 years agoResolve ILLink warnings in System.Reflection.DispatchProxy (#46715)
Eric Erhardt [Tue, 12 Jan 2021 00:35:47 +0000 (18:35 -0600)]
Resolve ILLink warnings in System.Reflection.DispatchProxy (#46715)

* Resolve ILLink warnings in System.Reflection.DispatchProxy

I also took this chance to remove unnecessary GetTypeInfo() calls, since some of them needed to be removed.

Contributes to #45623

* Update annotations for PR feedback.

Remove DynamicallyAccessedMemberTypes.All from the interface and base class types. If unused members are trimmed, this won't cause problems with DispatchProxy.

* Add a trimming test for DispatchProxy since we are suppressing ILLinker warnings.

3 years agoQuiet the output from emsdk_env.sh to make the build less verbose. (#46780)
Zoltan Varga [Tue, 12 Jan 2021 00:33:07 +0000 (19:33 -0500)]
Quiet the output from emsdk_env.sh to make the build less verbose. (#46780)

* Quiet the output from emsdk_env.sh to make the build less verbose.

* Quiet mono-cil-strip as well.

3 years agoDisable Speech Tests on Mono. (#46828)
Johan Lorensson [Mon, 11 Jan 2021 22:27:13 +0000 (23:27 +0100)]
Disable Speech Tests on Mono. (#46828)

Mono on netcore doesn't support COM wrappers that System.Speech depends
on. Disable System.Speech.Tests on Mono.

3 years agoNo need to handle COR_E_STACKOVERFLOW when waiting for GC. (#46733)
Vladimir Sadov [Mon, 11 Jan 2021 21:44:55 +0000 (13:44 -0800)]
No need to handle COR_E_STACKOVERFLOW when waiting for GC. (#46733)

* remove TSNC_WaitUntilGCFinished, noone checks for it

* remove TS_BlockGCForSO, the secenario no longer can happen.

* unused flag related to user-requested thread suspension

3 years agoImprove OidLookup.ToLookup perf, in particular for X509Certificate2.Extensions (...
Stephen Toub [Mon, 11 Jan 2021 21:00:26 +0000 (16:00 -0500)]
Improve OidLookup.ToLookup perf, in particular for X509Certificate2.Extensions (#46819)

* Avoid OidLookup.ToOid call per extension in X509Certificate2.Extensions

`X509Certificate2.Extensions` invokes `CertificatePal.Extensions`, which in turn creates the extensions collection, invoking `new Oid(string)` for each.  This in turn calls `OidLookup.ToOid` in order to gather the friendly name, even though in many situations, no one actually cares about the friendly name.  We can instead call `new Oid(string, null)`, which makes the friendly name lazily initialized on first use, saving the `OidLookup.ToOid` call when it's not needed, and significantly reducing the time to call Extensions (in particular when the predefined OID lookup tables don't contain the OID for an extension and when it can't be found on lookup).

* Allow OidLookup.ToOid to cache failure

ToOid has a cache, but it only caches successful results.  If ToOid fails to find the relevant OID, nothing is cached, which makes the failure path very expensive, as every ToOid call for that OID takes the slow path.  This lets it be cached.

3 years agoFix PostEvictionCallbacks bug (#46807)
Adam Sitnik [Mon, 11 Jan 2021 20:06:05 +0000 (21:06 +0100)]
Fix PostEvictionCallbacks bug  (#46807)

* add a failing test

* fix the actual bug (this was not a CacheEntry but a CacheEntryTokens instance here)

3 years agofix SslStreamCertificateContext.Create with partial chain (#46664)
Tomas Weinfurt [Mon, 11 Jan 2021 19:32:11 +0000 (11:32 -0800)]
fix SslStreamCertificateContext.Create with partial chain (#46664)

* fix SslStreamCertificateContext.Create with partial chain

* add test with long partial chain

3 years ago[Mono] Initial metadata update support (#45612)
Aleksey Kliger (λgeek) [Mon, 11 Jan 2021 18:13:10 +0000 (13:13 -0500)]
[Mono] Initial metadata update support (#45612)

* Initial metadata-update prototype

Co-Authored-By: Bernhard Urban-Forster <lewurm@gmail.com>
* Add metadata-update.{c,h} to CMakeLists.txt

* Add icall to corelib

* Add console and browser metadata update samples

   Both samples depend on the roslynildiff tool which should be specified with a RoslynILDiffFullPath property in the .csproj files for the projects.

* Add README for mbr samples

* [build] Add initial runtime support for MonoMetadataUpdate property

   In the runtime defines cmake ENABLE_METADATA_UPDATE option and sets a preprocessor flag.

   In System.Private.CoreLib, defines FEATURE_METADATA_UPDATE and uses it to throw a NotSupportedException from LoadMetadataUpdate

* [runtime] ifdef out metadata updates if not enabled

   Also move execution engine initialization into the main update function and use a MonoError to signal failures (such as if interp inlining is not turned off) instead of asserting at startup.

* [wasm] set log mask to metadata-update

* [mbr] Add InjectUpdate fn to sample

* [metadata-update] don't merge heaps

* Don't make entrypoint public yet

* Add LoadMetadataUpdate to linker descriptor

* [wasm] add default Makefile variable value

* fix mono/mono CI

   don't try to run enc tests yet since they depend on roslynildiff

* remove mono/mono/tests/enc

   Will add as runtime tests in a future PR

* [metadata-update] Add per-thread exposed generation

   A thread has to voluntarily roll up to the latest published generation in order to see updates.

   - Roll up to the latest published generation when attaching a thread
   - The updater thread sees the allocated unpublished generation

* [mbr] Fixup console sample

   Use a single changing testfile

* [metadata-update] delete unused method

* [mbr] Use 2 threads in console sample

* [metadata-update] Respect exposed generation in MethdDef RVA lookups

* [interp] Expose latest metadata update before transforming methods

* [mbr] Update samples after rebase

   Use the WasmApp.targets

* [metadata-update] Don't fail after the first unsupported edit

   Log all the unsupported edits, then cancel the update

* [metadata_update] Keep track of logical table sizes for deltas

   Keep track of inserted/modified rows for each table in each delta. This will help to use a simpler algorithm to locate effective table rows by keeping track of the logical number of rows in the appended tables

* [metadata-update] Use a GList for MonoImage:delta_image

   We're going to need to walk backwards from the latest published delta

* [metadata-update] add effective table lookup debug output

* Address review feedback

* [interp] Save top interp frame at MINT_SAFEPOINT to ThreadContext

   Give metadata updates a peek at the interp frames since the LMF so that it can copy the InterpMethods that are currently executing

   This only works with hybrid and full coop suspend.  Preemptive suspend will need another mechanism.

* [mbr] Extend console sample

   Add a busy thread to demonstrate that interp frames since the last managed frame are visible to the metadata update mechanism and the active method bodies are copied before being invalidated.

* [interp] Check mono_polling_required at safepoint

Co-authored-by: Bernhard Urban-Forster <lewurm@gmail.com>
3 years agoissue-46477 Fix issue about checking last char in datetime string. (#46614)
LateApexEarlySpeed [Mon, 11 Jan 2021 17:36:26 +0000 (01:36 +0800)]
issue-46477 Fix issue about checking last char in datetime string. (#46614)

* issue-46477 Fix issue about checking last char in datetime string.

* issue-46477 Fix comment: Add more tests with timezone part.

3 years agoJIT: suppress edge weight second computation pass (#46779)
Andy Ayers [Mon, 11 Jan 2021 16:27:00 +0000 (08:27 -0800)]
JIT: suppress edge weight second computation pass (#46779)

Follow up to #45615.

We compute edge weights twice. Make sure we either enable or suppress
both the computations.

3 years ago[wasm] Fix running on browsers missing SharedArrayBuffer (#46784)
Ankit Jain [Mon, 11 Jan 2021 16:24:39 +0000 (11:24 -0500)]
[wasm] Fix running on browsers missing SharedArrayBuffer (#46784)

Recently we added:

    `BINDING.mono_sab_supported: typeof SharedArrayBuffer !== "undefined"`

.. which is meant to guard use of `SharedArrayBuffer` on browsers that
don't support it. But the final dotnet.js seems to check this at build
time itself, and converts the above to:

    `BINDING.mono_sab_supported: true`

.. which causes errors on Safari (for example):

```
[Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: SharedArrayBuffer
onPendingRequestComplete (dotnet.js:1:149348)
processFetchResponseBuffer (dotnet.js:1:149582)
processFetchResponseBuffer
promiseReactionJob
```

Instead, we can use the type check directly.

3 years agoUse Math.DivRem instead of / % in BigInteger if dividend and divisor are trivial...
Ivan Kochurkin [Mon, 11 Jan 2021 15:41:37 +0000 (18:41 +0300)]
Use Math.DivRem instead of / % in BigInteger if dividend and divisor are trivial (#45230) (#46711)

3 years agoSimplify Uri UnicodeEquivalent helper (#46747)
Miha Zupan [Mon, 11 Jan 2021 15:17:15 +0000 (16:17 +0100)]
Simplify Uri UnicodeEquivalent helper (#46747)

3 years agoFix the position of the comment (#46806)
hopeko [Mon, 11 Jan 2021 14:29:31 +0000 (22:29 +0800)]
Fix the position of the comment (#46806)

3 years agoMinor refactoring to collections (#46506)
Shreyas Jejurkar [Mon, 11 Jan 2021 13:10:38 +0000 (18:40 +0530)]
Minor refactoring to collections (#46506)

* Minor refactoring to collections
1. Removed unwanted casting.
2. Added condition for Clear() method for SortedDictionary.

* Addressed PR feedback.
Removed unwated Clear condition.

* Addressed PR feedback.
1. Fixed spacing.

3 years ago[mono] Add DISABLE_NONBLITTABLE for non-blittable marshaling (#46444)
Ryan Lucia [Mon, 11 Jan 2021 13:05:54 +0000 (08:05 -0500)]
[mono] Add DISABLE_NONBLITTABLE for non-blittable marshaling (#46444)

This flag is not set by default on any platforms, but long-term it should be useful on wasm with the pinvoke generator work being done by the interop team.

This flag reduces around 13k in dotnet.wasm as of today (12/29/2020). However, that is a fairly low-end measurement because this PR only focused on the pinvoke marshaling rather than the full functionality. The structure of our marshaling callbacks means that even with icall linking, a lot of marshaling code will be kept around and unused, including all the string marshaling.

To solve this, we can either give up on the ilgen functionality being in a separate library so it gets linked our normally or we can just have this flag cover marshaling functionality as a whole. I've split that part off into a followup PR since it's more likely to be contested, but I implemented the latter option (and also disable things like certain JIT icalls for the same reason). We also will want analyzers set up before this is useful, so hopefully this solution is fine in combination with an extra analyzer for the marshaling methods in question?

3 years agoFix Mono Windows x64 crash blocking CI Windows x64 Release job. (#46573)
Johan Lorensson [Mon, 11 Jan 2021 07:42:51 +0000 (08:42 +0100)]
Fix Mono Windows x64 crash blocking CI Windows x64 Release job. (#46573)

After upgrade to later msvc version on CI boots, see
https://github.com/dotnet/runtime/issues/45524 for details,
Window x64 Release builds started to crash on libraries tests.

After investigation it turns out that new msvc compiler handles an
expression different compared to how it was handled in previous version.

After upgrade of msvc, the expression:

int _amd64_width_temp = ((guint64)(imm) == (guint64)(int)(guint64)(imm));

implemented in amd64_mov_reg_imm and then called from tramp-amd64.c@500
was transformed into an always true expression by compiler:

amd64_mov_reg_imm (code, AMD64_R11, (guint8*)mono_get_rethrow_preserve_exception_addr ());
lea rcx,[rethrow_preserve_exception_func (07FFB9E33A590h)]
mov word ptr [rbx+0Dh],0BB41h
mov byte ptr [rbx+0Fh],cl
mov rax,rcx
shr eax,8
mov byte ptr [rbx+10h],al
mov rax,rcx
shr eax,10h
shr ecx,18h
mov byte ptr [rbx+11h],al
lea rax,[rbx+13h]
mov byte ptr [rbx+12h],cl

as seen above, the condition and handling of a 64-bit imm has been
dropped by compiler.

This cause issues when the imm is a 64-bit value since it will always gets
truncated into 32-bit imm and in this case it was a pointer to a function
within coreclr.dll (mono_get_rethrow_preserve_exception_addr)
loaded located at higher address (using more than 32-bit).

This is most likely a regression issue in compiler for this specific
construction. I tried simpler construction (using same type conversion) on
both old and new compiler version and then it makes the right optimization.

Fix is to switch to a macro already available in amd64-codegen (amd64_is_imm32)
detecting if an imm needs a 32-bit or 64-bit sized value. This will be
correctly optimized by new msvc compiler and even if this is a work around
for a what seems to be a optimization bug in the compiler, it is still
cleaner and better describes the intent than current code.

Fix also re-enable Windows x64 Release CI test lane.

3 years agoDisable the test (#46752)
Jan Jahoda [Mon, 11 Jan 2021 01:09:52 +0000 (02:09 +0100)]
Disable the test (#46752)

Co-authored-by: Jan Jahoda <jajahoda@.microsoft.com>
3 years agoAdd recursion / thread interaction guard in LogInfoForFatalError (#46561)
Tomáš Rylek [Sun, 10 Jan 2021 21:06:44 +0000 (22:06 +0100)]
Add recursion / thread interaction guard in LogInfoForFatalError (#46561)

Based on local instrumentation I introduced while investigating
issues related to the switch-over to compile System.Private.CoreLib
using Crossgen2 I'm proposing to harden fatal exception handling
against nested and concurrent fatal error occurrences.

Thanks

Tomas

3 years agoFix the allocation of the acfg->cfgs array, it would have an incorrect size when...
Zoltan Varga [Sat, 9 Jan 2021 21:44:16 +0000 (16:44 -0500)]
Fix the allocation of the acfg->cfgs array, it would have an incorrect size when using profiled AOT. (#46781)

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

3 years ago[master] Update dependencies from dotnet/runtime-assets dotnet/arcade (#46744)
dotnet-maestro[bot] [Sat, 9 Jan 2021 15:57:05 +0000 (15:57 +0000)]
[master] Update dependencies from dotnet/runtime-assets dotnet/arcade (#46744)

[master] Update dependencies from dotnet/runtime-assets dotnet/arcade

3 years agoFix parsing of JIT-EE version GUID (#46773)
Bruce Forstall [Sat, 9 Jan 2021 00:03:11 +0000 (14:03 -1000)]
Fix parsing of JIT-EE version GUID (#46773)

With https://github.com/dotnet/runtime/pull/46116, a copy of the
actual first line of the GUID definition was added as a comment.
Unfortunately, the superpmi.py GUID parser was finding that one
instead of the actual GUID. Fix the parser to match from the
beginning of the line.

3 years agoHTTP/3: Fix decoding trailing headers (#46734)
James Newton-King [Fri, 8 Jan 2021 21:46:50 +0000 (10:46 +1300)]
HTTP/3: Fix decoding trailing headers (#46734)

3 years agoDisable some Speech tests on Server Core (#46756)
Dan Moseley [Fri, 8 Jan 2021 20:58:27 +0000 (12:58 -0800)]
Disable some Speech tests on Server Core (#46756)

3 years agoadd shutdown guard to profiler tests (#46739)
David Mason [Fri, 8 Jan 2021 20:05:41 +0000 (12:05 -0800)]
add shutdown guard to profiler tests (#46739)

3 years agoFix void returns in llvmonly runtime invokes. (#46735)
Zoltan Varga [Fri, 8 Jan 2021 19:03:42 +0000 (14:03 -0500)]
Fix void returns in llvmonly runtime invokes. (#46735)

3 years agoAdding System.Math overloads for nint/nuint (#46647)
Tanner Gooding [Fri, 8 Jan 2021 18:27:22 +0000 (10:27 -0800)]
Adding System.Math overloads for nint/nuint (#46647)

* Adding System.Math overloads for nint/nuint

* Adding a missing cast

* Fixing the Clamp_NInt and Clamp_NUInt tests to work with the provided MemberData

3 years agoControl Crossgen2 optimizations with DebuggableAttribute (#44514)
Simon Nattress [Fri, 8 Jan 2021 18:15:30 +0000 (10:15 -0800)]
Control Crossgen2 optimizations with DebuggableAttribute (#44514)

* Assemblies compiled in debug configuration use the `System.Diagnostics.DebuggableAttribute` to indicate optimizations are disabled.
* Match Crossgen 1's behavior and respect this setting if no explicit optimization arguments are passed in.
* Add `-Od` switch to disable optimizations since now the default behavior of Crossgen2 is to optimize release-built assemblies.
* Fix runtime assert when checking the GC ref map for multi-dimensional array's intrinsic `Address` method on x86. `Address` has a custom calling convention which always requires the extra param type in the signature. The extra shared generic check is too restrictive and doesn't match what we tell the JIT the signature is in https://github.com/dotnet/runtime/blob/4b8d10154c39b1f56424d4ba2068a3150d90d475/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs#L500.

3 years agoShare ICU culture init for unix/win with validation (#46660)
Adeel Mujahid [Fri, 8 Jan 2021 17:50:00 +0000 (19:50 +0200)]
Share ICU culture init for unix/win with validation (#46660)

3 years agoFix inconistent minus sign with different culture (#46588)
Buyaa [Fri, 8 Jan 2021 17:40:24 +0000 (09:40 -0800)]
Fix inconistent minus sign with different culture (#46588)

* Fix inconistent minus sign with different culture

3 years agoEnsure stack size is computed for stdcall name mangling (#46722)
Jan Kotas [Fri, 8 Jan 2021 17:32:15 +0000 (09:32 -0800)]
Ensure stack size is computed for stdcall name mangling (#46722)

Fixes #46667

3 years agoMake const variables internal to be used by other classes (#46693)
Justin Kotalik [Fri, 8 Jan 2021 16:49:48 +0000 (08:49 -0800)]
Make const variables internal to be used by other classes (#46693)

3 years agoUse signals for activation injection on macOS (#46657)
Jan Vorlicek [Fri, 8 Jan 2021 16:34:37 +0000 (17:34 +0100)]
Use signals for activation injection on macOS (#46657)

This change moves macOS activation injection to the signal plan like it
works on other Unix platforms. The reason is that the activation injection
using thread suspension and thread redirection with helper frame can
collide with signal handlers on the same thread and result in a corrupted
stack frame. The issue can be reproduced by sending signals to the
.NET process from some other process while the .NET process is doing
a lot of GCs.

3 years agoAdd missing BrotliStream methods to ref file (#46726)
Carlos Sanchez [Fri, 8 Jan 2021 15:43:07 +0000 (07:43 -0800)]
Add missing BrotliStream methods to ref file (#46726)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
3 years ago[browser] White space clean up. (#46743)
Kenneth Pouncey [Fri, 8 Jan 2021 15:37:37 +0000 (16:37 +0100)]
[browser] White space clean up. (#46743)

- Fix the white space in the file to keep VSC from creating noise every time the file is touched.
- Does not change any functioning code.

3 years agoRemove System.Runtime.Remoting.Contexts.Context, its not used anymore on netcore...
Zoltan Varga [Fri, 8 Jan 2021 14:59:02 +0000 (09:59 -0500)]
Remove System.Runtime.Remoting.Contexts.Context, its not used anymore on netcore. (#46691)

3 years agoUpdate dependencies from https://github.com/mono/linker build 20210107.1 (#46695)
dotnet-maestro[bot] [Fri, 8 Jan 2021 14:13:41 +0000 (14:13 +0000)]
Update dependencies from https://github.com/mono/linker build 20210107.1 (#46695)

[master] Update dependencies from mono/linker

3 years ago[interp] Move from stack based to fully local var based design (#46037)
monojenkins [Fri, 8 Jan 2021 11:55:18 +0000 (06:55 -0500)]
[interp] Move from stack based to fully local var based design (#46037)

Instead of having instructions that push and pop from the stack, every instruction has explicit dreg and sregs.

While the purpose of this PR is mainly to make it easier to implement more advanced optimization in the future, it also has noticeable performance implications. The code is simplified because we no longer need to update and save the SP. However, the code for each instruction is bloated due to the addition of explicit source and destination offsets. This is counteracted by the reduction of the total number of instructions, since ldloc/stloc and moves become redundant and they are mostly optimized away, even in this implementation state. Here are the total number of executed opcodes as part of running the corlib test suite with the interp https://gist.github.com/BrzVlad/d62f504930b75cba4b870e6dbd947e90.

Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
3 years ago[browser][docs] Add docs for running outerloop and browser instance (#46737)
Kenneth Pouncey [Fri, 8 Jan 2021 09:49:38 +0000 (10:49 +0100)]
[browser][docs] Add docs for running outerloop and browser instance (#46737)

* [browser][docs] Add testing docs for running outerloop and browser instance

* Add information for GitHub interface.

3 years ago[browser][bindings] Fix error with SharedArrayBuffer when used as a backing view...
Kenneth Pouncey [Fri, 8 Jan 2021 04:33:24 +0000 (05:33 +0100)]
[browser][bindings] Fix error with SharedArrayBuffer when used as a backing view. (#46625)

* Add code to check for a backing ArrayBuffer as well as a backing SharedBuffer.

- Resolves the error `"Object '...' is not a typed array"`

* Add other Slice methods per documentation of JavaScript docs

- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/slice

* Add tests for SharedArrayBuffer.

* Address review comment about unused usings

* Address review comments.

* Address review comments for unnecessary mod in commit

* Add back whitespace

* Modify comment description as per review comment

* Address support for SharedArrayBuffer which fails under Firefox.

* Revert "Address support for SharedArrayBuffer which fails under Firefox."

This reverts commit f817638f897b2c558c49a80ac47f044683c58911.

* Address support for SharedArrayBuffer which fails under Firefox.  Without all the whitespace changes.

3 years agoPort System.Speech to .NET Core (#45941)
Dan Moseley [Fri, 8 Jan 2021 03:04:13 +0000 (19:04 -0800)]
Port System.Speech to .NET Core (#45941)

* Initial sources, with banners

* Run the code formatter

* Fix hang in XUnit due to failing to complete all AsyncOperation-s

* Remove reflection over RegistryKey

* Add ref and packaging

* Add tests

* Add sln

* Fix CS1584

* Fix CA1823

* Fix CA1834

* Unnecessary suppressions

* Fix SA1028

* Fix CA1507

* Fix CA1810

* Fix CA1825

* Fix CA1825

* Unnecessary suppressions

* Fix CA1805

* Fix IDE0004

* Fix IDE0090

* Remove CAS

* Remove tabs and dead code

* Unnecessary suppressions

* Fix SA1212

* Fix SA1121

* Disable SA1129

* Fix SA1206

* Fix SA1518

* Fix SA1617

* Fix SA1001

* Fix CS0618

* Remove unnecessary comments

* Remove unnecessary whitespace

* Remove low value xml doc comments

* Unused usings

* dead files

* Remove CAS

* More junk

* Fix obvious original bug

* Remove/insert newlines

* Remove reference to old design document

* Fix spacing

* Fix typo name

* Fix file casing

* Remove dead code

* Add to compat pack

* Remove AppDomain etc

* Fix casing of .NET

* Remove low value XML docs

* Remove code that relies on compiling assemblies

* Fix inadvertently removed padding

* Use EDI to preserve stack when rethrowing

* Fix misaligned resource ID's to match sperror.h

* Skip SpeechRecognitionEngine tests if no installed recognizers

* Fix misformatted string bug

* Logging for CI error

* Fix NRE trying to map phonemes for voice for culture for which we do not have phoneme map

* Fix 153 spelling errors in comments using `Visual Studio Spell Checker`

* Remove extraneous file

* Fix spacing

* Fix project reference

* Reorder properties in csproj

* Change from netcoreapp2.0 to netcoreapp2.1

* Update src/libraries/System.Speech/pkg/System.Speech.pkgproj

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
* Add build error for targeting netcoreapp2.0

* Suppress new error during packaging testing

* Update System.Speech.targets

* Remove ref comments

* Update pkgproj

* Remove placeholder

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
3 years agoRemove incorrectly added ActiveIssue (#46680)
Aleksey Kliger (λgeek) [Fri, 8 Jan 2021 02:36:46 +0000 (21:36 -0500)]
Remove incorrectly added ActiveIssue (#46680)

https://github.com/mono/mono/issues/15029 was fixed by
https://github.com/dotnet/runtime/pull/44081, but
https://github.com/dotnet/runtime/pull/43407 incorrectly re-added the ActiveIssue.

3 years agoGlob include files based on project extension (VS) (#46702)
Viktor Hofer [Fri, 8 Jan 2021 01:20:13 +0000 (02:20 +0100)]
Glob include files based on project extension (VS) (#46702)

* Glob include files based on project extension (VS)

* Update Directory.Build.targets

* Update Directory.Build.targets

* Update Directory.Build.targets

3 years agoResolve ILLink warnings in System.Text.RegularExpressions (#46687)
Eric Erhardt [Fri, 8 Jan 2021 00:16:51 +0000 (18:16 -0600)]
Resolve ILLink warnings in System.Text.RegularExpressions (#46687)

* Add DynamicallyAccessedMembers All to TypeBuilder and EnumBuilder CreateType methods.

Contributes to #45623

3 years agoDisable System.ComponentModel.Composition on Mono (#46699)
Aleksey Kliger (λgeek) [Fri, 8 Jan 2021 00:14:26 +0000 (19:14 -0500)]
Disable System.ComponentModel.Composition on Mono (#46699)

Active issue is https://github.com/mono/mono/issues/16417

There seems to be some kind of System.Reflection.Emit concurrency problem here

3 years agoImprove SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)
Bruce Forstall [Fri, 8 Jan 2021 00:13:49 +0000 (14:13 -1000)]
Improve SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)

* Improve SuperPMI handling of CORINFO_SIG_INST handle arrays

CORINFO_SIG_INST, used by the CORINFO_SIG_INFO struct, contains
two pointers to arrays of handles. SuperPMI was saving/restoring
these assuming 8-byte pointers. This worked fine for same-bitness
record/playback (although on 32-bit it saved/restored twice as
much data as it should, reading beyond the actual arrays when
saving). However, when recording on 32-bit and replaying on 64-bit,
this didn't work.

Change the CORINFO_SIG_INST recording to record the handle arrays
in a new dense DWORDLONG map, SigInstHandleMap, in "agnostic" format (64-bit pointers),
and store an index into this map to the base of the array. The handle array
can then be serialized/deserialized properly for cross-bitness scenarios.
The map contains only unique array sequences, which is required so when
we look up an array we find the unique map index.

Create helpers for all the CORINFO_SIG_INST related serialization/deserialization/
dump/formatting.

Also, implement record/playback of getExpectedTargetArchitecture().

Added "-simple" option to "mcs -dump" to not print the function name/signature
for a method context. Useful for debugging problems where constructing that
name/signature causes mcs crashes/asserts.

Record on arm, playback on x64, using cross-compiler, now works.

* Change the JIT/EE GUID

The JIT/EE interface hasn't changed, but the SuperPMI data format
has changed incompatibly, so force a recollection that won't be
confused with the old collections.

* Fix non-Windows build

3 years agoResolve easy ILLink warnings from InteropServices, ObjectModel, Drawing.Primitives...
Eric Erhardt [Fri, 8 Jan 2021 00:10:46 +0000 (18:10 -0600)]
Resolve easy ILLink warnings from InteropServices, ObjectModel, Drawing.Primitives (#46605)

* Resolve ILLink warnings in System.Runtime.InteropServices
* Resolve ILLink warnings in System.ObjectModel
* Resolve ILLink warnings in System.Drawing.Primitives

Contributes to #45623

* Remove suppression no longer needed with the latest ILLinker.

* Annotate ComEventInterfaceAttribute.EventProvider to make it trim compatible.

3 years agoDelete DateTime FCalls and switch to fully managed implementation (#46690)
Jan Kotas [Fri, 8 Jan 2021 00:06:20 +0000 (16:06 -0800)]
Delete DateTime FCalls and switch to fully managed implementation (#46690)

3 years agoAvoid OutOfMemoryException in some test environments (#45710)
Steve Harter [Thu, 7 Jan 2021 23:54:01 +0000 (17:54 -0600)]
Avoid OutOfMemoryException in some test environments (#45710)

3 years agoUse faster Guid/Name lookup for EventSource (#45745)
Ben Adams [Thu, 7 Jan 2021 23:18:27 +0000 (23:18 +0000)]
Use faster Guid/Name lookup for EventSource (#45745)

3 years agoAllow early prop to undertand how R2R creates arrays (#42831)
nathan-moore [Thu, 7 Jan 2021 22:57:58 +0000 (17:57 -0500)]
Allow early prop to undertand how R2R creates arrays (#42831)

3 years agoChange FeedbackSize on Rijndael wrappers to delegate to implementation.
Kevin Jones [Thu, 7 Jan 2021 22:44:07 +0000 (17:44 -0500)]
Change FeedbackSize on Rijndael wrappers to delegate to implementation.

The FeedbackSize on RijndaelManaged and RijndaelImplementation were not
accurately reflecting the feedback size that the actual implementation
was using. The FeedbackSize would report 128, however the implementation
defaults to 8, so CFB8 is actually what was being used.

Likewise, the setter for FeedbackSize on the Rijndael types had no
effect. The implementation's default feedback size of 8 would always
be used.

3 years agoReduce CacheEntry size (#45962)
Adam Sitnik [Thu, 7 Jan 2021 19:57:33 +0000 (20:57 +0100)]
Reduce CacheEntry size (#45962)

* reduce the size of CacheEntry instance by 2xsizeof(int)

* remove _lock field and use "this" for locking instead

* move _expirationTokenRegistrations, _postEvictionCallbacks and _expirationTokens to separate type to reduce the typical cache entry size

* apply code review suggestion: don't use Enum.HasFlag

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
3 years agoBetter error message in ActivatorUtilities (#43762)
Joris Vergeer [Thu, 7 Jan 2021 16:48:43 +0000 (17:48 +0100)]
Better error message in ActivatorUtilities (#43762)

3 years agoAdd some rationale for why GC/API/GCSettings/InputValidation and GC/Features/LOHCompa...
imhameed [Thu, 7 Jan 2021 16:47:50 +0000 (08:47 -0800)]
Add some rationale for why GC/API/GCSettings/InputValidation and GC/Features/LOHCompaction/lohpin are disabled on Mono (#44978)

3 years agoFix watson buckets setting race condition (#46636)
Jan Vorlicek [Thu, 7 Jan 2021 16:44:04 +0000 (17:44 +0100)]
Fix watson buckets setting race condition (#46636)

* Fix watson buckets setting race condition

The code that updates watson buckets in an exception from its inner
exception has a race that can cause runtime crashes when many threads
are rethrowing the same exception using ExceptionDispatchInfo.Throw.
At several places, we check if the inner exception contains watson
buckets and if that is true, we copy them to the outer exception.
However, the ExceptionDispatchInfo.Throw on another thread can reset
the buckets to the captured value, which might be null. So the
copying then crashes with access violation.

This change fixes the issue by reading the buckets reference once and
then performing the checks / copying using that extracted value.

It also adds a regression test that asserts quickly in debug / checked
builds.

* Reflect feedback

* Make the VALIDATEOBJECTREF race-resilient
* Add license header to the test
* Fix indentation

* Fix wrong VALIDATEOBJECTREF change

3 years agoEventSource linker warnings fix (#46510)
Lakshan Fernando [Thu, 7 Jan 2021 15:59:11 +0000 (07:59 -0800)]
EventSource linker warnings fix (#46510)

* eh fix

* First set of changes for EventSource trim warnings
This is WIP that  fixes EventSource.cs warnings with other fixes to come

* incorporating fb

* incorporating feedback

* Missed removing annotation in the earlier checkin

* Incorporating feedback

* Incorporating feedback

* Incorporating feedback

* merging suppresion file with master

* fix build break

* removing a suppression for linker update

3 years ago[Mono] enable tests that seem to pass (#43407)
Aleksey Kliger (λgeek) [Thu, 7 Jan 2021 14:54:08 +0000 (09:54 -0500)]
[Mono] enable tests that seem to pass (#43407)

* Re-enable some passing tests for Mono

That have active issues in mono/mono

| Test project | Issue |
|----------------|-----------|
| `System.Numerics.Vectors` | Fixes https://github.com/mono/mono/issues/15190 |
| `System.ComponentModel.Composition` | Partly addresses https://github.com/mono/mono/issues/16417 |
| `System.Private.Xml` | Fixes https://github.com/mono/mono/issues/15353 |
| `System.Linq.Parallel` | Fixes https://github.com/mono/mono/issues/14956 |

3 years agoBackport changes affecting EventPipe from PR 45672 into C library. (#46220)
Johan Lorensson [Thu, 7 Jan 2021 08:06:26 +0000 (09:06 +0100)]
Backport changes affecting EventPipe from PR 45672 into C library. (#46220)

3 years agoBackport changes affecting EventPipe from PR 38225 into C library. (#46219)
Johan Lorensson [Thu, 7 Jan 2021 08:05:28 +0000 (09:05 +0100)]
Backport changes affecting EventPipe from PR 38225 into C library. (#46219)

* Backport changes affecting EventPipe from PR 38225 into C library.

* Mono only supports portable thread pool.

3 years agoBackport parts of EventPipe PR 43711 not currently in C library. (#46214)
Johan Lorensson [Thu, 7 Jan 2021 08:04:11 +0000 (09:04 +0100)]
Backport parts of EventPipe PR 43711 not currently in C library. (#46214)

3 years agoDon't consider types with empty base classes blittable. They have a different managed...
Jeremy Koritzinsky [Thu, 7 Jan 2021 02:39:01 +0000 (18:39 -0800)]
Don't consider types with empty base classes blittable. They have a different managed and native size. (#46653)

* Don't consider types with empty base classes blittable. They have a different managed and native size.

* Add test.

* Update src/coreclr/vm/classlayoutinfo.cpp

3 years agoIntroduce CallConvSuppressGCTransition type to enable suppressing the transition...
Jeremy Koritzinsky [Thu, 7 Jan 2021 02:19:25 +0000 (18:19 -0800)]
Introduce CallConvSuppressGCTransition type to enable suppressing the transition frame for unmanaged function pointer calls (#46343)

* Add public CallConvSuppressGCTransition type

* Fix parsing CallConv modopts out of an IL stub.

* Insert SuppressGCTransition modopt into ilstub target sig. Use modopts for IL stub callconv when SuppressGCTransition in use.

* Recognize CallConvSuppressGCTransition as supressing the GC transition for modopts (Coreclr and crossgen1).

* Support specifying CallConvSuppressGCTransition on both inlinable and non-inlinable calli.

* Enable SuppressGCTransition on calli signatures in crossgen2.

* Fix callconv in il

* PR feedback

* Add docs.

* Use STANDARD_VM_CONTRACT and fix clang build.

* Update contracts in jitinterface.

* Exclude test on mono since support isn't implemented.

* Fix contract.

* PR feedback.

* Add flags back to cache.

3 years agoFix TestsManifestGeneration tests (#46658)
Sung Yoon Whang [Thu, 7 Jan 2021 01:52:32 +0000 (17:52 -0800)]
Fix TestsManifestGeneration tests (#46658)

* Flush before checking for manifest data

* add comments

3 years agoBring back checkout bundle for PRs until AzDo fixes PR job checkouts (#46649)
Santiago Fernandez Madero [Wed, 6 Jan 2021 23:29:33 +0000 (15:29 -0800)]
Bring back checkout bundle for PRs until AzDo fixes PR job checkouts (#46649)

3 years agoDisable runtime tests that hit known limitations (#46623)
Vlad Brezae [Wed, 6 Jan 2021 23:20:25 +0000 (01:20 +0200)]
Disable runtime tests that hit known limitations (#46623)

3 years agoFix rare cleanup race condition in Task.Delay (#46631)
Stephen Toub [Wed, 6 Jan 2021 21:48:02 +0000 (16:48 -0500)]
Fix rare cleanup race condition in Task.Delay (#46631)

If both a timeout and a cancelable token are provided, and if the timer manages to fire between the time that it's created and the time that we register with the cancellation token immediately after, we will end up leaking a registration into the token.

3 years agoJIT: clear patchpoint flags during block split (#46637)
Andy Ayers [Wed, 6 Jan 2021 21:09:26 +0000 (13:09 -0800)]
JIT: clear patchpoint flags during block split (#46637)

We only want the patchpoint flags to apply to the original block,
not the split remainder block.

3 years ago[mono] Add MonoAOTCompiler MSBuild Task to produce NuPkg (#46537)
Mitchell Hwang [Wed, 6 Jan 2021 20:43:12 +0000 (15:43 -0500)]
[mono] Add MonoAOTCompiler MSBuild Task to produce NuPkg (#46537)

* Test workload

* Remove hardcoded path to MonoAOTCompiler

Remove changes related to testing the MonoAOTCompiler NuPkg

Remove changes to deprecated files that led to file additions

* Inline pkg descriptions for MonoAOTCompiler Task and workload packs

* Remove Workload AOT additions

* Replace _ILLinkTasksDirectoryRoot with _AOTTasksDirectoryRoot

* Add TargetsMobile condition

* Remove temporary variables

* Reword MonoAOTCompiler NuPkg description

* Remove NuPkg import of MonoAOTCompiler UsingTask

* Add MonoAOTCompilerTaskAssemblyPath property

* Cleanup Microsoft.NET.Runtime.MonoAOTCompiler.Tasks.props

* Add README.md with example of using the NuPkg

* Specify the package files for the aot task, in the project itself

* Add comment for GetFilesToPackage target

* Update README.md

Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
3 years agoUpdate dependencies from https://github.com/mono/linker build 20210106.1 (#46635)
dotnet-maestro[bot] [Wed, 6 Jan 2021 19:59:59 +0000 (14:59 -0500)]
Update dependencies from https://github.com/mono/linker build 20210106.1 (#46635)

Microsoft.NET.ILLink.Tasks
 From Version 6.0.0-alpha.1.21054.5 -> To Version 6.0.0-alpha.1.21056.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoImplement and use MultiArrayBuffer (#44980)
Geoff Kizer [Wed, 6 Jan 2021 19:06:15 +0000 (11:06 -0800)]
Implement and use MultiArrayBuffer (#44980)

* add MultiArrayBuffer and use in StreamBuffer and Http2Stream

* rework EnsureAvailableSpace and add tests for it

* make dispose handling more robust, plus minor tweaks

* add AssertExtensions.SequenceEqual for providing more useful information about sequence differences, and use in StreamConformanceTests

* tweaks

* replace _blockCount with _allocatedEnd

* use uint instead of int internally to assure bitop optimizations

* fix _allocatedEnd calculation

* address PR feedback

* more PR feedback and some minor fixes/improvements

* small test improvements

* Apply suggestions from code review

Co-authored-by: Günther Foidl <gue@korporal.at>
* address review feedback

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
Co-authored-by: Günther Foidl <gue@korporal.at>
3 years agoPGO: don't record info for collectible classes (#46611)
Andy Ayers [Wed, 6 Jan 2021 19:04:38 +0000 (11:04 -0800)]
PGO: don't record info for collectible classes (#46611)

Map method tables for collectible classes to null so profile entries won't
hold onto pointers that can become invalid.

Record the nulls in the profiles so that collectible classes still impact the
profile stats.

3 years ago[mono] Add functional tests for the supported platforms (#46286)
Maxim Lipnin [Wed, 6 Jan 2021 19:01:22 +0000 (22:01 +0300)]
[mono] Add functional tests for the supported platforms (#46286)

Part of https://github.com/dotnet/runtime/issues/43865

The functional tests:

- live under src/tests/FunctionalTests directory.
- are built as a part of the library tests build.
- are isolated from the build/test setup used for the tests in src/tests
- run on CI

3 years agoDisable TC for UnmanagedCallersOnly methods. (#46550)
Jeremy Koritzinsky [Wed, 6 Jan 2021 18:51:48 +0000 (10:51 -0800)]
Disable TC for UnmanagedCallersOnly methods. (#46550)

3 years agoFix conversions from subnormal System.Half values (#46536)
Tanner Gooding [Wed, 6 Jan 2021 18:15:24 +0000 (10:15 -0800)]
Fix conversions from subnormal System.Half values (#46536)

* Fix conversions from subnormal System.Half values

* Fix conversions from subnormal System.Single/Double to System.Half values

* Fixing the HalfTests parameters

3 years agoJIT: fix layering of profile and model inlining policies (#46612)
Andy Ayers [Wed, 6 Jan 2021 17:01:14 +0000 (09:01 -0800)]
JIT: fix layering of profile and model inlining policies (#46612)

Both these policies delegate to the discretionary policy. When that policy
makes a decision, the overlaying policies shouldn't take further action.

In particular, in some test cases we were failing an inline twice for
recursion depth, once via the discretionary policy, and once via the
overlay policy; this triggered an assert.

3 years agoConvert Debugger.Log and Debugger.Launch to QCalls (#46617)
Jan Kotas [Wed, 6 Jan 2021 13:49:22 +0000 (05:49 -0800)]
Convert Debugger.Log and Debugger.Launch to QCalls (#46617)

3 years agoFixing doc link to maximum file path limitation removal (#46627)
Lukas Lansky [Wed, 6 Jan 2021 13:49:01 +0000 (14:49 +0100)]
Fixing doc link to maximum file path limitation removal (#46627)

3 years ago[Android] Implement RSA encryption using Android SDK (#45870)
Egor Bogatov [Wed, 6 Jan 2021 12:35:51 +0000 (15:35 +0300)]
[Android] Implement RSA encryption using Android SDK (#45870)

3 years agoFix Socket.ReceiveFrom on Unix (#46151)
Anton Firszov [Wed, 6 Jan 2021 12:22:48 +0000 (13:22 +0100)]
Fix Socket.ReceiveFrom on Unix (#46151)

Fix a regression within the sync-over-async blocking path within the Unix ReceiveFrom implementation.

3 years agoset BuildingInsideOfficialBuild (#46615)
Anirudh Agnihotry [Wed, 6 Jan 2021 06:42:47 +0000 (22:42 -0800)]
set BuildingInsideOfficialBuild (#46615)

3 years agoDelete reflection blocking on GetThreadDeserializationTracker (#46607)
Jan Kotas [Wed, 6 Jan 2021 04:50:47 +0000 (20:50 -0800)]
Delete reflection blocking on GetThreadDeserializationTracker (#46607)

Fixes https://github.com/mono/mono/issues/15112

3 years agoRemove duplicate bundle WXL file (#46599)
Nikola Milosavljevic [Wed, 6 Jan 2021 03:54:45 +0000 (19:54 -0800)]
Remove duplicate bundle WXL file (#46599)

3 years ago[Mono][jit] Emit GC transitions for "calli unmanaged" instructions (#46491)
Aleksey Kliger (λgeek) [Wed, 6 Jan 2021 02:29:58 +0000 (21:29 -0500)]
[Mono][jit] Emit GC transitions for "calli unmanaged" instructions (#46491)

* [metadata] Treat CallConv bit 0x09 as MONO_CALL_UNMANAGED_MD

This is the C#9 function pointers "unmanaged"+ext calling convention.
Additional calling convention details are encoded in the modopts of the return
type.

This PR doesn't handle the modopts yet

* [marshal] Add mono_marshal_get_native_func_wrapper_indirect

This will be used to add a wrapper around "calli sig" indirect calls where "sig" has
an unmanaged calling convention.

We need to do a GC transition before calling an unmanaged function from
managed. So this wrapper does it.

This is reusing much of the code implemented for
mono_marshal_get_native_func_wrapper_aot which is used for delegates.
Unfortunately that means that the function pointer is (pointlessly) boxed when
it is passed as the first argument.

* [jit] Use a wrapper for "calli unmanaged" instructions

If there's a calli with an unmanaged signature, invoke a wrapper that
does a transition to GC Safe mode and then do the call.

The wrapper is always inlined into the callee.

Because we're reusing much of the code of
mono_marshal_get_native_func_wrapper_aot, the function pointer first has to be
boxed before it's passed to the wrapper.  In theory we should be able to just
pass it directly and get much simpler code.  But that will require changing the
code in emit_native_wrapper_ilgen to get an unboxed function pointer arg

* fixup don't emit GC transitions in runtime invoke wrapper

* fixup don't emit two wrappers on dynamic methods

* check that calli wrapper only gets blittable args

* negate logic for when to add an indirection wrapper

assume that if the callee is a wrapper, it doesn't need the transition, and
only add it to normal managed methods.

* add disabled debug printf

* Add MonoNativeWrapperFlags arg to emit_native_wrapper

Replace the 4 boolean args by a flags arg.

Also add a new EMIT_NATIVE_WRAPPER_FUNC_PARAM_UNBOXED and use it in
mono_marshal_get_native_func_wrapper_indirect.  The new flag has no effect yet.

* Address review feedback

* Use an unboxed func ptr mono_marshal_get_native_func_wrapper_indirect

Add support for the EMIT_NATIVE_WRAPPER_FUNC_PARAM_UNBOXED flag to mono_marshal_emit_native_wrapper

3 years agoCleanups after awk dependency removal (#46574)
Adeel Mujahid [Wed, 6 Jan 2021 02:20:37 +0000 (04:20 +0200)]
Cleanups after awk dependency removal (#46574)

3 years agoFix `assert(isByteReg(ireg))`. (#46567)
Sergey Andreenko [Wed, 6 Jan 2021 01:58:46 +0000 (17:58 -0800)]
Fix `assert(isByteReg(ireg))`. (#46567)

3 years agoRemove JIT_FLAG_PROF_REJIT_NOPS (#46560)
Egor Chesakov [Wed, 6 Jan 2021 01:16:15 +0000 (17:16 -0800)]
Remove JIT_FLAG_PROF_REJIT_NOPS (#46560)

* Remove padding for ReJit in CodeGen::genAllocLclFrame in src/coreclr/jit/codegenxarch.cpp

* Remove JIT_FLAG_PROF_REJIT_NOPS in src/coreclr/jit/jitee.h

* Remove CORJIT_FLAG_PROF_REJIT_NOPS in src/coreclr/inc/corjitflags.h

* Remove CORJIT_FLAG_PROF_REJIT_NOPS in src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs

* Remove genPrologPadForReJit() in src/coreclr/jit

* Remove dead code in src/coreclr/jit

* Update JIT/EE interface GUID in src/coreclr/inc/jiteeversionguid.h

3 years agoHandle '/' in locale name in PAL (#46601)
Adeel Mujahid [Wed, 6 Jan 2021 00:29:56 +0000 (02:29 +0200)]
Handle '/' in locale name in PAL (#46601)

3 years agoFix build errors using GCC 11 (#46334)
Omair Majid [Tue, 5 Jan 2021 23:50:18 +0000 (18:50 -0500)]
Fix build errors using GCC 11 (#46334)

Building runtime with GCC 11 leads to some new errors. The errors are
consistent with the "Header dependency changes" section documented at
https://gcc.gnu.org/gcc-11/porting_to.html

The first set of errors looks like this:

    runtime/src/coreclr/pal/src/misc/cgroup.cpp:403:29:
    error: no member named 'numeric_limits' in namespace 'std'
              if (temp > std::numeric_limits<size_t>::max())
                         ~~~~~^

Fix that by including <limits>.

The second set of errors looks like this:

    runtime/src/installer/corehost/cli/test/nativehost/host_context_test.cpp:634:31:
     error: no member named 'sleep_for' in namespace 'std::this_thread'
              std::this_thread::sleep_for(std::chrono::milliseconds(100));
              ~~~~~~~~~~~~~~~~~~^

Fix that by including <thread>.

3 years agoPass an alc to Assembly.Load() in GetSatelliteAssembly() to avoid a stack walk. ...
Zoltan Varga [Tue, 5 Jan 2021 23:48:50 +0000 (18:48 -0500)]
Pass an alc to Assembly.Load() in GetSatelliteAssembly() to avoid a stack walk. (#46534)

3 years agoCleanup, and little improvement for aggressive trimming (#46587)
Ankit Jain [Tue, 5 Jan 2021 21:48:00 +0000 (16:48 -0500)]
Cleanup, and little improvement for aggressive trimming (#46587)

* Cleanup, and little improvement for aggressive trimming

- The `ConfigureTrimming` target adds xunit assemblies explicitly, and
  sets `TriggerRootAssembly` too.

- Looking at the files being linked, some issues noticed:
    - Multiple copies of xunit assemblies, from various locations are
      included. Eg. from `System.Buffer.Tests`, `WasmTestRunner`, and
      from the nuget
    - `WasmTestRunner` is explicitly added as `TriggerRootAssembly`, but
      it is also passed as an arg for linking, `-p link ...`
    - `xunit.runner.json` is incorrectly added to the files to be linked

- Instead:
    - all the files to be published are already in
      `ResolvedFileToPublish` after `AddTestRunnersToPublishedFiles` target
    - so, we mark everything for linking,
    - *except*:
        - main test assembly
        - and the test runner assembly

    - This way we are explicitly specifying which assemblies to link,
      and which ones to `copy`

- This reduces the size:
    - 3.1M to 2.6M `artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/managed/`
    - 46M to 31M `artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/publish/`

* cleanup

* Trim the test runner also. based on @mareks' feedback

3 years agoEnsure special static slots respect alignment. (#43683)
monojenkins [Tue, 5 Jan 2021 21:19:04 +0000 (16:19 -0500)]
Ensure special static slots respect alignment. (#43683)

Without proper alignment, this may lead to reference types
being stored at non-pointer aligned offsets. Among other
issues this may lead to the GC not scanning those pointers
properly.

For example, a type such as
```
struct Point
{
    public int X;
    public int Y;
}
```
will have size 8 and alignment 4 on x64 platforms.

If we reuse the special slot allocated for the `Point` type to store
a reference pointer, it may not be pointer aligned.

Co-authored-by: joncham <joncham@users.noreply.github.com>
3 years ago[mono] Add support for PINVOKE_OVERRIDE (#46442)
Ryan Lucia [Tue, 5 Jan 2021 21:04:00 +0000 (16:04 -0500)]
[mono] Add support for PINVOKE_OVERRIDE (#46442)

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
3 years agoUse assembly name formatting code for missing satellite assemblies (#45472)
Marek Safar [Tue, 5 Jan 2021 20:52:39 +0000 (21:52 +0100)]
Use assembly name formatting code for missing satellite assemblies (#45472)

exception message

3 years ago[master] Update dependencies from mono/linker (#46557)
dotnet-maestro[bot] [Tue, 5 Jan 2021 20:36:16 +0000 (20:36 +0000)]
[master] Update dependencies from mono/linker (#46557)

[master] Update dependencies from mono/linker

3 years agoUse Centos8 instead Centos7 for Helix tests (#46205)
Tomas Weinfurt [Tue, 5 Jan 2021 20:28:55 +0000 (12:28 -0800)]
Use Centos8 instead Centos7 for Helix tests (#46205)

* use Centos8 instead Centos8 for tests

* pick up image with libicu

* pull in new image with openssl app

3 years agoRemove StartupHooks ILLink warning suppressions from shared file (#46559)
Eric Erhardt [Tue, 5 Jan 2021 19:27:54 +0000 (13:27 -0600)]
Remove StartupHooks ILLink warning suppressions from shared file (#46559)

One suppression is needed going forward in order for developers to get a warning if they trim apps with StartupHookProvider.IsSupported=true.

Contributes to #45623