Commit Graph

1549 Commits

Author SHA1 Message Date
Nate Chandler
a5a7c98be0 [metadata prespecialization] getGenericMetadata finds records.
Previously, the metadata accessor for which canonical prespecializations
had been formed included checks against the passed-in arguments to
determine whether the access matched a prespecialized record or not.

Now that the prespecialized records are attached to the nominal type
descriptor for the type, eliminate this hard-coded generated code and
instead let swift_getGenericMetadata do the work of looking through the
prespecializations.
2020-08-14 11:19:10 -07:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
nate-chandler
6dddf96faf Merge pull request #33442 from nate-chandler/generic-metadata-prespecialization-components/record-canonical-prespecializations
[metadata prespecialization] Add canonical prespecialization to end of type descriptors.
2020-08-14 09:59:26 -07:00
Nate Chandler
5114f22e5e [metadata prespecialization] Reemit dependent values.
The metadata accessor and type context descriptor for a nominal type
both depend on canonical metadata--the former because it returns those
metadata, the latter because it has them as trailing objects.

Here, the work is done to reemit those values when new canonical
prespecialized metadata are encountered.
2020-08-13 17:44:05 -07:00
swift-ci
1d9bad4039 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-13 17:23:10 -07:00
Saleem Abdulrasool
fc164ce098 IRGen: be less aggressive about applying COMDAT
COMDAT can only be applied to definitions, not declarations.  This
manifested in builds of llbuild with SwiftPM on Windows.  The nominal
type descriptor accessor declaration was marked as COMDAT.
2020-08-13 10:42:03 -07:00
Nate Chandler
665100d74f [IRGen] Teach defineAlias to replace useds.
Previously, it was possible to alias an old LinkEntity which was marked
used (i.e. in LLVMUsed) or compiler used (i.e. in LLVMCompilerUsed).
The result of defining such an alias was a failure downstream when
writing out the lists of globals.

Here, the old value is removed from the list before it is invalidated.
2020-08-12 19:18:23 -07:00
David Zarzycki
00f4700496 Handle expanded enums in upstream LLVM (ZOS and GOFF) 2020-08-12 09:05:38 -04:00
swift_jenkins
baf7116b7c Merge remote-tracking branch 'origin/master' into master-next 2020-08-08 18:07:37 -07:00
swift-ci
4dd4a42112 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-08 18:04:04 -07:00
John McCall
03d94b44a6 Add default IR attributes to helper functions and convert
several more places to use getOrCreateHelperFunction.

This means that several of these places are now emitting
shared functions rather than private ones, which I've
verified is okay.  There are some other places where
privacy is still unfortunately necessary.

I've also fixed the name of the store-extra-inhabitants
helper function to say "store" instead of "get", which
is longstanding (but harmless because it's private).

Fixes rdar://66707994.
2020-08-08 16:57:02 -04:00
Nathan Hawes
8435dc7d20 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 14:21:08 -07:00
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