Skip to content

[pull] swiftwasm from main #3077

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

Closed
wants to merge 2,998 commits into from
Closed

[pull] swiftwasm from main #3077

wants to merge 2,998 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented May 7, 2021

See Commits and Changes for more details.


Created by pull[bot]

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

MaxDesiatov
MaxDesiatov previously approved these changes May 7, 2021
MaxDesiatov
MaxDesiatov previously approved these changes May 8, 2021
@MaxDesiatov
Copy link

@kateinoigakukun macOS fails with this error:

FAILED: lib/swift_static/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodulesummary 
15172
cd /Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/stdlib/public/core && \
/usr/local/Cellar/cmake/3.20.2/bin/cmake -E copy \
/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodulesummary \
/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift_static/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodulesummary && \
/usr/local/Cellar/cmake/3.20.2/bin/cmake -E copy \
/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift/wasi/Swift.swiftmodule/wasm32-unknown-wasi.sib \
/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift_static/wasi/Swift.swiftmodule/wasm32-unknown-wasi.sib
15173
Error copying file "/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodulesummary"
to "/Users/runner/work/swift/swift/target-build/swift-stdlib-wasi-wasm32/./lib/swift_static/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodulesummary".

Do you think this could be related to the LTO changes?

@kateinoigakukun
Copy link
Member

@MaxDesiatov The failure is caused by a PR that started using swift-driver as a default driver.
swiftmodulesummary is only implemented in legacy driver, so the new driver ignored LTO related options.

So what actions we can take are:

  1. Fork swift-driver and port modulesummary implementation
  2. Pass -disallow-use-new-driver to use legacy driver as a temporary solution

But unfortunately, I can't make much time on swiftwasm for a few weeks, sorry.

@MaxDesiatov
Copy link

No problem, thanks for the clarification!

