Commit Graph

12522 Commits

Author SHA1 Message Date
Lance Parker
f9aa78761f Moar feedback 2018-11-16 10:21:33 -08:00
Lance Parker
12bf2978e3 Michael's feedback 2018-11-16 10:20:46 -08:00
Lance Parker
0009b21533 properly promote stack buffer to heap buffer when necessary 2018-11-16 10:19:48 -08:00
Doug Gregor
cc2ee165a1 [ABI] Use generic environment to handle mangled generic keypath types.
Always use mangled type names to represent type metadata in keypath patterns.
For generic types, use the generic environment to pull substituted types
from the instantiation arguments.

Finishes the type metadata part of rdar://problem/38038799.
2018-11-16 10:13:07 -08:00
Doug Gregor
cdd2928fec [Runtime] Generalize SubstGenericParametersFromMetadata slightly.
Only use the metadata and context information during initial setup, not
later on. NFC just yet.
2018-11-16 10:13:06 -08:00
Doug Gregor
f759296cc8 [Keypaths] Encode generic environment in the key-path pattern.
Extend the key-path pattern with a representation of the generic environment
of the key-path, which includes the generic parameters and generic
requirements of the environment.
2018-11-16 10:13:06 -08:00
Saleem Abdulrasool
6072d9f5df runtime: adjust LLVMSupport for Windows
Windows does not support weak linking.  Use an undocumented linker
feature to provide a default implementation for report_bad_alloc_error
in the case that we are not linking against LLVMSupport.
2018-11-16 08:42:10 -08:00
Mike Ash
68094fac75 Merge pull request #20608 from mikeash/fix-bundleForClass-nil
[Runtime] Accept Nil in the patched bundleForClass:.
2018-11-16 10:43:54 -05:00
John McCall
e169d32a4e Merge pull request #20624 from rjmccall/type-reference-to-protocols
Allow TypeReference to refer to protocol descriptors
2018-11-16 01:34:06 -05:00
Mark Lacey
d7cf830842 [ConstraintSystem] Add Array as a designated type for + and +=.
Also add overloads for these operators to an extension of Array.

This allows us to typecheck array concatenation quickly with
designated type support enabled and the remaining type checker hacks
disabled.
2018-11-15 21:42:33 -08:00
John McCall
ff6d031482 Allow TypeReference to refer to protocol descriptors.
We should also allow references via manglings just to cover the
general case if we need it, but this is useful on its own so that
we can emit a reference to any natively-declared Swift type.
2018-11-16 00:39:10 -05:00
Ben Cohen
f86fc100a5 Ditch the underscore 2018-11-15 20:55:10 -08:00
Ben Cohen
7df1587c27 Restore LazyCollection, but deprecated 2018-11-15 20:54:13 -08:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
swift-ci
f093925036 Merge pull request #20452 from Catfish-Man/stringtrampolines 2018-11-15 17:55:34 -08:00
swift-ci
126f9d7773 Merge pull request #20610 from DougGregor/abi-symbolic-accessor-ref-2-byte 2018-11-15 17:30:19 -08:00
swift-ci
f76d920709 Merge pull request #20612 from DougGregor/runtime-demangle-to-metadata-overriode 2018-11-15 17:16:29 -08:00
David Smith
8bb6b78e36 Use super trampolines to let us override several more NSString methods (-UTF8String, -cStringUsingEncoding:, and -getCString:maxLength:encoding:) for performance 2018-11-15 17:10:51 -08:00
Doug Gregor
986b8f3f9f [Runtime] Make swift_getTypeByMangled(Name|Node) overridable.
Rename the funnel points for demangling strings/nodes to metadata to
swift_getTypeByMangled(Name|Node) and make them overridable. This will let
us back-deploy mangling improvements and bug fixes.
2018-11-15 16:43:38 -08:00
Doug Gregor
723b56e64f [Standard library] Simplify _getTypeByMangledName.
Simplify the signature of the internal _getTypeByMangledName() used by the
standard library to what we actually (currently) use. Drop it as a
compatibility override, because it’s not a useful place to introduce
customization.
2018-11-15 16:10:11 -08:00
Doug Gregor
cd6d6be64d [Runtime] Consolidate runtime functions used for demangle-to-metadata.
Clean up the interfaces used to go from a mangled name or demangle tree to
metadata. Parameterize these interfaces for generic parameter substitutions
(already in use) and dependent conformance substitutions (speculative).
2018-11-15 15:57:44 -08:00
Doug Gregor
3eb171d814 [ABI] Ensure that symbolic references to accessor functions are 2-byte aligned
When we emit "false" symbolic references to accesors for conformances or
type metadata, ensure that we end up with two-byte-aligned symbolic
references. This addresses a problem with ARM+Thumb compilation where the
low bit wasn't getting set for Thumb code.

Fixes rdar://problem/46067353.
2018-11-15 14:51:55 -08:00
Mike Ash
bdb822a788 [Runtime] Accept Nil in the patched bundleForClass:.
The patched +[NSBundle bundleForClass:] crashes on Nil, while the original Foundation implementation returns the main bundle. Avoid the crash and pass Nil through to Foundation. This also ensures that Nil is passed through to class_getImageName rather than crashing.

