profile
viewpoint
Arnold Schwaighofer aschwaighofer

llvm/llvm-project 6332

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

aschwaighofer/swift 1

The Swift Programming Language

aschwaighofer/swift-corelibs-foundation 0

The Foundation Project, providing core utilities, internationalization, and OS independence

aschwaighofer/swift-evolution 0

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.

aschwaighofer/swift-lldb 0

This is the version of LLDB that supports the Swift programming language & REPL.

aschwaighofer/swift-source-compat-suite 0

The infrastructure and project index comprising the Swift source compatibility suite.

aschwaighofer/swift-syntax 0

SwiftPM package for SwiftSyntax library.

aschwaighofer/swift-xcode-playground-support 0

Logging and communication to allow Swift toolchains to communicate with Xcode.

push eventapple/swift

Arnold Schwaighofer

commit sha 9db5916d1a53f8bdce76e9273cc0fa53d55645e6

Adjust to LLVM change: InitTargetOptionsFromCodeGenFlags requires a triple

view details

Arnold Schwaighofer

commit sha e8de6d3e48b75f4d677d75777b5622b7469a73af

Merge pull request #34377 from aschwaighofer/next-try-fix-InitTargetOptionsFromCodeGenFlags Adjust to LLVM change: InitTargetOptionsFromCodeGenFlags requires a triple

view details

push time in 13 hours

pull request commentapple/swift

Adjust to LLVM change: InitTargetOptionsFromCodeGenFlags requires a triple

@swift-ci Please test

aschwaighofer

comment created time in 14 hours

push eventapple/llvm-project

Arnold Schwaighofer

commit sha 020bdf7bdb017246b5616de7816eab2e8c75d660

Teach the swift calling convention about _Atomic types rdar://67351073 Differential Revision: https://reviews.llvm.org/D86218

view details

Arnold Schwaighofer

commit sha 8099dc6be2cc0940cf3f8b5c775866595cbfd60e

Merge pull request #1999 from aschwaighofer/rdar_67351073 Teach the swift calling convention about _Atomic types

view details

push time in 15 hours

PR merged apple/llvm-project

Teach the swift calling convention about _Atomic types

rdar://67351073

Differential Revision: https://reviews.llvm.org/D86218

+42 -2

1 comment

2 changed files

aschwaighofer

pr closed time in 15 hours

create barnchaschwaighofer/llvm-project

branch : async_example

created branch time in a day

create barnchaschwaighofer/llvm-project

branch : rdar_67351073

created branch time in 2 days

pull request commentapple/llvm-project

Teach the swift calling convention about _Atomic types

@swift-ci Please test

aschwaighofer

comment created time in 2 days

PR opened apple/llvm-project

Teach the swift calling convention about _Atomic types

rdar://67351073

Differential Revision: https://reviews.llvm.org/D86218

+42 -2

0 comment

2 changed files

pr created time in 2 days

push eventapple/swift

Arnold Schwaighofer

commit sha 1599d3e8dc7ff8940de6f7089a8610e9096bdfbd

Pass subst options down when substitution sil_box type's substitution map rdar://70262551

view details

Arnold Schwaighofer

commit sha 4c0ea5512d0be520a212d1f8de641ff1b27f607b

Test requires x86_64

view details

Arnold Schwaighofer

commit sha 077e81456ddd12af15f44113396d499adcbdf5c3

Merge pull request #34334 from aschwaighofer/fix_sil_box_type_opaque_result_type_subst Pass subst options down when substitution sil_box type's substitution map

view details

push time in 2 days

pull request commentapple/swift

Pass subst options down when substitution sil_box type's substitution map

@swift-ci Please test

aschwaighofer

comment created time in 2 days

pull request commentapple/swift

Pass subst options down when substitution sil_box type's substitution map

@swift-ci Please test

aschwaighofer

comment created time in 3 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha 4c0ea5512d0be520a212d1f8de641ff1b27f607b

Test requires x86_64

view details

push time in 3 days

pull request commentapple/swift

Pass subst options down when substitution sil_box type's substitution map

@swift-ci Please test

aschwaighofer

comment created time in 5 days

create barnchaschwaighofer/swift

branch : fix_sil_box_type_opaque_result_type_subst

created branch time in 5 days

push eventapple/swift

Arnold Schwaighofer

commit sha 18777bfa94a2eece5ab8e935d5bc539ad3483a24

LoadableByAddress: Make sure that indirect return arguments are at the right type expansion rdar://70220886

view details

Arnold Schwaighofer

commit sha b3e9a7f252019c7f0ecf008137f2ca232ac25804

Merge pull request #34324 from aschwaighofer/fix_opaque_indirect_return_results_loadable_by_address LoadableByAddress: Make sure that indirect return arguments are at the right type expansion

view details

push time in 6 days

push eventapple/swift

Arnold Schwaighofer

commit sha 96a0d0e5840045e25d2c05f02999972f804201df

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline `@inlinable` implies `@usableFromInline`. NFC intended.

view details

Arnold Schwaighofer

commit sha a7259558238eadd1c69a234baef1b67ab45f8492

More renaming

view details

Arnold Schwaighofer

commit sha c880be6c90242424f28182b6ea13e7ef2213e115

Merge branch 'main' into rename_usableFromInline_flags

view details

Arnold Schwaighofer

commit sha 8b170f9a4a3c630f8c13d5d155aa491437fb19e3

Merge pull request #34304 from aschwaighofer/rename_usableFromInline_flags Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

view details

push time in 6 days

PR merged apple/swift

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

@inlinable implies @usableFromInline.

NFC intended.

+29 -27

5 comments

15 changed files

aschwaighofer

pr closed time in 6 days

pull request commentapple/swift

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

@swift-ci Please test

aschwaighofer

comment created time in 7 days

push eventaschwaighofer/swift

Dave Lee

commit sha 27330f169df5d2dcb018ab2c6615d66be91d04e2

[build] Remove unused lldb cmake

view details

Dave Lee

commit sha b02dc2b25bc2c9c258370265c54d744c178a101c

LLDB_PATH_TO_SWIFT_SOURCE too

view details

Zoe Carver

commit sha 722cc755f8ee5bd74eb8f6c4e7f0a6514838fd50

