Skip to content

Resolve conflicts with upstream main #4104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Jan 13, 2022
Merged

Conversation

MaxDesiatov
Copy link

No description provided.

gottesmm and others added 30 commits November 1, 2021 15:48
We currently have a problem with how constantness diagnostics
traverse the AST to look for function calls to diagnose. We
special case closure bodies and don't check them (unless they're
single expression closures) because closure bodies are type-
checked separately and will be covered later. This poses a problem
in certain AST structures, such as what we see with result builders,
because the call expressions are rooted in declarations, which aren't
checked in the closure body type-checking covered by MiscDiag.

This patch fixes the problem by manually checking all closure bodies
and stopping misc diagnostics from checking the bodies separately.

rdar://85737300
This change has two parts to it:

1. Add in a new interface (addStatusRecordWithChecks) for adding task
status records that also takes in a function ref. This function ref will
be used to evaluate if current state of the parent task has any changes
that need to be propagated to the child task that has been created.

This is necessary to prevent the following race between task creation
and concurrent cancellation and escalation:

a. Parent task create child task. It does lazy relaxed loads on its own
   state while doing so and propagates this state to the child.
b. Child task is created but has not been attached to the parent
   task/task group.
c. Parent task gets cancelled by another thread.
d. Child task gets linked into the parent’s task status records but no
   reevaluation has happened to account for changes that might have happened to
   the parent after (a).

2. Move status record management functions from the
Runtime/Concurrency.h to TaskPrivate.h. Remove any corresponding
overrides that are no longer needed. Remove unused tryAddStatusRecord
method whose functionality is provided by addStatusRecordWithChecks.

Radar-Id: rdar://problem/86347801
Radar-Id: rdar://problem/86347801
Verified that when a __consuming method calls a function which takes a
closure that captures self weakly, self is not deallocated until the
call returns.  (Note that this is a behavioral change from what occurs
when lexical borrow scopes are disabled; in that case, self is
deallocated before the call to the function.)
Verified that lexical lifetimes DO NOT result in a method call to a weak
reference resulting in a strong reference to the object.  Consequently,
even with lexical lifetimes enabled, it is still possible, within a
single scope, for the first method call to an object weakly referenced
to occur but for the second such call not to because the object will
have been deallocated.
This was missed when working on swiftlang#40723 and will prevent
`SWIFT_STDLIB_HAS_ASL` having a wrong default.
…time.

Each trace point is declared as a function in the new `Tracing.h` header. These functions are called from the appropriate places in the concurrency runtime.

On Darwin, an implementation of these functions is provided which uses the `os/signpost.h` API to emit signpost events/intervals.

When the signpost API is not available, no-op stub implementations are provided. Implementations for other OSes can be provided by providing implementations of the trace functions for that OS.

rdar://81858487
* use quoted arguments when referencing "SWIFTLIB_SINGLE_SDK"
* break the first condition on multiple lines

This will make changes to these conditions easier to review.
… module

Diagnostics of public imports of private modules are more likely to be
wrong about imports of the underlying module from a Swift overlay due to
project configuration/installation, or the fact that private overlays
are installed in the same folder as public ones. Let's always downgrade
these diagnostics to warnings to help landing the rest of the
diagnostics as errors.

rdar://87262431
[Sema] Downgrade to a warning public imports of an underlying private module
…his-economy

Avoid protocol conformance lookups in more NSString bridging scenarios
[gardening] align platform checks when enabling bitcode inclusion
…es/test/verification/20220105/1

[Test] Checked variable lifetimes extend self.
[build] Remove SWIFT_SDK_${OS}_ARCH_${ARCH}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY CMake variable
We were never setting these opaque type substitutions, but code
generation was silently failing. Now we assert, so move the code into
the proper common location so we always set opaque type substitutions
on properties.

Fixes rdar://86800325.
Instead of short-circuiting out of emitBlockStmt if the SIL insertion point
has become unreachable (because, for instance, all paths through the function
have returned), iterate through the remaining elements and process
non-PatternBindingDecl declarations, to ensure that local functions and types
get emitted. Fixes rdar://87039628.
ABI checker: check validity of extended nominals before continue
…var via its fields instead of all at once.

