Commit Graph

1537 Commits

Author SHA1 Message Date
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Nate Chandler
28cc144284 [IRGen] Add main() to __swift5_entry.
To enable lookup of the entry point, emit a pointer to that entry point
into a new section; on MachO, the __swift5_entry section of the __TEXT
segment.

rdar://problem/66402358
2020-08-03 15:40:16 -07:00
swift-ci
18516c1549 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 20:46:19 -07:00
swift_jenkins
e5f4c9ea97 Merge remote-tracking branch 'origin/master' into master-next 2020-07-30 19:07:53 -07:00
Brent Royal-Gordon
c4bbeb21a5 Mark main() as used
This prevents dead code stripping from removing the main() function used in widgets. This special case was added to support the integrated REPL, which was removed after Swift 5.3, and so it is no longer necessary.

Fixes rdar://65862827.
2020-07-29 17:39:51 -07:00
Nathan Hawes
898c20ee2b Manually merge remote-tracking branch 'upstream/master' into github-m-to-mn 2020-07-28 10:37:01 -07:00
Nathan Hawes
b0a2230860 Manually merge remote-tracking branch 'upstream/master' into merge-in-master 2020-07-27 09:25:01 -07:00
Meghana Gupta
b34791a0a0 Update code as per Apple Style Guide
whitelist -> allowlist
blacklist -> denylist
2020-07-24 11:37:15 -07:00
swift_jenkins
f7a1baff06 Merge remote-tracking branch 'origin/master' into master-next 2020-07-21 13:30:27 -07:00
swift-ci
4d29897ac3 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-21 08:05:28 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Nate Chandler
d4b82bacca [metadata prespecialization] Cross-module: enums and structs.
When a generic type from a different module is not resilient within the
current module and at least one of its arguments is from the current
module, emit a non-canonical prespecialized record, and access that
metadata via a call to swift_getCanonicalSpecializedMetadata, passing in
the non-canonical record.