[cxx-interop] Cast data to the correct type. (#34266) The implicit conversions are OK in C but C++ will error. To make this header valid in both C and C++ we should just always cast.

view details

Doug Gregor

commit sha 21a0696e165747248ac5f4532feeb942e13e326b

[Concurrency] Clean up inference logic for @asyncHandler.

view details

Doug Gregor

commit sha dee5356021f49ea31954e3ecc2170d285d47804c

[Concurrency] Add inferred actor-isolation attributes. When we infer an actor-isolation attribute on a declaration, add an implicit attribute that will show up in the printed interface and get serialized. ... and clean up the type resolution logic for global actor attributes to make it use CustomAttrTypeRequest, so the result gets appropriately cached in CustomAttr for serialization.

view details

Doug Gregor

commit sha 4032cd8e7d4857dad9e07782212e30848580ca56

Rename CustomAttrTypeKind::PropertyDelegate to PropertyWrapper.

view details

Alexis Laferrière

commit sha e509d6883a068334df96f34ade141d8c38dfd1f0

Revert "[Sema] Fix availability checking in inlinable code"

view details

Dave Lee

commit sha 804459df815793cc3781addd3f14b0ee1a983abf

Merge pull request #34212 from apple/build-Remove-unused-lldb-cmake [build] Remove unused lldb cmake

view details

Arnold Schwaighofer

commit sha d6d921d7fafcfa67e500e6013f93ac30f6248b79

IRGen: Fix fixLifetime emission of enums rdar://70270724

view details

Robert Widmann

commit sha 6125d25cb4f5059f455b3c6f4bde70f6aa79f59e

[NFC] Silence Non-Exhaustive Switch Warnings on Windows

view details

Robert Widmann

commit sha 9c879c008e642278b2bce557db19b78ca391caad

Resolve Virtual Inheritance By Dominance By Being Explicit Since the alternative is name lookup selecting members from a pure virtual base, it's probably best to be explicit here.

view details

Alexis Laferrière

commit sha 0d8f689d1c50121c13980eadf7ee58917a930aef

Merge pull request #34306 from apple/revert-33855-availability-inlinable Revert "[Sema] Fix availability checking in inlinable code"

view details

Robert Widmann

commit sha ba737b563154e2e5261c57c482699d6ee8f4abf3

[NFC] Use an Explicit 64-Bit Shift

view details

Robert Widmann

commit sha 0d6a16258a1519b59644618be1ae2280476878ba

Silence a Deprecation Warning with FixedVectorType

view details

Saleem Abdulrasool

commit sha 78bc6aae363ff8e82d28aa7725c562ecf7e66ab2

Platform: link against Pathcch.lib when using pathcch.h The MSDN documentation indicates that you should link against the `Pathcch.lib` import library when using functions from `pathcch.h` which can also be verified by use functions failing to link due to unresolved symbols. Add the missing linking to enable autolinking for `WinSDK`.

view details

Arnold Schwaighofer

commit sha 1c85d201921abcedbd3a693229f597a6d015f81d

Try to appease 32bit tests

view details

Robert Widmann

commit sha 476890cac5224f1c9a2fcfee5a2267bd44d24466

Merge pull request #34312 from CodaFi/just-keep-passing-the-open-windows Silence a Raft of Warnings from the Windows Build

view details

Mishal Shah

commit sha 1d4fd87ee603a954ec078be88bf0d64962c001c8

[update-checkout] Add scheme to test a branch

view details

Saleem Abdulrasool

commit sha d3108db2429b29b96f452374a70fe74b08678fd6

Merge pull request #34314 from compnerd/autolinking-pathcch Platform: link against Pathcch.lib when using pathcch.h

view details

swift-ci

commit sha f9609079161420e152c325ba67e36d992bcdc2c0

Merge pull request #34316 from apple/shahmishal/test/update-checkout-scheme

view details

push time in 7 days

push eventapple/swift

Arnold Schwaighofer

commit sha d6d921d7fafcfa67e500e6013f93ac30f6248b79

IRGen: Fix fixLifetime emission of enums rdar://70270724

view details

Arnold Schwaighofer

commit sha 1c85d201921abcedbd3a693229f597a6d015f81d

Try to appease 32bit tests

view details

Arnold Schwaighofer

commit sha 01e0d3f9e6dfeab86e7b66847e79a0f48d789887

Merge pull request #34311 from aschwaighofer/fix_irgen_fixlifetime_enums IRGen: Fix fixLifetime emission of enums

view details

push time in 7 days

PR merged apple/swift

IRGen: Fix fixLifetime emission of enums

rdar://70270724

+17 -9

3 comments

2 changed files

aschwaighofer

pr closed time in 7 days

pull request commentapple/swift

IRGen: Fix fixLifetime emission of enums

@swift-ci Please test

aschwaighofer

comment created time in 7 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha 1c85d201921abcedbd3a693229f597a6d015f81d

Try to appease 32bit tests

view details

push time in 7 days

pull request commentapple/swift

IRGen: Fix fixLifetime emission of enums

@swift-ci Please test

aschwaighofer

comment created time in 7 days

PR opened apple/swift

IRGen: Fix fixLifetime emission of enums

rdar://70270724

+17 -9

0 comment

2 changed files

pr created time in 7 days

create barnchaschwaighofer/swift

branch : fix_irgen_fixlifetime_enums

created branch time in 7 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha a7259558238eadd1c69a234baef1b67ab45f8492

More renaming

view details

push time in 7 days

pull request commentapple/swift

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

@swift-ci Please test

aschwaighofer

comment created time in 7 days

pull request commentapple/swift

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

@swift-ci Please test

aschwaighofer

comment created time in 8 days

PR opened apple/swift

Rename various IncludeUsableFromInlineAndInlineable to IncludeUsableFromInline

@inlinable implies @usableFromInline.

NFC intended.

+19 -19

0 comment

12 changed files

pr created time in 8 days

create barnchaschwaighofer/swift

branch : rename_usableFromInline_flags

created branch time in 8 days

push eventapple/swift

Arnold Schwaighofer

commit sha b994bf319177ed07ab84402ec6e89590cbfdd5cd

Add support for `_specialize(exported: true, ...)` This attribute allows to define a pre-specialized entry point of a generic function in a library. The following definition provides a pre-specialized entry point for `genericFunc(_:)` for the parameter type `Int` that clients of the library can call. ``` @_specialize(exported: true, where T == Int) public func genericFunc<T>(_ t: T) { ... } ``` Pre-specializations of internal `@inlinable` functions are allowed. ``` @usableFromInline internal struct GenericThing<T> { @_specialize(exported: true, where T == Int) @inlinable internal func genericMethod(_ t: T) { } } ``` There is syntax to pre-specialize a method from a different module. ``` import ModuleDefiningGenericFunc @_specialize(exported: true, target: genericFunc(_:), where T == Double) func prespecialize_genericFunc(_ t: T) { fatalError("dont call") } ``` Specially marked extensions allow for pre-specialization of internal methods accross module boundries (respecting `@inlinable` and `@usableFromInline`). ``` import ModuleDefiningGenericThing public struct Something {} @_specializeExtension extension GenericThing { @_specialize(exported: true, target: genericMethod(_:), where T == Something) func prespecialize_genericMethod(_ t: T) { fatalError("dont call") } } ``` rdar://64993425

view details

Arnold Schwaighofer

commit sha 2a2cf91dcdf3fd5e50624eebfd3a0dc57b50ae0a

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `. rdar://64993425

view details

Arnold Schwaighofer

commit sha d6d79c66aa9bfa484547fa3be568d09bf21054bf

Merge two fields into a PointerUnion in SILDeclRef to save space

view details

Arnold Schwaighofer

commit sha fd3e3cfdb860fb118be7ad564644163f45b1921f

Merge pull request #32657 from aschwaighofer/wip_prespecialize_exported Preliminary support for `_specialize(exported: true, ...)`

view details

push time in 9 days

push eventapple/swift-syntax

Arnold Schwaighofer

commit sha 38f8771472d3a801bc30662f26c21f9162d7b7c2

Update gyb generated files for _specialize syntax addition rdar://64993425

view details

Arnold Schwaighofer

commit sha fd784856ac5106c2e33c27295fe336c6ab2be162

Merge pull request #241 from aschwaighofer/specialize_attr_changes Update gyb generated files for _specialize syntax addition

view details

push time in 9 days

PR merged apple/swift-syntax

Update gyb generated files for _specialize syntax addition

This is to go with https://github.com/apple/swift/pull/32657

rdar://64993425

+327 -1

1 comment

10 changed files

aschwaighofer

pr closed time in 9 days

PR merged apple/swift

Preliminary support for `_specialize(exported: true, ...)`

Adds support for _specialize(exported: true, ...)

This attribute allows to define a pre-specialized entry point of a generic function in a library.

The following definition provides a pre-specialized entry point for genericFunc(_:) for the parameter type Int that clients of the library can call.

@_specialize(exported: true, where T == Int)
public func genericFunc<T>(_ t: T) { ... }

Pre-specializations of internal @inlinable functions are allowed.

@usableFromInline
internal struct GenericThing<T> {
  @_specialize(exported: true, where T == Int)
  @inlinable
  internal func genericMethod(_ t: T) {
  }
}

There is syntax to pre-specialize a method from a different module.

import ModuleDefiningGenericFunc

@_specialize(exported: true, target: genericFunc(_:), where T == Double)
func prespecialize_genericFunc(_ t: T) { fatalError("dont call") }

Specially marked extensions allow for pre-specialization of internal methods accross module boundries (respecting @inlinable and @usableFromInline).

import ModuleDefiningGenericThing
public struct Something {}

@_specializeExtension
extension GenericThing {
  @_specialize(exported: true, target: genericMethod(_:), where T == Something)
  func prespecialize_genericMethod(_ t: T) { fatalError("dont call") }
}

Adds support for marking a _specialize attribute as SPI

  @_specialize(exported: true, spi: SPIGroupName, where T == Int)
  public func myFunc() { } 

The specialized entry point is only visible for modules that import using _spi(SPIGroupName) import ModuleDefiningMyFunc.

rdar://64993425

+2479 -387

7 comments

98 changed files

aschwaighofer

pr closed time in 9 days

pull request commentapple/swift

Preliminary support for `_specialize(exported: true, ...)`

The compiler failure in the source compatibility run also occurs without this change in: https://ci.swift.org/job/swift-main-source-compat-suite/5513/artifact/swift-source-compat-suite/FAIL_swift-nio-ssl_5.0_BuildSwiftPackage.log

aschwaighofer

comment created time in 9 days

push eventaschwaighofer/swift

swift-ci

commit sha f89dbd325b96dd694f747efde619a84b36dc6b7b

Merge pull request #33711 from stephentyrone/remainder-sign

view details

Tim Kientzle

commit sha 310c2656f0a05e52c2cdb0bc3f42460b8fb07c0b

Reorganize DynamicCasting spec This only rearranges the existing sections; it does not change any technical points. This attempts to make the spec a little clearer by grouping the individual type discussions under four main headings: * Classes and Foreign Types. This includes Swift classes, Obj-C classes, and CF types. * Other Concrete Types. Struct, Enum, Tuple, Function, Optional, and Set/Dict/Array * Existential Types. Any, AnyObject, Error, Protocol types, and AnyHashable(*) * Metatypes & Existential Metatypes (*) This organization seems to flow a little better. In particular, it gives me a place to discuss issues common to all Existential types, which I'll work through in a subsequent PR. Footnotes: This organization isn't perfect, of course: * AnyHashable isn't really an Existential type, but it behaves as such for casting purposes, so it makes the most sense to discuss it in the Existentials section. * Metatypes are technically concrete types, but it seems to make more sense to discuss them after discussing Existential types.

view details

Michael Gottesman

commit sha ba6dc1724b9a981eb6c4425a9372f436a4aabef5

[semantic-arc] Split load [copy] -> load_borrow opt into its own file.

view details

Nathan Hawes

commit sha 816b555d76d7868af1be4c115e65eced81bc0a47

Merge pull request #33695 from nathawes/fix-typo [IDE] Fix typo to address unused warning (NFC)

view details

Nathan Hawes

commit sha 9da1d895207136f84fc5346fb16706dd082aa1fc

Manually merge remote-tracking branch 'upstream/master' into HEAD Conflicts: lib/AST/ExtInfo.cpp

view details

Tim Kientzle

commit sha 62bae423b5b052277801882945865740ec837f70

Un-XFAIL a test that now passes protocol_lookup_foreign exercises CF casting that used to be broken, but now works with the new dynamic casting implementation.

view details

Xi Ge

commit sha 55e77785dfacdcfcecad801faaa2a38b4bbec6fb

ABI checker: add a mechansim for specifying allowd ABI breakages When the checker found a breakage listed in the user-specified list, the breage should be consumed internally without failing the check. rdar://68086477

view details

Michael Gottesman

commit sha af4199e4f6b0e97f700ef363f0d2c6e4d6a2b264

[build-toolchain] Add an option to control if code built by the toolchain links by default to the OS runtime or the toolchain runtime. Today by default, we always link against the runtime runtime. This option just lets our users decide what they want, but leaves the defaults alone.

view details

Michael Gottesman

commit sha 905712373999b00f977c98d083f813948e0f740e

Merge pull request #33618 from gottesmm/pr-bb7b96b4e43e9b8289ab38ff2613f251e373f0f3 [ownership] When computing usesNotContainedWithinLifetime make sure the error is only a use not in lifetime error.

view details

Doug Gregor

commit sha 0b2b7b58e88b16c7d9c0a1d07c57959b270e3ddc

[Constraint solver] Fix backward trailing closures with ".member" expressions The introduction of forward-scan matching for trailing closures (SE-0286) failed to account for unresolved member expressions, sometimes causing a crash in SILGen. Fixes rdar://problem/67781123.

view details

Frederick Kellison-Linn

commit sha c37d3c3917582c4420bab063a87aed6363a46444

Update CHANGELOG.md table of contents, add SE-0287 (#33685)

view details

Michael Gottesman

commit sha d29bca5a5340489906d2314e9cea566857f1f2af

[ownership] Extract out the computation of implicit uses for BorrowingOperands and InteriorPointerOperands into utilities on those classes. I am currently working on updating SimplifyCFG for ownership. One thing that I am finding that I need is the ability to compute the lifetime of a guaranteed argument from a checked_cast_br/switch_enum in order to convert said instructions to a br. The issue comes from br acting as a consuming (lifetime ending) use of a borrowed value, unlike checked_cast_br/switch_enum (which are treated like forwarding instructions). This means that during the conversion we need to insert a begin_borrow on the value before the new br instruction and then create an end_borrow at the end of the successor block's argument's lifetime. By refactoring out this code from the ownership verifier, I can guarantee that said lifetime computation will always match what the ownership verifier does internally preventing them from getting out of sync.

view details

swift-ci

commit sha e98c2587ec614f2747c507077fbcd3da4b0e1a16

Merge pull request #33715 from tbkka/tbkka/dynamicCastRework-Specification-c

view details

Michael Gottesman

commit sha 9b8c4141ce85b8609f8a3955eba4f1a0cf1fe2b5

Merge pull request #33707 from gottesmm/pr-73ca3d4385ca24e8499ece6066aa1942458cdedf [semantic-arc] Split load [copy] -> load_borrow opt into its own file.

view details

swift-ci

commit sha 1b928b5037ebf51e1ab939c889a9a56845ba73d1

Merge pull request #33719 from tbkka/tbkka/dynamicCast-CFUXPASS

view details

Xi Ge

commit sha e470919a4f799f31b516cb6c125fa40ba96feaf6

Merge pull request #33720 from nkcsgexi/add-allow-list-abi-checker ABI checker: add a mechansim for specifying allowed ABI breakages

view details

Doug Gregor

commit sha cabcbc92707e2e85a203dc99573c57537e1fbf24

[Constraint application] Find trailing closure direction more carefully. Rather than trying to include each expression kind, which leaves us open to errors of omission, exclude only the case where we don't record locators for trailing closure directions.

view details

Michael Gottesman

commit sha 8b5fb43370467a42eb19a2808a76bbac9ca68949

Merge pull request #33714 from gottesmm/pr-328e13b915804e9b08d18a354ef036522340f489 [ownership] Extract out the computation of implicit uses for BorrowingOperands and InteriorPointerOperands into utilities on those classes.

view details

Michael Gottesman

commit sha 7c12c7f4667a9afaddc658b48bda1ab89f9d0522

[semantic-arc] Extract out borrow scope optimizations into its own file.

view details

Artem Chikin

commit sha fd3f732e5f6658e6880f57ae79d17099b0f4c2c1

Merge pull request #33687 from artemcm/DepScannerOrder [DependencyScanner] Change the scanner order to resolve placeholders first

view details

push time in 9 days

pull request commentapple/swift

Preliminary support for `_specialize(exported: true, ...)`

@swift-ci Please test source compatibility

aschwaighofer

comment created time in 9 days

pull request commentapple/swift-syntax

Update gyb generated files for _specialize syntax addition

Please test with following PR: https://github.com/apple/swift/pull/32657

@swift-ci Please test

aschwaighofer

comment created time in 9 days

pull request commentapple/swift

Preliminary support for `_specialize(exported: true, ...)`

Please test with following PR: https://github.com/apple/swift-syntax/pull/241

@swift-ci Please test

aschwaighofer

comment created time in 9 days

PR opened apple/swift-syntax

Update gyb generated files for _specialize syntax addition

This is to go with https://github.com/apple/swift/pull/32657

rdar://64993425

+327 -1

0 comment

10 changed files

pr created time in 9 days

create barnchaschwaighofer/swift-syntax

branch : specialize_attr_changes

created branch time in 9 days

fork aschwaighofer/swift-syntax

SwiftPM package for SwiftSyntax library.

fork in 9 days

push eventaschwaighofer/swift

Anthony Latsis

commit sha 8f43d888b8fd88540c5ba3d770a857928ac0b3a7

Sema: Disallow usage of settable Self-returning storage requirements on existential base

view details

Artem Chikin

commit sha 939f547d517a2f9f6906d739dbb9da5a231be8aa

[Build Script] Pass Foundation and Dispatch build directories to the swift-driver build This is required in order to build swift-driver using CMake on Linux

view details

Pavel Yaskevich

commit sha 767c1a0ed6377470c2afdcd2a53281d13e88a099

[ConstraintSystem] NFC: Move `SolutionResult.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha 087906a013ad278deae80c2a64dcfe7a49f41b90

[ConstraintSystem] NFC: Move `OverloadChoice.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha f2614dec4a2fecef64de73e3e6c50df5effc25d3

[ConstraintSystem] NFC: Move `ConstraintLocator.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha ab951c208ab0f9bf8127ee1049dfd7c1174bfa2d

[ConstraintSystem] NFC: Move `ConstraintGraph{Scope}.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha 4954763524b92fcac638efdee3f84233c4dbc9bf

[ConstraintSystem] NFC: Move `CSFix.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha 6ba7ecb7c2d525f1f84dace06336669e37c5556d

[ConstraintSystem] NFC: Move `Constraint.h` to `include/swift/Sema`

view details

Pavel Yaskevich

commit sha 461eafff54b44a59ac4a1f8e1c3ee536b94ff895

[ConstraintSystem] NFC: Move `ConstraintSystem.h` to `include/swift/Sema`

view details

Daniel Rodríguez Troitiño

commit sha 8470a6624f08283719af2cbc6fdc10a2163d4888

[windows] Avoid %r for quoting module-cache-path in Windows. %r returns a representation of the object that is valid Python syntax. For numbers and strings this representation is very compatible with Unix shells, but for Windows, the quoting performed by Python will not be compatible. For example the Windows path separator `\` will be escaped as `\\`, which is not necessary for Windows and might make some tests that try to match path fail. Python 3.3 has `shlex.quote`, which was previously available as `pipes.quote` in earlier Python versions. `pipes.quote` was indeed used in several points of the `lit.cfg` file. For Windows, one need to do their own quoting. This change introduces `shell_quote` which uses `shlex.quote` or `pipes.quote` in Unix depending on the Python version, and provides an implementation of `shell_quote` for Windows. It replaces every usage of `pipes.quotes` for `shell_quote`, and modifies the value of `mcp_opt` to use `shell_quote` and not `%r`. This should fix the test `Driver\working-directory.swift` in the Windows Visual Studio 2017 builder.

view details

Slava Pestov

commit sha c5e138824544531fdf55935061afea1e999cc4b1

ASTScope: Remove cull()

view details

Slava Pestov

commit sha 89ea51e90ce69e62cd169b453db2e2d4d63b6728

ASTScope: Remove isLocalizable()

view details

Slava Pestov

commit sha ea9f84f66ee9f010cbedb2eff17e956ffe5db450

ASTScope: Remove addSiblingsToScopeTree()

view details

Slava Pestov

commit sha 885f6ebba3c39fe2b097631769b2ac8451e01e82

ASTScope: Rename addChildrenForAllLocalizableAccessorsInSourceOrder()

view details

Slava Pestov

commit sha b720c04f4b8f03dc93a00943ca9c3048f6305d42

ASTScope: Simplify a couple of getSourceRangeOfThisASTNode() methods

view details

Slava Pestov

commit sha 4b0d39c49d96c32f1ec0a1bdc8b54c9ef5c7365f

AST: Clean up and write better comments for source range assertions in addMember()

view details

John McCall

commit sha d8f46ddc3c983511d0f7f6f3972636771b2820fd

Fix a ptrauth test that I broke in #34213. Still not sure how the test run didn't catch this. rdar://70104537

view details

Slava Pestov

commit sha ef26ecfb13754ca9d641bc2081410564ec4d0935

ASTScope: Allocate list of local bindings for BraceStmt in the ASTContext Scopes need to register cleanups for non-trivial ivars in the ASTContext. Instead of doing that here, let's just change the SmallVectors into ArrayRefs. Fixes <rdar://problem/69908937>.

view details

Slava Pestov

commit sha 9bcec37db326bda80d698cc7b74f550c10a3d0ae

Add testcase for rdar://problem/17503169 / https://bugs.swift.org/browse/SR-10069 This now works thanks to ASTScope lookup. Also add a release note.

view details

Nathan Hawes

commit sha be231208f36e91d9b20d8bc52fb8d5012ce1277b

[CodeCompletion][CSGen] Treat ErrorExprs as holes when generating constraints for code completion This lets us still provide member completions when the base expression contains parse errors or unresolved decls e.g. returnsAString(undefined).<complete here>

view details

push time in 9 days

pull request commentapple/swift

Preliminary support for `_specialize(exported: true, ...)`

@swift-ci Please test

aschwaighofer

comment created time in 12 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha 4ec70aa7568dea343dbccea00b872c3073c71e5b

Merge two fields into a PointerUnion in SILDeclRef to save space

view details

push time in 12 days

push eventaschwaighofer/swift

Antoine Cœur

commit sha 4c30f8bd6de5487603ed645cc4dd2a2983f4f0ba

appendingPathComponent(:isDirectory:) should account for isDirectory

view details

Xiaodi Wu

commit sha 26cda274ca78b1df246521ba1eeea33285b57d5f

[stdlib] Simplify 'BinaryFloatingPoint.init?<T: BinaryFloatingPoint>(exactly: T)'

view details

Mike Ash

commit sha ece0399d601eec1069131f465bdbe7e16f4c6a50

[Runtime] Have ConcurrentReadableHashMap use 1-byte or 2-byte indices when possible.

view details

Alexis Laferrière

commit sha 14e6772dc04cf778ba393bebc21a0a8b8ada3603

Consider inherited platform unavailability to silence diagnostics rdar://68597591

view details

Holly Borla

commit sha 3a47087cc197aab8970a55ee265d395bc4f6f002

[Parser] Don't resolve decl references in the parser if the declaration has a custom attribute.

view details

Holly Borla

commit sha 9b2cd5e3ffa09063a8b64250cd0c62850a41fd26

[NameLookup] Teach unqualified lookup to resolve backing property wrapper and projected value references

view details

Holly Borla

commit sha b33dbedd9b8d3dc2e6ee28373c69a24764249745

[SILGen] Teach SIlGen to emit local property wrappers

view details

Holly Borla

commit sha 0842b4212773b36778d773331155df6be20d2c21

[SILGen] Only use assign_by_wrapper for wrapped instance properties inside an initializer, and for wrapped local variables.

view details

Holly Borla

commit sha 9bd3d0b67fc9599c693735d98c6ff98defccc8e5

[Property Wrappers] Make sure captures are computed for synthesized property wrapper accessors.

view details

Holly Borla

commit sha d8df6217d32cf7ec970d67bc66ff966df0c1a671

[Property Wrappers] Allow property wrappers on local variables.

view details

Holly Borla

commit sha 21cbdfa337dfa41e108573d5d99c6259bee671c9

[Property Wrappers] Add a VarDecl helper method for visiting synthesized property wrapper vars.

view details

Arnold Schwaighofer

commit sha 8e8c57caf59f043b4046ad0df6e7c358bcac9903

SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered. This could be because the type mentions an opaque archetype and therefore we would look through to the underlying type depending on the type expansion and could get a different SIL type. For example '() -> out some P' could lower to '() -> @out Int'. Or this could be because when we lower an aggregate type some of its fields are opaque types that could be looked through and therefore the aggregate has different lowering (e.g address vs. loadable) in different type expansion contexts. By replacing it this change also fixes an infinite recursion in hasOpaqueArchetypePropertiesOrCases. rdar://68798822

view details

Adrian Prantl

commit sha 26b5230f3c93ace3b5ad77ce36826bb5ea5da0d6

Remove stray character.

view details

Holly Borla

commit sha 2a67c651eecb6ccd6384a90961cfee46338c954e

[Property Wrappers] Generalize a few property wrapper decl context checks to check for type context instead of local context. This generalization will help us implement property wrappers on global variables, which should use the same approach of not adding synthesized accessors to the AST and instead lazily visit them in SILGen.

view details

Slava Pestov

commit sha dec9bf680e00eac0e1ca3074bc3967f5e582c068

AST: Remove unused UnqualifiedLookupFactory::Consumer field

view details

Slava Pestov

commit sha ba4d6ede07919fe141eb134dc2ab8aee8ea1aae6

AST: Remove unused NamedDeclConsumer class

view details

Slava Pestov

commit sha 17a0b41a40cc5d8e2c20aca07d96c096bab2bffc

Sema: Remove dead code from CheckRedeclarationRequest::evaluate()

view details

Slava Pestov

commit sha c56ab07c77184229d215213ec7a9e0b3c360fa36

ASTScope: Add finishLookupInBraceStmt parameter to ASTScope::lookupLocalDecls() This will be used to implement re-declaration checking for local declarations. Currently this is handled by parse-time lookup. To make it work with ASTScope, we need to perform lookups that look into the innermost local scope only; for example, this is an invalid redeclaration: do { let x = 321 let x = 123 } But the following is fine, even though both VarDecls are in the same *DeclContext*: do { let x = 321 do { let x = 123 } }

view details

Slava Pestov

commit sha d58583850d323cc8538f4508d4fcc16395556439

Sema: Check for re-declarations in local context in CheckRedeclarationRequest

view details

Slava Pestov

commit sha 18f5f94ce25a6bdc947a551ba4950626e04d9bb6

Sema: Check for duplicate parameter and generic parameter names when parser lookup is off The existing redeclaration checking can be extended for declarations in local scope, but it won't catch these.

view details

push time in 12 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha fc81e88988b49ca9107eb40b78faf7632743b35b

Add support for `_specialize(exported: true, ...)` This attribute allows to define a pre-specialized entry point of a generic function in a library. The following definition provides a pre-specialized entry point for `genericFunc(_:)` for the parameter type `Int` that clients of the library can call. ``` @_specialize(exported: true, where T == Int) public func genericFunc<T>(_ t: T) { ... } ``` Pre-specializations of internal `@inlinable` functions are allowed. ``` @usableFromInline internal struct GenericThing<T> { @_specialize(exported: true, where T == Int) @inlinable internal func genericMethod(_ t: T) { } } ``` There is syntax to pre-specialize a method from a different module. ``` import ModuleDefiningGenericFunc @_specialize(exported: true, target: genericFunc(_:), where T == Double) func prespecialize_genericFunc(_ t: T) { fatalError("dont call") } ``` Specially marked extensions allow for pre-specialization of internal methods accross module boundries (respecting `@inlinable` and `@usableFromInline`). ``` import ModuleDefiningGenericThing public struct Something {} @_specializeExtension extension GenericThing { @_specialize(exported: true, target: genericMethod(_:), where T == Something) func prespecialize_genericMethod(_ t: T) { fatalError("dont call") } } ``` rdar://64993425

view details

Arnold Schwaighofer

commit sha e0a4d8f3ac860dd8ad96a1d3910de5d44dbd7204

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `. rdar://64993425

view details

push time in 13 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha 17afdac72702b2016744e6c21d0a1e0dc059609b

Add support for `_specialize(exported: true, ...)` This attribute allows to define a pre-specialized entry point of a generic function in a library. The following definition provides a pre-specialized entry point for `genericFunc(_:)` for the parameter type `Int` that clients of the library can call. ``` @_specialize(exported: true, where T == Int) public func genericFunc<T>(_ t: T) { ... } ``` Pre-specializations of internal `@inlinable` functions are allowed. ``` @usableFromInline internal struct GenericThing<T> { @_specialize(exported: true, where T == Int) @inlinable internal func genericMethod(_ t: T) { } } ``` There is syntax to pre-specialize a method from a different module. ``` import ModuleDefiningGenericFunc @_specialize(exported: true, target: genericFunc(_:), where T == Double) func prespecialize_genericFunc(_ t: T) { fatalError("dont call") } ``` Specially marked extensions allow for pre-specialization of internal methods accross module boundries (respecting `@inlinable` and `@usableFromInline`). ``` import ModuleDefiningGenericThing public struct Something {} @_specializeExtension extension GenericThing { @_specialize(exported: true, target: genericMethod(_:), where T == Something) func prespecialize_genericMethod(_ t: T) { fatalError("dont call") } } ```

view details

Arnold Schwaighofer

commit sha 5a39f764f2f89642570f0a9270bcc4a7a7810ecb

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `.

view details

push time in 15 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha b69f639d311f31e54a4acb2393e5f7dd4d193e3a

WIP: Support for `_specialize(exported: true, ...)`

view details

Arnold Schwaighofer

commit sha ecc451026077d1ed05568a6150d7b034c3cf8709

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `.

view details

push time in 15 days

push eventaschwaighofer/swift

Arnold Schwaighofer

commit sha 5d65199f04143208c1c782f41b78716566cdc78d

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `.

view details

push time in 16 days

PullRequestReviewEvent

push eventapple/swift

Arnold Schwaighofer

commit sha 8e8c57caf59f043b4046ad0df6e7c358bcac9903

SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered. This could be because the type mentions an opaque archetype and therefore we would look through to the underlying type depending on the type expansion and could get a different SIL type. For example '() -> out some P' could lower to '() -> @out Int'. Or this could be because when we lower an aggregate type some of its fields are opaque types that could be looked through and therefore the aggregate has different lowering (e.g address vs. loadable) in different type expansion contexts. By replacing it this change also fixes an infinite recursion in hasOpaqueArchetypePropertiesOrCases. rdar://68798822

view details

Arnold Schwaighofer

commit sha 913543e0659cfcc1d4c93b4c9e3c20a51e6368d1

Merge pull request #34077 from aschwaighofer/fix_hasOpaqueArchetypePropertiesOrCases Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

view details

push time in 17 days

PR merged apple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

Also fix the code handling enums to use getArgumentInterfaceType instead of getInterfaceType and handle tuples.

rdar://68798822

+340 -211

12 comments

5 changed files

aschwaighofer

pr closed time in 17 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

The only failures in the source compatibility debug run are unexpected passes:

UPASS_BlueSocket_4.2_BuildXcodeWorkspaceScheme_Socket-iOS_generic-platform-iOS.log
UPASS_BlueSocket_5.0_BuildXcodeWorkspaceScheme_Socket-iOS_generic-platform-iOS.log
UPASS_BlueSocket_5.1_BuildXcodeWorkspaceScheme_Socket-iOS_generic-platform-iOS.log

These are all marked as passing on the latest debug run: https://ci.swift.org/job/swift-main-source-compat-suite-debug/3549/artifact/swift-source-compat-suite/.

aschwaighofer

comment created time in 17 days

Pull request review commentapple/swift

First steps towards calling convention for async functions.

 static unsigned findSinglePartiallyAppliedParameterIndexIgnoringEmptyTypes(   return firstNonEmpty; } +void irgen::loadArgumentFromContext(Explosion &param, +                                 const SILType &fieldTy,+                                 const TypeInfo &fieldTI,+                                 Address fieldAddr,+                                 ParameterConvention fieldConvention,+                                 IRGenFunction &subIGF,+                                 bool needsLoad,+                                 bool &needsAllocas,+                                 SmallVector<AddressToDeallocate, 4> &addressesToDeallocate,+                                 bool &dependsOnContextLifetime) {+  switch (fieldConvention) {+  case ParameterConvention::Indirect_In:+  case ParameterConvention::Indirect_In_Constant: {++    auto initStackCopy = [&addressesToDeallocate, &needsAllocas, &param,+                          &subIGF](const TypeInfo &fieldTI, SILType fieldTy,+                                   Address fieldAddr) {+      // The +1 argument is passed indirectly, so we need to copy into a+      // temporary.+      needsAllocas = true;+      auto stackAddr = fieldTI.allocateStack(subIGF, fieldTy, "arg.temp");+      auto addressPointer = stackAddr.getAddress().getAddress();+      fieldTI.initializeWithCopy(subIGF, stackAddr.getAddress(), fieldAddr,+                                 fieldTy, false);+      param.add(addressPointer);++      // Remember to deallocate later.+      addressesToDeallocate.push_back(+          AddressToDeallocate{fieldTy, fieldTI, stackAddr});+    };++    if (needsLoad) {+      // If the closure is [onstack] it only captured the address of the+      // value. Load that address from the context.+      Explosion addressExplosion;+      cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr,+                                                 addressExplosion);+      assert(fieldTy.isAddress());+      auto newFieldTy = fieldTy.getObjectType();+      auto &newFieldTI =+          subIGF.getTypeInfoForLowered(newFieldTy.getASTType());+      fieldAddr =+          newFieldTI.getAddressForPointer(addressExplosion.claimNext());+      initStackCopy(newFieldTI, newFieldTy, fieldAddr);+    } else {+      initStackCopy(fieldTI, fieldTy, fieldAddr);+    }+    break;+  }+  case ParameterConvention::Indirect_In_Guaranteed:+    if (needsLoad) {+      cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);+    } else {+      // The argument is +0, so we can use the address of the param in+      // the context directly.+      param.add(fieldAddr.getAddress());+      dependsOnContextLifetime = true;+    }+    break;+  case ParameterConvention::Indirect_Inout:+  case ParameterConvention::Indirect_InoutAliasable:+    // Load the address of the inout parameter.+    cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);+    break;+  case ParameterConvention::Direct_Guaranteed:+  case ParameterConvention::Direct_Unowned:+    // If the type is nontrivial, keep the context alive since the field+    // depends on the context to not be deallocated.+    if (!fieldTI.isPOD(ResilienceExpansion::Maximal))+      dependsOnContextLifetime = true;++    // Load these parameters directly. We can "take" since the parameter is+    // +0. This can happen since the context will keep the parameter alive.+    cast<LoadableTypeInfo>(fieldTI).loadAsTake(subIGF, fieldAddr, param);+    break;+  case ParameterConvention::Direct_Owned:+    // Copy the value out at +1.+    cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);

Basically the rule I have in mind is: The SwiftContext does not take ownership of any arguments or result. The ownership is held by the allocated (alloc_stack) memory location in the caller or by the reference passed by the caller. Therefore all indirect arguments should be just passing the address allocated in the caller and direct arguments should just extract the value out of the SwiftContext at +0.

nate-chandler

comment created time in 19 days

PullRequestReviewEvent

Pull request review commentapple/swift

First steps towards calling convention for async functions.

 static unsigned findSinglePartiallyAppliedParameterIndexIgnoringEmptyTypes(   return firstNonEmpty; } +void irgen::loadArgumentFromContext(Explosion &param, +                                 const SILType &fieldTy,+                                 const TypeInfo &fieldTI,+                                 Address fieldAddr,+                                 ParameterConvention fieldConvention,+                                 IRGenFunction &subIGF,+                                 bool needsLoad,+                                 bool &needsAllocas,+                                 SmallVector<AddressToDeallocate, 4> &addressesToDeallocate,+                                 bool &dependsOnContextLifetime) {+  switch (fieldConvention) {+  case ParameterConvention::Indirect_In:+  case ParameterConvention::Indirect_In_Constant: {++    auto initStackCopy = [&addressesToDeallocate, &needsAllocas, &param,+                          &subIGF](const TypeInfo &fieldTI, SILType fieldTy,+                                   Address fieldAddr) {+      // The +1 argument is passed indirectly, so we need to copy into a+      // temporary.+      needsAllocas = true;+      auto stackAddr = fieldTI.allocateStack(subIGF, fieldTy, "arg.temp");+      auto addressPointer = stackAddr.getAddress().getAddress();+      fieldTI.initializeWithCopy(subIGF, stackAddr.getAddress(), fieldAddr,+                                 fieldTy, false);+      param.add(addressPointer);++      // Remember to deallocate later.+      addressesToDeallocate.push_back(+          AddressToDeallocate{fieldTy, fieldTI, stackAddr});+    };++    if (needsLoad) {+      // If the closure is [onstack] it only captured the address of the+      // value. Load that address from the context.+      Explosion addressExplosion;+      cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr,+                                                 addressExplosion);+      assert(fieldTy.isAddress());+      auto newFieldTy = fieldTy.getObjectType();+      auto &newFieldTI =+          subIGF.getTypeInfoForLowered(newFieldTy.getASTType());+      fieldAddr =+          newFieldTI.getAddressForPointer(addressExplosion.claimNext());+      initStackCopy(newFieldTI, newFieldTy, fieldAddr);+    } else {+      initStackCopy(fieldTI, fieldTy, fieldAddr);+    }+    break;+  }+  case ParameterConvention::Indirect_In_Guaranteed:+    if (needsLoad) {+      cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);+    } else {+      // The argument is +0, so we can use the address of the param in+      // the context directly.+      param.add(fieldAddr.getAddress());+      dependsOnContextLifetime = true;+    }+    break;+  case ParameterConvention::Indirect_Inout:+  case ParameterConvention::Indirect_InoutAliasable:+    // Load the address of the inout parameter.+    cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);+    break;+  case ParameterConvention::Direct_Guaranteed:+  case ParameterConvention::Direct_Unowned:+    // If the type is nontrivial, keep the context alive since the field+    // depends on the context to not be deallocated.+    if (!fieldTI.isPOD(ResilienceExpansion::Maximal))+      dependsOnContextLifetime = true;++    // Load these parameters directly. We can "take" since the parameter is+    // +0. This can happen since the context will keep the parameter alive.+    cast<LoadableTypeInfo>(fieldTI).loadAsTake(subIGF, fieldAddr, param);+    break;+  case ParameterConvention::Direct_Owned:+    // Copy the value out at +1.+    cast<LoadableTypeInfo>(fieldTI).loadAsCopy(subIGF, fieldAddr, param);

I think this should be a take for async context since the caller of the async function guarantees the +1. Also I assume we never actually hit any of the indirect cases (except for indirect_inout) for async contexts. Because they all should map to a CanInout(AST.Type). Can we assert this? and prove me right or wrong.

nate-chandler

comment created time in 19 days

PullRequestReviewEvent

Pull request review commentapple/swift

First steps towards calling convention for async functions.

 class IRGenSILFunction :  } // end anonymous namespace +static AsyncContextLayout getAsyncContextLayout(IRGenSILFunction &IGF) {+  return getAsyncContextLayout(IGF, IGF.CurSILFn);+}++namespace {+class SyncEntryPointArgumentEmission+    : public virtual EntryPointArgumentEmission {+protected:+  IRGenSILFunction &IGF;+  SILBasicBlock &entry;+  Explosion &allParamValues;+  SyncEntryPointArgumentEmission(IRGenSILFunction &IGF, SILBasicBlock &entry,+                                 Explosion &allParamValues)+      : IGF(IGF), entry(entry), allParamValues(allParamValues){};++public:+  bool requiresIndirectResult(SILType retType) override {+    auto &schema =+        IGF.IGM.getTypeInfo(retType).nativeReturnValueSchema(IGF.IGM);+    return schema.requiresIndirect();+  }+  llvm::Value *getIndirectResultForFormallyDirectResult() override {+    return allParamValues.claimNext();+  }+  llvm::Value *getIndirectResult(unsigned index) override {+    return allParamValues.claimNext();+  };+};+class AsyncEntryPointArgumentEmission+    : public virtual EntryPointArgumentEmission {+protected:+  IRGenSILFunction &IGF;+  SILBasicBlock &entry;+  Explosion &allParamValues;+  AsyncEntryPointArgumentEmission(IRGenSILFunction &IGF, SILBasicBlock &entry,+                                  Explosion &allParamValues)+      : IGF(IGF), entry(entry), allParamValues(allParamValues){};+};++class COrObjCEntryPointArgumentEmission+    : public virtual EntryPointArgumentEmission {};++class SyncCOrObjCEntryPointArgumentEmission+    : public SyncEntryPointArgumentEmission,+      public COrObjCEntryPointArgumentEmission {+public:+  SyncCOrObjCEntryPointArgumentEmission(IRGenSILFunction &_IGF,+                                        SILBasicBlock &_entry,+                                        Explosion &_allParamValues)+      : SyncEntryPointArgumentEmission(_IGF, _entry, _allParamValues){};+};++class SyncNativeCCEntryPointArgumentEmission final+    : public NativeCCEntryPointArgumentEmission,+      public SyncEntryPointArgumentEmission {+public:+  SyncNativeCCEntryPointArgumentEmission(IRGenSILFunction &_IGF,+                                         SILBasicBlock &_entry,+                                         Explosion &_allParamValues)+      : SyncEntryPointArgumentEmission(_IGF, _entry, _allParamValues){};++  llvm::Value *getErrorResultArgument() override {+    return allParamValues.takeLast();+  }+  llvm::Value *getContext() override { return allParamValues.takeLast(); }+  Explosion getArgumentExplosion(unsigned index, unsigned size) override {+    assert(size > 0);+    Explosion result;+    allParamValues.transferInto(result, size);+    return result;+  }+  llvm::Value *getSelfWitnessTable() override {+    return allParamValues.takeLast();+  }+  llvm::Value *getSelfMetadata() override { return allParamValues.takeLast(); }+  llvm::Value *getCoroutineBuffer() override {+    return allParamValues.claimNext();+  }+};++class AsyncNativeCCEntryPointArgumentEmission final+    : public NativeCCEntryPointArgumentEmission,+      public AsyncEntryPointArgumentEmission {+  llvm::Value *context;+  /*const*/ AsyncContextLayout layout;+  const Address dataAddr;++public:+  AsyncNativeCCEntryPointArgumentEmission(IRGenSILFunction &IGF,+                                          SILBasicBlock &entry,+                                          Explosion &allParamValues)+      : AsyncEntryPointArgumentEmission(IGF, entry, allParamValues),+        context(allParamValues.claimNext()), layout(getAsyncContextLayout(IGF)),+        dataAddr(layout.emitCastTo(IGF, context)){};++  llvm::Value *getErrorResultArgument() override {+    auto errorLayout = layout.getErrorLayout();+    Address addr = errorLayout.project(IGF, dataAddr, /*offsets*/ llvm::None);+    // FIXME: FIXME_NOW: Alloca a %swift.error* and store the contents of+    //                   addr to it.+    return addr.getAddress();+  }+  llvm::Value *getContext() override {+    auto contextLayout = layout.getLocalContextLayout();+    Address addr = contextLayout.project(IGF, dataAddr, /*offsets*/ llvm::None);+    auto &ti = cast<LoadableTypeInfo>(contextLayout.getType());+    Explosion explosion;+    // FIXME: FIXME_NOW: CORRECTNESS: Actually use these fields.+    bool needsAllocas;+    SmallVector<AddressToDeallocate, 4> addressesToDeallocate;+    bool dependsOnContextLifetime;+    loadArgumentFromContext(explosion, layout.getLocalContextType(), ti, addr,+                            layout.getLocalContextConvention(), IGF,+                            IGF.CurSILFn->getLoweredFunctionType(),

I am confused by this line. Shouldn't that be /*isNoEscape*true?

nate-chandler

comment created time in 20 days

PullRequestReviewEvent

Pull request review commentapple/swift

First steps towards calling convention for async functions.

 void irgen::extractScalarResults(IRGenFunction &IGF, llvm::Type *bodyType,     out.add(returned); } +static void externalizeArguments(IRGenFunction &IGF, const Callee &callee,+                                 Explosion &in, Explosion &out,+                                 TemporarySet &temporaries, bool isOutlined);++namespace {++class SyncCallEmission final : public CallEmission {+  using super = CallEmission;++public:+  SyncCallEmission(IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)+      : CallEmission(IGF, selfValue, std::move(callee)) {+    setFromCallee();+  }++  SILType getParameterType(unsigned index) override {+    SILFunctionConventions origConv(getCallee().getOrigFunctionType(),+                                    IGF.getSILModule());+    return origConv.getSILArgumentType(+        index, IGF.IGM.getMaximalTypeExpansionContext());+  }+  void begin() override {+    super::begin();+  }+  void end() override {+    super::end();+  }+  void setFromCallee() override {+    super::setFromCallee();++    auto fnType = CurCallee.getOrigFunctionType();++    if (fnType->getRepresentation() ==+        SILFunctionTypeRepresentation::WitnessMethod) {+      unsigned n = getTrailingWitnessSignatureLength(IGF.IGM, fnType);+      while (n--) {+        Args[--LastArgWritten] = nullptr;+      }+    }++    llvm::Value *contextPtr = CurCallee.getSwiftContext();++    // Add the error result if we have one.+    if (fnType->hasErrorResult()) {+      // The invariant is that this is always zero-initialized, so we+      // don't need to do anything extra here.+      SILFunctionConventions fnConv(fnType, IGF.getSILModule());+      Address errorResultSlot = IGF.getErrorResultSlot(+          fnConv.getSILErrorType(IGF.IGM.getMaximalTypeExpansionContext()));++      assert(LastArgWritten > 0);+      Args[--LastArgWritten] = errorResultSlot.getAddress();+      addAttribute(LastArgWritten + llvm::AttributeList::FirstArgIndex,+                   llvm::Attribute::NoCapture);+      IGF.IGM.addSwiftErrorAttributes(CurCallee.getMutableAttributes(),+                                      LastArgWritten);++      // Fill in the context pointer if necessary.+      if (!contextPtr) {+        assert(!CurCallee.getOrigFunctionType()->getExtInfo().hasContext() &&+               "Missing context?");+        contextPtr = llvm::UndefValue::get(IGF.IGM.RefCountedPtrTy);+      }+    }++    // Add the data pointer if we have one.+    // (Note that we're emitting backwards, so this correctly goes+    // *before* the error pointer.)+    if (contextPtr) {+      assert(LastArgWritten > 0);+      Args[--LastArgWritten] = contextPtr;+      IGF.IGM.addSwiftSelfAttributes(CurCallee.getMutableAttributes(),+                                     LastArgWritten);+    }+  }+  void setArgs(Explosion &original, bool isOutlined,+               WitnessMetadata *witnessMetadata) override {+    // Convert arguments to a representation appropriate to the calling+    // convention.+    Explosion adjusted;++    auto origCalleeType = CurCallee.getOrigFunctionType();+    SILFunctionConventions fnConv(origCalleeType, IGF.getSILModule());++    // Pass along the indirect result pointers.+    original.transferInto(adjusted, fnConv.getNumIndirectSILResults());++    // Pass along the coroutine buffer.+    switch (origCalleeType->getCoroutineKind()) {+    case SILCoroutineKind::YieldMany:+    case SILCoroutineKind::YieldOnce:+      original.transferInto(adjusted, 1);+      break;++    case SILCoroutineKind::None:+      break;+    }++    // Translate the formal arguments and handle any special arguments.+    switch (getCallee().getRepresentation()) {+    case SILFunctionTypeRepresentation::ObjCMethod:+      adjusted.add(getCallee().getObjCMethodReceiver());+      adjusted.add(getCallee().getObjCMethodSelector());+      externalizeArguments(IGF, getCallee(), original, adjusted, Temporaries,+                           isOutlined);+      break;++    case SILFunctionTypeRepresentation::Block:+      adjusted.add(getCallee().getBlockObject());+      LLVM_FALLTHROUGH;++    case SILFunctionTypeRepresentation::CFunctionPointer:+      externalizeArguments(IGF, getCallee(), original, adjusted, Temporaries,+                           isOutlined);+      break;++    case SILFunctionTypeRepresentation::WitnessMethod:+      assert(witnessMetadata);+      assert(witnessMetadata->SelfMetadata->getType() ==+             IGF.IGM.TypeMetadataPtrTy);+      assert(witnessMetadata->SelfWitnessTable->getType() ==+             IGF.IGM.WitnessTablePtrTy);+      Args.rbegin()[1] = witnessMetadata->SelfMetadata;+      Args.rbegin()[0] = witnessMetadata->SelfWitnessTable;+      LLVM_FALLTHROUGH;++    case SILFunctionTypeRepresentation::Closure:+    case SILFunctionTypeRepresentation::Method:+    case SILFunctionTypeRepresentation::Thin:+    case SILFunctionTypeRepresentation::Thick: {+      // Check for value arguments that need to be passed indirectly.+      // But don't expect to see 'self' if it's been moved to the context+      // position.+      auto params = origCalleeType->getParameters();+      if (hasSelfContextParameter(origCalleeType)) {+        params = params.drop_back();+      }+      for (auto param : params) {+        addNativeArgument(IGF, original, origCalleeType, param, adjusted,+                          isOutlined);+      }++      // Anything else, just pass along.  This will include things like+      // generic arguments.+      adjusted.add(original.claimAll());++      break;+    }+    }+    super::setArgs(adjusted, isOutlined, witnessMetadata);+  }+  Address getErrorSlot(SILType errorType) override {+    return IGF.getErrorResultSlot(errorType);+  };+};++class AsyncCallEmission final : public CallEmission {+  using super = CallEmission;++  Address contextBuffer;+  Size contextSize;+  Address context;++  AsyncContextLayout getAsyncContextLayout() {+    return ::getAsyncContextLayout(IGF, getCallee().getOrigFunctionType(),+                                   getCallee().getSubstFunctionType(),+                                   getCallee().getSubstitutions());+  }++public:+  AsyncCallEmission(IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)+      : CallEmission(IGF, selfValue, std::move(callee)) {+    setFromCallee();+  }++  void begin() override {+    super::begin();+    assert(!contextBuffer.isValid());+    assert(!context.isValid());+    // Allocate space for the async arguments.+    auto layout = getAsyncContextLayout();+    std::tie(contextBuffer, contextSize) = emitAllocAsyncContext(IGF, layout);+    context = layout.emitCastTo(IGF, contextBuffer.getAddress());+  }+  void end() override {+    assert(contextBuffer.isValid());+    assert(context.isValid());+    emitDeallocAsyncContext(IGF, contextBuffer, contextSize);+    super::end();+  }+  void setFromCallee() override { super::setFromCallee(); }+  SILType getParameterType(unsigned index) override {+    return getAsyncContextLayout().getParameterType(index);+  }+  void setArgs(Explosion &llArgs, bool isOutlined,+               WitnessMetadata *witnessMetadata) override {+    Explosion asyncExplosion;+    asyncExplosion.add(contextBuffer.getAddress());+    super::setArgs(asyncExplosion, false, witnessMetadata);++    // Move all the arguments into the context.+    if (selfValue) {+      llArgs.add(selfValue);+    }+    auto layout = getAsyncContextLayout();+    unsigned baseParameterIndex = layout.getFirstArgumentIndex();+    unsigned baseIndirectReturnIndex = layout.getFirstIndirectReturnIndex();+    auto params = getCallee().getSubstFunctionType()->getParameters();+    for (auto index : indices(params)) {+      Optional<ElementLayout> fieldLayout;+      Optional<ParameterConvention> convention;+      SILType fieldTy;+      if (selfValue && index == params.size() - 1) {+        fieldLayout = layout.getLocalContextLayout();+        convention = layout.getLocalContextConvention();+        fieldTy = layout.getLocalContextType();+      } else {+        fieldLayout = layout.getElement(index + baseParameterIndex);+        convention = layout.getArgumentConvention(index);+        fieldTy = layout.getArgumentType(index);+      }+      Address fieldAddr =+          fieldLayout->project(IGF, context, /*offsets*/ llvm::None);+      storeArgumentIntoContext(llArgs, fieldTy,+                               /*fieldTI*/ fieldLayout->getType(), fieldAddr,+                               *convention, IGF, /*needsLoad*/ true,+                               isOutlined);+    }+    auto indirectResults =+        getCallee().getSubstFunctionType()->getIndirectFormalResults();+    unsigned index = 0;+    for (auto indirectResult : indirectResults) {+      (void)indirectResult;+      auto &fieldLayout = layout.getElement(index + baseIndirectReturnIndex);+      Address fieldAddr =+          fieldLayout.project(IGF, context, /*offsets*/ llvm::None);+      cast<LoadableTypeInfo>(fieldLayout.getType())+        .initialize(IGF, llArgs, fieldAddr, isOutlined);+      ++index;+    }+    if (layout.hasBindings()) {+      auto bindingLayout = layout.getBindingsLayout();+      auto bindingsAddr = bindingLayout.project(IGF, context, /*offsets*/ None);+      layout.getBindings().save(IGF, bindingsAddr);+    }+    // At this point, llArgs contains the arguments that are being passed along+    // via the async context.  We can safely drop them on the floor.+    (void)llArgs.claimAll();+    // TODO: Validation: we should be able to check that the contents of llArgs+    //       matches what is expected by the layout.+  }+  Address getErrorSlot(SILType errorType) override {+    auto layout = getAsyncContextLayout();+    auto errorLayout = layout.getErrorLayout();+    return errorLayout.project(IGF, context, /*offsets*/ llvm::None);+  };+};++} // end anonymous namespace++std::unique_ptr<CallEmission> irgen::getCallEmission(IRGenFunction &IGF,+                                                     llvm::Value *selfValue,+                                                     Callee &&callee) {+  if (callee.getOrigFunctionType()->isAsync()) {+    return std::make_unique<AsyncCallEmission>(IGF, selfValue,+                                               std::move(callee));+  } else {+    return std::make_unique<SyncCallEmission>(IGF, selfValue,+                                              std::move(callee));+  }+}+ /// Emit the unsubstituted result of this call into the given explosion. /// The unsubstituted result must be naturally returned directly. void CallEmission::emitToUnmappedExplosion(Explosion &out) {+  assert(state == State::Emitting);   assert(LastArgWritten == 0 && "emitting unnaturally to explosion");    auto call = emitCallSite(); +  if (getCallee().getOrigFunctionType()->isAsync()) {+    SILFunctionConventions fnConv(getCallee().getOrigFunctionType(),+                                  IGF.getSILModule());+    auto resultType =+        fnConv.getSILResultType(IGF.IGM.getMaximalTypeExpansionContext());+    auto &nativeSchema =+        IGF.IGM.getTypeInfo(resultType).nativeReturnValueSchema(IGF.IGM);+    auto expectedNativeResultType = nativeSchema.getExpandedType(IGF.IGM);+    if (expectedNativeResultType->isVoidTy()) {+      // If the async return is void, there is no return to move out of the+      // argument buffer.+      return;+    }+    assert(call->arg_size() == 1);+    auto context = call->arg_begin()->get();+    // Gather the values.+    Explosion nativeExplosion;+    auto layout = getAsyncContextLayout(IGF, getCallee().getOrigFunctionType(),+                                        getCallee().getSubstFunctionType(),+                                        getCallee().getSubstitutions());+    auto dataAddr = layout.emitCastTo(IGF, context);+    int index = layout.getFirstDirectReturnIndex();+    for (auto result :+         getCallee().getSubstFunctionType()->getDirectFormalResults()) {+      auto &fieldLayout = layout.getElement(index);+      Address fieldAddr =+          fieldLayout.project(IGF, dataAddr, /*offsets*/ llvm::None);+      auto &fieldTI = fieldLayout.getType();+      cast<LoadableTypeInfo>(fieldTI).loadAsCopy(IGF, fieldAddr,

This should be loadAsTake (+0 load). Any return calling convention ownership operation should have happened as part of SIL emission i.e it is not the return %owned_value : $SomeClass that performs the +1. Rather it is going to be some %owned_value = copy_value or some other instructions before the return.

We try to use the SILFunctionConventions abstraction rather the directly operating on SILFunctionType API. I would rather use the SILFunctionConventions(getCallee().getSubstFunctionType(), Module).getDirectSILResults()) from above's fnConv here. Sorry for not noticing/forgetting that when we looked at the code yesterday.

nate-chandler

comment created time in 20 days

PullRequestReviewEvent

Pull request review commentapple/swift

First steps towards calling convention for async functions.

 void irgen::extractScalarResults(IRGenFunction &IGF, llvm::Type *bodyType,     out.add(returned); } +static void externalizeArguments(IRGenFunction &IGF, const Callee &callee,+                                 Explosion &in, Explosion &out,+                                 TemporarySet &temporaries, bool isOutlined);++namespace {++class SyncCallEmission final : public CallEmission {+  using super = CallEmission;++public:+  SyncCallEmission(IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)+      : CallEmission(IGF, selfValue, std::move(callee)) {+    setFromCallee();+  }++  SILType getParameterType(unsigned index) override {+    SILFunctionConventions origConv(getCallee().getOrigFunctionType(),+                                    IGF.getSILModule());+    return origConv.getSILArgumentType(+        index, IGF.IGM.getMaximalTypeExpansionContext());+  }+  void begin() override {+    super::begin();+  }+  void end() override {+    super::end();+  }+  void setFromCallee() override {+    super::setFromCallee();++    auto fnType = CurCallee.getOrigFunctionType();++    if (fnType->getRepresentation() ==+        SILFunctionTypeRepresentation::WitnessMethod) {+      unsigned n = getTrailingWitnessSignatureLength(IGF.IGM, fnType);+      while (n--) {+        Args[--LastArgWritten] = nullptr;+      }+    }++    llvm::Value *contextPtr = CurCallee.getSwiftContext();++    // Add the error result if we have one.+    if (fnType->hasErrorResult()) {+      // The invariant is that this is always zero-initialized, so we+      // don't need to do anything extra here.+      SILFunctionConventions fnConv(fnType, IGF.getSILModule());+      Address errorResultSlot = IGF.getErrorResultSlot(+          fnConv.getSILErrorType(IGF.IGM.getMaximalTypeExpansionContext()));++      assert(LastArgWritten > 0);+      Args[--LastArgWritten] = errorResultSlot.getAddress();+      addAttribute(LastArgWritten + llvm::AttributeList::FirstArgIndex,+                   llvm::Attribute::NoCapture);+      IGF.IGM.addSwiftErrorAttributes(CurCallee.getMutableAttributes(),+                                      LastArgWritten);++      // Fill in the context pointer if necessary.+      if (!contextPtr) {+        assert(!CurCallee.getOrigFunctionType()->getExtInfo().hasContext() &&+               "Missing context?");+        contextPtr = llvm::UndefValue::get(IGF.IGM.RefCountedPtrTy);+      }+    }++    // Add the data pointer if we have one.+    // (Note that we're emitting backwards, so this correctly goes+    // *before* the error pointer.)+    if (contextPtr) {+      assert(LastArgWritten > 0);+      Args[--LastArgWritten] = contextPtr;+      IGF.IGM.addSwiftSelfAttributes(CurCallee.getMutableAttributes(),+                                     LastArgWritten);+    }+  }+  void setArgs(Explosion &original, bool isOutlined,+               WitnessMetadata *witnessMetadata) override {+    // Convert arguments to a representation appropriate to the calling+    // convention.+    Explosion adjusted;++    auto origCalleeType = CurCallee.getOrigFunctionType();+    SILFunctionConventions fnConv(origCalleeType, IGF.getSILModule());++    // Pass along the indirect result pointers.+    original.transferInto(adjusted, fnConv.getNumIndirectSILResults());++    // Pass along the coroutine buffer.+    switch (origCalleeType->getCoroutineKind()) {+    case SILCoroutineKind::YieldMany:+    case SILCoroutineKind::YieldOnce:+      original.transferInto(adjusted, 1);+      break;++    case SILCoroutineKind::None:+      break;+    }++    // Translate the formal arguments and handle any special arguments.+    switch (getCallee().getRepresentation()) {+    case SILFunctionTypeRepresentation::ObjCMethod:+      adjusted.add(getCallee().getObjCMethodReceiver());+      adjusted.add(getCallee().getObjCMethodSelector());+      externalizeArguments(IGF, getCallee(), original, adjusted, Temporaries,+                           isOutlined);+      break;++    case SILFunctionTypeRepresentation::Block:+      adjusted.add(getCallee().getBlockObject());+      LLVM_FALLTHROUGH;++    case SILFunctionTypeRepresentation::CFunctionPointer:+      externalizeArguments(IGF, getCallee(), original, adjusted, Temporaries,+                           isOutlined);+      break;++    case SILFunctionTypeRepresentation::WitnessMethod:+      assert(witnessMetadata);+      assert(witnessMetadata->SelfMetadata->getType() ==+             IGF.IGM.TypeMetadataPtrTy);+      assert(witnessMetadata->SelfWitnessTable->getType() ==+             IGF.IGM.WitnessTablePtrTy);+      Args.rbegin()[1] = witnessMetadata->SelfMetadata;+      Args.rbegin()[0] = witnessMetadata->SelfWitnessTable;+      LLVM_FALLTHROUGH;++    case SILFunctionTypeRepresentation::Closure:+    case SILFunctionTypeRepresentation::Method:+    case SILFunctionTypeRepresentation::Thin:+    case SILFunctionTypeRepresentation::Thick: {+      // Check for value arguments that need to be passed indirectly.+      // But don't expect to see 'self' if it's been moved to the context+      // position.+      auto params = origCalleeType->getParameters();+      if (hasSelfContextParameter(origCalleeType)) {+        params = params.drop_back();+      }+      for (auto param : params) {+        addNativeArgument(IGF, original, origCalleeType, param, adjusted,+                          isOutlined);+      }++      // Anything else, just pass along.  This will include things like+      // generic arguments.+      adjusted.add(original.claimAll());++      break;+    }+    }+    super::setArgs(adjusted, isOutlined, witnessMetadata);+  }+  Address getErrorSlot(SILType errorType) override {+    return IGF.getErrorResultSlot(errorType);+  };+};++class AsyncCallEmission final : public CallEmission {+  using super = CallEmission;++  Address contextBuffer;+  Size contextSize;+  Address context;++  AsyncContextLayout getAsyncContextLayout() {+    return ::getAsyncContextLayout(IGF, getCallee().getOrigFunctionType(),+                                   getCallee().getSubstFunctionType(),+                                   getCallee().getSubstitutions());+  }++public:+  AsyncCallEmission(IRGenFunction &IGF, llvm::Value *selfValue, Callee &&callee)+      : CallEmission(IGF, selfValue, std::move(callee)) {+    setFromCallee();+  }++  void begin() override {+    super::begin();+    assert(!contextBuffer.isValid());+    assert(!context.isValid());+    // Allocate space for the async arguments.+    auto layout = getAsyncContextLayout();+    std::tie(contextBuffer, contextSize) = emitAllocAsyncContext(IGF, layout);+    context = layout.emitCastTo(IGF, contextBuffer.getAddress());+  }+  void end() override {+    assert(contextBuffer.isValid());+    assert(context.isValid());+    emitDeallocAsyncContext(IGF, contextBuffer, contextSize);+    super::end();+  }+  void setFromCallee() override { super::setFromCallee(); }+  SILType getParameterType(unsigned index) override {+    return getAsyncContextLayout().getParameterType(index);+  }+  void setArgs(Explosion &llArgs, bool isOutlined,+               WitnessMetadata *witnessMetadata) override {+    Explosion asyncExplosion;+    asyncExplosion.add(contextBuffer.getAddress());+    super::setArgs(asyncExplosion, false, witnessMetadata);++    // Move all the arguments into the context.+    if (selfValue) {+      llArgs.add(selfValue);+    }+    auto layout = getAsyncContextLayout();+    unsigned baseParameterIndex = layout.getFirstArgumentIndex();+    unsigned baseIndirectReturnIndex = layout.getFirstIndirectReturnIndex();+    auto params = getCallee().getSubstFunctionType()->getParameters();+    for (auto index : indices(params)) {+      Optional<ElementLayout> fieldLayout;+      Optional<ParameterConvention> convention;+      SILType fieldTy;+      if (selfValue && index == params.size() - 1) {+        fieldLayout = layout.getLocalContextLayout();+        convention = layout.getLocalContextConvention();+        fieldTy = layout.getLocalContextType();+      } else {+        fieldLayout = layout.getElement(index + baseParameterIndex);+        convention = layout.getArgumentConvention(index);+        fieldTy = layout.getArgumentType(index);+      }+      Address fieldAddr =+          fieldLayout->project(IGF, context, /*offsets*/ llvm::None);+      storeArgumentIntoContext(llArgs, fieldTy,+                               /*fieldTI*/ fieldLayout->getType(), fieldAddr,+                               *convention, IGF, /*needsLoad*/ true,+                               isOutlined);+    }+    auto indirectResults =+        getCallee().getSubstFunctionType()->getIndirectFormalResults();+    unsigned index = 0;+    for (auto indirectResult : indirectResults) {+      (void)indirectResult;+      auto &fieldLayout = layout.getElement(index + baseIndirectReturnIndex);+      Address fieldAddr =+          fieldLayout.project(IGF, context, /*offsets*/ llvm::None);+      cast<LoadableTypeInfo>(fieldLayout.getType())+        .initialize(IGF, llArgs, fieldAddr, isOutlined);+      ++index;+    }+    if (layout.hasBindings()) {+      auto bindingLayout = layout.getBindingsLayout();+      auto bindingsAddr = bindingLayout.project(IGF, context, /*offsets*/ None);+      layout.getBindings().save(IGF, bindingsAddr);+    }+    // At this point, llArgs contains the arguments that are being passed along+    // via the async context.  We can safely drop them on the floor.+    (void)llArgs.claimAll();+    // TODO: Validation: we should be able to check that the contents of llArgs+    //       matches what is expected by the layout.+  }+  Address getErrorSlot(SILType errorType) override {+    auto layout = getAsyncContextLayout();+    auto errorLayout = layout.getErrorLayout();+    return errorLayout.project(IGF, context, /*offsets*/ llvm::None);+  };+};++} // end anonymous namespace++std::unique_ptr<CallEmission> irgen::getCallEmission(IRGenFunction &IGF,+                                                     llvm::Value *selfValue,+                                                     Callee &&callee) {+  if (callee.getOrigFunctionType()->isAsync()) {+    return std::make_unique<AsyncCallEmission>(IGF, selfValue,+                                               std::move(callee));+  } else {+    return std::make_unique<SyncCallEmission>(IGF, selfValue,+                                              std::move(callee));+  }+}+ /// Emit the unsubstituted result of this call into the given explosion. /// The unsubstituted result must be naturally returned directly. void CallEmission::emitToUnmappedExplosion(Explosion &out) {+  assert(state == State::Emitting);   assert(LastArgWritten == 0 && "emitting unnaturally to explosion");    auto call = emitCallSite(); +  if (getCallee().getOrigFunctionType()->isAsync()) {+    SILFunctionConventions fnConv(getCallee().getOrigFunctionType(),

I think this should be the substituted function type.

nate-chandler

comment created time in 20 days

PullRequestReviewEvent

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test source compatibility

aschwaighofer

comment created time in 20 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci please test source compatibility

aschwaighofer

comment created time in 20 days

PullRequestReviewEvent

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test source compatibility

aschwaighofer

comment created time in 21 days

push eventaschwaighofer/swift

Owen Voorhees

commit sha 6b6b640e133ca547139c6586eb0dcbf7933b46ec

[Driver] Don't test for null source locations in driver diagnostics swift-driver doesn't emit these, and there's no reason to check that they're present when using the integrated driver.

view details

Joe Groff

commit sha 023066c1966c63ab3b7a4baee31ac24d29b7de36

SILGen: Relax assertion that incorrectly tripped on lowered opaque capture types. When lowering the SILConstantInfo for a closure implementation type with captures, we are more conservative about substituting opaque types in the capture, since the underlying types may only be available in the local context. This means the SILConstantInfo type may not in fact be exactly what you get from `SILFunction::getFunctionTypeInContext` referencing the implementation function from its originating context, since those opaque types will be substituted in the local context. Fixes SR-13480 | rdar://problem/68159831.

view details

Xiaodi Wu

commit sha 94887747a4e2746163e85438934a78a8c165fa8f

[benchmark] Add another test to floating point conversion benchmark

view details

Xiaodi Wu

commit sha 26f3c81e44d9cb53abdf51ed2f6a637bae5a3a77

[benchmark] Add another floating point conversion benchmark

view details

Xiaodi Wu

commit sha cb96bfbfdf0045383f11ed4c87e8142aafddf538

[benchmark] Tweak naming and workload for two new tests

view details

Joe Groff

commit sha 57215cb17f9312187d59b7c2465a10f4682bf8f3

SIL.rst: Add documentation for async function representation. Unlike our existing coroutines, async functions run independently within an async coroutine context, and don't directly yield values back and forth. They therefore mostly behave like normal functions with only an `@async` annotation to indicate the presence of async suspend points. The `withUnsafeContinuation` primitive requires some instructions to represent the operation that prepares the continuation to be resumed, which will be represented by `begin_async_continuation`...`await_async_continuation` regions.

view details

3405691582

commit sha 62a13e9ecd31da5ef335f245b66be826d6b5b4ff

[test] Erase SDKROOT since env -u is not portable. The `env -u` flag is not portable and not available on all platforms, so this unit test will fail when the feature is unavailable. Instead of trying to unset the field, just erase it instead, since trying to copy the entire invoked environment is difficult.

view details

Anthony Latsis

commit sha 103a8218380c9d72160f9ca3aa7d1e0ba4d8f1bc

Sema: Allow non-final classes to satisfy properties and subscripts with covariant Self

view details

3405691582

commit sha 42a3da29d77810fed0374ea7efe2faff02f0aef2

[test] Mark failing reflection tests XFAIL. See SR-12893. swift-reflection-dump does not properly handle offsets in ELF executable images that, when interpreted as vaddrs, belong in segments part of the image. This just empirically XFAIL's the unit tests that are crashing or failing, even though the other tests are just happening to pass anyway. There's no clear workaround; disable the expected failures for the moment.

view details

Joe Groff

commit sha 29587ac766e596a4f154ce5c0889c43978e19f77

Revise with feedback from John and Andy

view details

Joe Groff

commit sha e2dfe3a334333b742af60bd513bdfca89c2c5bf1

Add example of `withUnsafeContinuation` lowering to SIL

view details

Arnold Schwaighofer

commit sha 383d47fd0061dcd01f4801eda5ba6b66148f4358

IRGen: Scalar type layouts need to profile the SIL type It might contain archetypes whose type metadata is required. rdar://68972976 SR-13555

view details

Alexey Komnin

commit sha 6a4c5cf0612e43caf10a4f27bd6255c1b66a4ec7

Fix SR-13520: return string instead of address of local temporary

view details

Egor Zhdan

commit sha 7ba7d9b5c1749df62cdde2d5b3184fb23d27382b

WinSDK: extract Printing submodule Currently winspool.h gets included into `WinSDK.WinSock2` via windows.h

view details

Egor Zhdan

commit sha 42dcb6948ba2332f30b833bef4913885725148ff

WinSDK: extract Multimedia submodule Some of the headers in the Multimedia subsystem were not included in any other submodule of WinSDK. This change adds them to WinSDK.

view details

Joe Groff

commit sha e4b6f8bccabcc9262597265d1ee650d3789f3232

More feedback: ownership of bbargs, begin -> get_async_continuation

view details

Pavel Yaskevich

commit sha bdfa8d9099cd7529e64a314b3fda270acdf182bb

[AST] Allow hole types to originate from declarations Associating holes directly with declarations is useful in cases when declarations are invalid e.g. directly `ErrorType` or have error types inside.

view details

Pavel Yaskevich

commit sha 17cb2d215257aba4b5f121eada24faefe9cd47d0

[ConstraintSystem] Add a new flag which specifies that solver is used for code completion

view details

Pavel Yaskevich

commit sha bf58b0c08db7641582ed650ae739a3fa15e21444

[CSGen] Use special accessor to get a type of `VarDecl` for solver use Solver needs to handle invalid declarations but only in "code completion" mode since declaration in question might not be associated with code completion, otherwise (if constraint generation fails) there is going to be no completion results.

view details

Meghana Gupta

commit sha 010c1cd91f26f7f8ec1dea1a06f26cf94972debf

Convert OME into a function transform

view details

push time in 21 days

push eventaschwaighofer/swift

Xi Ge

commit sha 29e655bac03c60a29e1fb95be083a15f557926e4

DependenciesScanner: implement protocol for batch module dependencies scan This scanning mode allows swift-driver to query module dependencies in a batch and in a more granular way. In short term, it could help solve a problem that clang module dependencies may vary if target triple changes. In a longer term, we could break a holistic dependencies graph into smaller pieces for better caching and reusing. This change doesn't include the implementation of using the specified scanner arguments to set up Clang dependencies scanner. It will come in later commits.

view details

swift-ci

commit sha 316475c4ffbd507cf471faf0a0ac7a42d40c7f14

Merge pull request #33564 from DougGregor/function-builders-remove-build-do

view details

swift_jenkins

commit sha d2aa3b88dff58cb650360455c6c6e08988c376af

Merge remote-tracking branch 'origin/master' into master-rebranch

view details

Brent Royal-Gordon

commit sha 1ecf062a3612bef4b313ab6e89c76c54359a6c2c

Merge pull request #33556 from brentdax/how-forward-of-you [PrintAsObjC] Forward-declare bridged types

view details

Varun Gandhi

commit sha 32e030547f513c9fa7d71a7d5521b37e39a80c66

[NFC] Add test for self-cycles in module trace.

view details

Xi Ge

commit sha 6a6b1f832d2c9cc9f3a89f2d38729845edeb08ac

DependenciesScanner: differentiate Swift and Clang module more explicitly in batch scan input

view details

Rintaro Ishizaki

commit sha 443e091d8c114364ae890315464cb17f0f6db533

Merge pull request #33562 from rintaro/ide-completion-rdar67155695 [CodeCompletion] Avoid prioritizing unavailable in LookupVisibleDecls

view details

Varun Gandhi

commit sha 260125e7aeac654273268f16b76e3d65f8b905f8

[ModuleTrace] Early exit if a Clang module imports itself. Fixes rdar://67435472.

view details

swift_jenkins

commit sha 10d7479b62a200ae2fad4342067e4467e6a40822

Merge remote-tracking branch 'origin/master' into master-rebranch

view details

Brent Royal-Gordon

commit sha 6c18a0388333df9b10b60bbea69b3bcd00afb966

[NFC] Add ClangNode::dump()

view details

Brent Royal-Gordon

commit sha 28ea3e1727a112ef8f84bd427958012e267e5cf5

[NFC] Document TypeAliasDecl::isCompatibilityAlias

view details

Brent Royal-Gordon

commit sha 9d4281b46b31cb10b678fdd8b574ab05ff161d27

Support generic @compatibility_alias in PrintAsObjC When @compatibility_alias is used with an ObjC generic class, this ends up importing as a generic typealias. PrintAsObjC previously didn’t handle declarations involving these types correctly; it would fail an assertion in asserts compilers, and potentially print an incorrect compatibility header in non-asserts compilers. This PR makes it so that PrintAsObjC can now correctly use generic typealiases imported from Objective-C modules. It is, of course, still not possible to declare a generic typealias in Swift that will be printed into the Objective-C header. Fixes rdar://67256866.

view details

Alexis Laferrière

commit sha 2f7e0d496f14cc45c8972d129f0e0daf19f9bd6f

Revert "Revert "[Serialization] Serialize isUserAccessible on functions"" This reverts commit bf25a017013e4d3c87a9abbb7b8b067e1eb985b2.

view details

Alexis Laferrière

commit sha 256226d35e02c52a370b12a68f06e048a1e8335a

[Serialization] Fix isUserAccessible serialization on functions only

view details

Alexis Laferrière

commit sha fd78da51372478b6734cc059a8626d033cde60b3

[ModuleInterface] Don't print extensions to implementation-only imported types Extensions to implementation-only types are accepted at type-checking only if they don't define any public members. However if they declared a conformance to a public type they were also printed in the swiftinterface, making it unparsable because of an unknown type. Still accept such extensions but don't print them. rdar://problem/67516588

view details

swift-ci

commit sha d3b40941df9828f7e970fe24edb73eeba00aa49e

Merge pull request #33566 from mikeash/fix-symbol-visibility-test

view details

swift-ci

commit sha 7daed3cf08386bf177d04e87197e51c40d1b69be

Merge pull request #33570 from DougGregor/function-builders-throw

view details

swift_jenkins

commit sha 41b81bca2d3dead976b09e9f6f31dd821fdab6de

Merge remote-tracking branch 'origin/master' into master-rebranch

view details

Varun Gandhi

commit sha 6b07132a3f1d7a08b2ccea6cf42273af158e66ff

Merge pull request #33572 from varungandhi-apple/vg-fix-clang-module-self-cycle [ModuleTrace] Early exit if a Clang module imports itself.

view details

swift_jenkins

commit sha ac8122598ca4cd056d616c408f88486fa22e24af

Merge remote-tracking branch 'origin/master' into master-rebranch

view details

push time in 21 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test source compatibility

aschwaighofer

comment created time in 21 days

push eventaschwaighofer/swift

Varun Gandhi

commit sha e48469d03c87f8c1b87a2462fa3cd8c27c4d685f

[NFC] Add missing invariant checks for ExtInfoBuilders.

view details

Varun Gandhi

commit sha 5e9bf1f7c69395db4a99c6e749acc07b81ade90e

[SIL] Store ClangTypeInfo in SILFunctionType. This patch includes a large number of changes to make sure that: 1. When ExtInfo values are created, we store a ClangTypeInfo if applicable. 2. We reduce dependence on storing SIL representations in ASTExtInfo values. 3. Reduce places where we sloppily create ASTExtInfo values which should store a Clang type but don't. In certain places, this is unavoidable; see [NOTE: ExtInfo-Clang-type-invariant]. Ideally, we would check that the appropriate SILExtInfo does always store a ClangTypeInfo. However, the presence of the HasClangFunctionTypes option means that we would need to condition that assertion based on a dynamic check. Plumbing the setting down to SILExtInfoBuilder's checkInvariants would be too much work. So we weaken the check for now; we should strengthen it once we "turn on" HasClangFunctionTypes and remove the dynamic feature switch.

view details

Varun Gandhi

commit sha 983399c1e780c490be51fbf82edd029a584258b9

[Printer] Conditionally print Clang types in emitted SIL.

view details

Pavel Yaskevich

commit sha f97e80347b481494305737a5a82c9c5eef8933b4

[Diagnostics] Allow "unknown base" fix to be diagnosed in ambiguity situations If there are multiple overloads and all of them require explicit base type for a member reference, let's diagnose it as a single error since the problem is the same across the overload choices: ```swift func foo<T>(_: T, defaultT: T? = nil) {} func foo<U>(_: U, defaultU: U? = nil) {} foo(.bar) ``` In this example there is not enough contextual information to determine base type of `.bar` reference and hence both `foo` overloads are a considered valid solutions until explicitly set base type disambiguates them. Resolves: rdar://problem/66891544

view details

Slava Pestov

commit sha fa4f7dd664e5745e31214ee5e9729ae33b391f80

Parse: Don't create PatternBindingDecls with overlapping source ranges This was happening in the error recovery path when parsing accessors on a pattern binding declaration that does not bind any variables, eg let _: Int { 0 }

view details

Slava Pestov

commit sha 51a4a91a137c63ad5be04f9e2607a89ed816832b

Sema: Mark a PatternBindingDecl as implicit in the builder transform

view details

Slava Pestov

commit sha 85ae2274653daa5f0da6bb08b03bc23c997ad715

ASTScope: Remove hacks for PatternBindingDecls with invalid source ranges

view details

Slava Pestov

commit sha c662c10d1eb75521d75bffe496ae5ee6dc1dfe6d

ASTScope: Use visitParsedAccessors() instead of getAllAccessors()

view details

Kuba (Brecka) Mracek

commit sha ed96cf43f4b5fb855748005c6b86a5535eb28584

Avoid using extra-cmake-options in the stdlib standalone presets (#34020)

view details

Slava Pestov

commit sha 007c81413d69b5a27f6a3e900594097e48f3fe21

Merge pull request #34021 from slavapestov/astscope-invalid-pbds ASTScope: Clean up handling of PatternBindingDecls and AccessorDecls

view details

Varun Gandhi

commit sha 7b967a80304fd1a843cffe2c81826a61e60b6e2d

Merge pull request #33085 from varungandhi-apple/vg-clang-types-in-sil-retry Propagate Clang function types through SIL

view details

Slava Pestov

commit sha 76802dd6354d67e75c8a206e435086a32a0342f4

ASTScope: FunctionBodyScope should not be nested inside ParameterListScope

view details

Slava Pestov

commit sha 753d303c73c1759ded7e9486407d93dd4285e48b

ASTScope: Remove expandIfConfigClauses() We're always guaranteed to visit the elements of the active clause as members of the parent AST node.

view details

Slava Pestov

commit sha c9f2060e54d52365a11c52d0c3d3695aaa81ca04

ASTScope: Remove shouldThisNodeBeScopedWhenFoundInSourceFileBraceStmtOrType()

view details

Slava Pestov

commit sha b7bd4fb8b3e5a2d20ebd27134a473a2e17fee211

ASTScope: Remove 'history' vector

view details

Doug Gregor

commit sha fb86fb3610c2467d8fcaea3b8dddac38b5ad894c

[SR-10251] Add test case for a bug that's already been fixed. Also tracked as rdar://68946205.

view details

Slava Pestov

commit sha 4ff6cda18043cf0f47523dd9485a0f18c45dc8fc

Add module interface printing test with non-trivial pattern binding initializer A stored property can be part of a pattern binding entry whose pattern declares multiple bindings with a single initializer, for example: struct S { let (x, y) = (0, 0) } Make sure these round-trip correctly.

view details

Artem Chikin

commit sha e0dbba569bc2cda697a7d585ae4272d1bf97a5cb

[Dependency Scanner] Add option to execute an import prescan With this option enabled, the dependency scanner gathers all import statements in source files of the main module (non-transitive) and outputs a list of imported modules. This will be used by build systems and the swift-driver as a way to avoid redundant re-scanning in incremental contexts.

view details

Mishal Shah

commit sha 20be565f66ddcf089c2534ba6391110ea430762b

Update CMark branch to main

view details

Artem Chikin

commit sha d5449bf55fb37deef04d0a652dd5e4b4787e0994

[Dependency Scanner] Add import-prescan handling to batch scanning

view details

push time in 21 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci please test os x

aschwaighofer

comment created time in 22 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test source compatibility

aschwaighofer

comment created time in 22 days

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test

aschwaighofer

comment created time in 22 days

push eventaschwaighofer/swift

Joe Groff

commit sha 023066c1966c63ab3b7a4baee31ac24d29b7de36

SILGen: Relax assertion that incorrectly tripped on lowered opaque capture types. When lowering the SILConstantInfo for a closure implementation type with captures, we are more conservative about substituting opaque types in the capture, since the underlying types may only be available in the local context. This means the SILConstantInfo type may not in fact be exactly what you get from `SILFunction::getFunctionTypeInContext` referencing the implementation function from its originating context, since those opaque types will be substituted in the local context. Fixes SR-13480 | rdar://problem/68159831.

view details

Jonas Devlieghere

commit sha 7a128470bd281b254525008131e5cf639ccedaeb

[test] Re-enable linux-fatal-backtrace.swift This was fixed by #33235 rdar://66389949

view details

Egor Zhdan

commit sha 30f7b9ecef834a6ca0fa1fb8f1ae37815569a126

WinSDK: extract Performance submodule Currently some of the headers get included into `WinSDK.WinSock2` via windows.h

view details

Brent Royal-Gordon

commit sha 0a94737ff1496e048bbda720f9d8b2184b7d4aa8

Emit -enable-experimental-concurrency into module interfaces …when the module is built with that flag. Fixes rdar://69322538.

view details

Pavel Yaskevich

commit sha 8c6098a3de956ca058d55a0d4875b29e3ce38498

[CSFix] Add a fix to detect when type of couldn't be inferred

view details

Kuba Mracek

commit sha a20118b54deebb2aa768294b19ef25de62339b23

When building modules on secondary threads via RunSafelyOnThread, request 8 MB of stack

view details

Andrew Trick

commit sha 28294725d4c468d41da49c48f0323d494f314a03

Change SIL ref_element_addr getFieldNo() to return a unique index. I don't have a test case for this bug based on the current code. But the fix is clearly needed to have a unique AccessStorage object for each property. The AccessPath commits will contain test cases for this functionality.

view details

Doug Gregor

commit sha 6fe5245899d6613e0d7e35a1ee539d8a84114678

Fix grammatical error in a new comment

view details

Robert Widmann

commit sha 76cd4bf16079909137ae6d8542f0ebe15f295cbf

[NFC] Differential Incremental External Dependencies in DependencyTracker Also perform the plumbing necessary to convince the rest of the compiler that they're just ordinary external dependencies. In particular, we will still emit these depenencies into .d files, and code completion will still index them.

view details

Robert Widmann

commit sha 1b01f213830ab7ce351c83c91721634ee41aa394

[Gardening] Add a spot of documentation about withReferenceDependencies

view details

Robert Widmann

commit sha 044f85ad9c48aac43affa6c91686292d9a3d4bde

Add ModuleDepGraphFactory This completes the missing piece from #34073 and means the frontend may now serialize moduledecl-based dependencies.

view details

Andrew Trick

commit sha 5ae231eaabc96939c0141c5388617df84018ca31

Rename getFieldNo() to getFieldIndex(). Do I really need to justify this?

view details

Slava Pestov

commit sha bbd79a2db2b88a6e086b897ddebb424356c913b4

ASTScope: unqualifiedLookup() entry point does not need the name If we're searching for a declaration with a given name, the name should be entirely encapsulated inside the DeclConsumer. Otherwise, there might not be a specific name at all, if we're performing code completion for example (once LookupVisibleDecls starts to use ASTScope, anyway).

view details

Slava Pestov

commit sha 49e371c563aa3afc2df811ad7af343cb1921a48f

ASTScope: Remove crossCheckWithAST()

view details

Slava Pestov

commit sha f8fb071f0fd0dd56f5d670696e453d0093d8ee9c

ASTScope: Remove ASTScopeImpl::getDeclContext()

view details

Robert Widmann

commit sha e646ef2cbe18e7a61056fe2f1a2176cc36259261

Add incrementalExternalDepend as an Incremental NodeKind

view details

Robert Widmann

commit sha 3ba33b93eb2e72e46e6ec6464a51e3d38d455660

Install Faux Cross-Module Incremental Infrastructure In Driver Treat any incremental external depends like normal external depends. This will eventually become the fallback behavior for cross-module incremental builds.

view details

Jonas Devlieghere

commit sha 5dc969f37b1eb590ef608378be3ddaabf3b9789d

Merge pull request #34054 from JDevlieghere/re-enable-linux-fatal-backtrace.swift [test] Re-enable linux-fatal-backtrace.swift

view details

Artem Chikin

commit sha d913fc609f191a01bc131f37858b00b87d94a328

[Build Script] Pass down a CMake path to swift-driver's build script

view details

Robert Widmann

commit sha 1b6baf63324c40c7d239e3f899d51e24f7031dc5

Merge pull request #34075 from CodaFi/crosstabs Differentiate Cross-Module Incremental Dependencies

view details

push time in 22 days

Pull request review commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

 Type TypeBase::openAnyExistentialType(OpenedArchetypeType *&opened) {   return opened; } -bool TypeBase::hasOpaqueArchetypePropertiesOrCases() {-  if (auto *structDecl = getStructOrBoundGenericStruct()) {+bool TypeBase::hasOpaqueArchetypePropertiesOrCasesImpl(+    llvm::SmallDenseSet<TypeBase *, 128> &visited) {+  if (!visited.insert(this).second)+    return false;++  if (auto *tupleTy = getAs<TupleType>()) {+    for (auto eltTy : tupleTy->getElementTypes()) {+      if (eltTy->hasOpaqueArchetype() ||+          eltTy->hasOpaqueArchetypePropertiesOrCasesImpl(visited))+        return true;+    }+  }+  else if (auto *structDecl = getStructOrBoundGenericStruct()) {     for (auto *field : structDecl->getStoredProperties()) {       auto fieldTy = field->getInterfaceType()->getCanonicalType();       if (fieldTy->hasOpaqueArchetype() ||-          fieldTy->hasOpaqueArchetypePropertiesOrCases())+          fieldTy->hasOpaqueArchetypePropertiesOrCasesImpl(visited))         return true;     }   }--  if (auto *enumDecl = getEnumOrBoundGenericEnum()) {+  else if (auto *enumDecl = getEnumOrBoundGenericEnum()) {     for (auto *elt : enumDecl->getAllElements()) {-      auto eltType = elt->getInterfaceType();-      if (eltType->hasOpaqueArchetype() ||-          eltType->getCanonicalType()->hasOpaqueArchetypePropertiesOrCases())+      auto eltType = elt->getArgumentInterfaceType();+      if (eltType &&+          (eltType->hasOpaqueArchetype() ||+           eltType->getCanonicalType()->hasOpaqueArchetypePropertiesOrCasesImpl(+               visited)))         return true;     }   }

Do you also need a case for tuples here?

Yes it is needed. I had added tuple types based on your feedback in the radar. It is already there.

This code is used in front of the type lowering cache. If a type can lower to different type lowerings (e.g loadable vs non-loadable) depending on the resilience expansion (or type context for opaque result types) we look for the right type lowering by type expansion context, if a type can't lower to different type lowerings (either because it is not resilient (recursively) or because it does not 'contain' opaque result types we map to one type lowering.

  auto *candidateLowering = find(key.getKeyForMinimalExpansion());              
  auto *lowering = getTypeLoweringForExpansion(                                 
      key, forExpansion, candidateLowering, origHadOpaqueTypeArchetype); 
const TypeLowering *TypeConverter::                                             
getTypeLoweringForExpansion(TypeKey key,                                        
                            TypeExpansionContext forExpansion,                  
                            const TypeLowering *lowering,                       
                            bool origHadOpaqueTypeArchetype) {                  
  if (lowering == nullptr)                                                      
    return nullptr;                                                             
                                                                                
  if (!lowering->isResilient() && !origHadOpaqueTypeArchetype) {                
    // Don't try to refine the lowering for other resilience expansions if      
    // we don't expect to get a different lowering anyway. Similar if the       
    // original type did not have opaque type archetypes.                       
    //                                                                          
    // See LowerType::handleResilience() for the gory details; we only          
    // set this flag if the type is resilient *and* inside our module.          
    return lowering;                                                            
  }                                                                             
                                                                                
  auto *exactLowering = find(key);                                              
  if (exactLowering)                                                            
    return exactLowering;   

For this purpose, it is okay for hasOpaqueArchetypePropertiesOrCases to eagerly answer yes. But it is not okay to answer no when there is an opaque result type that influence type lowering depending on whether we look through to the underlying type or not.

Yes, as you say for this purpose we can ignore indirect enum cases because the argument type of indirect cases will not influence the lowering since it is a reference.

@slavapestov's point is good. Just like resilience this can also be compute as a recursive type lowering property. (This way it will be more precise then my existing code, because we will handle the cases where the opaque result type is not 'stored'). I will do that instead.

aschwaighofer

comment created time in a month

PullRequestReviewEvent

pull request commentapple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

@swift-ci Please test

aschwaighofer

comment created time in a month

PR opened apple/swift

Fix TypeBase::hasOpaqueArchetypePropertiesOrCases for recursive types

Also fix the code handling enums to use getArgumentInterfaceType instead of getInterfaceType and handle tuples.

rdar://68798822

+40 -9

0 comment

3 changed files

pr created time in a month

create barnchaschwaighofer/swift

branch : fix_hasOpaqueArchetypePropertiesOrCases

created branch time in a month

push eventapple/swift

Arnold Schwaighofer

commit sha 383d47fd0061dcd01f4801eda5ba6b66148f4358

IRGen: Scalar type layouts need to profile the SIL type It might contain archetypes whose type metadata is required. rdar://68972976 SR-13555

view details

Arnold Schwaighofer

commit sha 361c47784749a6f1048a8ee80f4688cb3900b182

Merge pull request #34024 from aschwaighofer/irgen_type_layout_profile_sil_type IRGen: Scalar type layouts need to profile the SIL type

view details

push time in a month

PR merged apple/swift

IRGen: Scalar type layouts need to profile the SIL type

It might contain archetypes whose type metadata is required.

rdar://68972976 SR-13555

+27 -4

4 comments

3 changed files

aschwaighofer

pr closed time in a month

pull request commentapple/swift

IRGen: Scalar type layouts need to profile the SIL type

@swift-ci Please test

aschwaighofer

comment created time in a month

PullRequestEvent

PR closed apple/swift

IRGen: Scalar type layouts need to profile the SIL type

It might contain archetypes whose type metadata is required.

rdar://68972976 SR-13555

+27 -4

6 comments

3 changed files

aschwaighofer

pr closed time in a month

pull request commentapple/swift

IRGen: Scalar type layouts need to profile the SIL type

@swift-ci Please test

aschwaighofer

comment created time in a month

push eventaschwaighofer/swift

Holly Borla

commit sha 1f426773eed1bbed59dfdbbcc4288e92454b2b07

[Property Wrappers] Lower assign_by_wrapper to re-assignment of the backing property wrapper before all of self is initialized if the wrapper has already been initialized.

view details

vermont42

commit sha c311e451951b28afacebae69107cef28e4af9e44

Implements SR-11580

view details

3405691582

commit sha 2dd75857bba6b493c999c6041c192fe1a1edc896

Specify Float80 as supported on OpenBSD. This fixes unit test `stdlib/PrintFloat.swift.gyb` on OpenBSD.

view details

Slava Pestov

commit sha d7f4b1a1bd381d4179566e8b90e0eae5c0bdb9b7

AST: Capture list bindings now point back to their parent CaptureListExpr We'll need this to get the right 'selfDC' when name lookup finds a 'self' declaration in a capture list, eg class C { func bar() {} func foo() { _ = { [self] in bar() } } }

view details

Slava Pestov

commit sha 38883ce10041264913aecbd20e21ec22254602e5

ASTScope: Remove unused shouldCreateAccessorScope() method

view details

Slava Pestov

commit sha 9c4c95943d4f1202576f6348bf3e546e0f2261dd

AST: Generalize CaptureListEntry::isSimpleSelfCapture() to work without parse-time lookup The DeclRefExpr here was resolved by parse-time lookup. Without it, it's an UnresolvedDeclRefExpr.

view details

Slava Pestov

commit sha 9b851bf8cb0173ed0fc568ac7e30cbd5104d747d

ASTScope: Collapse PureFunctionBodyScope and MethodBodyScope This centralizes some invariants around the 'self' parameter. While all ConstructorDecls and DestructorDecls have a 'self', even if they're invalid because they're not nested inside a type, we don't want to consider this as the base 'self' for lookups. Eg, consider this invalid code: class C { func f() { init() { x } } } The base for the lookup should be f.self, not f.init.self.

view details

Slava Pestov

commit sha ed17c333e0f877d85d21fffcf6975e3cd755550a

ASTScope: Compute 'selfDC' directly in ASTScopeDeclConsumerForUnqualifiedLookup Instead of having ASTScope compute 'selfDC', the lookup consumer can compute it on its own, by looking for bindings named 'self'.

view details

Doug Gregor

commit sha ab4c58482e16d4ff8dc876564f57f376ed0b738f

[Concurrency] Centralize rejection of concurrency-only attributes. Reject concurrency-only attributes in the parser if the experimental concurrency mode is not enabled.

view details

Slava Pestov

commit sha 7cb809bf1dfcdc1f343782783d98189d99be95f2

ASTScope: Remove old implementation of 'selfDC' computation

view details

Slava Pestov

commit sha d4cc35a93837988c4d4ff3acb743967eb321d692

AST: Remove VarDecl::hasNonPatternBindingInit()

view details

Saleem Abdulrasool

commit sha f20a7f942f15dd09327e7b357b929ffeb08f3bed

Merge pull request #33988 from 3405691582/FixSwiftDtoa Specify Float80 as supported on OpenBSD.

view details

Michael Gottesman

commit sha fb88f2607e111038704669a4daa234db6654e293

[gardening] Add a test case for #33984 I had this originally before landing #33984, but it got merged while rebasing into the wrong patch by mistake. Upstreaming ti now as a result.

view details

Doug Gregor

commit sha f91767cfa06aa60076e1487ccd444daea8957c24

[Conformance checker] Capture potential matches for missing witnesses. Rework the data structures we use in the conformance checker to talk about missing witnesses, so they can capture the set of potential matches. This will allow us to delay more diagnostics to later, more uniformly.

view details

Doug Gregor

commit sha f956e4f7041d48529eee12a87cbfc9b187338099

[Conformance checker] Eliminate redundant recording of missing witnesses.

view details

Argyrios Kyrtzidis

commit sha 493d56748e6820d70c2ec91fa0b7dd49a9bf7759

Merge pull request #33948 from vermont42/literal-values Update GYB Files for SwiftSyntax Double and Int Convenience Properties

view details

Doug Gregor

commit sha 1c5be70255cccb17ef1dc75f7f79db02b3773628

Merge pull request #33995 from DougGregor/conformance-checker-missing-witnesses [Conformance checker] Capture potential matches for missing witnesses.

view details

Slava Pestov

commit sha 1e0a9ca6bd4d56ddf13d26b84a3b13ccda6a951b

Merge pull request #33989 from slavapestov/astscope-self-dc-cleanup ASTScope: Redo 'selfDC' computation

view details

Doug Gregor

commit sha 27624053906c49ac28e96071c6135ac14db654d5

[Concurrency] Introduce `@actorIndependent` attribute. Introduce a new attribute `@actorIndependent` that specifies that a given declaration is considered to be independent of any actor. Actor-independent declarations do not have access to actor-isolated state, even when they are declared as instance members of the actor. On the other hand, actor-independent declarations can be used to conform to (synchronous) requirements in protocols.

view details

Anthony Latsis

commit sha 8ee7b8fcafc008896a496dd0df9279ca3c4ff472

ASTContext: Tidy up the interface of getOpenedArchetypeSignature Drop a dead parameter, encapsulate input type canonicalization, and slightly improve the doc comment.

view details

push time in a month

pull request commentapple/swift

IRGen: Scalar type layouts need to profile the SIL type

@swift-ci Please test linux

aschwaighofer

comment created time in a month

pull request commentapple/swift

IRGen: Scalar type layouts need to profile the SIL type

@swift-ci Please test

aschwaighofer

comment created time in a month

more