Skip to content

[pull] swiftwasm from main #5486

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 121 commits into from
Jun 1, 2023
Merged

[pull] swiftwasm from main #5486

merged 121 commits into from
Jun 1, 2023

Conversation

pull[bot]
Copy link

@pull pull bot commented May 31, 2023

See Commits and Changes for more details.


Created by pull[bot]

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

cachemeifyoucan and others added 30 commits May 15, 2023 13:42
Move some deserialization error handling services to methods under ModuleFile.
This will give access to the ASTContext and allow to report diagnostics.

Also rename `consumeErrorIfXRefNonLoadedModule` into the more general
`consumeExpectedError` that is more appropriate for future improvements.
Intro the service `diagnoseAndConsumeError` as the ultimate site to drop
deserialization issues we can recover from. It will be used to raise
diagnostics on the issues before dropping them silently.
…ction

This comes up in the code for constructing an empty string literal.
With this optimization it's possible to statically initialize empty string global variables.
Optimize the sequence
```
  %1 = init_enum_data_addr %enum_addr, #someCaseWithPayload
  store %payload to %1
  inject_enum_addr %enum_addr, #someCaseWithPayload
```
to
```
  %1 = enum  $E, #someCaseWithPayload, %payload
  store %1 to %enum_addr
```
This sequence of three instructions must appear in consecutive order.
But usually this is the case, because it's generated this way by SILGen.
… in static initializers

Instead of passing `IRGenFunction`, pass the `IRGenModule` and the `IRBuilder`.
This makes enum creation not dependent on the presence of a function.

NFC, just refactoring.
The main change here is in IRGen which needs to be able to emit constant enum values.
Use `emitValueInjection` to create the enum constant.
Usually this method creates code in the current function.
But if all arguments to the enum are constant, the builder never has to emit an instruction.
Instead it can constant fold everything and just returns the final constant.

Also, create statically initialized let-globals as constant global (`constant` instead of `global`).
Deserialization recovery silently drops errors and the affected decls.
This can lead to surprises when a function from an imported module
simply disappears without an explanation.

This commit introduces the flag -Rmodule-recovery to report as remarks
some of these previously silently dropped issues. It can be used to
debug project configuration issues.
Macros are expanded as part of interface generation, so they shouldn't
also be printed into the Swift interface.

Fixes rdar://109378191.
This reverts commit b0f5c39.

rdar://109851266
…ubmodules"

There is a special case that already exists in 'ClangImporter' for implicit module loading:
Import of a "submodule" named "Foo.Private" is treated as a top-level module named "Foo_Private".
Clang has special support for this.

Resolves rdar://108287140
…se values.

I also added a bunch of tests that showed the behavior of subscripts/other accessors with the following combinations of semantics:

1. get only.
2. get/set.
3. get/modify.
4. read/set.
5. read/modify.

rdar://109746476
…ttach a mark_must_check [consumable_and_assignable].

Most of the time SILGen already emits these correctly without having extra
copies, but in certain situations SILGen will emit copies that we need the move
checker to eliminate (e.x.: when we generate a yield). An additional benefit is
that this also will catch places where the frontend makes a mistake.

This also removes a bunch of "copy of noncopyable" types error that showed up in
the implicit compiler generated modify.
Type-checking an operator requires look up of all of its decls regardless of
which access modifier is used before filtering. If one of them is a package
decl in an imported module that was built with package-name, but the use site
of the operator decl is in a module that is not built with package-name, it
currently crashes as it tries to access package context of the use site, which
is null. This PR checks if both decl site and use site have package contexts
before accessing the package name property, otherwise return false to be filtered
out.

Resolves rdar://108961906
The release needs to be preserved in case a user-defined deinit is
present in the released type. Checking for move-only is slightly
conservative.

Fixes rdar://109846094 ([move-only] SILCombine eliminates struct deinitialization)
When `-unavailable-decl-optimization=complete` is specified, skip emission of
resilient tag indices for enum cases that are marked unavailable with
`@available`.

Resolves rdar://109805050
Optimizer/IRGen: allow enums in static initializers of globals
…wiftlang#66127)

rdar://109832161

Some features used in this test were not available in production compilers, causing build failures.
`TypeChecker::checkExistentialTypes` has decl-specific logic and backs out without invoking `ExistentialTypeVisitor` on `TypeDecl`s, but `MacroExpansionDecl` isn't a type decl and would fall into `ExistentialTypeVisitor` which will visit its expansion. The caller of `checkExistentialTypes` already visits auxiliary decls, so here we should only visit arguments and generic arguments of a macro.

Fixes a case where a declaration macro produces a type that conforms to a PAT. We now also run existential diagnostics on generic arguments on a `MacroExpansionDecl` that was previously not handled.

Note: I tried bailing out in `walkToDeclPre` but we should really visit macro arguments and generic arguments. Not walking expansions in `ExistentialTypeVisitor` is also not the right fix because we need to be able to visit macro expansions in arguments.

rdar://109779928
expected order; but as long as they all run we're happy
…sk-leak

[Distributed] Relax ordering of checks in async_taskgroup_discarding_dontLeak
drexin and others added 28 commits May 30, 2023 14:36
…tlang#66216)

Nested ref count byte was accidentally counted as Int64, but should be Size
Introduce 'createMacroSourceFile()' that creates macro expanded
'SourceFile' object. Use it from various macro expansion functions.
[Swift-ObjC-Interop] Speculative cyclic lookup fix
…rvation

[Test] Note that test requires observation to be built
…able-function-availability-miscompile

Frontend: Don't append `-target-min-inlining-target target` to implicit module builds
…sors (swiftlang#66218)

rdar://109803119

It is sufficient to skip the header, because everything after that are regular ref counts
[Sema] Increase impact of ternary then branch aiming better diagnostics
ARCSequenceOpts: fix a wrong handling of applies with indirect out arguments
…99ec769c2d1c0bb3e4197f41

[DiscardingTG] Fix runtime signature mismatch for statically known `-> Void` closure
fixes a compiler crash

rdar://109999583
After removing the store it's required to remove the remaining dead instructions to avoid ownership verifier errors.

rdar://109999674
…swift

Those tests are failing after fixing ARCSequenceOpts in swiftlang#66221

rdar://110055637
`Concurrency require libdispatch` -> `Concurrency requires libdispatch`
[NFC] fix option description typo in `StdlibOptions.cmake`
[Macros] Factor out SourceFile creation for macro expanded buffer
`config.host_triple` can be None when no host tools are built
…fa169232e0e1bb6330f5fb33

[lit] Repair tests for stdlib-only build
@kateinoigakukun kateinoigakukun merged commit 46e8971 into swiftwasm Jun 1, 2023
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.