Skip to content

[pull] swiftwasm from main #5429

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 55 commits into from
May 12, 2023
Merged

[pull] swiftwasm from main #5429

merged 55 commits into from
May 12, 2023

Conversation

pull[bot]
Copy link

@pull pull bot commented May 11, 2023

See Commits and Changes for more details.


Created by pull[bot]

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

nate-chandler and others added 30 commits May 4, 2023 20:12
Clients may not want the lifetime to be fixed up.
When rewriting forwards, don't fix the lifetime which results in
spurious lifetime ends.
...when running on Apple Silicon

Addresses rdar://108794689
If `FuncDeclRef` is `null` we shouldn’t be trying to get any parameters from it.
…tlang#65768)

...when running on Apple Silicon

Addresses rdar://108794689
Handle a gap while matching SIL patterns for hoisting array bound checks
…ang#65814)

We should no longer say "macro implementation must be provided via '-load-plugin-library'" as there are multiple ways to pick up a macro dependency. Here's an improved version:

> warning: external macro implementation type 'MissingModule.MissingType' could not be found for macro 'missingMacro1'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library'
This reverts commit be845f1.
…STScope.

The previous code made the assumption that the ASTScope for a variable
declaration should be the one of the declaration's source location. That is not
necessarily the case, in some cases it should be an ancestor scope. This patch
introduces a map from ValueDecl -> ASTScope that is derived from querying each
ASTScope for its locals, which matches also what happens in name lookup.  This
patch also fixes the nesting of SILDebugScopes created for guard statement
bodies, which are incorrectly nested in the ASTScope hierarchy.

rdar://108940570
Use the signature to get the function type when getting Swift function pointer callees.
This is okay because there is a previous call to cast to that type using the Signature
…-fixes

[CodeCompletion] Fix two crashers found by the stress tester
… an address argument instead of an object.

The signature was already correct, just the logic in the deinit code assumed
that we would always have an object.

rdar://109170069
… resilient guaranteed arguments.

The only difference from normal concrete guaranteed parameter emission is we
have a load_borrow on the argument before the copy_value. That is instead of:

```
bb0(%0 : @guaranteed $Type):
  %1 = copy_value %0
  %2 = mark_must_check [no_consume_or_assign] %1
```

we have,

```
bb0(%0 : $*Type): // in_guaranteed
  %1 = load_borrow %0
  %2 = copy_value %1
  %3 = mark_must_check [no_consume_or_assign] %2
```

So I just needed to update the checker to recognize that pattern.

This is tested by just making sure that the checker can handle the borrowVal in
the tests without emitting an error.

rdar://109170906
…ow if we call a resilient function that takes it in_guaranteed.

This ensures that given a class that contains a noncopyable type that contains
another noncopyable type:

```
@_moveOnly struct S2 {}
@_moveOnly struct S { var s2: S2 }
class C { var s: S }
```

if we call a resilient function that takes C.S.S2:

```
borrowVal(c.s.s2)
```

we properly spill s2 onto the stack using a store_borrow.

Why Do This?
------------

Currently SILGenLValue treats ref_element_addr as a base that it needs to load
from for both copyable and non-copyable types. We keep a separation of concerns
and require emission of resilient functions to handle these loaded values. For
copyable types this means copying the value and storing it into a temporary
stack allocation. For noncopyable types, we never actually implemented this so
we would hit an error in SILGenApply telling us that our resilient function
expected an address argument, but we are passing an object.

To work around this, I updated how we emit borrowed lvalue arguments to in this
case to spill the value into a temporary allocation using a store_borrow. I also
included a test that validates that we properly have a read exclusivity scope
around the original loaded from memory for the entire call site so even though
we are performing a load_borrow and then spilling it, we still have read
exclusivity to the original memory for the entire region meaning that we still
preserve the semantics.

rdar://109171001
I hit a weird bug where for some reason it wasn't working. I can't reproduce it
now, so it makes sense to use the correct syntax.
Derive the SILDebugScope for a variable declaration from its owning ASTScope.
The new LexicalLifetimes suppressible language feature results in
declarations annotated with @_eagerMove, @_noEagerMove, and
@_lexicalLifetimes to be printed with that attribute when it's available
and without it when it's not.
…oves the self parameter of a method

When dropping the self metatype parameter of a method, it must become a "thin" function.

Fixes a crash when using performance annotations.

rdar://107202455
The module doesn't necessarily need to be in a valid state when de-serializing a function
This was a leftover from the time we didn't use C++ interop
Performance annotations can now be used without specifying this option
eeckstein and others added 19 commits May 11, 2023 08:03
as a shortcut for `Instruction.setOperand`
…ng to a separate function pass

This allows to run the NamedReturnValueOptimization only late in the pipeline.
The optimization shouldn't be done before serialization, because it might prevent predictable memory optimizations in the caller after inlining.
…ries

Instead bail when trying to deleted a dead closure or when performing the apply-of-partial_apply optimization.

TODO: In OSSA this should be solvable without the need of copies to temporaries.
… partial_apply

* move the apply of partial_apply transformation from simplify-apply to simplify-partial_apply
* delete dead partial_apply instructions
* devirtualize apply, try_apply and begin_apply
* `Options.assertConfiguration`
* `Argument.isIndirectResult`
* in `Function`: `selfArgument`, `isTransparent`, `performanceConstraints` and `inlineStrategy`
* `BuiltinInst.substitutionMap`
* `SubstitutionMap.replacementTypes`
* `Type.canBeClass`
As a replacement for the old MandatoryGenericSpecializer

The pass it not enabled yet in the pass pipeline
…ions

Fix several problems with performance annotations
…aranteed-value/dont-hoist-forwards

[CanonicalizeGuaranteedValue] Rewrite forwards in place.
…_pointer_fix

IRGen: Another fix for compiling LLVM opaque pointers
Fixes a verifier crash caused by a not properly nested alloc-dealloc pair

rdar://109204178
…age_feature

[AST] Added language feature for @_eagerMove.
…consuming use instead of liveness use.

rdar://109217216
gottesmm and others added 6 commits May 11, 2023 12:44
…e_borrow if we are using lowered addresses.

When opaque values are enabled, we do not need this store_borrow. This was
caught by the following tests:

  Swift(macosx-x86_64) :: SILGen/opaque_values_silgen.swift
  Swift(macosx-x86_64) :: SILGen/opaque_values_silgen_resilient.swift
SIL Optimizer: handle dead-end infinite loops in StackNesting
…7297f17557ddd02a5567ce7

[sil-optimizer] Add LLVM_DEBUG statements to escaping capture diagnostics
…fda427c5ce8d64de2158c85

[move-only] Fix a thinko where we are treating inout convention as a consuming use instead of liveness use.
…out-copyable

add even more test coverage for parsing `~Copyable`
@kateinoigakukun kateinoigakukun merged commit 0020e7f into swiftwasm May 12, 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.