Commit Graph

1500 Commits

Author SHA1 Message Date
Arnold Schwaighofer
2b6ba2830c Serialize decls with _specialize(exported:true, target: somefunc(_:), ...) in a list for fast lookup
rdar://71430641
2020-12-11 09:58:32 -08:00
Alexis Laferrière
182c769b83 [Serialization] Update include of RecordLayout.h for recent LLVM upstreaming 2020-12-08 17:16:16 -08:00
swift_jenkins
8b28c896dd Merge remote-tracking branch 'origin/main' into next 2020-11-30 18:06:27 -08:00
Richard Wei
de2dbe57ed [AutoDiff] Bump-pointer allocate pullback structs in loops. (#34886)
In derivatives of loops, no longer allocate boxes for indirect case payloads. Instead, use a custom pullback context in the runtime which contains a bump-pointer allocator.

When a function contains a differentiated loop, the closure context is a `Builtin.NativeObject`, which contains a `swift::AutoDiffLinearMapContext` and a tail-allocated top-level linear map struct (which represents the linear map struct that was previously directly partial-applied into the pullback). In branching trace enums, the payloads of previously indirect cases will be allocated by `swift::AutoDiffLinearMapContext::allocate` and stored as a `Builtin.RawPointer`.
2020-11-30 15:49:38 -08:00
swift_jenkins
f3be04a4e2 Merge remote-tracking branch 'origin/main' into next 2020-11-18 22:00:44 -08:00
Robert Widmann
b50dfef51c Merge pull request #34808 from CodaFi/read-eval-fingerprint-loop
Add 'Fingerprint' Currency Type... And Serialize It!
2020-11-18 21:35:37 -08:00
Robert Widmann
d2a98f3b0f Address Review Comments 2020-11-18 17:12:09 -08:00
Robert Widmann
27d29262b0 [NFC] Traffic in Fingerprints 2020-11-18 12:20:14 -08:00
swift_jenkins
19b6dc0c29 Merge remote-tracking branch 'origin/main' into next 2020-11-18 10:41:29 -08:00
Ben Barham
b07c06e839 [Serialization] Fix crashes when allowing compiler errors in modules 2020-11-18 12:35:21 +10:00
Robert Widmann
9f79fd5df1 Serialize Fingerprints in Swift Modules 2020-11-17 16:23:07 -08:00
swift_jenkins
9786acd193 Merge remote-tracking branch 'origin/main' into next 2020-11-10 14:39:06 -08:00
Ben Barham
241559dc88 [Serialization] Add an option to output modules regardless of errors
Adds a new frontend option
"-experimental-allow-module-with-compiler-errors". If any compilation
errors occur while generating the .swiftmodule, this mode will skip SIL
entirely and only serialize the (likey invalid) AST.

This existence of this option during generation is serialized into the
resulting .swiftmodule. Errors found in deserialization are only allowed
if it is set.

Primarily intended for IDE requests (eg. indexing and code completion)
to ensure robust cross-module results, despite possible errors.

Resolves rdar://69815975
2020-11-10 14:47:22 +10:00
swift_jenkins
d73adae0f2 Merge remote-tracking branch 'origin/main' into next 2020-10-29 18:01:19 -07:00
Alejandro Alonso
424802fb34 Revert SE-0283 (#34492)
Reverted despite build failures.
2020-10-29 17:32:06 -07:00
David Smith
0180aca9fc Merge branch 'main' into david/fix-merge-conflict 2020-10-27 13:05:20 -07:00
Varun Gandhi
d32a371df5 Merge pull request #34410 from varungandhi-apple/vg-revert-import-filtering-refactor
Revert "[NFC] Clarify semantics of getImportedModules."
2020-10-26 13:36:32 -07:00
Varun Gandhi
1f479896f4 Revert "[NFC] Clarify semantics of getImportedModules."
This reverts commit 4b5d885114.
2020-10-23 10:01:35 -07:00
Azoy
f21a306ae5 [AST] Introduce BuiltinProtocolConformance 2020-10-22 18:24:27 -04:00
Kavon Farvardin
34d22105b8 implemented parsing and typechecking for @actorIndependent(unsafe)
[broken] first impl of @actorIndependent in the type checker.

[broken] fixed mistake in my parsing code wrt invalid source range

[broken] found another spot where ActorIndependent needs custom handling

[broken] incomplete set of @actorIndependent(unsafe) tests

updates to ActorIndependentUnsafe

[fixed] add FIXME plus simple handling of IndependentUnsafe context

finished @actorIndependent(unsafe) regression tests

added wip serialization / deserialization test

focus test to just one actor class

round-trip serialize/deserialize test for @actorIndependent

serialize -> deserialize -> serialize -> compare to original

most of doug's comments

addressed robert's comments

fix printing bug; add module printing to regression test

[nfc] update comment for ActorIsolation::IndependentUnsafe
2020-10-19 15:20:24 -07:00
swift_jenkins
ac24c24279 Merge remote-tracking branch 'origin/main' into next 2020-10-13 08:06:23 -07:00
Arnold Schwaighofer
2a2cf91dcd 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
2020-10-12 09:19:29 -07:00
Arnold Schwaighofer
b994bf3191 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
2020-10-12 09:19:29 -07:00
swift_jenkins
ab605d0f44 Merge remote-tracking branch 'origin/main' into next 2020-10-11 12:57:42 -07:00
Brent Royal-Gordon
b440ab7331 [NFC] Move several types/functions to Import.h
To help consolidate our various types describing imports, this commit moves the following types and methods to Import.h:

* ImplicitImports
* ImplicitStdlibKind
* ImplicitImportInfo
* ModuleDecl::ImportedModule
* ModuleDecl::OrderImportedModules (as ImportedModule::Order)
* ModuleDecl::removeDuplicateImports() (as ImportedModule::removeDuplicates())
* SourceFile::ImportFlags
* SourceFile::ImportOptions
* SourceFile::ImportedModuleDesc

This commit is large and intentionally kept mechanical—nothing interesting to see here.
2020-10-09 18:57:07 -07:00
swift_jenkins
ea08a982fe Merge remote-tracking branch 'origin/main' into next 2020-10-06 23:10:40 -07:00
Robert Widmann
d695acfed1 Document 'standalone' Parameters 2020-10-06 11:50:00 -07:00
Robert Widmann
82e9935885 Correct the Serialization of Embedded Swift Dependencies
llvm-bcanalyzer does *not* like it when there are multiple block info metadata blocks in the same bitstream file. This patch will skip the emission of that and just jump straight to the metadata block when we're not reading a "standalone" incremental dependency file. While I'm here, also add the right block abbreviation info so we can get a decent dump from llvm-bcanalyzer
2020-10-05 18:40:43 -07:00
swift_jenkins
a3167223fa Merge remote-tracking branch 'origin/main' into next 2020-10-02 20:02:15 -07:00
Fero
b0b546873c Fix typo 2020-10-02 01:26:33 +02:00
swift_jenkins
b1fa15fe87 Merge remote-tracking branch 'origin/main' into next 2020-09-29 23:14:40 -07:00
Varun Gandhi
8e63a4b43f [Serialization] Gate Clang type (de)serialization behind UseClangFunctionTypes. 2020-09-28 14:29:26 -07:00
Robert Widmann
d2e7bdcfab Teach SwiftModules To Embed Incremental Information
Take advantage of the binary swiftdeps serialization utliities built during #32131. Add a new optional information block to swiftdeps files. For now, don't actually serialize swiftdeps information.

Frontends will use this information to determine whether to write incremental dependencies across modules into their swiftdeps files. We will then teach the driver to deserialize the data from this section and integrate it into its incremental decision making.
2020-09-24 20:07:01 -06:00
Varun Gandhi
734b8a2533 Merge pull request #33986 from varungandhi-apple/vg-import-filter-cleanup
[NFC] Clarify import filtering logic and naming.
2020-09-23 18:23:11 -07:00
Varun Gandhi
4b5d885114 [NFC] Clarify semantics of getImportedModules.
The lack of clarity manifested as unexpected behavior when using
getImportedModules to create the module import graph. The new behavior
makes SPI-ness and Shadowing-ness behave similarly in terms of
filtering. We also check if a filter is well-formed to avoid
accidental empty import lists.
2020-09-23 12:50:37 -07:00
Varun Gandhi
d3369f7711 [NFC] Rename ImportFilterKind cases to be clearer. 2020-09-23 12:50:20 -07:00
swift_jenkins
bd2d87de62 Merge remote-tracking branch 'origin/master' into master-next 2020-09-18 21:27:04 -07:00
Slava Pestov
d4cc35a938 AST: Remove VarDecl::hasNonPatternBindingInit() 2020-09-18 16:11:06 -04:00
swift_jenkins
3265b1e877 Merge remote-tracking branch 'origin/master' into master-next 2020-09-16 07:02:37 -07:00
Slava Pestov
8e83dd902f Sema: Don't compute isSimpleDidSet() from getStorageImplInfo() 2020-09-15 22:03:58 -04:00
swift_jenkins
b37089c76b Merge remote-tracking branch 'origin/master' into master-next 2020-09-10 22:30:58 -07:00
Brent Royal-Gordon
cff4ddf13a [NFC] Adopt new ImportPath types and terminology
# Conflicts:
#	lib/IDE/CodeCompletion.cpp
2020-09-10 19:07:49 -07:00
swift_jenkins
39a0bc2296 Merge remote-tracking branch 'origin/master' into master-next 2020-09-03 21:31:53 -07:00
Holly Borla
3332df6f89 Merge pull request #33777 from hborla/rename-storage-wrapper
[NFC][Property Wrappers] Rename "storage wrapper var" to "projection var/projected value"
2020-09-03 18:29:04 -07:00
Holly Borla
3fd882cadf [NFC] Rename "storage wrapper var" to "projection var" or "projected value"
in property wrapper-related code.
2020-09-02 18:07:40 -07:00
swift_jenkins
fb946baf59 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-28 11:08:22 -07:00
swift_jenkins
2aa51b1078 Merge remote-tracking branch 'origin/master' into master-next 2020-08-28 10:56:52 -07:00
Pavel Yaskevich
a6c3e6f543 Merge pull request #33658 from xedin/introduce-hole-type
[ConstraintSystem] Introduce a new type to represent a type hole
2020-08-28 10:40:15 -07:00
Pavel Yaskevich
78ea3de8e4 [AST] Introduce a new type to represent a type hole in constraint system
Instead of using `UnresolvedType` as a placeholder for a type hole,
let's switch over to a dedicated "rich" `HoleType` which is capable
of storing "originator" type - type variable or dependent member
type which couldn't be resolved.

This makes it easier for the solver to determine origins of
a hole which helps to diagnose certain problems better. It also
helps code completion to locate "expected type" of the context
even when it couldn't be completely resolved.
2020-08-26 16:55:39 -07:00
swift_jenkins
adf903d271 Merge remote-tracking branch 'origin/master' into master-next 2020-08-24 20:52:27 -07:00