platform/upstream/dotnet/runtime.git
2 years ago[mono] Fix types for arguments to printf calls (#62796)
Alexander Köplinger [Wed, 15 Dec 2021 01:49:39 +0000 (02:49 +0100)]
[mono] Fix types for arguments to printf calls (#62796)

* [mono] Fix types for arguments to printf calls

   These came up while I was using a code scanning tool.

* Fix build

2 years agoIL cleanup - remove .module and make .assembly match source name (#62812)
Tomáš Rylek [Wed, 15 Dec 2021 01:15:25 +0000 (02:15 +0100)]
IL cleanup - remove .module and make .assembly match source name (#62812)

2 years agoAdd SchemeHttp index to QPACK constants (#62800)
github-actions[bot] [Wed, 15 Dec 2021 00:01:51 +0000 (13:01 +1300)]
Add SchemeHttp index to QPACK constants (#62800)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
2 years agoFix __SkipRestorePackages setup for msbuild (#62583)
Gleb Balykov [Tue, 14 Dec 2021 23:54:00 +0000 (02:54 +0300)]
Fix __SkipRestorePackages setup for msbuild (#62583)

2 years agoBuild NativeAOT flavor of clrcompression static lib (#62570)
Michal Strehovský [Tue, 14 Dec 2021 23:43:21 +0000 (08:43 +0900)]
Build NativeAOT flavor of clrcompression static lib (#62570)

This is similar in spirit to the static library for the single file host.

The main different from the single file host one is that we don't want `/GL` because the static library is going to be linked on end user machine and `/GL` is super version fragile.

We build two flavors - with control flow guard and without control flow guard. CFG is a compile time option for end users in NativeAOT and we need static libs that support both.

2 years agoFix named mutex PAL test issue (#62655)
Jan Vorlicek [Tue, 14 Dec 2021 23:39:42 +0000 (00:39 +0100)]
Fix named mutex PAL test issue (#62655)

The issue seems to be caused by a bug in the test. The problematic call
to `TestCreateMutex` is passed `nullptr` as the `name` parameter. It
then calls `convert` helper on it to convert it to wide char. However,
the `convert` helper doesn't check whether it is `nullptr` or not and
ends up returning a pointer to a memory with possibly random data,
that is returned by `malloc(0)`. The returned pointer is then passed to
the CreateMutex PAL api that probably ends up attempting to get the
length of the name or something. And depending on the random data, it
sometimes fails.

The fix is to change the `convert` function to handle `nullptr` so that
it returns `nullptr` too.

2 years agoDisable HardwareIntrinsics Pause tests (#62793)
Bruce Forstall [Tue, 14 Dec 2021 23:27:59 +0000 (15:27 -0800)]
Disable HardwareIntrinsics Pause tests (#62793)

Tracking: #62423

2 years agoFixing regression for AuthType.Anonymous which leads to a NullReferenceException...
Jose Perez Rodriguez [Tue, 14 Dec 2021 23:25:55 +0000 (15:25 -0800)]
Fixing regression for AuthType.Anonymous  which leads to a NullReferenceException be thrown. (#62807)

2 years agoDeduplicate JIT/Methodical/Boxing/xlang tests (#62753)
Tomáš Rylek [Tue, 14 Dec 2021 21:40:58 +0000 (22:40 +0100)]
Deduplicate JIT/Methodical/Boxing/xlang tests (#62753)

This group comprises a C# & IL main module and a C# & IL library
and tries all four pairings between them. The C# version of the
main module used to be shared but that's problematic with test
merging as distinguishing the two tests with an identical
namespace, class name and entry point would be hard. As this is
the only occurrence of this pattern in the runtime test source
tree, I'm proposing to duplicate the C# main module source and
adjust it for the two scenarios (targeting C# vs. IL version
of the dependent library).

Thanks

Tomas

2 years agoJIT: Fix range checks for "i >= 0 && i < cns" patterns (#61569)
Egor Bogatov [Tue, 14 Dec 2021 21:17:56 +0000 (00:17 +0300)]
JIT: Fix range checks for "i >= 0 && i < cns" patterns (#61569)

2 years ago[main] Update dependencies from 7 repositories (#62718)
dotnet-maestro[bot] [Tue, 14 Dec 2021 20:11:14 +0000 (21:11 +0100)]
[main] Update dependencies from 7 repositories (#62718)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix named mutexes on OSX to work between arm64 and emulated x64 processes (#62764)
Koundinya Veluri [Tue, 14 Dec 2021 19:32:53 +0000 (11:32 -0800)]
Fix named mutexes on OSX to work between arm64 and emulated x64 processes (#62764)

- The page size is different between arm64 processes and emulated x64 processes
- The shared memory file size is set to the page size and there was a strict check on the file size, leading to an exception from the second process of a different arch that tries to share the same mutex
- Made the file size check less strict, and allowed an arch to increase but not decrease the file size such that it can be mapped at page size granularity
- Fix for https://github.com/dotnet/runtime/issues/62140 in main

2 years agoRename IHttpHeadersHandler to IHttpStreamHeadersHandler (#62750)
github-actions[bot] [Tue, 14 Dec 2021 18:48:18 +0000 (07:48 +1300)]
Rename IHttpHeadersHandler to IHttpStreamHeadersHandler (#62750)

Co-authored-by: James Newton-King <james@newtonking.com>
2 years agoRemove dummy project property IlasmRoundTrip (#62678)
Tomáš Rylek [Tue, 14 Dec 2021 18:41:07 +0000 (19:41 +0100)]
Remove dummy project property IlasmRoundTrip (#62678)

I have identified 63 tests in the tree that set IlasmRoundTrip
to true in their MSBuild project scripts. I haven't found any place
in the scripts that would be looking at the value so I'm guessing
it may have been a predecessor to today property
IlasmRoundTripIncompatible and I'm proposing to delete the unused
property. Please let me know if you're aware of any test script logic
that queries it.

Thanks

Tomas

2 years agoUnify native file name props (#62724)
Adeel Mujahid [Tue, 14 Dec 2021 18:31:19 +0000 (20:31 +0200)]
Unify native file name props (#62724)

The top level `Directory.Build.props` imports eng/native/naming.props,
which defines platform specific naming conventions. Use that in places
where locally defined props are used and delete the redundant props.

2 years agoPE loader/image cleanups. No-copy mapping of R2R PEs on Windows. (#61938)
Vladimir Sadov [Tue, 14 Dec 2021 18:23:57 +0000 (10:23 -0800)]
PE loader/image cleanups. No-copy mapping of R2R PEs on Windows. (#61938)

* removed IMAGE_MAPPED

* removed RawImageLayout

* delete MappedImageLayout

* use mem-mapping on Windows

* tweaks and touchups

* a few cleanups

* comments

* move EnsureLoaded into Assemby::Init

* A fix for IsDynamic() case.

* fix for preferred base, if used.

* disable failing scenario

* PR feedback

* Typo (CENTINEL --> SENTINEL)

* added a bug link to a disabled test scenario + couple comment tweaks

2 years ago[wasm] Make typescript and rollup build incremental (#62772)
Pavel Savara [Tue, 14 Dec 2021 17:30:23 +0000 (18:30 +0100)]
[wasm] Make typescript and rollup build incremental (#62772)

- eliminate slow ArgsMarshalString
- make rollup build incremental
- exclude dotnet.d.ts from typescript inputs

2 years agoRemove AOT warnings for S.Drawing.Common (#61567)
Andrii Kurdiumov [Tue, 14 Dec 2021 17:21:50 +0000 (23:21 +0600)]
Remove AOT warnings for S.Drawing.Common (#61567)

* Remove AOT warnings for S.Drawing.Common
- `Marshal.SizeOf(Type)` replaced with `Marshal.SizeOt<T>()`
- `Marshal.PtrToStructure(IntrPtr, Type)` replaced with `Marshal.PtrToStructure<T>(IntPtr)`

* Use pointers where possible

* Ref return PRINTDLG

* Use GeneratedDllImport

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years ago[wasm][debugger] Avoiding assert on mono runtime (#62601)
Thays Grazia [Tue, 14 Dec 2021 16:40:08 +0000 (13:40 -0300)]
[wasm][debugger] Avoiding assert on mono runtime (#62601)

* Avoiding assert on mono runtime

* Update src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs

Co-authored-by: Ankit Jain <radical@gmail.com>
* Addressing @radical comments.
Removing unused fields in another test case.

Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agointroduce automation rules aiding PR workflows (#62534)
Eirik Tsarpalis [Tue, 14 Dec 2021 16:27:28 +0000 (18:27 +0200)]
introduce automation rules aiding PR workflows (#62534)

2 years ago[tests] Re-enable some explicit layout tests on Mono (#62746)
Aleksey Kliger (λgeek) [Tue, 14 Dec 2021 15:13:01 +0000 (10:13 -0500)]
[tests] Re-enable some explicit layout tests on Mono (#62746)

* [tests] Re-enable some explicit layout tests on Mono

   These were fixed by https://github.com/dotnet/runtime/pull/61467

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

* objref and non-objref overlap tests expected to fail AOT compilation

   As well as the NestedStructs tests.

   Resolves https://github.com/dotnet/runtime/issues/62567

2 years agoUse TempFile in SendPacketsAsync tests (#62726)
Anton Firszov [Tue, 14 Dec 2021 14:38:49 +0000 (15:38 +0100)]
Use TempFile in SendPacketsAsync tests (#62726)

2 years ago[wasm] Fix imports: require, exit, quit (#62712)
Pavel Savara [Tue, 14 Dec 2021 11:47:08 +0000 (12:47 +0100)]
[wasm] Fix imports: require, exit, quit (#62712)

- fix require, just capture require on top level, replace it later
- simplify exit, quit
- whitespace in *.lib.*

2 years agoRemoving trailing dot from a SNI host in TLS (#62540)
Katya Sokolova [Tue, 14 Dec 2021 09:58:41 +0000 (10:58 +0100)]
Removing trailing dot from a SNI host in TLS (#62540)

* Removing trailing dot from a SNI host in TLS

* Add SSL connection scenario for FQDN with trailing dot

* Removing http layer test for FQDN with trailing dot

* Removing null-forgiving for TargetHost

2 years agoAdd support for NativeAOT testing (#62704)
Michal Strehovský [Tue, 14 Dec 2021 08:01:03 +0000 (17:01 +0900)]
Add support for NativeAOT testing (#62704)

Adds support for running runtime tests in NativeAOT configuration. It's similar to crossgen2 testing, but there's small differences.

* A layout for the AOT compiler is generated into `CORE_ROOT`. This includes the AOT compiler, NativeAOT corelib, and framework/test dependencies we otherwise dump into `CORE_ROOT`.
* The test execution script is amended to first AOT compile the test using the AOT compiler in `CORE_ROOT` and then run the AOT compiled test.
* The test is compiled by running MSBuild on a generated project file. This is different from crossgen2 testing that directly invokes crossgen2. The extra project file is annoying, but also the NativeAOT compiler has more command line arguments and we also need to invoke the platform linker with another set of command line arguments. Having MSBuild do that for us (using the shipping .target/.props that ship with NativeAOT) saves a some trouble there.
* This also includes support for multimodule testing (where each managed .dll is compiled into a single .o/.obj that we link with the native linker). This needs an extra step during test build to precompile the entire framework into a .a/.lib file.

2 years agoGeneralize loop pre-header creation and loop hoisting (#62560)
Bruce Forstall [Tue, 14 Dec 2021 07:02:51 +0000 (23:02 -0800)]
Generalize loop pre-header creation and loop hoisting (#62560)

* Generalize loop pre-header creation and loop hoisting

A loop pre-header is a block that flows directly (and only) to the loop entry
block. The loop pre-header is the only non-loop predecessor of the entry block.
Loop invariant code can be hoisted to the loop pre-header where it is
guaranteed to be executed just once (per loop entry).

Currently, a loop pre-header has a number of restrictions:
- it is only created for a "do-while" (top entry) loop, not for a mid-loop entry.
- it isn't created if the current loop head and the loop entry block are in
different EH try regions

Additionally, partially due those restrictions, loop hoisting has restrictions:
- it requires a "do-while" (top entry) loop
- it requires the existing `head` block to dominate the loop entry block
- it requires the existing `head` block to be in the same EH region as the entry block
- it won't hoist if the `entry` block is the first block of a handler

This change removes all these restrictions.

Previously, even if we did create a pre-header, the definition of a pre-header
was a little weaker: an entry predecessor could be a non-loop block and also
not the pre-header, if the predecessor was dominated by the entry block. This
is more complicated to reason about, so I change the pre-header creation to
force entry block non-loop predecessors to branch to the pre-header instead.
This case only rarely occurs, when we have what looks like an outer loop back
edge but the natural loop recognition package doesn't recognize it as an outer loop.

I added a "stress mode" to always create a loop pre-header immediately after
loop recognition. This is disabled currently because loop cloning doesn't
respect the special status and invariants of a pre-header, and so inserts
all the cloning conditions and copied blocks after the pre-header, triggering
new loop structure asserts. This should be improved in the future.

A lot more checking of the loop table and loop annotations on blocks has been
added. This revealed a number of problems with loop unrolling leaving things
in a bad state for downstream phases. Loop unrolling has been updated to fix
this, in particular, the loop table is rebuilt if it is detected that we unroll
a loop that contains nested loops, since there will now be multiple copies of
those nested loops. This is the first case where we might rebuild the loop
table, so it lays the groundwork for potentially rebuilding the loop table in
other cases, such as after loop cloning where we don't add the "slow path"
loops to the table.

There is some code refactoring to simplify the "find loops" code as well.

Some change details:
- `optSetBlockWeights` is elevated to a "phase" that runs prior to loop recognition.
- LoopFlags is simplified:
- LPFLG_DO_WHILE is removed; call `lpIsTopEntry` instead
- LPFLG_ONE_EXIT is removed; check `lpExitCnt == 1` instead
- LPFLG_HOISTABLE is removed (there are no restrictions anymore)
- LPFLG_CONST is removed: check `lpFlags & (LPFLG_CONST_INIT | LPFLG_CONST_LIMIT) == (LPFLG_CONST_INIT | LPFLG_CONST_LIMIT)` instead (only used in one place
- bool lpContainsCall is removed and replaced by LPFLG_CONTAINS_CALL
- Added a `lpInitBlock` field to the loop table. For constant and variable
initialization loops, code assumed that these expressions existed in the
`head` block. This isn't true anymore if we insert a pre-header block.
So, capture the block where these actually exist when we determine that
they do exist, and explicitly use this block pointer where needed.
- Added `fgComputeReturnBlocks()` to extract this code out of `fgComputeReachability` into a function
- Added `optFindAndScaleGeneralLoopBlocks()` to extract this out of loop recognition to its own function.
- Added `optResetLoopInfo()` to reset the loop table and block annotations related to loops
- Added `fgDebugCheckBBNumIncreasing()` to allow asserting that the bbNum
order of blocks is increasing. This should be used in phases that depend
on this order to do bbNum comparisons.
- Add a lot more loop table validation in `fgDebugCheckLoopTable()`

* Inline fgBuildBlockNumMap to allow using _alloca

* Fix BBJ_SWITCH output

1. Change `dspSuccs()` to not call code that will call `GetDescriptorForSwitch()`
2. Change `GetDescriptorForSwitch()` to use the correct max block number while
inlining. We probably don't or shouldn't call GetDescriptorForSwitch while inlining,
especially after (1), but this change doesn't hurt.

* Remove incorrect assertion

There was an assertion when considering an existing `head` block as
a potential pre-header, that the `entry` block have the `head`
block as a predecessor. However, we early exit if we find a non-head,
non-loop edge. This could happen before we encounter the `head` block,
making the assert incorrect. We don't want to run the entire loop just
for the purpose of the assert (at least not here), so just remove the
assert.

* Formatting

* Use `_alloca` instead of `alloca` name

* Convert fgBBNumMax usage

Change:
```
compIsForInlining() ? impInlineInfo->InlinerCompiler->fgBBNumMax : fgBBNumMax
```
to:
```
impInlineRoot()->fgBBNumMax
```

* Code review feedback

1. Added loop epoch concept. Currently set but never checked.
2. Added disabled assert about return blocks always being moved
out of line of loop body.
3. Fixed bug checking `totalIter` after it was decremented to zero
as a loop variable
4. Added more comments on incremental loop block `bbNatLoopNum`
setting.

* Add EH condition when converting head to pre-header

When considering converting an existing loop `head` block to a pre-header,
verify that the block has the same EH try region that we would create
for a new pre-header. If not, we go ahead and create the new pre-header.

2 years agoRename 'excludemonofailures' to 'mono' (#62749)
Tomáš Rylek [Tue, 14 Dec 2021 06:38:55 +0000 (07:38 +0100)]
Rename 'excludemonofailures' to 'mono' (#62749)

2 years agoAdd NativeAOT to build (#62569)
Michal Strehovský [Tue, 14 Dec 2021 05:23:32 +0000 (14:23 +0900)]
Add NativeAOT to build (#62569)

2 years agoAdd more precise descriptor for RuntimeAssembly (#62737)
Marek Safar [Tue, 14 Dec 2021 00:54:03 +0000 (01:54 +0100)]
Add more precise descriptor for RuntimeAssembly (#62737)

to remove more unused fields

2 years agoMade mono runs stop depending on coreclr, and stop using patching. (#62652)
Nathan Ricci [Tue, 14 Dec 2021 00:22:36 +0000 (19:22 -0500)]
Made mono runs stop depending on coreclr, and stop using patching. (#62652)

2 years agoAdd explicit null-check for tailcalls to VSD (#62719)
Jakob Botsch Nielsen [Tue, 14 Dec 2021 00:15:34 +0000 (01:15 +0100)]
Add explicit null-check for tailcalls to VSD (#62719)

There is already a comment that this is necessary, but it is only being
done for x86 tailcalls via jit helper. Do it for normal tailcalls to VSD
as well.

Fix #61486

2 years agoDo not perform vector save/restore around call that will never return (#62662)
Kunal Pathak [Mon, 13 Dec 2021 23:29:53 +0000 (15:29 -0800)]
Do not perform vector save/restore around call that will never return (#62662)

* Do not perform vector save/restore around call that will never return

* First check if tree is a call

* Use the IsNoReturn() method

2 years agoUnify naming style of dbg / rel-variant JIT projects (#62710)
Tomáš Rylek [Mon, 13 Dec 2021 23:19:25 +0000 (00:19 +0100)]
Unify naming style of dbg / rel-variant JIT projects (#62710)

Most JIT test projects use the _d, _do, _r and _ro name suffixes
to denote debug vs. non-debug ('release') and non-optimized vs.
optimized runs of the tests, however a smaller number of tests
use a different notation using the prefixes _dbg, _speed_dbg,
_rel and _speed_rel. I propose renaming these projects to
match the suffixes other test projects are using.

Thanks

Tomas

2 years agoFix SC tests (#62698)
Dan Moseley [Mon, 13 Dec 2021 20:20:48 +0000 (13:20 -0700)]
Fix SC tests (#62698)

2 years agoDo not promote struct locals with holes (#62645)
Kunal Pathak [Mon, 13 Dec 2021 18:35:57 +0000 (10:35 -0800)]
Do not promote struct locals with holes (#62645)

* Make sure the combined field size matches the struct size

* Fix the condition

* Update test and include containHoles condition

2 years agoEnable building StressLogAnalyzer for Alpine (#62703)
Andrew Au [Mon, 13 Dec 2021 18:05:58 +0000 (10:05 -0800)]
Enable building StressLogAnalyzer for Alpine (#62703)

2 years agoDisable X509StoreTests.RemoveReadOnlyNonExistingDoesNotThrow test on Android (#62717)
Maxim Lipnin [Mon, 13 Dec 2021 17:32:39 +0000 (20:32 +0300)]
Disable X509StoreTests.RemoveReadOnlyNonExistingDoesNotThrow test on Android (#62717)

It disables System.Security.Cryptography.X509Certificates.Tests.X509StoreTests.RemoveReadOnlyNonExistingDoesNotThrow until #62713 is addressed.

2 years agoStop marking volatile indirections as NO_CSE (#62043)
SingleAccretion [Mon, 13 Dec 2021 16:58:24 +0000 (19:58 +0300)]
Stop marking volatile indirections as NO_CSE (#62043)

It is unnecessary - we model volatile indirections as mutating
the global heap in value numbering and thus they can only ever
be CSE defs, which is legal in our model (only volatile operations
serve as mutators as per ECMA).

We get some good small diffs this way.

However, the real purpose of this change is making fixing the
incorrect assertions for L-value indirections, which will be
identified by the presence of the GTF_NO_CSE flag, as that is
the only reliable way to detect L-values in the compiler, mostly
zero-diff.

We could venture and add something like a GTF_LVALUE flag (I
think we had one with that very name at some point...), but that
seems very risky - how many a place today forgets about GTF_NO_CSE,
certainly plumbing the new flag through will not be a pleasant, or
good, long-term solution. The proper solution is to delete GT_ASG,
but that,  of course, is not something done in one weekend :), and
it seems bad to leave known silent bad codegen bugs hanging around
in the meantime.

2 years agoFix invalid IR in span indexer import (#62709)
SingleAccretion [Mon, 13 Dec 2021 14:15:49 +0000 (17:15 +0300)]
Fix invalid IR in span indexer import (#62709)

* Fix invalid IR in Span[] import

* Re-enable disabled tests

2 years agoFix XmlSchema does not correctly validate xs:NMTOKENS type restrictions with enumerat...
Semyon A. Chertkov [Mon, 13 Dec 2021 13:43:16 +0000 (16:43 +0300)]
Fix XmlSchema does not correctly validate xs:NMTOKENS type restrictions with enumeration (#60544)

* ListFacetsChecker fix

* Added  Issue_60543 unit test

* retrigger checks

* Added more unit tests

* Update XmlSchemaSet.Tests.csproj

* TC_SchemaSet_NmTokens enhanced

* TC_SchemaSet_NmTokens test refactoring

Co-authored-by: semyon.chertkov <ngkKNG#xf3>
2 years agoDo not contain zeroes for STOREIND(CLS_VAR_ADDR) (#62686)
SingleAccretion [Mon, 13 Dec 2021 12:46:56 +0000 (15:46 +0300)]
Do not contain zeroes for STOREIND(CLS_VAR_ADDR) (#62686)

There is no good reason for this special case, it seems, and
removing it is a CQ improvement across the board.

2 years agoFixing a possible null reference error in WebSocket deflate. (#62428)
Ivan Zlatanov [Mon, 13 Dec 2021 12:41:42 +0000 (14:41 +0200)]
Fixing a possible null reference error in WebSocket deflate. (#62428)

Fixes #62422

2 years ago[main] Update dependencies from dotnet/linker (#62393)
dotnet-maestro[bot] [Mon, 13 Dec 2021 12:35:20 +0000 (13:35 +0100)]
[main] Update dependencies from dotnet/linker (#62393)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[main] Update dependencies from dotnet/arcade (#62671)
dotnet-maestro[bot] [Mon, 13 Dec 2021 09:36:41 +0000 (10:36 +0100)]
[main] Update dependencies from dotnet/arcade (#62671)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoDon't create multiple large files at the same time (#62519)
Adam Sitnik [Sun, 12 Dec 2021 23:41:20 +0000 (00:41 +0100)]
Don't create multiple large files at the same time (#62519)

* move existing large file tests into a separate type (no code changes)

* don't run the large file tests in parallel

* use FileOptions.DeleteOnClose to ensure that each test removes it's own file

use single large file to test File.ReadAllBytes and ile.ReadAllBytesAsync for both limits

2 years agoUnify the namespaces of HashProviderDispenser. (#62590)
Kevin Jones [Sun, 12 Dec 2021 23:39:07 +0000 (18:39 -0500)]
Unify the namespaces of HashProviderDispenser. (#62590)

2 years agoCleanup, use camel case name conventions of method parameters (#62633)
Ali Yousefi [Sun, 12 Dec 2021 23:38:12 +0000 (23:38 +0000)]
Cleanup, use camel case name conventions of method parameters (#62633)

* Cleanup, use camel case name conventions of method parameters

* Cleanup, use camel case name conventions of method parameters #62633

2 years agoWorkaround clang crash due to large array assignment (#62675)
Adeel Mujahid [Sun, 12 Dec 2021 21:25:44 +0000 (23:25 +0200)]
Workaround clang crash due to large array assignment (#62675)

2 years agoFix gcc warnings in mono (#62684)
Adeel Mujahid [Sun, 12 Dec 2021 18:25:32 +0000 (20:25 +0200)]
Fix gcc warnings in mono (#62684)

* Fix gcc warnings in mono

* Cleanup trailing whitespace in changeset files
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main

if uname 2>/dev/null | grep -q Darwin; then
    space=" "
fi

git show --name-only --pretty="" HEAD...dotnet/main |\
  xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```

* Enable warn-as-error by default; protect good state

2 years agoReplace CorInfoIntrinsics with NamedIntrinsic (#62639)
Adeel Mujahid [Sun, 12 Dec 2021 17:25:36 +0000 (19:25 +0200)]
Replace CorInfoIntrinsics with NamedIntrinsic (#62639)

* Replace CorInfoIntrinsics with NamedIntrinsic

* Implement NI_ARRAY_* intrinsics

* Rename IsJitIntrinsic to IsIntrinsic

2 years agoMove a few vendor libraries to src/native/external (#62673)
Adeel Mujahid [Sun, 12 Dec 2021 16:27:38 +0000 (18:27 +0200)]
Move a few vendor libraries to src/native/external (#62673)

* Move brotli to src/native/external

* Move rapidjson to src/native/external

* Move zlib to src/native/external

* Move zlib-intel to src/native/external

* Cleanup trailing whitespace in changeset files

2 years agoFix errors in Clang 13 (#62685)
Andrii Kurdiumov [Sun, 12 Dec 2021 14:48:19 +0000 (20:48 +0600)]
Fix errors in Clang 13 (#62685)

Without that patch, I was having this errors
```
error: implicit conversion changes signedness: 'long' to 'uintptr_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
```

2 years agoTwo small fixes for the recently merged in merged wrapper logic (#62683)
Tomáš Rylek [Sun, 12 Dec 2021 10:22:14 +0000 (11:22 +0100)]
Two small fixes for the recently merged in merged wrapper logic (#62683)

1. When running the entire Pri1 test file I noticed that xUnit
sometimes generates an empty <assembly /> entry that was crashing
the new logic in run.py. I have added a check to harden the script
against this eventuality.

2. My logic to disable merged test wrapper build in BuildAsStandalone
mode wasn't completely correct - I used the CLRTestTargetUnsupported
property but that's ignored when CLRTestBuildAllTargets is set to
'allTargets'. I have changed it to DisableProjectBuild.

Thanks

Tomas

2 years agoDedup addprefix & delete unused defines from cmake (#62528)
Adeel Mujahid [Sat, 11 Dec 2021 13:59:29 +0000 (15:59 +0200)]
Dedup addprefix & delete unused defines from cmake (#62528)

2 years agoAdded missed penultimate bytes in SniHelper_TruncatedData_Fails scenario (#62641)
Katya Sokolova [Sat, 11 Dec 2021 09:13:13 +0000 (10:13 +0100)]
Added missed penultimate bytes in SniHelper_TruncatedData_Fails scenario (#62641)

2 years agoHTTP/2: Improve incoming header performance (#62614)
github-actions[bot] [Sat, 11 Dec 2021 05:27:24 +0000 (18:27 +1300)]
HTTP/2: Improve incoming header performance (#62614)

Co-authored-by: JamesNK <JamesNK@users.noreply.github.com>
2 years agoFix setting timestamp on Windows on readonly files (#62638)
Dan Moseley [Sat, 11 Dec 2021 04:42:23 +0000 (21:42 -0700)]
Fix setting timestamp on Windows on readonly files (#62638)

2 years agoExclude DNNE based test project from armel builds (#62486)
Adeel Mujahid [Sat, 11 Dec 2021 04:02:59 +0000 (06:02 +0200)]
Exclude DNNE based test project from armel builds (#62486)

2 years agoUpdate spmi asp.net script to collect some osr method contexts (#62635)
Andy Ayers [Sat, 11 Dec 2021 02:43:32 +0000 (18:43 -0800)]
Update spmi asp.net script to collect some osr method contexts (#62635)

Collect both non-pgo and pgo cases. For non-pgo, set OSR to trigger immediately
when any patchpoint is hit to maximize number of cases collected. For PGO, set
OSR to trigger once we've got a bit of profile data gathered by the Tier0 method.

2 years agoSkip native composite ReadyToRun images as inputs to Crossgen2 (#62537)
Tomáš Rylek [Sat, 11 Dec 2021 01:15:06 +0000 (02:15 +0100)]
Skip native composite ReadyToRun images as inputs to Crossgen2 (#62537)

According to the issue https://github.com/dotnet/runtime/issues/49247
a known pre-existing Crossgen2 bug is that it fails when presented
with the components of a previous Crossgen2 compilation in the
composite mode. This is because Crossgen2 lacks proper logic to
recognize the composite images and mistakes them for currently
unsupported managed C++ MSIL assemblies. This change adds the extra
check; I have also unified it between Crossgen2 and R2RDump.

Thanks

Tomas

2 years agoSwitch over Loader/classloader/TypeGeneratorTests to use merged wrappers (#61942)
Tomáš Rylek [Sat, 11 Dec 2021 00:26:40 +0000 (01:26 +0100)]
Switch over Loader/classloader/TypeGeneratorTests to use merged wrappers (#61942)

This change introduces test infra changes supporting new-style merged test wrappers.
As a first step in the test conversion the change switches over 1501 tests under the path
Loader/classloader/TypeGeneratorTests.

2 years agoMark overflow fix for regions (#60646)
Andrew Au [Fri, 10 Dec 2021 23:15:15 +0000 (15:15 -0800)]
Mark overflow fix for regions (#60646)

2 years agoCleanup name of CreateThread shim (#62648)
Jan Kotas [Fri, 10 Dec 2021 22:50:43 +0000 (14:50 -0800)]
Cleanup name of CreateThread shim (#62648)

2 years agoMake tests pass on AVX only host again (#62544)
Andrii Kurdiumov [Fri, 10 Dec 2021 22:34:43 +0000 (04:34 +0600)]
Make tests pass on AVX only host again (#62544)

Just anotate couple other methods which I need, based on https://github.com/dotnet/runtime/pull/61259 methodology

2 years agoFix double-negatives with MatchCharacterClass (#62636)
Stephen Toub [Fri, 10 Dec 2021 22:13:59 +0000 (17:13 -0500)]
Fix double-negatives with MatchCharacterClass (#62636)

Also add missing set description rendering for \d, \D

2 years agoFix describing concatenations in alternations (#62646)
Stephen Toub [Fri, 10 Dec 2021 21:29:48 +0000 (16:29 -0500)]
Fix describing concatenations in alternations (#62646)

I was previously too aggressive in getting rid of concatenations in the comment rendering.  We would end up flattening concatenations into alternations erroneously.

2 years ago[main] Update dependencies from dotnet/runtime-assets dotnet/arcade dotnet/xharness...
dotnet-maestro[bot] [Fri, 10 Dec 2021 21:22:11 +0000 (13:22 -0800)]
[main] Update dependencies from dotnet/runtime-assets dotnet/arcade dotnet/xharness dotnet/icu dotnet/hotreload-utils dotnet/llvm-project (#62582)

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

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Drawing.Common.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 7.0.0-beta.21602.1 -> To Version 7.0.0-beta.21603.1

* Update dependencies from https://github.com/dotnet/llvm-project build 20211206.1

runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools
 From Version 11.1.0-alpha.1.21579.1 -> To Version 11.1.0-alpha.1.21606.1

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 7.0.0-alpha.1.21579.1 -> To Version 7.0.0-alpha.1.21606.1

* Update dependencies from https://github.com/dotnet/xharness build 20211209.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.21607.3 -> To Version 1.0.0-prerelease.21609.1

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

Microsoft.DotNet.XUnitExtensions , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.ApiCompat , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.GenFacades , Microsoft.DotNet.GenAPI , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SharedFramework.Sdk
 From Version 7.0.0-beta.21602.3 -> To Version 7.0.0-beta.21609.2

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20211206.2

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.0.2-alpha.0.21579.1 -> To Version 1.0.2-alpha.0.21606.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix lazy-initialization of Trace.s_correlationManager to be thread-safe (#62640)
Stephen Toub [Fri, 10 Dec 2021 20:28:32 +0000 (15:28 -0500)]
Fix lazy-initialization of Trace.s_correlationManager to be thread-safe (#62640)

If two threads race to initialize it, one may end up overwriting the others, which means state pushed onto the losing thread's stack might end up disappearing.

2 years agoAdd IsPackable to RateLimiting package and cleanup packaging TODOs (#62612)
Santiago Fernandez Madero [Fri, 10 Dec 2021 20:05:05 +0000 (14:05 -0600)]
Add IsPackable to RateLimiting package and cleanup packaging TODOs (#62612)

2 years agoAdd \w helper function to RegexCompiler / source generator (#62620)
Stephen Toub [Fri, 10 Dec 2021 19:17:23 +0000 (14:17 -0500)]
Add \w helper function to RegexCompiler / source generator (#62620)

2 years agoFix custom JsonConverterFactories not working with transitive type/property declarati...
Eirik Tsarpalis [Fri, 10 Dec 2021 18:17:43 +0000 (18:17 +0000)]
Fix custom JsonConverterFactories not working with transitive type/property declarations. (#62595)

2 years ago[wasm] Decrease the startup ceremony (#62587)
Pavel Savara [Fri, 10 Dec 2021 16:13:11 +0000 (17:13 +0100)]
[wasm] Decrease the startup ceremony (#62587)

* new API MONO.mono_run_main_and_exit and MONO.mono_run_main
* default onAbort
* console-v8-cjs sample
* reduced setup ceremony

2 years agoEnforce HTTP request Content-Length correctness (#62541)
Miha Zupan [Fri, 10 Dec 2021 15:50:23 +0000 (07:50 -0800)]
Enforce HTTP request Content-Length correctness (#62541)

* Enforce HTTP request Content-Length correctness

* Skip test on Browser

* Test that subsequent HTTP/1.1 requests can still succeed on a new connection

* Be consistent about exception nesting

2 years agoAdd instructions to skip restoring nuget packages (#62634)
Fan Yang [Fri, 10 Dec 2021 15:38:15 +0000 (10:38 -0500)]
Add instructions to skip restoring nuget packages (#62634)

Add build instructions to skip restoring nuget packages, when you only made change to mono.

2 years ago[wasm] Reduce number of calls to setTimer (#62433)
Pavel Savara [Fri, 10 Dec 2021 15:37:59 +0000 (16:37 +0100)]
[wasm] Reduce number of calls to setTimer (#62433)

* Reduce number of calls to setTimer (#62433)
* unit test
Co-authored-by: Marek Fišera <mara@neptuo.com>
2 years ago[wasm] Allow the main.js file to keep it's name (#62576)
Pavel Savara [Fri, 10 Dec 2021 13:04:27 +0000 (14:04 +0100)]
[wasm] Allow the main.js file to keep it's name (#62576)

* allow the main.js file to keep it's name
Co-authored-by: Ankit Jain <radical@gmail.com>
2 years agoMark forward delegate stubs as not having hidden arguments (#62617)
Jan Kotas [Fri, 10 Dec 2021 07:28:57 +0000 (23:28 -0800)]
Mark forward delegate stubs as not having hidden arguments (#62617)

2 years agoRelegate PatternsDataSet_ConstructRegexForAll_SourceGenerated test to 64-bit only...
Stephen Toub [Fri, 10 Dec 2021 05:58:34 +0000 (00:58 -0500)]
Relegate PatternsDataSet_ConstructRegexForAll_SourceGenerated test to 64-bit only (#62621)

2 years agoA little more regex source generator tweaking (#62605)
Stephen Toub [Fri, 10 Dec 2021 02:16:40 +0000 (21:16 -0500)]
A little more regex source generator tweaking (#62605)

* Remove now unecessary "Variable declared but never used" warning suppression

* Avoid declaring inputSpan in FindFirstChar if we don't have to

* Add RegexNode.Ref/Bol/Eol to non-backtracking list

* Move some additionalDeclarations back to where they're used

I was overaggressive in moving these to the beginning.  Some are fine where they're needed.

* Delete dead code

* Emit IsEmpty for more slice.Length checks

* Apply suggestions from code review

2 years agoPopulate NativeAOT sources from runtimelab (#62611)
Michal Strehovský [Fri, 10 Dec 2021 01:15:32 +0000 (10:15 +0900)]
Populate NativeAOT sources from runtimelab (#62611)

2 years agoAdd System.Native APIs needed by NativeAOT (#62571)
Michal Strehovský [Fri, 10 Dec 2021 00:39:21 +0000 (09:39 +0900)]
Add System.Native APIs needed by NativeAOT (#62571)

Porting files over from runtimelab branch - no changes to what was there.

2 years agoDisable CreateSpan_il test (#62598)
Bruce Forstall [Thu, 9 Dec 2021 23:30:54 +0000 (15:30 -0800)]
Disable CreateSpan_il test (#62598)

Failing in many jitstress modes

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

2 years agoReenable Mono runtime tests on PRs (#62437)
Alexander Köplinger [Thu, 9 Dec 2021 20:34:26 +0000 (21:34 +0100)]
Reenable Mono runtime tests on PRs (#62437)

2 years agoFix ReadAsync_ThrowsIfWriterCompletedWithException for PGO (#62584)
Egor Bogatov [Thu, 9 Dec 2021 20:05:47 +0000 (23:05 +0300)]
Fix ReadAsync_ThrowsIfWriterCompletedWithException for PGO (#62584)

2 years agoMake `gtHasRef` pay attention to LCL_FLD nodes (#62568)
SingleAccretion [Thu, 9 Dec 2021 19:23:07 +0000 (22:23 +0300)]
Make `gtHasRef` pay attention to LCL_FLD nodes (#62568)

* Add a test

* Make "gtHasRef" pay attention to LCL_FLD nodes

Fixes the interference checks in the forward substitution of relops optimization.

2 years agoHTTP/3: QPACK decoder performance (#62470)
github-actions[bot] [Thu, 9 Dec 2021 19:19:05 +0000 (08:19 +1300)]
HTTP/3: QPACK decoder performance (#62470)

Co-authored-by: James Newton-King <james@newtonking.com>
2 years agoUpdated testing document; patching and various mono-specific msbuild targets are...
Nathan Ricci [Thu, 9 Dec 2021 18:40:03 +0000 (13:40 -0500)]
Updated testing document; patching and various mono-specific msbuild targets are no longer needed. (#62588)

2 years agoApp does not Run as a service in a Windows Container (#62452)
Eric Erhardt [Thu, 9 Dec 2021 17:53:22 +0000 (11:53 -0600)]
App does not Run as a service in a Windows Container (#62452)

Removing SessionId check in IsWindowsService(). This check is not correct when the process is being run in a Windows container. The container will get a different SessionId.

Fix #52416

2 years agoFix some outerloop tests (#62559)
Dan Moseley [Thu, 9 Dec 2021 17:41:58 +0000 (10:41 -0700)]
Fix some outerloop tests (#62559)

* serialport

* Fix OpenOrCreate_DeleteOnClose_UsableAsMutex

* logging

* impersonated

* ping

2 years agoConvert some old style intrinsics to NamedIntrinsic (#62271)
Adeel Mujahid [Thu, 9 Dec 2021 16:25:34 +0000 (18:25 +0200)]
Convert some old style intrinsics to NamedIntrinsic (#62271)

* Convert some old style intrinsics to NamedIntrinsic

* Delete GetStubContextAddr and related code

* More cleanups

Co-authored-by: EgorBo <egorbo@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years ago[mono] Support LLVM inline assembly. (#62558)
imhameed [Thu, 9 Dec 2021 15:20:52 +0000 (07:20 -0800)]
[mono] Support LLVM inline assembly. (#62558)

This change adds a convenience function, named `mono_llvm_inline_asm`,
that wraps `LLVMGetInlineAsm` and `LLVMBuildCall2`.

Inline assembly isn't used right now for normal code generation. But
this can be used to ease debugging and development by inserting
easy-to-find markers in the generated code. Towards that end, this
change also adds a convenience `LLVMTypeRef`, named `void_func_t`, that
denotes a function type that takes no parameters and does not return a
value.

Example:

    mono_llvm_inline_asm (builder, void_func_t, "int $$0x3", "", LLVM_ASM_SIDE_EFFECT, NULL, 0, "");

2 years agoSkip source gen DLLs in mono AOT (#62518)
Andy Gocke [Thu, 9 Dec 2021 14:59:24 +0000 (06:59 -0800)]
Skip source gen DLLs in mono AOT (#62518)

These appear to be failing because Microsoft.CodeAnalysis isn't present, but that's expected
behavior for source generators/analyzers, as they are plugins.

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

2 years agoAdd additional binary operations into the RangeCheck analysis. (#61662)
anthonycanino [Thu, 9 Dec 2021 14:55:12 +0000 (06:55 -0800)]
Add additional binary operations into the RangeCheck analysis. (#61662)

* Add additional binary operations into the RangeCheck analysis.

GT_LSH and GT_MUL are now covered in the range analysis check. This
allows to catch and eliminate the range check for cases like

```
ReadOnlySpan<byte> readOnlySpan => new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

byte byt = 0;
for (int i = 0; i < 5; i++)
{
  byt = readOnlySpan[i * 3];
  // ...
}
```

or

```
bool[] flags = new bool[Size + 1];

for (int i = 2; i <= Size; i++)
{
  for (int k = i * 2; k <= Size; k += i)
  {
    flags[k] = false;
  }
}
```

Note that without this change, the previous snippet would not eliminate
the range check on `flags[k]`, but the equivalent snippet would

```
for (int i = 2; i <= Size; i++)
{
  for (int k = i + i; k <= Size; k += i)
  {
    flags[k] = false;
  }
}

```

as additional was implemented in the range check analysis, but multiply
was not.

* RangeCheck multiply overflow fix and tests.

Tests catch some edge cases with multiplcation overflow IF
the overflow detection isn't implemented correctly.

* Use CheckedOps::Signed instead of false.

* Reduced overflow test array size to more reasonable value.

* Update src/coreclr/jit/rangecheck.cpp

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
* Update src/coreclr/jit/rangecheck.cpp

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
Co-authored-by: Egor Bogatov <egorbo@gmail.com>
2 years agofix the build (#62575)
Adam Sitnik [Thu, 9 Dec 2021 14:50:51 +0000 (15:50 +0100)]
fix the build (#62575)

2 years agoCI matrix update: add Ubuntu 21.04 - second attempt (#60162)
Jan Jahoda [Thu, 9 Dec 2021 12:47:15 +0000 (13:47 +0100)]
CI matrix update: add Ubuntu 21.04 - second attempt (#60162)

* CI matrix update: add Ubuntu 21.04 (#59578)

* Change base os from amd64 to arm

2 years agoMore regex source generator tweaks (#62539)
Stephen Toub [Thu, 9 Dec 2021 11:58:39 +0000 (06:58 -0500)]
More regex source generator tweaks (#62539)

* Remove some unnecessary capture position locals

Now that we emit a helper function for the uncapturing loop, we no longer need a local to temporarily store a popped capture position from the stack.

* Consolidate a few declaration lines

* Clean up descriptions further.

* Fix blank lines between nodes

* Build atomic description into some child nodes instead

* Remove stale Debug.Fail being emitted

I'd included it initially for debugging and never removed it.

* Avoid ReserveName for a few iteration variables

* Fix missing ||

* Fix += in char loop to use EmitAdd

Mainly so that `+= 1` is instead rendered as the more idiomatic `++`

* Update warning level in tests to ensure we're observing all warnings

* Clean up loop descriptions a bit

- Use "exactly" for repeaters
- Put a comma before "optionally"
- Special-case a minimum of 2 as "twice"

* Delete defunct base.InitializeReferences call.

This is now a nop.

* Update src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
2 years agoUpdate Xharness dependencies (#62501)
Marek Fišera [Thu, 9 Dec 2021 10:24:54 +0000 (11:24 +0100)]
Update Xharness dependencies (#62501)

2 years ago[tests] Fix local test runs for mobile (#62549)
Mitchell Hwang [Thu, 9 Dec 2021 09:03:24 +0000 (04:03 -0500)]
[tests] Fix local test runs for mobile (#62549)

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
2 years agoEscape lower-cased type names (#62507)
Julien Couvreur [Thu, 9 Dec 2021 08:05:25 +0000 (00:05 -0800)]
Escape lower-cased type names (#62507)

2 years agoPopulate NativeAOT sources from runtimelab (#62563)
Michal Strehovský [Thu, 9 Dec 2021 06:11:46 +0000 (15:11 +0900)]
Populate NativeAOT sources from runtimelab (#62563)