Skip to content

Conversation

@joshpeterson
Copy link

This is an automatically generated pull request to merge changes from the upstream main branch.

jkotas and others added 30 commits January 10, 2022 07:45
…ritten as valid JSON. (dotnet#62690)

* Change documentation

* Move doc addition in remark block

Co-authored-by: Layomi Akinrinade <[email protected]>

* Add remarks block

* Update exception text

* Fix characters

* Update exception message

Co-authored-by: Layomi Akinrinade <[email protected]>

* Usage of a more insightful message

Co-authored-by: Krzysztof Wicher <[email protected]>

* Usage of more insightful remark

* Simplify wording

* Update remark

* Change wording

See dotnet/dotnet-api-docs#7488 (comment)

* Change wording

Co-authored-by: Layomi Akinrinade <[email protected]>

* Change wording

* Remove duplicate closing tag

* Add enum-lvl remark

Co-authored-by: Layomi Akinrinade <[email protected]>
Co-authored-by: Krzysztof Wicher <[email protected]>
* Fix Regex if-then-else code generation

Code coverage revealed some gaps in testing around conditionals, which in turn led to discovering a) some bugs in both RegexCompiler and the source generator around expression conditionals, and b) divergence between the compiler and the source generator.  This adds tests to address the code coverage gaps and fixes the implementations to both address the bugs and bring the code much closer.  The main problem with expressional conditionals was flawed handling of backtracking, either not pushing the right state on to the stack or not initializing the state correctly in the first place.  We also failed to revert positional changes made in the expression condition when the condition failed to match.

* Address PR feedback

* A few more tweaks
* Matched fallback messages with default variants from resources.
There were some instances of async calls being blocking by the use of
`.Wait()` on the task, in various `Check*` methods. And that would cause
completions to get blocked, and not get run.

In some cases, we didn't await the task at all, and so failures in that
would only fail randomly.

This removes all uses of `.Wait()`, and makes the methods async, and
correctly awaits on them.

Fixes dotnet#62661 .
)" (dotnet#63586)

This reverts commit 97ef512.

# Conflicts:
#	src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs
* improve TLS resume on server

* make sure low bit is never set for SslProtocols

* add assert
OSR wasn't aggressive enough in importing the original method entry,
so if an inlinee introduced a recursive tail call that we wanted to
turn into a loop, we might find that the target block for the loop
branch never got created.

Update the logic so that we import the entry if we're in the root
method and we have an inlineable call in tail position. This will
over-import in many cases but if those blocks turn out to be unreachable
they will usually be removed without impacting final code gen.

Fixes one of the OSR stress mode failures seen in dotnet#62980.
* Refactor "fgDebugCheckFlags" with "VisitOperands"

This change does away with one more case of custom traversal logic.

Semantic changes have mostly been avoided, with some exceptions:

1) Dead checking of GLOB_REF on ADDR was dropped
2) Dead checking of GLOB_REF on statics was commented out
3) REVERSE_OPS checking was strengthened
4) Flag propagation for calls was also strengthened

Note: the GLOB_REF checking was dead because we do not check for
"extra" GLOB_REF flags, and the code in question was using the
"actual" "treeFlags".

Also renamed "treeFlags" to "actualFlags" and "chkFlags" to
"expectedFlags" as the handle checking code was apparently
confused by the (somewhat unobvious) names and got them swapped.

* Fix flags copying in "gtCloneExpr"

The code in question was copying GT_LCL_VAR flags to GT_CNS_INT
nodes, which is dangerous and not necessary. There is no need to
copy the flags in case we didn't create a new constant node as
the code under "DONE:" already does that.

Found by the new checking code for GTF_REVERSE_OPS.
When this test was changed to use a seed from an environment variable it
changed the test to repeatedly create the same Random instance, reducing
coverage to only ever test one variant.

This reverts the changes by dotnet#50767 and uses the environment variable in
the existing seed mechanism instead.
Correct calling convention for corerun export using in CoreShim.
)