rdar://problem/56996727
rdar://problem/56997022
2020-07-16 14:14:01 -07:00
Varun Gandhi
ee10198e9a Manually merge master into master-next.
Fixed merge conflicts in:
- lib/ClangImporter/ClangImporter.cpp
- lib/ClangImporter/ImportType.cpp
- lib/Frontend/CompilerInvocation.cpp
- lib/Serialization/ModuleFile.cpp
- lib/TBDGen/TBDGen.cpp
2020-07-15 21:36:13 -07:00
Hamish Knight
9b2bcd13f9 [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.

(cherry picked from commit 56929fdaaa)
2020-07-15 18:41:57 -07:00
Hamish Knight
4daeb4fa3a Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.

(cherry picked from commit c0a2ea7d0e)
2020-07-15 18:41:52 -07:00
Hamish Knight
56929fdaaa [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.
2020-07-15 17:48:51 -07:00
Hamish Knight
c0a2ea7d0e Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-15 17:46:14 -07:00
Hamish Knight
c354b0faa1 [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.
2020-07-13 20:42:54 -07:00
Hamish Knight
db7fea4665 Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-13 20:42:54 -07:00
Doug Gregor
f818a1e1b0 [Driver/IRGen] Put backward-deployment libraries into a table.
Describe the backward-deployment libraries via a preprocessor-driven
table. Macro-metaprogramming the two places in the code base---the
driver and IRGen---to use this tabble to determine which
backward-compatibility libraries to link against.
2020-07-07 23:11:37 -07:00
swift_jenkins
f496210e1a Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 14:59:55 -07:00
Hamish Knight
fa715820a9 [IRGen] Assert the SourceFile has been type-checked 2020-07-01 09:43:51 -07:00
David Zarzycki
b7664fa320 [IRGen] Adjust to upstream LLVM change
GlobalValue::getAlignment() was removed in a2caa3b61497b6be8c8b77823d0fd62b4be1f177.
2020-06-24 14:42:33 -04:00
swift_jenkins
debe1f27c8 Merge remote-tracking branch 'origin/master' into master-next 2020-06-15 11:19:44 -07:00
Keith Smiley
76ca05f7b1 reland: Emit coverage mappings for all modules
This reverts commit 499ed05fd9.

This changes the num-threads passed to 1 to avoid a multithreaded output
issue on windows
2020-06-14 13:13:47 -07:00
swift_jenkins
0bc30e312e Merge remote-tracking branch 'origin/master' into master-next 2020-06-11 07:39:16 -07:00
Arnold Schwaighofer
abfbbbeee5 Merge pull request #32213 from aschwaighofer/note_use_of_type_metadata_in_conditional_reqts
IRGen: Note use of types in conditional requirements of protocol conformances
2020-06-11 07:27:30 -07:00
swift_jenkins
136859e08f Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 20:19:05 -07:00
Saleem Abdulrasool
499ed05fd9 Revert "Emit coverage mappings for all modules" 2020-06-10 15:16:00 -07:00
swift_jenkins
e3bbcdc7df Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 12:39:02 -07:00
swift-ci
1fb06f1952 Merge pull request #32216 from keith/ks/coverage-modules 2020-06-10 12:34:28 -07:00
swift_jenkins
48530ac212 Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 10:39:00 -07:00
Arnold Schwaighofer
7997183dbc IRGen: Move emitProtocolConformance before emitLazyDefinitions
It is possible that the only mention of metadata happens as part of protocol conformannce emission.
This ordering makes sure we emit this metadata.

SR-12891
rdar://63819461
2020-06-09 12:44:19 -07:00
Arnold Schwaighofer
825a2a259b Mark non-foreign entry points of @objc dynamic methods in generic classes dynamically_replaceable
```
class Generic<T> {
  @objc dynamic func method() {}
}

extension Generic {
  @_dynamicReplacement(for:method())
  func replacement() {}
}
```

The standard mechanism of using Objective-C categories for dynamically
replacing @objc methods in generic classes does not work.

Instead we mark the native entry point as replaceable.

Because this affects all @objc methods in generic classes (whether there
is a replacement or not) by making the native entry point
`[dynamically_replaceable]` (regardless of optimization mode) we guard this by
the -enable-implicit-dynamic flag because we are late in the release cycle.

* Replace isNativeDynamic and isObjcDynamic by calls to shouldUse*Dispatch and
  shouldUse*Replacement
  This disambiguates between which dispatch method we should use at call
  sites and how these methods should  implement dynamic function
  replacement.

* Don't emit the method entry for @_dynamicReplacement(for:) of generic class
  methods
  There is not way to call this entry point since we can't generate an
  objective-c category for generic classes.

rdar://63679357
2020-06-09 09:23:29 -07:00
Karoy Lorentey
57ea964f2c Merge commit '3eb82c183662945687f48e11c09828f551b34858' into master-next
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:58:37 -07:00
Keith Smiley
8215ea105c Emit coverage mappings for all modules
Previously in WMO builds where IR was multithreaded only the
primary module would emit the coverage mapping leading to only the first
object file to have the __llvm_covmap section. This change emits
coverage for all modules so they are correctly reflected in the final
coverage report.
2020-06-08 16:35:35 -07:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
swift_jenkins
8b380c38b6 Merge remote-tracking branch 'origin/master' into master-next 2020-05-29 17:39:08 -07:00
Nate Chandler
bdef1cef23 [metadata prespecialization] Support for classes.
When generic metadata for a class is requested in the same module where
the class is defined, rather than a call to the generic metadata
accessor or to a variant of typeForMangledNode, a call to a new
accessor--a canonical specialized generic metadata accessor--is emitted.
The new function is defined schematically as follows:

    MetadataResponse `canonical specialized metadata accessor for C<K>`(MetadataRequest request) {
      (void)`canonical specialized metadata accessor for superclass(C<K>)`(::Complete)
      (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, 1)`(::Complete)
      ...
      (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, count)`(::Complete)
      auto *metadata = objc_opt_self(`canonical specialized metadata for C<K>`);
      return {metadata, MetadataState::Complete};
    }

where generic_argument_class(C<K>, N) denotes the Nth generic argument
which is both (1) itself a specialized generic type and is also (2) a
class.  These calls to the specialized metadata accessors for these
related types ensure that all generic class types are registered with
the Objective-C runtime.

To enable these new canonical specialized generic metadata accessors,
metadata for generic classes is prespecialized as needed. So are the
metaclasses and the corresponding rodata.

Previously, the lazy objc naming hook was registered during process
execution when the first generic class metadata was instantiated. Since
that instantiation may occur "before process launch" (i.e. if the
generic metadata is prespecialized), the lazy naming hook is now
installed at process launch.
2020-05-29 13:20:33 -07:00
Arnold Schwaighofer
2b2f7dcd2f Adjust to AllocaInst MaybeAlign -> Align api change 2020-05-20 07:45:43 -07:00
Anthony Latsis
55447e66aa Merge pull request #31645 from AnthonyLatsis/relocate-to-iterabledc
[NFC] AST: Relocate some conformance lookup client methods from DeclContext to IterableDeclContext
2020-05-18 22:25:08 +03:00
Arnold Schwaighofer
5d3f1739b9 IRGen: Only replace opaque result types of function result types when
performing a dynamic replacement

rdar://61936622
2020-05-15 12:12:55 -07:00
Anthony Latsis
bfe25fabeb [NFC] AST: Relocate getLocalConformances to IterableDeclContext 2020-05-08 17:43:09 +03:00
Slava Pestov
dd0ce1ad13 Remove the integrated REPL 2020-05-06 22:29:05 -04:00
Arnold Schwaighofer
d1bc9acea5 IRGen: Fix alignment of global variable buffer for non-fixed types
It needs to have the getFixedBufferAlignment because that is the value we use to determine whether the type
will be stored inline in the buffer or outline in an allocated buffer

rdar://62443743
2020-04-28 11:54:51 -07:00
Joe Groff
948372b87c Merge pull request #31087 from jckarter/compatibility-51
Start a Compatibility51 library for backporting fixes to Swift 5.1 runtimes
2020-04-17 15:06:50 -07:00
Joe Groff
42514f42e0 Start a Compatibility51 library for backporting fixes to Swift 5.1 runtimes 2020-04-17 10:41:48 -07:00
Robert Widmann
85fdc7a555 Merge pull request #31080 from CodaFi/why-I-R-ta
Give IRGenModule Ownership of its LLVMContext
2020-04-17 10:32:46 -07:00
Michael Forster
8d1d9f1eb5 Remove calls to deprecated IRBuilder APIs
These APIs have been removed in upstream LLVM, breaking master-next.
2020-04-17 09:32:03 +02:00
Robert Widmann
40d9cd8d3f [NFC] Give IRGenModule Exclusive Ownership of an LLVMContext Object 2020-04-16 11:57:44 -07:00