Skip to content
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

[pull] swiftwasm from main #5450

Merged
merged 67 commits into from
May 20, 2023
Merged

[pull] swiftwasm from main #5450

merged 67 commits into from
May 20, 2023

Conversation

pull[bot]
Copy link

@pull pull bot commented May 20, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

Catfish-Man and others added 30 commits May 8, 2023 17:03
…ion.append(contentsOf:) before falling back to a slow element-by-element loop. Fixes rdar://109059874
We don't need to initialise the posix_spawnattr unless we're enabling the
backtracer, so don't.

rdar://109354306
Constrained existentials should be type erased to an upper bound that is dependent on other type parameters.
Intro a new class ErrorWithUnderlyingReason to refactor duplicated logic from
three classes. It can be used as super class to any error with an underlying
error.
Describe in more detail how an object can end up with a non-zero refcount on deallocation, and the consequences.

rdar://109045333
Generate a fake empty buffer to return a SourceLoc pointing to the
beginning of a swiftmodule file.
The Swift compiler expects the context to remain stable between when a
module is built and loaded by a client. Usually the build system would
rebuild a module if a dependency changes, or the compiler would rebuilt
the module from a swiftinterface on a context change. However, such
changes are not always detected and in that case the compiler may crash
on an inconsistency in the context. We often see this when a clang
module is poorly modularized, the headers are modified in the SDK, or
some clang define change its API.

These are project issues that used to make the compiler crash, it
provided a poor experience and doesn't encourage the developer to fix
them by themselves. Instead, let's keep track of modularization issues
encountered during deserialization and report them as proper errors when
they trigger a fatal failure preventing compilation.
New ordring is:
1) `-load-plugin-library`
2) `-load-plugin-executable`
3) `-plugin-path`
4) `-external-plugin-path`

rdar://109163929
Macro expansions are currently written to disk using the mangled name of
the macro. Do not use operators that only differ in case-sensitivity to
avoid issues on case-insensitive filesystems.

Resolves rdar://109371653.
* Unify macro expansion parsing logic between MacroExpansionExpr and
  MacroExpansionDecl
* Diagnose whitespace between '#' and the macro name
* Diagnose keyword as a macro name
When swift-frontend is explicitly passed the pch file as bridging header
on command-line through `-import-objc-header`, it needs to print the
original source file name if needed to the generated objc header.

rdar://109411245
Gave it its own file to be guarded with REQUIRES: objc_interop.
In preparation for using the value in the `StructuralRequirement`s
created for the `parentSig`.
`InferredGenericSignatureRequest` creates `StructuralRequirement`s for
the requirements of the generic signature that is passed to it (if one
is).

Previously, it used invalid `SourceLoc`s for these requirements.  The
result was that when errors that were emitted as a result of those
`StructuralRequirement`s (during concrete type contraction), they would
also have invalid `SourceLoc`s.  The effect was that those errors were
ignored during `diagnoseRequirementErrors`.

Here, use the available loc for those requirements.

rdar://108963047
Now that `InferredGenericSignatureRequest` creates
`StructuralRequirement`s from of the generic signature with valid source
locations, additional redundancy warnings are produced.  Update tests
with the new warnings.
Opened existentials should be erased to the dependent upper bound
if the dependent member can be reduced to a concrete type. This
allows the generic signature to support parameterized protocol types
and bound generic class types by producing a more specific constraint
instead of just a plain protocol or class.
…making consuming and borrowing no implicit copy.

Some notes:

1. I implemented this as a contextual keyword that can only apply directly to
lvalues. This ensures that we can still call functions called copy, define
variables named copy, etc. I added tests for both the c++ and swift-syntax based
parsers to validate this. So there shouldn't be any source breaks.

2. I did a little bit of type checker work to ensure that we do not treat
copy_expr's result as an lvalue. Otherwise, one could call mutating functions on
it or assign to it, which we do not want since the result of copy_value is

3. As expected, by creating a specific expr, I was able to have much greater
control of the SILGen codegen and thus eliminate extraneous copies and other
weirdness than if we used a function and had to go through SILGenApply.