* Reproduce the issue with spaces around the section name

* Remove leading and trailing whitespaces from section name
… clean up the entry in the region allocator. (dotnet#63577)

The region itself though looks like it is on a region free list (heap_segment_allocated is null), so we crash when we try to remove it from its free list, as its containing_free_list is null.

Fix is to delete the region in the region allocator's map, i.e. cause it to be marked as free.
…et#63574)

* Add getter properties unfolding in structures.

* Changed to TryParse in case of reaching beyond the array while doing parts[4].

* Applied @radical's suggestion about array safety.

* Applied @radical's ElementType check simplifiaction.
* Re-enable tests

* Dynamically load getifaddrs if necessary

* Prevent redeclaration of the ifaddrs struct

* Fix typo

* Do not close the dynamic library

* Enable the fixed functional tests in CI

* Reduce code duplication for obtaining libc file name

* Simplify usage of the function pointers

* Move typedefs

* Rename the _ensure_ function

* Remove fptr typedefs

* Update comment

* Add missing include

* Update comment

* Remove unnecessary comment

* Move static variable

* Remove unnecessary change

* Move LIBC_FILENAME to the utilities header

* Avoid error if constant is undefined

* Conditionally include ifaddrs

* Try to fix cmake_symbol_exists issue for browser

* Minor tweaks

* Try different way of detecting getifaddrs

* Use the hack only for Android builds

* Revert "Move LIBC_FILENAME to the utilities header"

This reverts commit 4e67687.

* Revert "Reduce code duplication for obtaining libc file name"

This reverts commit aca15d1.

* Simplify opening libc

* Update code style

* Fix race condition

* Prevent race condition

* Switch locking implementation for a lock-free implementation

* Enable unit test for Android

* Try using weak symbols

* Fix function name

* Revert "Fix function name"

This reverts commit f927aae.

* Revert "Try using weak symbols"

This reverts commit 46d3ede.

* Refactor code to use pthread_once
* fix step on ios when using interpreter

* Apply review suggestions.

* Removing unrelated change
This PR makes sure we never write more bytes into the destination buffer than we allocated. The way we currently use this function always is safe because we ensure that the destination buffer is large enough beforehand but it could be a problem if we reused this function somewhere else in the future.

If there's too much data in the input buffer to fit into the destination buffer we read only as much as we can and we leave the rest of the data intact for future reads.
* Enable regions by default

* ApproxTotalBytesInUse

* one line fix

* initialize CurrentThread before initializing GC

Without this fix enabling Regions is failing AOT tests on checked build.

* use GetCurrentThreadIfAvailable within GCToEEInterface::GetThread

This is similar to GCToEEInterface::GetThread implementation in the runtime.

Co-authored-by: Maoni Stephens <[email protected]>
…tnet#62894) (dotnet#63012)

Modifies the logging in 
LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler to log the AbsoluteUri so the unescaped Uri is logged
* add capture group name in comment

* Some fixes for using capture group name

- Pass correct arguments into GroupNameFromNumber from RegexCode
- Use capture group name for backreferences and backreference conditionals as well
- Only render the group number if there is no name
- Consistenly use the "capture group" suffix
- Clean up GroupNameFromNumber to avoid duplicate string.Empty fallback cases
- Fixes rendering of balancing groups

Co-authored-by: Stephen Toub <[email protected]>
* Added DrawRectangle overload accepting RectangleF

* Added DrawRectangle overload to reference assembly file

* Added FillPie overload accepting RectangleF

* Added test cases for DrawRectangle accepting RectangleF

* Added FillPie argument test cases

* Added XML parameters for newly added FillPie and DrawRectangle

* Moving DrawRectangle and FillPie with RectangleF to netcoreapp

* Moving DrawRectangle and FillPie RectangleF tests to netcoreapp

* Only testing RectangleF overloads in GraphicsTests.Core.cs; other
  overloads stay as they are.
* FillPie tests that were newly added as part of issue dotnet#62385 are split
  in the same manner.

* Removing RectangleF overload from mono tests

DrawRectangle with RectangleF overload is new and not compiled into
mono.
…guration.FileExtensions` (dotnet#57434)

* Annotate

* Update FileConfigurationProvider.cs

* DisableImplicitAssemblyReferences

* Use compaund assigment

* DisallowNull

* Suppress warning

* GetFileProvider non nullable return
* HostBuilder.Build doc: mention lifetime

Mention that the host application lifetime service will be added *in addition* to the services configured to be run.

* ExecuteAsync: See Worker Services in .NET

* StartAsync: mention IHostApplicationLifetime

1. The application will run until interrupted or until `HostApplicationLifetime.StopApplication()` is called.
2. Document how to configure `Services`.

* mv mention StopApplication to StartAsync

Co-authored-by: Eric Erhardt <[email protected]>

* Build doc: mv services to remarks

* typo fix

* Starts only hosted services

Co-authored-by: Eric Erhardt <[email protected]>

* See see

* IHost.Services are RO

Co-authored-by: Genevieve Warren <[email protected]>

* Use indicative

Co-authored-by: Genevieve Warren <[email protected]>

* Oxford commas

Co-authored-by: Genevieve Warren <[email protected]>

* see in remarks

* typo fix

Co-authored-by: Eric Erhardt <[email protected]>

Co-authored-by: Eric Erhardt <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
stephentoub and others added 24 commits January 21, 2022 07:44
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Přemek Vysoký <[email protected]>
Fix crash when VS4Mac is debugging VS4Mac arm64

Issue: dotnet#64011
* ILVerify: Handle readonly references in ldfld

Fixes dotnet#63953

* Fix test name

Co-authored-by: Michal Strehovský <[email protected]>
Very often 'this' is already a local and we can avoid creating another
local.
)

* Apply changes on wasm using sdb protocol.

* conflict

* Merge conflict.

* Fix merge

* Fix compilation error.
…e operands (dotnet#64083)

* Fixed IsFloatPositiveZero from returning 'true' on non-constant double operands

* Update src/coreclr/jit/gentree.h

Co-authored-by: Egor Bogatov <[email protected]>

Co-authored-by: Egor Bogatov <[email protected]>
…otnet#63972)

* Ensure several helper intrinsics are correctly imported and handled

* Ensure that Sum for TYP_INT/UINT on Arm64 is correctly handled

* Respond to PR feedback and ensure ExtractMostSignificantBits for Vector64<int/uint> on Arm64 also uses AddPairwise

* Applying formatting patch

* Ensure the clsHnd is correct

* Fix the remaining musl failures

* Ensure that we aren't sign-extending TYP_BYTE (System.SByte) for ExtractMostSignificantBits

* Ensure an assert is correct on x64

* Ensure Vector64<int/uint>.Dot on Arm64 uses AddPairwise, not AddAcross

* Apply formatting patch
No functional changes, just code cleanup:
- Move node types into a RegexNodeKind enum
- Rename some of the kinds to make them more descriptive
- Rename node.Next to node.Parent to better describe its purpose
- Add a bunch of comments about node kinds
* Create "fgOptimizeCommutativeArithmetic"

And just move code from "fgMorphSmpOp" to it.

Just one diff: better comma throw propagation in an ILGEN method.

* Refactor the function

Split it into specialized variants for each operator,
delete redundant code, fix up one case of wrong typing
for a constant in the MUL -> SHIFT optimization.

One CSE diff due to different VNs because of the typing
change for the constant (int -> long).

Many text diffs: "mov x3, 5" => "mov w3, 5".
It is not necessary, the compiler fully supports locals
on the RHS of a struct assignment. Not marking these results
in a CQ improvement, from struct (including SIMD) CSEs and
global constant propagation into promoted fields.
* Clean things up a little

Delete redundant conditions, use "LclVarDsc*", rename locals for clarity.

* Delete a redundant condition

For actual def nodes, GTF_VAR_CAST will never be set, it is
only set in "optNarrowTree" for uses.

For "def nodes" that are actually uses (parameters), the VNs
will never match anyway.

* Handle embedded assignments in copy propagation

Previously, as the comments in copy propagation tell us, it
did not handle "intervening", or not-top-level definitions of
locals, instead opting to maintain a dedicated kill set of them.

This is obviously a CQ problem, but also a TP one, as it meant
there had to be a second pass over the statement's IR, where
the definitions would be pushed on the stack.

This change does away with that, instead pushing new definitions
as they are encountered in execution order, and simultaneously
propagating on uses. Notably, this means the code now needs to
look at the real definition nodes, i. e. ASGs, not the LHS locals,
as those are encountered first in canonical execution order, i. e.
for a tree like:

```
  ASG
    LCL_VAR V00 "def"
    ADD
      LCL_VAR V00
      LCL_VAR V00
```

Were we to use the "def" as the definition point, we would wrongly
push it as the definition on the stack, even as the assignments
itself hasn't happened yet at that point.

There are nice diffs with this change, all resulting from unblocked
propagations, and mostly coming from setup arguments under calls.

* Simplify optIsSsaLocal
* Make ApiCompat.proj incrementally buildable

In dotnet#64000, I noticed that ApiCompat.proj never builds incrementally. Even though the RunApiCompat target has Inputs and Outputs, those aren't defined too late inside the target to have any effect. Moving them out and declare the generated response file as an output.

Also simplifying some msbuild logic and renaming some properties as underscore prefixes in project files don't make sense if the property isn't reserved in any way.

* Update ApiCompat.proj
* Remove enable drawing on unix switch

* Update some tests and not run tests that need Drawing on non Windows

* PR Feedback, just turn off the switch
…dotnet#63100)

* Handle complex local addresses in block morphing

In block morphing, "addrSpill" is used when the destination or source
represent indirections of "complex" addresses. Unfortunately, some trees
in the form of "IND(ADDR(LCL))" fall into this category.

If such an "ADDR(LCL)" is used as an "addrSpill", the underlying local
*must* be marked as address-exposed. Block morphing was using a very
simplistic test for when that needs to happen, essentially only recognizing
"ADDR(LCL_VAR/FLD)". But it is possible to have a more complicated pattern
as "PrepareDst/Src" uses "IsLocalAddrExpr" to recognize indirect stores
to locals.

Currently it appears impossible to get a mismatch here as morph transforms
"IND(ADD(ADDR(LCL_VAR), OFFSET))" into "LCL_FLD" (including for TYP_STRUCT
indirections), but this is a very fragile invariant. Transforming TYP_STRUCT
GT_FIELDs into GT_OBJs instead of GT_INDs breaks it, for example.

Fix this by address-exposing the local obtained via "IsLocalAddrExpr".

* Add a TODO-CQ for LCL_FLD usage
…dencyInjection` (dotnet#63836)

* Annotate src

* Update ResolverBuilder.Build

* Update RunOnEmptyStackCore

* ILEmitResolverBuilderContext constructor

* Remove setter

* Add assert
* Import GT_STORE_DYN_BLK directly

* Delete GT_DYN_BLK

* DynBlk -> StoreDynBlk

* Add some tests

* Mark tests Pri-1

* Rebase and fix build

* Bring back the odd early return
Allows building the runtime without SPMI.

`build.cmd clr` will still build SPMI.
`build.cmd clr.native` will still build SPMI.
`build.cmd clr.runtime` will no longer build SPMI.

This is mostly motivated by NativeAOT subset builds where SPMI contributes to 10% of the native build time (nativeaot CorecLR subset builds pretty quickly compared to full CoreCLR).
@joshpeterson
Copy link
Author

Looks like we got a good sync-up this time!

@joshpeterson joshpeterson merged commit bad4f4c into unity-main Jan 24, 2022
@joshpeterson joshpeterson deleted the bot-upstream-main-merge-2022-01-22 branch January 24, 2022 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.