SR-9188 rdar://problem/45849924
2018-11-15 17:19:12 -05:00
Michael Ilseman
f9e6df312a Implement SE-0221: Character Properties (#20520)
Provide convenience properties on Character.
2018-11-15 14:03:49 -08:00
Michael Ilseman
0a5177d778 Merge pull request #20605 from milseman/abi_publishing
Finish String and Unicode ABI audit
2018-11-15 14:03:28 -08:00
Karoy Lorentey
7df40769a4 Merge pull request #20509 from lorentey/not-quite-shadowy-enough
[stdlib] Unexport shadow protocols
2018-11-15 20:09:26 +00:00
swift-ci
d6a9f30882 Merge pull request #20601 from milseman/stringinable 2018-11-15 12:09:03 -08:00
Doug Gregor
9191ffe124 [Runtime] Eliminate more dead code for flat generic argument indices. 2018-11-15 11:25:02 -08:00
Doug Gregor
041ffe82d4 [Standard library] Eliminate some newly-introduced warnings. 2018-11-15 11:21:42 -08:00
Doug Gregor
201c13ab01 [Runtime] Remove code for handling “flat” generic argument indices.
We no longer encode “flat” indices in the metadata, and have no need for
this now-dead decoding code.
2018-11-15 11:12:41 -08:00
Doug Gregor
a53b2e285c [Standard library] Drop _typeByMangledName().
This underscored function was only intended for testing; drop it from the
ABI. We’re keeping _typeByName because it’s used by Foundation.
2018-11-15 11:06:52 -08:00
Michael Ilseman
63fe485758 [String] Audit and publish the rest of the ABI 2018-11-15 11:06:33 -08:00
Michael Ilseman
cd35876fa5 [Unicode] Publish Unicode ABI
De-genericize one axis of storage buffers to speed up compilation time
of stdlib and user code. Publish the rest as ABI, since we're out of
time to reevaluate the design.
2018-11-15 11:06:33 -08:00
Michael Ilseman
c749123297 [String] DCE and drop inlinable
Remove some more inlinable annotations and drop dead code.
2018-11-15 11:06:30 -08:00
swift-ci
9052579244 Merge pull request #20592 from DougGregor/runtime-get-assoc-typeconformance-override 2018-11-15 10:59:37 -08:00
Lance Parker
739169dc77 Merge pull request #20369 from lancep/ArrayCastInlinableAudit
[stdlib]Remove unneeded @inlinable attributes from the array casts
2018-11-15 10:59:48 -07:00
Michael Ilseman
034f76d10b [String] Remove some unneeded inlinable annotations 2018-11-15 09:43:34 -08:00
Karoy Lorentey
d707b0beeb [stdlib] Re-add dummy versions of _NSSetCore and _NSDictionaryCore on non-ObjC platforms 2018-11-15 09:54:25 +00:00
Karoy Lorentey
93a3ebe509 [stdlib] Make the rest of the shadow protocols internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
c4c4c17871 [stdlib] _BridgeStorage: Remove second type parameter (ObjCClass)
It used to be a shadow protocol existential, but now it’s invariably AnyObject.
I see no reason to keep supporting this unused abstraction.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
0463230e2f [stdlib] _SliceBuffer: Make the order of fields a bit more sensible
Also, move field declarations to the top of the struct.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
ee17e975ca [stdlib] Make protocol _NSArrayCore internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
c71abaaf51 [stdlib] Make protocol _NSNumber internal 2018-11-15 09:54:25 +00:00
Karoy Lorentey
4f8eeae64e [stdlib] Make _NSSetCore, _NSSet internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
096903732c [stdlib] Make _NSDictionaryCore, _NSDictionary internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Doug Gregor
dc73c67d10 [Runtime] Allow overrides or swift_getAssociated(Type|Conformance)Witness.
Split these two functions into a fast path (for the cached case) and a slow
path. Make the slow path overridable, so we can patch it in the future if
needed.
2018-11-14 21:10:42 -08:00
Maxim Moiseev
51bd2f1856 Fix abi_v7k.swift test
The test seems to rely on the fact that Double.init(_: Int) gets inlined
in -Onone.

Fixes: <rdar://problem/45306568>
2018-11-14 16:20:09 -08:00
Brent Royal-Gordon
e0a267064a Improve an explanatory comment in Dictionary (#20540)
It took me a little while to figure out why we were fatalError()ing in such a convoluted way in Dictionary.init(uniqueKeysWithValues:); the next person to look at this code won’t waste that time.
2018-11-14 14:47:03 -08:00
swift-ci
b02e48f168 Merge pull request #20566 from weissi/jw-uni-decoder-doc-fix 2018-11-14 14:44:27 -08:00
Lance Parker
d08f49d561 audit ArrayCasts @inlinable attributes 2018-11-14 13:22:51 -08:00