@pull pull bot added the merge-conflict Resolve conflicts manually label May 12, 2021
compnerd and others added 20 commits August 22, 2021 09:39
This ensures that we do not accidentally convert line-endings in Windows
batch files.
build: identify and centralise the build artifacts
…ment (swiftlang#38974)

* [Distributed] Ensure _remote funcs synthesized before dynamic replacement

* cleanup

* remove redundant synthesis cause
And add `UnaryInstruction` which adds a property `operand` to all unary instructions.
This replaces the existing single-operand properties, which simplifies the code.
* unify FunctionPassContext and InstructionPassContext
* add a modification API: PassContext.setOperand
* automatic invalidation notifications when the SIL is modified
ARC operations don't have an effect on immortal objects, like the empty array singleton or statically allocated arrays.
Therefore we can freely remove and retain/release instructions on such objects, even if there is no paired balanced ARC operation.

This optimization can only be done with a minimum deployment target of Swift 5.1, because in that version we added immortal ref count bits.

The optimization is implemented in libswift. Additionally, the remaining logic of simplifying strong_retain and strong_release is also ported to libswift.

rdar://81482156
When use_os_stdlib is set, we use the system Swift libraries, rather than
the ones we've just built.  Older Swift libraries don't have some of the
required functions to run this test, and since the test is supposed to be
testing the library rather than the compiler, it makes sense to just mark
it as unsupported in that configuration.
Temporarily disable on non-macOS platforms until
the CI is fixed.

rdar://82240971
…f-tests

[test] Disable a couple of AutoDiff tests
Replaced dirname() as the man page says (alarmingly) that it might write to
the input string.  Also use asprintf() to build the new value for
DYLD_LIBRARY_PATH.
cross-module-optimization: Don't serialize functions which reference implementationOnly-imported functions
This test has been XFAIL'd for over a year due to changes in
AVFoundation. The second error message in this test also recently
changed due to changes in Foundation. The diagnostics here are not
reliable because they can change when new overloads are added to
the SDK.
AnthonyLatsis and others added 28 commits August 31, 2021 19:21
…inside collections, since the optimizer doesn't know how to handle them yet
This new SIL di-expression represents the dereference on the SSA value.
Similar to DW_OP_deref in DWARF. It is also going to replace the
existing `debug_value_addr`. Namely, replacing the following
instruction:
```
debug_value_addr %a : $*T, name "my_var"
```
with this one:
```
debug_value %a : $*T, name "my_var", expr op_deref
```
In OSSA RLE for loops, in certain cases SSAUpdater will not create a new
SILPhiArgument to be used as the forwarding value. Based on dominator info
it may return the newly copied available value as the forwarding value.
This newly copied available value in the dominating predecessor
will have destroy values at leaking blocks.

Rename makeNewValueAvailable to makeValueAvailable and handle users so that only
additional required destroy_values are inserted.
This eliminates a compilation error with Swift 5.5 and the latest
argument parser library.
…alid-2

Keep the buffer in the invalid UTF8 handling path of String(unsafeUninitializedCapacity:initializingWith:) alive while we're using it
This patch replace all in-memory objects of DebugValueAddrInst with
DebugValueInst + op_deref, and duplicates logics that handles
DebugValueAddrInst with the latter. All related check in the tests
have been updated as well.

Note that this patch neither remove the DebugValueAddrInst class nor
remove `debug_value_addr` syntax in the test inputs.
This patch removes all references to DebugValueAddrInst class and
debug_value_addr instruction in textual SIL files.
This is a temporary measure tracked by rdar://82593574
Mark test as unsupported on windows to unblock CI
…ript tests.

It makes sense to just set this here since we aren't testing that functionality
and enables us to test this if we aren't using one of the specified Xcodes
(which can be useful).
Fix an edge case in OSSA RLE for loops
[Diagnostics] Fix diagnostics to produce valid rename fixit for SubscriptExpr
…d50ec26da03b6e03b8b1594

[build-script] Add a SKIP_XCODE_VERSION_CHECK to all dry-run build-script
…rform a dry-run.

Otherwise, we can't successfully dry-run a toolchain on darwin.

I added an option enable-extract-symbol-dry-run-test that can be set to restore
the previous behavior and updating the BuildSystem unit tests that depend on
that behavior to pass that flag.
…d965c705a0c01988543a372

[build-script-impl] Do not actually try to extract symbols when we perform a dry-run.
Pattern matching in Swift can either be expression pattern matching by comparing two instances using the `~=` operator or using enum matching by matching the enum case and its associated types (+ tuple pattern matching, but that’s not relevant here). We currenlty only consider the expression pattern matching case for code completion. To provide enum pattern matching results, we thus need to have a `~=` operator between the code completion token and the match expression

For example, when we are completing

```swift
enum MyEnum {
  case myCase(String)
}

switch x {
case .#^COMPLETE^#
}
```
then we are looking up all overloads of `~=` and try to match it to the call arguments `(<Code Completion Type>, MyEnum)`.
The way we currently get `#^COMPLETE^#` to offer members of `MyEnum`, is that we are trying to make sure that the `~=<T: Equatable>(T, T)` operator defined in the standard library is the best solution even though it has fixes associated with it. For that we need to carefully make sure to ignore other, more favourable overloads of `~=` in `filterSolutions` so that `~=<T: Equatable>(T, T)` has the best score.

This poses several problems:
- If the user defines a custom overload of `~=` that we don't prune when filtering solutions (e.g. `func ~=(pattern: OtherType, value: MyEnum) -> Bool`), it gets a better score than `~=<T: Equatable>(T, T)` and thus we only offer members of `OtherType` instead of members from `MyEnum`
- We are also suggesting static members of `MyEnum`, even though we can't pattern match them due to the lack of the `~=` operator.

If we detect that the completion expression is in a pattern matching position, also suggests all enum members of the matched type. This allows us to remove the hack which deliberately ignores certain overloads of `~=` since we no longer rely on `~=<T: Equatable>(T, T)`. It thus provides correct results in both of the above cases.

Fixes rdar://77263334 [SR-14547]
…letion

[CodeCompletion] Explicitly support enum pattern matching
…g-val-addr

[SIL][DebugInfo] PATCH 3/3: Deprecate debug_value_addr SIL instruciton
caches: add a cache for a i686 build of the runtime on Windows
…requires

Add missing REQUIRES: CPU=x86_64 to Concurrency test.
…requires

Add missing REQUIRES: CPU=x86_64 to Reflection test.
The code checked if the last element of locator path vector
is a certain kind of element without first ensuring that the
vector isn't empty.
[ConstraintSystem] Fix a silly crash in `repairFailures`.
SE-0309: Unlock existential types for all protocols
@MaxDesiatov MaxDesiatov closed this Sep 2, 2021
auto-merge was automatically disabled September 2, 2021 06:32

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.