rdar://101862423
…identifiers correctly.

This resulted from explorations around implementing the copy expr.

rdar://109479131
…d an lvalue.

Before this change it was possible to:

1. Call mutating methods on a consume result.
2. assign into a consume (e.x.: var x = ...; (consume x) = value.

From an implementation perspective, this involved just taking the logic I
already used for the CopyExpr and reusing it for ConsumeExpr with some small
tweaks.

rdar://109479440
…on var without errors to work.

I found that in the given case, an extra allocation was being emitted causing us
to in the success case to have an extra copy. In the previous commit, as part of
updating the codegen for consume, I also ensured that we wouldn't have that
extra allocation any more by handling the lvalue directly.

rdar://109222496
[Runtime][Backtracing] Conditionalise initialisation of the spawnattr.
[RequirementMachine] InferredGenericSignatureRequest uses valid location for generic signature requirements.
…-rdar109163929

[Macros] Rearrange plugin search order
xymus and others added 28 commits May 18, 2023 13:57
[Serialization] Report modularization breaks as proper diagnostics
…assignment.

After a value is consumed, we emit a `debug_value undef` to indicate that the
variable value is no longer valid to the debugger. However, once a value is
reassigned, it becomes valid again, so emit a `debug_value %original_address` to
reassociate the variable with the valid memory location. rdar://109218404
[cxx-interop] Update help message for the driver flag
Calling `getInnermostDeclContext()->getParentSourceFile()` on a macro-produced decl does not seem to be a reliable way to obtain the macro expansion source file, because `PatternBindingDecl` is not a `DeclContext` and `getInnermostDeclContext()` falls back outside the macro expansion file. This patch switches to using `getSourceFileContainingLocation` when possible.

Resolves rdar://109376568.
…tate

Once we have transitioned the actor into a new state, we report the
state change as a trace event so it can be noted by tools (e.g.,
Instruments). However, the act of transitioning to a new state can mean
that there is an opportunity for another thread to deallocate the
actor. This means that the tracing call cannot depend on dereferencing
the actor pointer.

A refactoring a few months ago to move the bit that indicates when a
distributed actor is remote from inside the atomic actor state out to a
separate field (because it's constant for a given actor instance),
which introduced a dereference of the actor instance in forming the
tracing call. This introduced a narrow window in which a race
condition could occur: the actor transitions to an idle state, and is
then deallocate before the trace event for the actor transition occurs,
leading to a use-after-free.

Fetch this bit of information earlier in the process, before any state
changes and when we know the actor is still allocated, and pass it
through to the tracing code.

Fixes rdar://108497870.
…-for-constrained-existentials

Fix covariant erasure for constrained existentials
Fix the type of the `alloca` created by `GenPack`'s for type metadata
and witness tables by fixing its callee, `emitDynamicAlloca` to always
return a `StackAddress` whose `Address`' type is the one specified by
the caller.

rdar://109540863
…tests-2

Add some tests for default implementations on RangeReplaceableCollection
[AST] Use a different operator for member attribute macros
Try using withContiguousStorageIfAvailable in RangeReplaceableCollection.append(contentsOf:) before falling back to a slow element-by-element loop.
[IRGen] Cast dynamic alloca to appropriate type.
…-reinitialization

MoveOnlyAddressChecker: Reintroduce debug info for variables after reassignment.
[Parse] Improve freestanding macro expansion parsing
…s of asymptotic complexity (apple#65927)

Don't reserveCapacity in append(contentsOf:), it breaks API guarantees of asymptotic complexity. Fixes rdar://109577273
[Runtime] Improve wording of deinit escape warning.
[copy-operator] Add support for the copy operator in preparation for  making consuming and borrowing no implicit copy.
[Macros/Test] Plugin search order test is 'executable_test'
…se-order

[Distributed] Ensure to swift_release during destroying decoded distributed call arguments
…ks-shim

Fix assert build of CompatibilityPacks shim
@kateinoigakukun kateinoigakukun merged commit c9171c1 into swiftwasm May 20, 2023
9 checks passed
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.

None yet