Skip to content

Resolve conflicts with upstream main #2463

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 75 commits into from
Jan 9, 2021
Merged

Resolve conflicts with upstream main #2463

merged 75 commits into from
Jan 9, 2021

Conversation

MaxDesiatov
Copy link

No description provided.

Dave Abrahams and others added 30 commits January 6, 2021 11:38
…rInstance into callers of scanDependencies

It is now the responsibility of the scanDependencies code to instantiate (and share) the cache.
e.g. FrontendTool instantiates a new cache per `-scan-dependencies` invocation, and the DependencyScanningTool keeps one shared cache across its lifetime.
Since it was introduced, its use-case has been entirely subsumed by batch scanning.
…ory format as a result

This commit refactors ScanDependencies.cpp to split the functionality into two functional groups:
- Scan execution code that performs the mechanics of the scan and produces an in-memory result
- Dependency scanner entry-points used when the scanning action is invoked as a `swift-frontend` execution mode
This commit also adds the aforementioned in-memory dependency scanning result in `FullDependencies.h`, modeled after the InterModuleDependencyGraph representation in swift-driver
… scanning actions, and scan results.

Adds a C API layer consisting of:
- Data structures used to represent in-memory result of dependency scanning
- Opaque dependency scanner tool (C wrapper for `DependencyScanningTool`)

Refactors `ScanDependencies.cpp` to produce dependency scanning result in the form of the above binary format.
…he corresponding C API for an import prescan operation
…s with API query functions for individual fields
…he corresponding C API for a batch scan operation
…nd adopt query method naming scheme of:

`<prefix>_<object>_<action>`
…module dependency graph) an opaque structure
…stead of `void*` for better type-safety and cleaner code
…and a creation method to return an isntance of the opaque invocation
…ols` and add exports file.

This library now relires on a static compiler library called `swiftDependencyScan`, which is also common to being used by `swift-frontend` for its dependency scanner invocations.
…stead of defining own wrap/unwrap functions for the opaque scanner type.
atrick and others added 26 commits January 8, 2021 11:52
On Linux with -O:

[ RUN      ] Set.formSymmetricDifference
stdout>>> check failed at /Users/docker_user/src/build/buildbot_linux/swift-linux-x86_64/main.swift, line 3245
stdout>>> unexpected value: "94788628116752" (of type Swift.Int)
[     FAIL ] Set.formSymmetricDifference

The test is roughly:

  var s1 = Set(...)
  let s1_copy = s1

  let identity1 = s1._rawIdentifier()
  s1.someMutatingMethod1()

  check(s1)
  check(s1_copy)

  s1.someMutatingMethod2()

  // Mutating the set should cause an identity change
  releaseAssert(identity1 != s1._rawIdentifier())

On Linux, the optimizer is able to destroy s1_copy before the call to
s1.someMutatingMethod2(), which generates new Set storage. This new
storage uses the same address as the destroyed s1_copy.

Fixes rdar://72933150 ([CanonicalOSSA] Fix Set.swift unit test that assumes object lifetime)
On Linux with -O:

Could not cast value of type 'Swift.Optional<Swift.AnyObject>'
(0x7fa5f4285b60) to 'weaktest.NativeSwiftClass' (0x563acd3f30d8).

  weak var verifier: AnyObject?
  do {
    let parent = NativeSwiftClassHasWeak(x: 1010)
    let child = NativeSwiftClass(x: 2020)
    verifier = child
    parent.weakProperty = child
    let mirror = Mirror(reflecting: parent)
    let children = Array(mirror.children)
    let extractedChild = children[0].1 as! NativeSwiftClass
    expectNotNil(extractedChild)
    expectNotNil(verifier)
  }
  expectNil(verifier)

Here the expression children[-1].1 is a weak reference refering back
to 'child'. There's nothing keeping that 'child' object alive. On
Linux, the optimizer is able to destroy child before the dynamic type
cast. The cast attempts to cast a nil weak reference and fails.

Fixes rdar://72933297 ([CanonicalOSSA] Fix WeakMirror.swift test that
assumes object lifetime)
Additional handling of copy_value/destroy_value/load[copy]/
begin_borrow/end_borrow is needed to support OSSA.

TODO: Support handling of 2d array in the pass for OSSA.
Currently hoisting of loads and borrows are not supported in OSSA
ClangImporter: synchronize clang and Swift
This fixes a regression from some over-eager logic introduced by my commit
5d6cf5c.

We need to be careful to preserve this flag only in cases where the
throwing-ness bubbles up from the nested ContextScope, namely AwaitExpr
and InterpolatedStringLiteralExpr.

Fixes <rdar://problem/72748150>.
[Sema] Fix storage of availability macros definition for SourceKit
Add a _fixLifetime call to stdlib/WeakMirror.swift test.
Frontend: Don't record request references in WMO builds
[test] Disable tests for newly introduced Range behavior on earlier OSes
Like pullbacks, differentials should have private linkage, not hidden linkage. This patch fixes that.
…ssing-throws-fix

Sema: Fix preservation of DiagnoseErrorOnTry flag
Add a _fixLifetime to stdlib/Set.swift test.
The code in #selector doesn't execute, so don't perform actor-isolation
checking in there. It also happens to have subexpressions that don't
really follow the rules for references to instance methods, so
avoiding this checking eliminates both compiler crashes and
been spurious errors.

Fixes rdar://72945343.
Otherwise, this uniqueness check will unexpectedly succeed when tests
run in optimize mode and 'c' is destroyed early:

      let c = C()
      var b = B(native: c, isFlagged: flag)
      //...
      expectFalse(b.isUniquelyReferencedUnflaggedNative())
      // Keep 'c' alive for the isUniquelyReferenced check above.
      _fixLifetime(c)

Fixes rdar://72957398 ([CanonicalOSSA] Add a _fixLifetime to
stdlib/BridgeStorage.swift test.)
…lector

[Concurrency] Don't perform actor isolation checking within #selector.
[AutoDiff] Differentials should have private linkage
fix minor typo in command in benchmarks/readme
@MaxDesiatov MaxDesiatov marked this pull request as ready for review January 9, 2021 21:33
@MaxDesiatov MaxDesiatov merged commit 9937b59 into swiftwasm Jan 9, 2021
@MaxDesiatov MaxDesiatov deleted the maxd/main-merge branch January 9, 2021 21:33
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.