platform/upstream/dotnet/runtime.git
4 years agoMerge branch 'master' of github.com:dotnet/runtime into type-isassignedfrom
EgorBo [Sat, 1 Feb 2020 11:39:08 +0000 (14:39 +0300)]
Merge branch 'master' of github.com:dotnet/runtime into type-isassignedfrom

# Conflicts:
# src/coreclr/tests/src/JIT/Intrinsics/TypeIntrinsics.cs
# src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs

4 years agoEmit DebugDirectory section and all DebugDirectory entries (#2398)
Fadi Hanna [Sat, 1 Feb 2020 05:33:38 +0000 (00:33 -0500)]
Emit DebugDirectory section and all DebugDirectory entries (#2398)

* Emit DebugDirectory section and all DebugDirectory entries

- Add new RELOC type for raw data points
- Emit native DebugDirectory entry with proper MD5 hash of the output image
- Fix determinism issue: timestamp has to be copied from input IL image

4 years agoCleanup NETCOREAPP ifdef usage in System.Runtime.Tests (#22224)
Jan Kotas [Sat, 1 Feb 2020 03:17:23 +0000 (19:17 -0800)]
Cleanup NETCOREAPP ifdef usage in System.Runtime.Tests (#22224)

Fixes #21827

4 years agoDisable macOS 10.15 from fullMatrix runs
Jeremy Barton [Sat, 1 Feb 2020 01:47:45 +0000 (17:47 -0800)]
Disable macOS 10.15 from fullMatrix runs

This OS was just enabled a couple of days ago, and isn't testing so hot.

Turning it off until it can come back on in a passing state.

4 years agoFix UpperVector save asserts (#2268)
Carol Eidt [Sat, 1 Feb 2020 01:11:41 +0000 (17:11 -0800)]
Fix UpperVector save asserts (#2268)

Not all helper calls have standard kill sets.
Fix #2181

4 years ago Rename cross compilation related defines (#2256)
Steve MacLean [Sat, 1 Feb 2020 00:36:44 +0000 (19:36 -0500)]
 Rename cross compilation related defines (#2256)

* Rename identifiers to be more consistent

This patch was a machine generated search and replace of
identifiers.  The replacement was done in the order listed
for the path specified.

A regex was used to find the identifiers.

s/(^|[^A-CE-Za-z0-9_])${find}($|[^A-Za-z0-9_])

The 'D' character was specifically allowed a s a prefix
to catch add_definitions(-D${find}).

The patch also reverts all managed code changes after replacement.

    _ARM_                -> HOST_ARM       in src/coreclr
    _ARM64_              -> HOST_ARM64     in src/coreclr
    _AMD64_              -> HOST_AMD64     in src/coreclr
    _X86_                -> HOST_X86       in src/coreclr
    _HOST_UNIX_          -> HOST_UNIX      in src/coreclr
    _HOST_AMD64_         -> HOST_AMD64     in src/coreclr
    _HOST_ARM64_         -> HOST_ARM64     in src/coreclr
    _HOST_ARM_           -> HOST_ARM       in src/coreclr
    _HOST_X86_           -> HOST_X86       in src/coreclr
    DBG_TARGET_AMD64     -> TARGET_AMD64   in src/coreclr
    DBG_TARGET_ARM64     -> TARGET_ARM64   in src/coreclr
    DBG_TARGET_ARM       -> TARGET_ARM     in src/coreclr
    DBG_TARGET_X86       -> TARGET_X86     in src/coreclr
    _TARGET_AMD64_       -> TARGET_AMD64   in src/coreclr
    _TARGET_ARM_         -> TARGET_ARM     in src/coreclr
    _TARGET_ARM64_       -> TARGET_ARM64   in src/coreclr
    _TARGET_X86_         -> TARGET_X86     in src/coreclr
    _TARGET_ARMARCH_     -> TARGET_ARMARCH in src/coreclr
    _TARGET_XARCH_       -> TARGET_XARCH   in src/coreclr
    _HOST_64BIT_         -> HOST_64BIT     in src/coreclr
    BIT64                -> HOST_64BIT     in src/coreclr
    _TARGET_64BIT_       -> TARGET_64BIT   in src/coreclr
    DBG_TARGET_64BIT     -> TARGET_64BIT   in src/coreclr
    HOST_IS_WINDOWS_OS   -> HOST_WINDOWS   in src/coreclr
    PLATFORM_UNIX        -> HOST_UNIX      in src/coreclr/*.cmake
    PLATFORM_WINDOWS     -> HOST_WINDOWS   in src/coreclr/*.cmake
    _TARGET_MAC64        -> TARGET_OSX     in src/coreclr
    FEATURE_PAL          -> TARGET_UNIX    in src/coreclr
    _TARGET_UNIX_        -> TARGET_UNIX    in src/coreclr
    _TARGET_WINDOWS_     -> TARGET_WINDOWS in src/coreclr
    PLATFORM_UNIX        -> TARGET_UNIX    in src/coreclr
    PLATFORM_WINDOWS     -> TARGET_WINDOWS in src/coreclr

* Miscellaneous manual fixes to fix compilation

Remove unused defines

Remove BIT32
Remove DBG_TARGET_AMD64_UNIX
Remove DBG_TARGET_ARM64_UNIX
Remove DBG_TARGET_ARM_UNIX
Remove DBG_TARGET_32BIT

Fixes for HOST_<arch> rename

Move TARGET_<Arch> and TARGET_<bit>

Move from clrdefinitions.cmake
to configurecompiler.cmake so it is used globally.

More jit.h

* Whitespace by clang-format

4 years agocrossgen2 ARM support misc (#21109)
Yaroslav Yamshchikov [Fri, 31 Jan 2020 22:57:09 +0000 (01:57 +0300)]
crossgen2 ARM support misc (#21109)

4 years agoFix handling of missing ConfigurationGroup property (#24077)
Jared Parsons [Fri, 31 Jan 2020 22:11:05 +0000 (14:11 -0800)]
Fix handling of missing ConfigurationGroup property (#24077)

* Account for missing ConfigurationGroup

Our logic for setting the CoreCLR and Mono runtime configurations didn't
properly account for cases where only `$(Configuration)` was passed down
as a build property. It expects that both `$(Configuration)` and
`$(ConfigurationGroup)` are passed down as a pair.

This change guards against us accidentially setting the runtime
configuration to the current library definition of configuration which
is more like a target framework than Debug or Release.

Related to #23800

* Test for missing ConfigurationGroup

4 years agoAbort cmov optimization, when one of the out blocks is try block (#2373)
monojenkins [Fri, 31 Jan 2020 21:41:20 +0000 (16:41 -0500)]
Abort cmov optimization, when one of the out blocks is try block (#2373)

Fixes mono/mono#17733

Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
4 years agoAdd profiler APIs for writing EventPipe events (#2173)
David Mason [Fri, 31 Jan 2020 21:01:10 +0000 (13:01 -0800)]
Add profiler APIs for writing EventPipe events (#2173)

* Profiler APIs for writing events

* Code review feedback

* Change EVENTPIPE_EVENTID to EVENTPIPE_EVENT to avoid confusion with EventID

* have the runtime pack the arguments instead of the profiler

* Add more checks in asserts

4 years agoNew pgo format for crossgen2 (#2314)
David Wrighton [Fri, 31 Jan 2020 20:56:47 +0000 (12:56 -0800)]
New pgo format for crossgen2 (#2314)

* Adjust compilation model to support trace based profile guided optimization data in a new format
- Add parser for new format
- Adjust program startup and options parsing to make it simpler for the profiler guided logic to be aware of version bubbles
- Use CompilationModuleGroup and version bubble in parsing and handling of profile data

* Handle malformed and incorrect IBC data

4 years agoReferred GC Benchmarking Infra in the GC Performance testing docs (#5532)
Ivan Diaz Sanchez [Fri, 31 Jan 2020 20:30:05 +0000 (12:30 -0800)]
Referred GC Benchmarking Infra in the GC Performance testing docs (#5532)

4 years agoimport thunks for ARM just from zapper (#21072)
Yaroslav Yamshchikov [Fri, 31 Jan 2020 19:49:01 +0000 (22:49 +0300)]
import thunks for ARM just from zapper (#21072)

4 years agoKey should be non null (#5072)
buyaa-n [Fri, 31 Jan 2020 19:15:37 +0000 (11:15 -0800)]
Key should be non null (#5072)

4 years agoAdd runtime flavor to test run name for libraries outerloop runs (#12715)
Santiago Fernandez Madero [Fri, 31 Jan 2020 18:26:33 +0000 (10:26 -0800)]
Add runtime flavor to test run name for libraries outerloop runs (#12715)

* Add runtime flavor to test run name for libraries outerloop runs

* Bring Windows_x64 back

4 years agoAvoid extra indirect writes in BinaryPrimitives.TryRead methods (#20985)
Stephen Toub [Fri, 31 Jan 2020 17:54:44 +0000 (12:54 -0500)]
Avoid extra indirect writes in BinaryPrimitives.TryRead methods (#20985)

4 years ago[aot] Add support for making direct cross-assembly calls in llvm mode. (#2225)
monojenkins [Fri, 31 Jan 2020 16:41:39 +0000 (11:41 -0500)]
[aot] Add support for making direct cross-assembly calls in llvm mode. (#2225)

Co-authored-by: Zoltan Varga <vargaz@gmail.com>
4 years agoCleanup outdated docs (#21915)
Jan Kotas [Fri, 31 Jan 2020 16:00:05 +0000 (08:00 -0800)]
Cleanup outdated docs (#21915)

* Delete outdated redundant PR docs

* Delete outdated docs

* Delete portability analyzer docs

Outdates and redundant with official documentation

4 years ago[jit] Avoid generating wbarriers for vtype stores to the stack. (#2089)
monojenkins [Fri, 31 Jan 2020 14:54:20 +0000 (09:54 -0500)]
[jit] Avoid generating wbarriers for vtype stores to the stack. (#2089)

The existing heuristic doesn't work with llvm.

Co-authored-by: Zoltan Varga <vargaz@gmail.com>
4 years agoScript copying SDKs to testhost folder so they can be loaded into stress test contain...
Alexander Nikolaev [Fri, 31 Jan 2020 14:53:37 +0000 (15:53 +0100)]
Script copying SDKs to testhost folder so they can be loaded into stress test containers (#19178)

System.Net.Http stress test infra can build test containers from a local runtime build, however it currently fails on startup due to missing SDKs. This PR adds script which can be run before running the main run-docker-compose.ps1 to copy SDKs to testhost folder, so container building logic can find them.

4 years agoFix OverflowException from IntPtr casting (#14381)
Swift Kim [Fri, 31 Jan 2020 14:27:40 +0000 (23:27 +0900)]
Fix OverflowException from IntPtr casting (#14381)

4 years agoConvert AppDomainNative::CreateDynamicAssembly to QCall (#2381)
Dong-Heon Jung [Fri, 31 Jan 2020 14:18:30 +0000 (23:18 +0900)]
Convert AppDomainNative::CreateDynamicAssembly to QCall (#2381)

- Get rid of the libunwind overhead by converting to QCall

4 years agoAdd missing throw in CertificateValidationApple_EndToEnd_Ok
Tomas Weinfurt [Fri, 31 Jan 2020 13:59:19 +0000 (05:59 -0800)]
Add missing throw in CertificateValidationApple_EndToEnd_Ok

4 years agoUpdate yamls with latest release info. Clean out EOL versions. (#2371)
Lee Coward [Fri, 31 Jan 2020 11:11:57 +0000 (03:11 -0800)]
Update yamls with latest release info. Clean out EOL versions. (#2371)

4 years agoDelete remaining reflection security checks (#2348)
Jan Kotas [Fri, 31 Jan 2020 10:42:17 +0000 (02:42 -0800)]
Delete remaining reflection security checks (#2348)

* Delete remaining reflection security checks

Most the reflection security checks to restrict use of private reflection were deleted in CoreCLR years ago. There were still some left that got noticed in performance profiles.

* Delete IsCalledFromInterop

* Rename StaticAccessCheckContext to AccessCheckContext

4 years agoUpdate Dotnet host for testing and add RuntimeFrameworkVersion to nca5.0 package...
Santiago Fernandez Madero [Fri, 31 Jan 2020 06:30:49 +0000 (22:30 -0800)]
Update Dotnet host for testing and add RuntimeFrameworkVersion to nca5.0 package testing (#2290)

* Update Dotnet host for testing and add RuntimeFrameworkVersion to nca5.0 package testing

* Update host version to latest containing musl arm fix

4 years agoDisable HttpListener tests failing on Mono in CI (#9373)
Stephen Toub [Fri, 31 Jan 2020 06:25:59 +0000 (01:25 -0500)]
Disable HttpListener tests failing on Mono in CI (#9373)

4 years agoMerge pull request #10554 from monojenkins/sync-pr-18497-from-mono
Zoltan Varga [Fri, 31 Jan 2020 05:39:22 +0000 (00:39 -0500)]
Merge pull request #10554 from monojenkins/sync-pr-18497-from-mono

Move generic_class_init out of line to assist branch prediction.

4 years agoMove generic_class_init out of line to assist branch prediction.
lateralusX [Fri, 31 Jan 2020 04:28:41 +0000 (04:28 +0000)]
Move generic_class_init out of line to assist branch prediction.

When calling a generic class we need to make sure it has been initilized. This is done by calling generic_class_init. Since the need to check if the method has been executed happens frequently, but will only run once, it should be put out of line, assisting branch predictor, preventing misspredictions (in all places but the first).

Currently this is not the case, since we will generate code like this:

```
0000000000000484: cmp         byte ptr [rcx+2Dh],0
0000000000000488: jne         000000000000048F
000000000000048A: call        p_3_plt_EmptyGame__jit_icall_mono_generic_class_init_llvm
000000000000048F: mov         rax,qword ptr [mono_aot_EmptyGame_llvm_got+0C8h]
```

Where we will always (except for first call) take the forward branch.

Instead we should mark the call to the method as out of line, at least giving the code generator the information so it can move it out of line and preventing a jmp, unless when it needs to init, the slow path. Doing that will generate the following code:

```
0000000000000484: cmp         byte ptr [rcx+2Dh],0
0000000000000488: je          00000000000004C1
000000000000048A: mov         rax,qword ptr [mono_aot_EmptyGame_llvm_got+0C8h]
...
00000000000004C1: call        p_3_plt_EmptyGame__jit_icall_mono_generic_class_init_llvm
00000000000004C6: jmp         000000000000048A

```

4 years agoImprove resiliency of CertificateValidationRemoteServer_EndToEnd_Ok test (#2369)
Tomas Weinfurt [Fri, 31 Jan 2020 04:27:00 +0000 (20:27 -0800)]
Improve resiliency of CertificateValidationRemoteServer_EndToEnd_Ok test (#2369)

* Improve resiliency of CertificateValidationRemoteServer_EndToEnd_Ok test

* minor update

* add sync version

* feedback from review

4 years agoimprove handling of kSecTrustResultRecoverableTrustFailure (#2135)
Tomas Weinfurt [Fri, 31 Jan 2020 04:25:49 +0000 (20:25 -0800)]
improve handling of kSecTrustResultRecoverableTrustFailure (#2135)

* improve handling of kSecTrustResultRecoverableTrustFailure

* feedback from review

4 years agoimprove Connection_UnderDifferentUsers_BehavesAsExpected test (#2549)
Tomas Weinfurt [Fri, 31 Jan 2020 04:16:58 +0000 (20:16 -0800)]
improve Connection_UnderDifferentUsers_BehavesAsExpected test (#2549)

* improve Connection_UnderDifferentUsers_BehavesAsExpected test

* feedback from review

4 years agoFix Receive loop in System.Net.Quic, add test (#6035)
Justin Kotalik [Fri, 31 Jan 2020 04:04:45 +0000 (20:04 -0800)]
Fix Receive loop in System.Net.Quic, add test (#6035)

4 years agoJIT: improve stress range experience (#2313)
Andy Ayers [Fri, 31 Jan 2020 03:21:12 +0000 (19:21 -0800)]
JIT: improve stress range experience (#2313)

Use `compMethodHash` for stress and inline range inclusions.

Base all stress decisions on the hash of the root method.

Indicate if stress is potentially active for a method in the one-line output
from `DumpJittedMethods`. Indicate if stress is active but this method is
excluded from stress by name or hash.

Update inline xml to use hex for tokens and hashes.

Update`JitPrintInlinedMethods` to take a method set, likewise for `JitPrintDevirtualizedMethods`.

4 years agoUpdate ActiveIssue URLs for Newtonsoft tests for immutable collections (#6215)
Layomi Akinrinade [Fri, 31 Jan 2020 02:57:20 +0000 (18:57 -0800)]
Update ActiveIssue URLs for Newtonsoft tests for immutable collections (#6215)

4 years agoLocal live builds not picking up runtime config (#2093)
Jared Parsons [Fri, 31 Jan 2020 00:35:27 +0000 (16:35 -0800)]
Local live builds not picking up runtime config (#2093)

* Local live builds not picking up runtime config

The local live builds were not properly picking up the runtime
configuration varaible. This meant that libraries always attempted to
build against a Debug CoreCLR even if the developer specified
`-runtimeConfiguration Release`

* PR Feedback:

- Ensure that `$(RuntimeConfiguration)` is always set
- Remove duplicated logic in Subsets.props

* Remove unnecessary properties

* Progress

* Mix configurations

Change the live / live jobs so they mix release and debug
configurations. This will help ensure we avoid future breaks in this
area

* Undo MonoOsGorup delete

* Correct the import order

* Publish binary logs

* Pass -ci as this is a CI build

* Progress

* Test

* Set ArtifactsObjDir early enough for Mono

Mono currently relies on ArtifactsObjDir when setting
BaseIntermediateOutputPath. Not setting it leads to restore issues.

* Don't overwrite the properties

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
4 years agoMerge pull request #2397 from vargaz/aot-races
Zoltan Varga [Thu, 30 Jan 2020 22:12:39 +0000 (17:12 -0500)]
Merge pull request #2397 from vargaz/aot-races

[aot] Fix some races if GOT entries are already set.

4 years agoTry changing dotnet installation path to avoid clash with the one in tools directory...
Santiago Fernandez Madero [Thu, 30 Jan 2020 22:07:11 +0000 (14:07 -0800)]
Try changing dotnet installation path to avoid clash with the one in tools directory (#3856)

4 years agoFix unhandled exception line number issues (#2269)
Mike McLaughlin [Thu, 30 Jan 2020 21:20:58 +0000 (13:20 -0800)]
Fix unhandled exception line number issues (#2269)

Fix unhandled exception line number issues

There are a few paths to get the place (DebugStackTrace::DebugStackTraceElement::InitPass2) where
the offset/ip needs an adjustment:

1) The System.Diagnostics.StackTrace constructors that take an exception object. The stack trace in
   the exception object is used (from the _stackTrace field).
2) Processing an unhandled exception for display (ExceptionTracker::ProcessOSExceptionNotification).
3) The System.Diagnostics.StackTrace constructors that don't take an exception object that get the
   stack trace of the current thread.

For cases #1 and #2 the StackTraceInfo/StackTraceElement structs are built when the stack trace
for an exception is generated and is put in the private _stackTrace Exception object field. The
IP in each StackTraceElement is decremented for hardware exceptions and not for software exceptions
because the CrawlFrame isInterrupted/hasFaulted fields are not initialized (always false). This is
backwards for h/w exceptions leaf node frames but really can't be changed to be compatible with
other code in the runtime and SOS.

The fIsLastFrameFromForeignStackTrace BOOL in the StackTraceElement/DebugStackTraceElement structs
have been replaced with INT "flags" field defined by the StackTraceElementFlags enum. There is a new
flag that is set (STEF_IP_ADJUSTED) if the IP has been already adjusted/decremented. This flag is
used to adjust the native offset when it is converted to an IL offset for source/line number lookup
in DebugStackTraceElement::InitPass2().

When the stack trace for an exception is rendered to a string (via the GetStackFramesInternal FCALL)
the internal GetStackFramesData/DebugStackTraceElement structs are initialized. This new "flags"
field is passed from the StackTraceElement to the DebugStackTraceElement struct.

For case #3 all this happens in the GetStackFramesInternal FCALL called from the managed constructor
building the GetStackFramesData/DebugStackTraceElement structs directly.

Fixes issues #27765 and #25740.

Fix IL offset map search.

4 years agoMerge pull request #2321 from vargaz/top-runtime-invoke-opt
Zoltan Varga [Thu, 30 Jan 2020 20:58:38 +0000 (15:58 -0500)]
Merge pull request #2321 from vargaz/top-runtime-invoke-opt

[jit] Add a 'top-runtime-invoke-unhandled' option to treat exceptions which reach the top invoke frame as unhandled when embedding.

4 years agoMerge pull request #2392 from monojenkins/sync-pr-18634-from-mono
Zoltan Varga [Thu, 30 Jan 2020 20:57:45 +0000 (15:57 -0500)]
Merge pull request #2392 from monojenkins/sync-pr-18634-from-mono

[mono] Prevent direct MonoClass field access

4 years agoAdd support for emitting inlining info in large version bubble (#1981)
Michal Strehovský [Thu, 30 Jan 2020 20:32:31 +0000 (21:32 +0100)]
Add support for emitting inlining info in large version bubble (#1981)

The existing inlining info format wasn't ready for large version bubble. This adds a new table that uses the NativeHashtable to store the inlining info.

This implements support in crossgen2, r2rdump, and the runtime. Crossgen will keep generating the old format until crossgen is decommissioned.

4 years agoFix EventWrittenEventArgs.Keywords on EventSource error event (#2343)
Stephen Toub [Thu, 30 Jan 2020 20:27:58 +0000 (15:27 -0500)]
Fix EventWrittenEventArgs.Keywords on EventSource error event (#2343)

When EventSource encounters an error, it emits an event with ID == 0.  The EventWrittenEventArgs.Keywords property is incorrectly trying to find keyword data for this event, resulting in a null ref when accessing the property on an error event.

4 years agoRemove defunct !s after Roslyn changes for default(T) (#2377)
Stephen Toub [Thu, 30 Jan 2020 20:18:00 +0000 (15:18 -0500)]
Remove defunct !s after Roslyn changes for default(T) (#2377)

4 years agoUpdate alpine arm64 image (#2370)
Santiago Fernandez Madero [Thu, 30 Jan 2020 19:33:59 +0000 (11:33 -0800)]
Update alpine arm64 image (#2370)

4 years agoMerge pull request #2386 from vargaz/fix-wasm-mmap
Zoltan Varga [Thu, 30 Jan 2020 18:29:09 +0000 (13:29 -0500)]
Merge pull request #2386 from vargaz/fix-wasm-mmap

[wasm] Fix mono_vfree ().

4 years agoAdd attribute to support inline namespaces in C++/CLI. (#781)
Tanveer Gani [Thu, 30 Jan 2020 18:28:26 +0000 (10:28 -0800)]
Add attribute to support inline namespaces in C++/CLI. (#781)

* Add attribute to support inline namespaces in C++/CLI.

A new assembly-scope custom attribute

[CppInlineNamespace(string dottedName)]

has been added to implement inline namespaces in C++/CLI. For every
inline namespace encountered in a translation unit, the C++ compiler
will emit this attribute with the fully scoped name, in CLR dotted
form, as the argument for the attribute.

* Add [CppInlineNamespace] to refs.

4 years agoFail FuncEval if slot backpatching lock is held by any thread (#2380)
Koundinya Veluri [Thu, 30 Jan 2020 18:15:29 +0000 (10:15 -0800)]
Fail FuncEval if slot backpatching lock is held by any thread (#2380)

- In many cases cooperative GC mode is entered after acquiring the slot backpatching lock and the thread may block for debugger suspension while holding the lock. A FuncEval may time out on entering the lock if for example it calls a virtual or interface method for the first time. Failing the FuncEval when the lock is held enables the debugger to fall back to other options for expression evaluation.
- Also added polls for debugger suspension before acquiring the slot backpatching lock on background threads that often operate in preemptive GC mode. A common case is when the debugger breaks while the tiering delay timer is active, the timer ticks shortly afterwards (after debugger suspension completes) and if a thread pool thread is already available, the background thread would block while holding the lock. The poll checks for debugger suspension and pulses the GC mode to block before acquiring the lock.
- The fix is only a heuristic and lessens the problem when it is detected that the lock is held by some thread. Since the lock is acquired in preemptive GC mode, it is still possible that after the check at the start of a FuncEval, another thread acquires the lock and the FuncEval may time out. The polling makes it less likely for the lock to be taken by background tiering work, for example if a FuncEval starts while rejitting a method.
- The expression evaluation experience may be worse when it is detected that the lock is held, and may still happen from unfortunate timing

Fix for https://github.com/dotnet/runtime/issues/1537

4 years ago[aot] Fix some races if GOT entries are already set.
Zoltan Varga [Thu, 30 Jan 2020 17:34:35 +0000 (12:34 -0500)]
[aot] Fix some races if GOT entries are already set.

decode_patch_info () would not decode patches if their corresponding GOT entry
was already set, causing half initialized MonoJumpInfo entries to be returned
to callers. Set the type of the MonoJumpInfo entry to MONO_PATCH_INFO_NONE
in these cases, and have the callers handle it.

4 years ago[master] Update dependencies from 4 repositories (#2074)
dotnet-maestro[bot] [Thu, 30 Jan 2020 16:20:32 +0000 (17:20 +0100)]
[master] Update dependencies from 4 repositories (#2074)

* Update dependencies from https://github.com/dotnet/arcade build 20200122.3

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20072.3
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20072.3
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20072.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20072.3
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20072.3
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20072.3
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20072.3
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20072.3
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20072.3
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20072.3
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20072.3
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20072.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20072.3
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20072.3

* Update dependencies from https://github.com/dotnet/runtime-assets build 20200122.1

- System.Windows.Extensions.TestData - 5.0.0-beta.20072.1
- System.Security.Cryptography.X509Certificates.TestData - 5.0.0-beta.20072.1
- System.Private.Runtime.UnicodeData - 5.0.0-beta.20072.1
- System.Net.TestData - 5.0.0-beta.20072.1
- System.IO.Packaging.TestData - 5.0.0-beta.20072.1
- System.IO.Compression.TestData - 5.0.0-beta.20072.1
- System.Drawing.Common.TestData - 5.0.0-beta.20072.1
- System.ComponentModel.TypeConverter.TestData - 5.0.0-beta.20072.1

* Update dependencies from https://github.com/dotnet/arcade build 20200123.17

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20073.17
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20073.17
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20073.17
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20073.17
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20073.17
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20073.17
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20073.17
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20073.17
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20073.17
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20073.17
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20073.17
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20073.17
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20073.17
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20073.17

* Update dependencies from https://github.com/dotnet/arcade build 20200124.6

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20074.6
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20074.6
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20074.6
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20074.6
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20074.6
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20074.6
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20074.6
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20074.6
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20074.6
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20074.6
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20074.6
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20074.6
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20074.6
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20074.6

* Update dependencies from https://github.com/dotnet/arcade build 20200125.3

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20075.3
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20075.3
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20075.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20075.3
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20075.3
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20075.3
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20075.3
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20075.3
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20075.3
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20075.3
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20075.3
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20075.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20075.3
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20075.3

* Update dependencies from https://github.com/dotnet/arcade build 20200126.3

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20076.3
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20076.3
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20076.3
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20076.3
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20076.3
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20076.3
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20076.3
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20076.3
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20076.3
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20076.3
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20076.3
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20076.3
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20076.3
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20076.3

* Update dependencies from https://github.com/dotnet/arcade build 20200127.7

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20077.7
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20077.7
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20077.7
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20077.7
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20077.7
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20077.7
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20077.7
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20077.7
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20077.7
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20077.7
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20077.7
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20077.7
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20077.7
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20077.7

* Bang some nullability warnings on generics

* Update dependencies from https://github.com/dotnet/arcade build 20200129.8

- Microsoft.DotNet.XUnitExtensions - 5.0.0-beta.20079.8
- Microsoft.DotNet.VersionTools.Tasks - 5.0.0-beta.20079.8
- Microsoft.DotNet.ApiCompat - 5.0.0-beta.20079.8
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20079.8
- Microsoft.DotNet.Build.Tasks.Configuration - 5.0.0-beta.20079.8
- Microsoft.DotNet.Build.Tasks.Feed - 5.0.0-beta.20079.8
- Microsoft.DotNet.Build.Tasks.Packaging - 5.0.0-beta.20079.8
- Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk - 5.0.0-beta.20079.8
- Microsoft.DotNet.CodeAnalysis - 5.0.0-beta.20079.8
- Microsoft.DotNet.GenAPI - 5.0.0-beta.20079.8
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.20079.8
- Microsoft.DotNet.GenFacades - 5.0.0-beta.20079.8
- Microsoft.DotNet.Helix.Sdk - 5.0.0-beta.20079.8
- Microsoft.DotNet.RemoteExecutor - 5.0.0-beta.20079.8

* Update dependencies from https://github.com/microsoft/vstest build 20200130-01

- Microsoft.NET.Test.Sdk - 16.5.0-preview-20200130-01

* Remove obsolete namespace for MonoAttribute

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
4 years agoTweak Regex compiler's FindFirstChar code gen (#2342)
Stephen Toub [Thu, 30 Jan 2020 16:08:25 +0000 (11:08 -0500)]
Tweak Regex compiler's FindFirstChar code gen (#2342)

* Tweak Regex compiler's FindFirstChar code gen

- If we're able to use IndexOf{Any} and we don't have any information on subsequent characters, we can avoid spitting the code related to looping, avoid unnecessary slicing, etc.
- If the Boyer-Moore prefix contains non-ASCII text, we currently don't use it when compiling FindFirstChar, but we previously made a change to also skip computing other prefix information if we got a Boyer-Moore prefix, which ends up making FindFirstChar terrible when there's Unicode in the prefix string.  This fixes that to still compute the other prefix information in that case.
- We're currently often generating multiple "this.runtextpos = runtextend; return false" blocks.  We can consolidate them.
- Makes a few cleanliness changes to the assembly generator, e.g. ensuring the internal types are sealed, the types are all beforefieldinit as the C# compiler would do, etc.

Also added/tweaked a few tests.

* Address PR feedback

4 years agoAllow using non-backtracking code gen for captures in atomic groups (#2327)
Stephen Toub [Thu, 30 Jan 2020 16:05:39 +0000 (11:05 -0500)]
Allow using non-backtracking code gen for captures in atomic groups (#2327)

I think it was an oversight that I didn't include Atomic in this list previously.  This lets our better non-backtracking code gen be used even when captures are inside of atomic groups.

4 years ago[mono] Prevent direct MonoClass field access
mdh1418 [Thu, 30 Jan 2020 16:02:18 +0000 (16:02 +0000)]
[mono] Prevent direct MonoClass field access

Fixes mono/mono#15544

### After adding configure flag
<img width="874" alt="Screen Shot 2020-01-30 at 10 54 25 AM" src="https://user-images.githubusercontent.com/16830051/73466184-81f4c180-434f-11ea-87f0-0863c32b1251.png">

### After using m_class accessors
<img width="865" alt="Screen Shot 2020-01-30 at 10 55 04 AM" src="https://user-images.githubusercontent.com/16830051/73466229-93d66480-434f-11ea-8914-cef5571a0528.png">

<!--
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
-->

4 years ago[wasm] Fix mono_vfree ().
Zoltan Varga [Thu, 30 Jan 2020 14:36:12 +0000 (09:36 -0500)]
[wasm] Fix mono_vfree ().

4 years ago[wasm][debugger] Cancel Existing Single Step Request When Creating New (#2309)
monojenkins [Thu, 30 Jan 2020 14:24:33 +0000 (09:24 -0500)]
[wasm][debugger] Cancel Existing Single Step Request When Creating New (#2309)

When stepping out of a c# breakpoint into the runtime (or JS... Not sure if that's accurate),
multiple single step requests can be created when the breakpoint is hit again.  In order to handle this scenario for wasm, we just cancel the existing one.

4 years agoPort more Regex doc samples to tests (#2326)
Stephen Toub [Thu, 30 Jan 2020 14:04:52 +0000 (09:04 -0500)]
Port more Regex doc samples to tests (#2326)

* Port more Regex doc samples to tests

* Address PR feedback

4 years agoPass native build args from top-level scripts (#2071)
Adeel Mujahid [Thu, 30 Jan 2020 12:22:03 +0000 (14:22 +0200)]
Pass native build args from top-level scripts (#2071)

* Pass native build args from top-level scripts

* Remove obsolete message; switch platform/arch order

* Move export to a separate line

* Use URL-encoding to escape msbuild CMakeArgs property

4 years agoImprove thunk call disassembly in R2RDump (#2297)
Tomáš Rylek [Thu, 30 Jan 2020 10:27:34 +0000 (11:27 +0100)]
Improve thunk call disassembly in R2RDump (#2297)

* Improve thunk call disassembly in R2RDump

This change improves the disassembly of thunk-based calls to R2R
helpers used by Crossgen1 and considered for Crossgen2 to improve
disassembly quality and facilitate easier comparison of Crossgen1
vs. Crossgen2 codegen.

I have also added new options for hiding the instruction offsets
in the disassembly and for omitting functions with identical
disassembly in the common functions diff output. For SPC this
reduced the size of the dump in <code>--naked --hide-offsets
--diff-hide-same-disasm</code> mode by about one half.

In view of the fact that Andrew wasn't too happy about my change
to stop logging to the console I further simplified the related
code by basically reverting that aspect of my change in a more
radical manner.

I have also moved the call to CoreDisTools.ClearOutputBuffer
into CoreDisTools.GetInstruction so that we don't need to call it
manually in the higher-level code.

Thanks

Tomas

* JanV's PR feedback: use spaces, not tabs, in R2RDump output

4 years agoNullable annotate System.Reflection.MetadataLoadContext.
Eirik Tsarpalis [Thu, 30 Jan 2020 07:59:30 +0000 (07:59 +0000)]
Nullable annotate System.Reflection.MetadataLoadContext.

* Nullable annotate System.Reflection.MetadataLoadContext

* address feedback

* address feedback

* undo accidental change

* address more feedback

* Revert "address more feedback"

This reverts commit 6519238856c318186ef225e360f732780038d435.

4 years agoHide redundant members from debugger views (#2361)
Andrew Arnott [Thu, 30 Jan 2020 07:19:45 +0000 (00:19 -0700)]
Hide redundant members from debugger views (#2361)

4 years agoFor a destination register use scalar forms (i.e. Sd, Hd, Bd) instead of vector ones...
Egor Chesakov [Thu, 30 Jan 2020 03:32:38 +0000 (19:32 -0800)]
For a destination register use scalar forms (i.e. Sd, Hd, Bd) instead of vector ones (i.e. Vd.2S, Vd.4H, Vd.2B) for instructions that return scalar result (e.g. addv, smaxv, umaxv) in emitDispIns in emitarm64.cpp (#2324)

4 years ago[Arm64] Support Vector64<double>, Vector64<long>, and Vector64<ulong> (#1747)
Egor Chesakov [Thu, 30 Jan 2020 03:31:52 +0000 (19:31 -0800)]
[Arm64] Support Vector64<double>, Vector64<long>, and Vector64<ulong> (#1747)

* Add "LoadVector64" for Vector64<double>, Vector64<long> and Vector64<ulong> in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Update "Abs" and "AbsScalar" in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Update "AbsoluteCompareGreaterThan" and "AbsoluteCompareGreaterThanScalar" in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Update "AbsoluteCompareGreaterThanOrEqual" and "AbsoluteCompareGreaterThanOrEqualScalar" in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Update "AbsoluteCompareLessThan" and "AbsoluteCompareLessThanScalar" in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Update "AbsoluteCompareLessThanOrEqual" and "AbsoluteCompareLessThanOrEqualScalar" in AdvSimd.PlatformNotSupported.cs AdvSimd.cs

* Add "AbsoluteDifferenceScalar" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "AddScalar" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "BitwiseSelect" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareEqual" and "CompareEqualScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Re-order "CompareEqual" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareGreaterThan" and "CompareGreaterThanScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareGreaterThan" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareGreaterThanOrEqual" and "CompareGreaterThanOrEqualScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareGreaterThanOrEqual" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareLessThan" and "CompareLessThanScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareLessThan" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareLessThanOrEqual" and "CompareLessThanOrEqualScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareLessThanOrEqual" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareTest" and "CompareTestScalar" in AdvSimd.Arm64 in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "CompareTest" in AdvSimd in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "LeadingSignCount" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "LeadingZeroCount" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update "PopCount" in AdvSimd.cs AdvSimd.PlatformNotSupported.cs

* Update System.Runtime.Intrinsics.Experimental.cs

* Re-order "AbsScalar" in hwintrinsiclistarm64.h

* Re-order "TransposeEven" and "TransposeOdd" in hwintrinsiclistarm64.h

* Update "Abs" in AdvSimd and AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AbsScalar" in AdvSimd and AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AbsoluteCompareGreaterThan" and "AbsoluteCompareGreaterThanScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AbsoluteCompareGreaterThanOrEqual" and "AbsoluteCompareGreaterThanOrEqualScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AbsoluteCompareLessThan" and "AbsoluteCompareLessThanScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AbsoluteCompareLessThanOrEqual" and "AbsoluteCompareLessThanOrEqualScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add "AbsoluteDifferenceScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Update "AddScalar" in AdvSimd in hwintrinsiclistarm64.h

*  Update "Add" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add "CompareEqualScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add "CompareGreaterThanScalar" and "CompareGreaterThanOrEqualScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add "CompareLessThanScalar" and "CompareLessThanOrEqualScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add "CompareTestScalar" in AdvSimd_Arm64 in hwintrinsiclistarm64.h

* Add AdvSimd_Arm64_CompareLessThanScalar AdvSimd_Arm64_CompareLessThanOrEqualScalar AdvSimd_Arm64_AbsoluteCompareLessThanScalar AdvSimd_Arm64_AbsoluteCompareLessThanOrEqualScalar in hwintrinsiccodegenarm64.cpp

* Support Vector64<double>, Vector64<long> and Vector64<ulong> in Compiler::getBaseTypeAndSizeOfSIMDType() in compiler.h simd.cpp

* Stop treating Vector64<long>, Vector64<ulong> and Vector64<double> as unsupported types in MethodTable::GetVectorSize() in class.cpp

* Support scalar comparison operations in emitarm64.cpp

* For SimpleSIMD instructions that operates on 64x1 type remove INS_OPTS_1D in hwintrinsiccodegenarm64.cpp

* Add special hanling for SIMDIntrinsicInit for Vector64<double> in CodeGen::genSIMDIntrinsicInit in codegenarm64.cpp

* Add an assertion since INS_dup does not have .1D encoding in emitarm64.cpp

* Add LoadVector64 tests for Vector64<double>, Vector64<long> and Vector64<ulong> in GenerateTests.csx

* Add "Add" in Helpers.cs Helpers.tt

* Add "Abs" in Helpers.cs Helpers.tt

* Update "Abs" in AdvSimd in GenerateTests.csx

* Update "AbsScalar" in AdvSimd in GenerateTests.csx

* Update "Abs" and "AbsScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "AbsoluteCompare*" in AdvSimd in GenerateTests.csx

* Update "AbsoluteCompare*" in AdvSimd.Arm64 in GenerateTests.csx

* Update "AbsoluteDifference" in AdvSimd in GenerateTests.csx

* Update "AbsoluteDifference" in AdvSimd.Arm64 in GenerateTests.csx

* Update "Add" in AdvSimd in GenerateTests.csx

* Update "AddScalar" in AdvSimd in GenerateTests.csx

* Update "AddScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "BitwiseSelect" in AdvSimd in GenerateTests.csx

* Update "AddAcross" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareEqual" in AdvSimd in GenerateTests.csx

* Update "CompareEqual" and "CompareEqualScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareGreaterThan" in AdvSimd in GenerateTests.csx

* Update "CompareGreaterThan" and "CompareGreaterThanScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareGreaterThanOrEqual" in AdvSimd in GenerateTests.csx

* Update "CompareGreaterThanOrEqual" and "CompareGreaterThanOrEqualScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareLessThan" in AdvSimd in GenerateTests.csx

* Update "CompareLessThan" and "CompareLessThanScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareLessThanOrEqual" in AdvSimd in GenerateTests.csx

* Update "CompareLessThanOrEqual" and "CompareLessThanOrEqualScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "CompareTest" in AdvSimd in GenerateTests.csx

* Update "CompareTest" and "CompareTestScalar" in AdvSimd.Arm64 in GenerateTests.csx

* Update "LeadingSignCount" in AdvSimd in GenerateTests.csx

* Update "LeadingZeroCount" in AdvSimd in GenerateTests.csx

* Update "PopCount" in AdvSimd in GenerateTests.csx

* Update "LoadVector64" in AdvSimd in GenerateTests.csx

* Update "LoadVector128" in AdvSimd in GenerateTests.csx

* Use ValidateIterResult in LoadUnOpTest.template

* Update AdvSimd/ AdvSimd.Arm64/

4 years agoUpdate test OS matrix
Jeremy Barton [Thu, 30 Jan 2020 01:14:24 +0000 (17:14 -0800)]
Update test OS matrix

* Update all docker-based configurations to the latest tags
* Remove Alpine 3.8 (near EOL)
* Add Alpine 3.11
* Remove Fedora 28 (EOL)
* Add Fedora 30
* Add OSX 10.15 to fullMatrix runs

4 years agoAdd periodic schedule for the R2R pipeline (#2358)
Tomáš Rylek [Thu, 30 Jan 2020 00:49:13 +0000 (01:49 +0100)]
Add periodic schedule for the R2R pipeline (#2358)

4 years agoImprove GC stress tests (#2166)
Andrew Au [Thu, 30 Jan 2020 00:16:59 +0000 (16:16 -0800)]
Improve GC stress tests (#2166)

4 years ago[wasm][debugger] Initial support for proxying flat sessions (#2263)
monojenkins [Thu, 30 Jan 2020 00:16:28 +0000 (19:16 -0500)]
[wasm][debugger] Initial support for proxying flat sessions (#2263)

Initial support means handling the browser endpoint and proxying any sessionId values, along with making sure we load pdbs as things start initializing

Co-authored-by: Larry Ewing <lewing@microsoft.com>
4 years agoAdd a fallback condition for musl ldd check (#2336)
Adeel Mujahid [Wed, 29 Jan 2020 23:50:36 +0000 (01:50 +0200)]
Add a fallback condition for musl ldd check (#2336)

If ldd fails with Exec format error, attempt to locate musl token
in the output of `strings /path/ldd`.

4 years agoUse Arcade-provided IBCMerge support for System.Private.CoreLib. (#2308)
Jeremy Koritzinsky [Wed, 29 Jan 2020 22:49:13 +0000 (14:49 -0800)]
Use Arcade-provided IBCMerge support for System.Private.CoreLib. (#2308)

* Use Arcade-provided IBCMerge support.

* Clean up build.sh as well.

* Restore internal tools on Windows and Unix instead of just Windows.

* Remove unused item metadata.

4 years agoDisable Regex long pattern string test on .NET Framework (#2366)
Stephen Toub [Wed, 29 Jan 2020 22:07:50 +0000 (17:07 -0500)]
Disable Regex long pattern string test on .NET Framework (#2366)

4 years agoFix parsing of '-' when inside a range (#1075)
Prashanth Govindarajan [Wed, 29 Jan 2020 21:53:40 +0000 (13:53 -0800)]
Fix parsing of '-' when inside a range (#1075)

4 years agoRevert "Nullable annotate System.Reflection.MetadataLoadContext (#1943)" (#2360)
Eirik Tsarpalis [Wed, 29 Jan 2020 21:13:05 +0000 (21:13 +0000)]
Revert "Nullable annotate System.Reflection.MetadataLoadContext (#1943)" (#2360)

This reverts commit c541ea976b7cdae36462392d774b02bad7ea328e.

4 years agoFix double expansion of AggregateException.Flatten message (#605)
Pent Ploompuu [Wed, 29 Jan 2020 19:37:51 +0000 (21:37 +0200)]
Fix double expansion of AggregateException.Flatten message (#605)

* Fix double expansion of AggregateException.Flatten message

* Update tests

4 years agoMerging small assemblies (part 1/N) (#2189)
Jan Kotas [Wed, 29 Jan 2020 18:02:22 +0000 (10:02 -0800)]
Merging small assemblies (part 1/N) (#2189)

* Delete unnecessary ClsCompliant

* Merge System.Diagnostics.Tools\src into CoreLib

* Merge System.Security.Pricipal\src into CoreLib

* Delete System.IO.UnmanagedMemoryStream\ref\System.IO.UnmanagedMemoryStream.cs

* Delete System.Reflection\ref\System.Reflection.cs

* Delete  System.Threading.Timer\src\ApiCompatBaseline.uapaot.txt

* Delete System.Buffers\src\Resources\Strings.resx

* Merge System.Buffers\ref into System.Runtime

* Merge System.Diagnostics.Debug\ref into System.Runtime

* Delete *\MatchingRefApiCompatBaseline.txt

* Merge System.Diagnostics.Tools into System.Runtime\ref

* Merge System.Resources.ResourceManager into System.Runtime\ref

* Cleanup System.IO.* project references

* Cleanup System.Reflection project references

* Cleanup System.Runtime.Handles project references

* Merge System.Threading.Thread\src into CoreLib

* Merge System.Threading.Timer\ref into System.Runtime

* Merge System.Threading.Tasks\ref into System.Runtime

4 years agoRevert "Dead Ending Microsoft.CSharp Package and Bumping the leftout assembly version...
Jan Kotas [Wed, 29 Jan 2020 17:01:10 +0000 (09:01 -0800)]
Revert "Dead Ending Microsoft.CSharp Package and Bumping the leftout assembly versions to 5.0.0.0 (#2264)" (#2344)

This reverts commit 5fca04171171f118bca0f93aa9741f205b8cdc29.

4 years agotypo - removed unneeded word in a comment (#2331)
John Smith [Wed, 29 Jan 2020 16:45:30 +0000 (16:45 +0000)]
typo - removed unneeded word in a comment (#2331)

4 years agoLimit jit format.py to src/coreclr/src/jit (#2328)
Steve MacLean [Wed, 29 Jan 2020 16:16:06 +0000 (11:16 -0500)]
Limit jit format.py to src/coreclr/src/jit (#2328)

4 years ago[merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP (#2149)
monojenkins [Wed, 29 Jan 2020 15:03:12 +0000 (10:03 -0500)]
[merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP (#2149)

Only prevent `gdb` or `lldb` from being invoked.

MERP is controlled by separate mechanisms --- configure flags for crash
reporting and an explicit opt-in icall.

The existing code collects crashed process data in-process, but it writes the
data out (using mono_merp_invoke) in the forked child process.  This is a bit
surprising, but in the interest of not disturbing the code too much, this PR
doesn't change that.  We should revisit `dump_native_stacktrace` again in the
future and rationalize these decisions.

Addresses https://github.com/mono/mono/issues/18565

Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
4 years agoNullable annotate System.Reflection.MetadataLoadContext (#1943)
Eirik Tsarpalis [Wed, 29 Jan 2020 14:29:58 +0000 (14:29 +0000)]
Nullable annotate System.Reflection.MetadataLoadContext (#1943)

* Nullable annotate System.Reflection.MetadataLoadContext

* address feedback

* address feedback

* undo accidental change

* address more feedback

4 years agoRefactor handling of non-SOH generations (#1688)
Vladimir Sadov [Wed, 29 Jan 2020 14:18:25 +0000 (06:18 -0800)]
Refactor handling of non-SOH generations (#1688)

* refactoring

* ploh-->uoh

* fix Linux build
PR feedback

* some PR feedback

* more PR feedback

more PR feedback

* more PR feedback

* address comments in UpdatePreGCCounters

* removed a confusing comment

* stress fix in background sweep

* use `saved_sweep_ephemeral_seg` in background sweep.

* fixed `GCPerHeapHistory_V3` event.

* re-implemented https://github.com/dotnet/runtime/pull/2103 on top of refactoring  (it was hard to merge)

4 years agoConstruct TypedReference on top of ByReference (#2216)
Michal Strehovský [Wed, 29 Jan 2020 13:06:11 +0000 (14:06 +0100)]
Construct TypedReference on top of ByReference (#2216)

CoreCLR and Crossgen2 need to special case TypedReference because it's not a regular byref-like type (constructed on top of `ByReference<T>` fields). This gets rid of the special casing.

4 years agoUse different artifact name for Mono vs CoreCLR (#2292)
Viktor Hofer [Wed, 29 Jan 2020 10:01:49 +0000 (11:01 +0100)]
Use different artifact name for Mono vs CoreCLR (#2292)

Currently during a build-job, we overwrite existing artifacts as CoreCLR
and Mono use the same artifact name. Adding the runtime flavor name as
a differentiator.

4 years agoEmit Partial/PlatformNeutralSource flags in R2R header (#2282)
Michal Strehovský [Wed, 29 Jan 2020 09:34:25 +0000 (10:34 +0100)]
Emit Partial/PlatformNeutralSource flags in R2R header (#2282)

I added the partial flag to the legacy crossgen in dotnet/coreclr#22680 but crossgen2 was missing it. Also added platform neutral source since it's easy.

4 years agoDelete dead code in Crossgen's Program.cs (#2304)
Michal Strehovský [Wed, 29 Jan 2020 09:30:39 +0000 (10:30 +0100)]
Delete dead code in Crossgen's Program.cs (#2304)

* We don't need a workaround for a desktop framework bug since we don't have an ambition to run on desktop framework anymore.
* We don't need the entrypoint module.

4 years agoEnable inline type checks for all type equality cases (#2276)
Andy Ayers [Wed, 29 Jan 2020 08:47:56 +0000 (00:47 -0800)]
Enable inline type checks for all type equality cases (#2276)

Now that method tables are not shared by distinct types, we can always emit
inlined type equality tests.

Closes #1258.

4 years ago[interp] Fix virtual calls in mixed mode (#2299)
monojenkins [Wed, 29 Jan 2020 08:05:00 +0000 (03:05 -0500)]
[interp] Fix virtual calls in mixed mode (#2299)

Alternative to https://github.com/mono/mono/pull/18475 which doesn't ignore mixed mode virtual call performance. It is 20% faster with this approach.

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

Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
4 years agoDead Ending Microsoft.CSharp Package and Bumping the leftout assembly versions to...
Anirudh Agnihotry [Wed, 29 Jan 2020 06:36:54 +0000 (22:36 -0800)]
Dead Ending Microsoft.CSharp Package and Bumping the leftout assembly versions to 5.0.0.0 (#2264)

* deadending Microsoft.Csharp Package and bumping the assembly versions

* retargeting and clean up

* Update Microsoft.CSharp.csproj

* fixing the build

* reference -> projectreference

* adding ignored reference

4 years agoRevert "Disable test based on #129 (#130)" (#2310)
Koundinya Veluri [Wed, 29 Jan 2020 03:05:08 +0000 (19:05 -0800)]
Revert "Disable test based on #129 (#130)" (#2310)

This reverts commit 3a2dc0f8429b922fa254a1ba6f751b79259275b1.

Fixed by https://github.com/dotnet/runtime/pull/1457. Closes https://github.com/dotnet/runtime/issues/129.

4 years agoAdd support for multiple char classes in FindFirstChars (#2254)
Stephen Toub [Wed, 29 Jan 2020 02:17:53 +0000 (21:17 -0500)]
Add support for multiple char classes in FindFirstChars (#2254)

* Add a "multi first" check for FindFirstChars

FindFirstChars already has multiple things it checks for:
- If the expression is anchored, it checks the current position for that anchor.
- If we were able to compute a min required length, it checks for that much space remaining.
- If we were able to analyze the expression and come up with a string of text of multiple characters that must be at the beginning of any expression, we use Boyer-Moore to find it.
- If we were able to analyze the expression to come up with a character class that must match the first character in the input, we iterate through looking for that (and if possible, use IndexOf{Any} to speed that along).

This PR extends that last check to try to create a character class not just for the first character in the input, but for the first N characters in the input.  The check isn't as robust, mainly focused on expressions beginning with an alternation (often when it's global), so it's a separate check we try first, and only fall back to the more robust single-class analysis if we were unsuccessful.

By checking multiple characters, we're able to stay in a tighter loop inside of FindFirstChars.  In the future, we could look at replacing this with something potentially even better, such as a vectorized search for multiple starting strings.

* Address PR feedback

4 years agoDisable System.Net.* tests on Mono that are also disabled on CoreCLR (#2318)
Alexander Köplinger [Wed, 29 Jan 2020 02:12:47 +0000 (03:12 +0100)]
Disable System.Net.* tests on Mono that are also disabled on CoreCLR (#2318)

Should help with https://github.com/dotnet/runtime/issues/2316

4 years agoRemove format.patch (#2323)
Steve MacLean [Wed, 29 Jan 2020 01:49:43 +0000 (20:49 -0500)]
Remove format.patch (#2323)

Thies file was added accidentally as part of #1735

4 years ago[jit] Add a 'top-runtime-invoke-unhandled' option to treat exceptions which reach...
Zoltan Varga [Wed, 29 Jan 2020 01:19:08 +0000 (20:19 -0500)]
[jit] Add a 'top-runtime-invoke-unhandled' option to treat exceptions which reach the top invoke frame as unhandled when embedding.

This is not really a MONO_DEBUG option, but easier to implement it this way.

4 years agoMove libraries internal restore before repo restore, produce a restore binlog and...
Santiago Fernandez Madero [Wed, 29 Jan 2020 01:01:36 +0000 (17:01 -0800)]
Move libraries internal restore before repo restore, produce a restore binlog and increase verbosity (#2311)

* Move libraries internal restore before repo restore, produce a restore binlog and increase verbosity

* Use SDK from global.json

4 years agoAdd build skip functionality for servicing builds (#2291)
Davis Goodin [Wed, 29 Jan 2020 00:24:24 +0000 (18:24 -0600)]
Add build skip functionality for servicing builds (#2291)

4 years agoJIT: remove inlining restriction for some methods that throw (#2232)
Andy Ayers [Wed, 29 Jan 2020 00:01:09 +0000 (16:01 -0800)]
JIT: remove inlining restriction for some methods that throw (#2232)

We were blocking inlines for methods that throw with more than one thing on the
evaluation stack. There was already logic for the non-inlining case to flush
the stack and preserve pending side effects. So we can simply remove the
inlining restriction.

Fixes #2156.

4 years agoImprove call counting mechanism (#1457)
Koundinya Veluri [Tue, 28 Jan 2020 22:19:27 +0000 (14:19 -0800)]
Improve call counting mechanism (#1457)

Improve call counting mechanism

- Call counting through the prestub is fairly expensive and can be seen immediately after call counting begins
- Added call counting stubs. When starting call counting for a method:
  - A `CallCountingInfo` is created and initializes a remaining call count with a threshold
  - A `CallCountingStub` is created. It contains a small amount of code that decrements the remaining call count and checks for zero. When nonzero, it jumps to the code version's native code entry point. When zero, it forwards to a helper function that handles tier promotion.
  - When the call count threshold is reached, the helper call enqueues completion of call counting for background processing
  - When completing call counting, the code version is enqueued for promotion, and the call counting stub is removed from the call chain
  - Once all work queued for promotion is completed and methods transitioned to optimized tier, call counting stubs are deleted based on some heuristics and under runtime suspension
- The `CallCountingManager` is the main class with most of the logic. Its private subclasses are just simple data structures.
- Call counting is done at a `NativeCodeVersion` level (stub association is with the code version)
- The code versioning lock is used for data structures used for call counting. Since installing a call counting stub requires that we know what the currently active code version is, it made sense to use the same lock.
- Call counting stubs have hardcoded code. x64 has short and long stubs, short stubs are used when possible (often) and use IP-relative branches to the method's code and helper stub. Other platforms have only one type of stub (a short stub).
- For tiered methods that don't have a precode (virtual and interface methods), a forwarder stub (a precode) is created and it forwards to the call counting stub. This is so that the call counting stub can be safely and easily deleted. The forwarder stubs are only used when counting calls, there is one per method (not per code version), and they are not deleted. See `CallCountingManager::SetCodeEntryPoint()` for more info.
- The `OnCallCountThresholdReachedStub()` takes a "stub-identifying token". The helper call gets a stub address from it, and tells whether it's a short or long stub. From the stub, the remaining call count pointer is used to get the `CallCountingInfo`, and from it gets the `NativeCodeVersion` associated with the stub.
- The `CallCountingStubManager` traces through a call counting stub so that VS-like debuggers can step into a method through the call counting stub
- Exceptions (OOM)
  - On foreground threads, exceptions are propagated unless they can be handled without any compromise
  - On background threads, exceptions are caught and logged as before. Tried to limit scope of exception to one per method or code version such that a loop over many would not all be aborted by one exception.
- Fixed a latent race where a method is recorded for call counting and then the method's code entry point is set to tier 0 code
  - With that order, the tiering delay may expire and the method's entry point may be updated for call counting in the background before the code entry point is set by the recording thread, and that last action would disable call counting for the method and cause it to not be optimized. The only thing protecting from this happening was the delay itself, but a configured shorter delay increases the possibility of this happening.
  - Inverted the order such that the method's code entry point is set before recording it for call counting, both on first and subsequent calls
  - Changed the tiered compilation lock to be an any-GC-mode lock so that it can be taken inside the code versioning lock, as some things were more naturally placed inside the code versioning lock where we know the active code version, like checking for the tiering delay to delay call counting and promoting the code version when the call count threshold is reached
    - Unfortunately, that makes code inside the lock a GC-no-trigger scope and things like scheduling a timer or queuing a work item to the thread pool could not be done inside that scope. This tradeoff seems to be better than alternatives, so refactored those pieces to occur outside that scope.
- Publishing an entry point after changing the active code version now takes call counting into account, fixes https://github.com/dotnet/coreclr/issues/22426
- After the changes:
  - Call counting overhead is much smaller and is not many orders of magnitude greater than a method call
  - Some config modes for tuning tiering are now much more reasonable and do not affect perf negatively nearly as much as before - increasing call count threshold, disabling or decreasing the tiering delay. Enables dynamic thresholds in the future, which is not feasible due to the overhead currently.
  - No change to startup or steady-state perf
- Left for later
  - Eventing work to report call counting stub code ranges and method name (also needs to be done for other stubs)
  - Some tests that consume events to verify run-time behavior in a few config modes
  - Debugger test to verify debugging while call-counting. Debugger tests also need to be fixed for tiering.
  - The call count threshold has not been changed for now. As we don't have many tests that measure the performance in-between startup and steady-state, some will need to be created maybe from existing tests, to determine the effects
- Fixes https://github.com/dotnet/coreclr/issues/23596

4 years agoUse process_vm_readv to read remote memory when available on createdump
Next Turn [Tue, 28 Jan 2020 22:03:24 +0000 (06:03 +0800)]
Use process_vm_readv to read remote memory when available on createdump

4 years agoInclude error details when stream can't be opened for parsing in host (#2287)
Elinor Fung [Tue, 28 Jan 2020 21:28:59 +0000 (13:28 -0800)]
Include error details when stream can't be opened for parsing in host (#2287)

4 years agoRemove workaround for Build.SourcesDirectory variable in containers (#2261)
Santiago Fernandez Madero [Tue, 28 Jan 2020 18:54:52 +0000 (10:54 -0800)]
Remove workaround for Build.SourcesDirectory variable in containers (#2261)

4 years agoMake string._stringLength readonly (#2001)
Ben Adams [Tue, 28 Jan 2020 18:44:36 +0000 (18:44 +0000)]
Make string._stringLength readonly (#2001)

4 years agoAnnotate System.Security.AccessControl for nullable (#1992)
buyaa-n [Tue, 28 Jan 2020 18:42:23 +0000 (10:42 -0800)]
Annotate System.Security.AccessControl for nullable (#1992)

* Annotate System.Security.AccessControl for nullable