In the future we may be able to handle this case, but for now lets just error so
that users are not confused.
…-builders

[Sema][MiscDiag] Fix constantness diag to handle result builder patterns
…variables

Ensure that we set opaque type substitutions on local variables.
…-enum-cp

[Sema] Avoid misleading diagnostics for incomplete enum computed properties
`printClangDeclName` introduced another use of the clang AST in `swiftAST`, remove it by returning early if we are only building the parser library.
gottesmm and others added 24 commits January 11, 2022 11:57
…47eef3e843e8e7023c14230

Re-enable a test requiring an optimized stdlib to ensure we pattern match.
[stdlib] Implement the Indic grapheme breaking rules
…-warning

[NFC] Removing unused ctx variable
Add new `-print-ast-decl` frontend option for only printing declarations,
to match existing behavior.
Some tests want to print the AST, but don't care about expressions.

The existing `-print-ast` option now prints function bodies and expressions.
Not all expressions are printed yet, but most common ones are.
…conformance

Tolerate missing Sendable conformances on superclasses.
This may be the cause of the instability we've been seeing on the bots
here. If a type variable is used as the pattern type across allocation
arenas, we may incorrectly reuse a cache entry and it could be
substituted a second time for a bogus type.

rdar://87413287
…-parserlib

[SwiftSyntax] Avoid linking clangAST in SwiftSyntaxParserLib build
…5433388c5c882d89cab7912

[move-function] Fix _move SILGen test to match current codegen.
… test.

Due to rdar://87429620, test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift is still using `-requirement-machine=off`. This patch moves the reproducer to a standalone XFAIL test, and removes `-requirement-machine=off` from differentiation_diagnostics.swift.
…creation-escalation-race

Resolve race between task creation and concurrent escalation and cancellation.
Propagate Pattern Arena When Allocating PackExpansionTypes
…fer (swiftlang#40814)

* [Distributed] Adjust interface of `swift_distributed_execute_target`

Since this is a special function, `calleeContext` doesn't point to
a direct parent but instead both parent context (uninitialized)
and resume function are passed as last arguments which means that
`callContext` has to act as an intermediate context in call to accessor.

* [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

`RawPointer?` is lowered into a two arguments since it's a struct,
to make it easy let's just allocate an empty pointer for `Void` result.

* [Distributed] NFC: Update _remoteCall test-case to check multiple different result types
This change adds support for WASI in stdlib tests. Some tests that expect a crash to happen had to be disabled, since there's currently no way to observe such crash from a WASI host.
test: add a local lit configuration for Interop
# Conflicts:
#	stdlib/private/StdlibUnittest/RaceTest.swift
#	stdlib/private/SwiftPrivateThreadExtras/SwiftPrivateThreadExtras.swift
#	stdlib/private/SwiftPrivateThreadExtras/ThreadBarriers.swift
#	stdlib/public/Concurrency/ThreadSanitizer.cpp
#	test/stdlib/Character.swift
#	test/stdlib/Error.swift
#	test/stdlib/FloatingPoint.swift.gyb
#	test/stdlib/KeyPath.swift
#	test/stdlib/Mirror.swift
#	test/stdlib/NumericParsing.swift.gyb
#	test/stdlib/Optional.swift
#	test/stdlib/Repeat.swift
#	test/stdlib/StaticString.swift
#	test/stdlib/UnsafePointer.swift.gyb
#	test/stdlib/UnsafeRawBufferPointer.swift
#	test/stdlib/UnsafeRawPointer.swift
This reverts commit 24a6f37, reversing
changes made to 79f9a59.
@MaxDesiatov MaxDesiatov marked this pull request as ready for review January 12, 2022 18:57
@kateinoigakukun kateinoigakukun merged commit dce4cdc into swiftwasm Jan 13, 2022
@MaxDesiatov MaxDesiatov deleted the maxd/main-merge branch January 13, 2022 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.