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 master #1141

Closed
wants to merge 168 commits into from
Closed

[pull] swiftwasm from master #1141

wants to merge 168 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jun 2, 2020

See Commits and Changes for more details.


Created by pull[bot]. Want to support this open source service? Please star it : )

meg-gupta and others added 30 commits May 11, 2020 19:43
The PassManager should transform all functions in bottom up order.
This is necessary because when optimizations like inlining looks at the
callee function bodies to compute profitability, the callee functions
should have already undergone optimizations to get better profitability
estimates.

The PassManager builds its function worklist based on bottom up order
on initialization. However, newly created SILFunctions due to
specialization etc, are simply appended to the function worklist. This
can cause us to make bad inlining decisions due to inaccurate
profitability estimates. This change now updates the function worklist such
that, all the callees of the newly added SILFunction are proccessed
before it by the PassManager.

Fixes rdar://52202680
State explicitly that we want to eliminate all differences between
`apple/master` and `llvm.org/master`. All new LLVM development should happen
upstream.
… init

Diagnose an attempt to initialize raw representable type or convert to it
a value of some other type that matches its `RawValue` type.

```swift
enum E : Int {
   case a, b, c
}

let _: E = 0
```

`0` has to be wrapped into `E(rawValue: 0)` and either defaulted via `??` or
force unwrapped to constitute a valid binding.
…table`

Do the verification during constraint repair and provide fix itself
with raw representative type and its raw value to be used for diagnostics.
Clang provides options to override that default value.
These options are accessible via the -Xcc flag.

Some Swift functions explicitly disable the frame pointer.

The clang options will not override those.
…alization

This makes logic in `ContextualFailure::tryRawRepresentableFixIts`
partially obsolete.
…struction

Since both raw representable and value types originated in
constraint system they can have type variables which need to be
resolved before types could be used in a diagnostic and fix-it.
Add additional clarification that submitting to `swift/master-next` continues to be allowed.
…ontruct raw representable

Introduce `repairByExplicitRawRepresentativeUse` which is used for
assignment, argument-to-parameter conversions and contextual mismatches.

It checks whether `to` side is a raw representable type and tries
to match `from` side to its `rawValue`.
…instead of its raw value

Diagnose an attempt to pass raw representable type where its raw value
is expected instead.

```swift
enum E : Int {
  case one = 1
}

let _: Int = E.one
```

`E.one` has to use `.rawValue` to match `Int` expected by pattern binding.
to 'typeCheckAbstractFunctionBodyNodeAt()' because that only typecheck
a statement at the position.
…e initializers.

The Original Bug
----------------

In ffbfcfa, we fixed a bug around implicit
value initializers but did not cherry-pick it to 5.3. While investigating a bug
that turned out to be that same bug (no worries!), I noticed that there is
additional code that is "unsafely" correct in this area and that while
ffbfcfa is correct in the small, we can expand
on the fix to prevent future bugs.

The Larger Bug
--------------

Here we are still open coding using ManagedValue/Cleanup APIs /without/ a top
level function scope. The code is only correct since we never emit unconditional
cleanups and always manually forward conditional cleanups. If we did not do
either of these things, we would have another instance of this bug, namely a
cleanup that is never actually emitted. So the code on master today is correct,
albeit unsafe, and we already have coverage for this (namely the test case from
ffbfcfa).

That being said, in general when working with ManagedValue APIs (especially in
utility functions) we assume that we have a scope already created for us by our
caller. So by fixing this issue we are standardizing to safer SILGen invariants.

Building on ffbfcfa
----------------------------------------------------

This commit builds on the shoulders of ffbfcfa
by adding the function level scope mentioned in the previous section so that we
are now "safely" correct.

While looking at this I also realized that just using a normal scope when open
coding here may be a bit bugprone for open coding situations like this since:

1. If one just creates a scope in open coding situations, the scope will fire at
   end of the c++ function /after/ one has probably emitted a return.

2. Once one has emitted the return, the insertion point will no longer be set
   implying =><=.

To avoid this, I created a move only composition type on top of Scope called
AssertingManualScope. This type just asserts in its destructor if the scope it
contains has not been popped yet.

While, one can pop it by ones self, I added an overload of createReturnInst on
SILGenBuilder that also takes an AssertingManualScope and pops it at the
appropriate time.

So now when performing simple open coding tasks, we have the ability to in code
tie together the function level scope to the actual creation of return inst,
simulating the hand-off of lifetimes/resources from caller/callee that often
happens in the epilog of functions.

<rdar://problem/63189210>
Rather than trying to continue the compilation
with an empty main module, let's bail out early if
we expect an implicit stdlib import and fail to
load in the stdlib.
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

<rdar://problem/63700540>
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
This is analogous to ASTPrinter's FullyQualifiedTypesIfAmbiguous option.

This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
compnerd and others added 29 commits June 4, 2020 08:39
The host platform should be using `CMAKE_SYSTEM_NAME STREQUAL Darwin`.
However, we currently drive the host side of the compilation against
custom variables.  This makes the migration simpler by ensuring that the
entire file uses the same pattern.

Since `is_darwin_based_sdk` is now used only in the standard library
build, sink it to the standard library build.
`classMetadata` is only used in the ObjC path, resulting in a
`-Wunused-variable` warning.  Sink the variable into the ObjC path.
Because the conversion of the metadata does not rely on the type
metadata bits in the metadata, it is safe to delay the definition and
bit adjustment to the point where it is used unifying the two ObjC
paths.
…resLinkPthread

[stdlib][cmake] OpenBSD target requires -lpthread.
…wiftlang#32133)

* Add note that LLDB changes should be cherry-picked to `swift/master`

* New Swift-dependent commits should go to `swift/master`, not `swift/master-next`.

* Update naming scheme for release branches

* Fix indentation
…closure-cleanup

[AST] Clean up handling of single-expression closures
…8390-inherit-availability

[SymbolGraph] Inherit availability from parent contexts
ABI: qualify use of `StringRef` and `Optional` (NFC)
[NFC] AST: Optimize GenericSignatureImpl::getInnermostGenericParams
…03c93f1ba6ac111c52d1157

[semantic-arc-opts] Teach semantic-arc-opts how to handle structs with multiple non-trivial values.
[CSGen] Allow `is` patterns to infer type from enclosing context
runtime: silence -Wunused-variable warning (NFC)
…c54f4b3c46468e4706e7c80

[memory-lifetime] Teach the verifier that select_enum_addr doesn't write to memory.
…deScalarProperties

Refactors internal func _applyMapping using _FixedArray16
…iables

[Runtime] Unify debug variable parsing from the environment and avoid getenv when possible.
build: use the same pattern for detecting Darwin platforms
Inline the standard headers that they included and remove the extra
include path.
Cache empty member list so that 'IterableDeclContext::loadAllMembers()'
doesn't perform delayed member parsing.

Fixes: rdar://problem/63921896
Remove changed lines
…declbraces-rdar63921896

[Parse] Avoid delayed member parsing for type decl with missing brace
runtime: remove `llvm/DataTypes.h`, `llvm-c/DataTypes.h`
…ype-of-opaque-type

ASTDemangler: Add support for member types of opaque result types
…ssion-tests

A couple of regression tests
Add a test to verify that C++ out-of-line operator functions are imported correctly.
Includes fixes for armv7 and arm64.

This is part of addressing SR-12748.
…lang-agnostic-lto

[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows
@MaxDesiatov MaxDesiatov closed this Jun 5, 2020
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