Commit Graph

45 Commits

Author SHA1 Message Date
Joe Groff
1adf2aeb87 Update IRGen tests for opaque pointers 2023-06-23 06:57:37 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Dario Rexin
a8d4d57f11 [IRGen] Generate compressed representation of value witnesses (#63813)
rdar://105837040

* WIP: Store layout string in type metadata

* WIP: More cases working

* WIP: Layout strings almost working

* Add layout string pointer to struct metadata

* Fetch bytecode layout strings from metadata in runtime

* More efficient bytecode layout

* Add support for interpreted generics in layout strings

* Layout string instantiation, take and more

* Remove duplicate information from layout strings

* Include size of previous object in next objects offset to reduce number of increments at runtime

* Add support for existentials

* Build type layout strings with StructBuilder to support target sizes and metadata pointers

* Add support for resilient types

* Properly cache layout strings in compiler

* Generic resilient types working

* Non-generic resilient types working

* Instantiate resilient type in layout when possible

* Fix a few issues around alignment and signing

* Disable generics, fix static alignment

* Fix MultiPayloadEnum size when no extra tag is necessary

* Fixes after rebase

* Cleanup

* Fix most tests

* Fix objcImplementattion and non-Darwin builds

* Fix BytecodeLayouts on non-Darwin

* Fix Linux build

* Fix sizes in linux tests

* Sign layout string pointers

* Use nullptr instead of debug value
2023-02-24 15:40:28 -08:00
Arnold Schwaighofer
0d3af14d0c IRGen: Fix using weak linkage to avoid duplicate metadata by only applying this to PROTOCOL related data
rdar://86256970
2021-12-10 07:26:22 -08:00
Arnold Schwaighofer
7fd49f1697 IRGen: Default to weak hidden instead of internal linkage for objc metadata
This extends #39944 to apply to more objc metadata.

rdar://85037490
2021-12-10 07:26:00 -08:00
Arnold Schwaighofer
fab112fb1e Revert "Merge pull request #40342 from aschwaighofer/make_objc_metadata_weak_hidden"
This reverts commit 4323d2fa26, reversing
changes made to 451b902cd5.

This caused linking errors on the swift source compat suite in the
Sourcery project.

rdar://86256970
2021-12-09 08:01:27 -08:00
Arnold Schwaighofer
f8d009e05f IRGen: Default to weak hidden instead of internal linkage for objc metadata
This extends #39944 to apply to more objc metadata.

rdar://85037490
2021-12-02 12:56:50 -08:00
Joe Groff
ebb714d607 IRGen: ObjC method lists are not const.
Put them in __objc_data instead of __objc_const. rdar://problem/66630432
2020-08-06 12:29:15 -07:00
Joe Groff
445bde5127 IRGen: Give ObjC metadata symbols internal linkage.
This preserves the symbol names in (unstripped) binaries, so we can use them for link ordering and
memory usage analysis.
2020-07-29 13:49:25 -07:00
Mishal Shah
0c2617f47a [Apple Silicon] [IRGen] Fix test for arm64 macOS 2020-07-02 18:26:42 -07:00
Mishal Shah
efe5907e0b [Apple Silicon] [Test] Fix various IRGen tests for arm64 macOS 2020-07-02 17:56:54 -07:00
Mishal Shah
92ca9fc924 [Apple Silicon] Generalize tests for other macOS architectures
Most of the changes fall into a few categories:
* Replace explicit "x86_64" with %target-cpu in lit tests
* Cope with architecture differences in IR/asm/etc. macOS-specific tests
2020-07-02 16:27:46 -07:00
Arnold Schwaighofer
e0ce37e0da SILGen: Fix setting variables with property wrappers marked objc dynamic
rdar://54181647
2019-10-03 07:57:23 -07:00
Félix Cloutier
7fbb40b880 Change test for ObjC metadata of class properties regarding ivars 2018-12-20 00:51:45 -08:00
Slava Pestov
0ec5ac282a AST: Don't mangle weak/unowned as part of a property's type
LibraryEvolution.rst stipulates that adding or removing 'weak',
'unowned' and 'unowned(unsafe)' is a resilient change if the type
is resilient. This means we should not mangle these attributes as
part of the accessor declaration.
2018-11-27 18:04:25 -05:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Slava Pestov
9aeb252e28 Migrate IRGen tests to Swift 4 2018-06-24 22:33:17 -07:00
Slava Pestov
5d2752f7d2 Run tests with -swift-version 4 by default
Some test now fail, so add an explicit -swift-version 3.
2018-06-19 23:24:19 -07:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Alex Hoppen
1c7e289b96 [Mangling] Adjust subscript mangling to not include "subscript"
Change the mangling of accessors to have a variable or subscript node
as their only child node, while subscript nodes no longer contain a decl
name.
2017-09-10 19:44:07 +02:00
Erik Eckstein
c4a11f4c92 tests: remove the now unused option -new-mangling-for-tests 2017-03-22 11:28:43 -07:00
John McCall
d61d966451 Use ConstantInitBuilder in most kinds of metadata emission.
This is NFC in intent, but I had to restructure the code to emit more
of the lists "inline", which means I inevitably altered some IRGen
emission patterns in ways that are visible to tests:

- GenClass emits property/ivar/whatever descriptors in a somewhat
  different order.

- An ext method type list is now emitted as just an array, not a struct
  containing only that array.

- Protocol descriptors are no longer emitted as packed structs.

I was sorely tempted to stop using packed structs for all the metadata
emission, but didn't really want to update that many tests in one go.
2017-03-06 14:18:47 -05:00
Erik Eckstein
1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Jordan Rose
f0c3bc25ff [IRGen] Don't emit ObjC class property metadata on old targets. (#2350)
The ObjC runtime on OS X 10.10 and older and iOS 9 and older can't
handle them, so for these targets, emit nil for all class property
lists.

It's a little unfortunate that this is target-dependent, but there's
not much we can do about it.

rdar://problem/25605427
2016-05-02 13:10:02 -07:00
Jordan Rose
4dd3c10a42 [IRGen] Correctly emit metadata for ObjC class properties.
...which is important because Clang CodeGen was already claiming we were!

rdar://problem/25473573
2016-04-04 19:26:48 -07:00
Joe Groff
2368ce774b Remove self types from mangling by default.
And include some supplementary mangling changes:

- Give the first generic param (depth=0, index=0) a single character mangling. Even after removing the self type from method declaration types, 'Self' still shows up very frequently in protocol requirement signatures.
- Fix the mangling of generic parameter counts to elide the count when there's only one parameter at the starting depth of the mangling.

Together these carve another 154KB out of a debug standard library. There's some awkwardness in demangled strings that I'll clean up in subsequent commits; since decl types now only mangle the number of generic params at their own depth, it's context-dependent what depths those represent, which we get wrong now. Currying markers are also wrong, but since free function currying is going away, we can mangle the partial application thunks in different ways.

Swift SVN r32896
2015-10-26 22:05:20 +00:00
Doug Gregor
bd2a67d05e Fix Objective-C encodings for Swift-defined @objc classes and protocols.
We use Clang to produce Objective-C type encodings (e.g., for property
descriptors). In cases where we need to synthesize a Clang @interface
or @protocol to map a Swift type into a Clang type for this purpose,
attach an objc_runtime_name attribute to the synthesized Clang
declaration so that it gets the appropriate Objective-C runtime name
in the encoding, rather than simply falling back to the (unmangled)
Swift class or protocol name.

This requires a paired Clang commit, since Clang was ignoring the
objc_runtime_name attribute in its type encoding.

Swift SVN r29408
2015-06-16 23:24:23 +00:00
Dmitri Hrybenko
ea7b133046 Update tests for new LLVM IR syntax for the gep operator
Swift SVN r26132
2015-03-14 07:17:15 +00:00
Doug Gregor
8fcd016b9b Use the @objc name of a property for getters, setters, and Objective-C metadata
Fixes rdar://problem/19963219.

Swift SVN r25622
2015-02-27 22:36:53 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Chris Lattner
167b67eb07 Fix <rdar://problem/17127126> swift compiler segfaults trying to generate a setter for a lazy property in a subclass of NSObject
We were setting 'final' on the storage for a lazy property, then calling "synthesizeTrivialSetter" to
synthesize the setter for the lazy property accessors.  This helper noticed that the storage was
final, and propagated the bit to the setter of the lazy property itself, causing chaos downstream.

While we're here, mark the storage of a lazy property as 'private' for good behavior.  Perhaps this
will allow special code for lazy property storage to be removed from PrintAsObjC and elsewhere.




Swift SVN r20220
2014-07-20 06:13:12 +00:00
Mark Lacey
a0d33f7074 Fix another test with a hard-coded reference.
Swift SVN r20111
2014-07-17 19:34:28 +00:00
Chris Lattner
5b49d59c57 Remove the @ from @final and @lazy, the last major piece of
rdar://17168115.

Also, reinstate the ARM driver change and testcase that I removed
in my last patch.


Swift SVN r19790
2014-07-10 06:23:27 +00:00
Joe Groff
55c7b72e94 IRGen: Use property-style ObjC encoding for property metadata.
Finish up <rdar://problem/17373368> now that Clang has an API to properly encode the property type.

Swift SVN r19708
2014-07-08 22:31:59 +00:00
Joe Groff
cd5a624bbc IRGen: Emit more accurate property metadata.
Instead of hacking together inaccurate metadata only for object-typed properties, make an effort to produce accurate metadata for all types of properties, and accurately capture the "copy", "dynamic", and "weak" semantics of some properties. This is necessary for Core Data to accurately synthesize property accessors for non-object properties; currently it will generate bogus object accessors over properties with non-object type. <rdar://problem/17373368>

This isn't fully accurate, since Clang hides property type encoding behind a 'getObjCEncodingForPropertyDecl' that only accepts an ObjCPropertyDecl. With some refactoring, it should be possible to expose this.

Swift SVN r19567
2014-07-04 15:58:18 +00:00
Ted Kremenek
d075f06573 Require a minimum deployment target of iOS 7 or OSX 10.9
Implements <rdar://problem/17532113>

Swift SVN r19451
2014-07-02 06:23:38 +00:00
Doug Gregor
9210cd5ff4 Replace T[] array syntax with [T] in the test suite
Swift SVN r19192
2014-06-25 23:39:24 +00:00
John McCall
cc1d8b606f Look through reference storage types when generating
@encodings for property getter/setters.

rdar://16909436

Swift SVN r18399
2014-05-19 08:00:07 +00:00
Chris Lattner
c897ee2d76 Fix <rdar://problem/16952186> Crash with @lazy in @objc class
Swift SVN r18278
2014-05-17 22:05:47 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
be3f4ae1ec IRGen: Emit ObjC methods for properties.
Emit getter and setter ObjC methods and selectors for Swift properties declared in ObjC classes or extensions. If the type of the property is an ObjC class, also emit special-cased ObjC formal property metadata for the property as if it were declared @property (nonatomic, {readonly,strong}) in ObjC.

Swift SVN r4207
2013-02-26 22:57:45 +00:00