Commit Graph

25 Commits

Author SHA1 Message Date
Mike Ash
c8f1a538e9 [Runtime] Change ProtocolCache, NominalCache, and HashableConformances to ConcurrentReadableHashMap.
rdar://problem/70220804
2020-11-16 16:49:20 -05:00
Saleem Abdulrasool
61ddd09199 runtime: replace LLVM_ATTRIBUTE_ALWAYS_INLINE with SWIFT_INLINE (NFC)
This replaces the `LLVM_ATTRIBUTE_ALWAYS_INLINE` with `SWIFT_INLINE`
which is equivalent but namespaced to Swift instead.  This reduces the
unnecessary reliance on LLVMSupport.
2020-05-05 11:19:15 -07:00
Slava Pestov
4bc1d03283 Runtime: Use accessor method to get TargetWitnessTable::Description 2020-03-11 19:34:10 -04:00
Doug Gregor
c367c8e9cb [Runtime] Adjust "conforming type" based on a given conformance descriptor.
When we are looking for the specific type for a protocol conformance (e.g.,
because we may have a subclass of the type that declared conformances), don't
go back through swift_conformsToProtocol() multiple times, which
requires more lookups in the global conformance table. Instead, use
the (known) protocol conformance descriptor.
2018-11-13 20:45:03 -08:00
Mike Ash
e18e03171f [Stdlib] Change SWIFT_RUNTIME_STDLIB_INTERNAL to not export the symbol.
The functions in LibcShims are used externally, some directly and some through @inlineable functions. These are changed to SWIFT_RUNTIME_STDLIB_SPI to better match their actual usage. Their names are also changed to add "_swift" to the front to match our naming conventions.

Three functions from SwiftObject.mm are changed to SPI and get a _swift prefix.

A few other support functions are also changed to SPI. They already had a prefix and look like they were meant to be SPI anyway. It was just hard to notice any mixup when they were #defined to the same thing.

rdar://problem/35863717
2018-10-03 09:55:33 -04:00
Doug Gregor
5d2f55751a [Runtime] Substitute into associated types using the original conforming type
When producing an associated type witness from a mangled name, adjust the
conforming type metadata to find the original conforming type, which may
be a superclass of the conforming type given.
2018-09-26 23:19:34 -07:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Michael Gottesman
5648ef219d [+0-all-args] Clean up remains of +1 convention from the runtime. 2018-07-06 23:10:12 -07:00
Joe Groff
681a96b45c Runtime: Tolerate unknown metadata kinds.
We want to be able to potentially introduce new metadata kinds in future Swift compilers, so a runtime ought to be able to degrade gracefully in the face of metadata kinds it doesn't know about. Remove attempts to exhaustively switch over metadata kinds and instead treat unknown metadata kinds as opaque.
2018-05-17 15:35:06 -07:00
Arnold Schwaighofer
1ba367ada8 Fix _swift_makeAnyHashableUpcastingToHashableBaseType to use the witness table of the just unboxed typed of a SwiftValue
This got exposed due to the change to use witness tables as part of the
metadata cache key.

The  Swift._ConcreteHashableBox<MinimalHashableValue> metadata created as
part of:

 AnyHashable(MinimalHashableValue(1))

and

 AnyHashable(_bridgeAnythingToObjectiveC(MinimalHashableValue(1)) as!  NSObject)

Would not be uniqued to the same metadata because the witness table of
NSObject that we queried before that change was not equal to the witness
table of MinimalHashableValue.

This is tested by the AnyHashable.swift.gyb test case.

rdar://24958043
2018-05-14 13:54:15 -07:00
Michael Gottesman
0d4cbc4296 [+0-all-args] Fix const_cast issue.
This is hidden behind the +0 preprocessor flag, so it only affected me.

NFC.

rdar://34120147
2018-02-01 09:42:11 -08:00
Michael Gottesman
ce0c40e40b [+0-all] Update more runtime files for +0 normal arguments.
This is NFC when --enable-guaranteed-normal-arguments isn't passed into
build-script.

rdar://34222540
2018-01-29 12:13:45 -08:00
Greg Parker
1e894cd80b [runtime] Clean up symbols in error machinery. (#12853)
* [runtime] Clean up symbols in error machinery.

* [runtime] Clean up symbols in Foundation overlay.

* [runtime] Clean up symbols in collections and hashing.

* [runtime] Remove symbol controls from the Linux definition of swift_allocError.

* [tests] Add more stub functions for tests that link directly to the runtime.
2017-11-15 22:20:11 -08:00
Arnold Schwaighofer
ca63326e1b Delete unused existential value witnesses from the old existential
implementation

And remove the SWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS flag.
2017-06-02 14:34:41 -07:00
John McCall
2c40b39f26 Move runtime functions for casting into their own header. 2017-04-17 17:16:13 -04:00
Arnold Schwaighofer
d5cbb0bd62 Runtime changes for the copy-on-write existential implementation
Adds the runtime implementation for copy-on-write existentials. This support is
enabled if SWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS is defined. Focus is on
correctness -- not performance yet.

Don't use allocate/deallocate/projectBuffer witnesses for globals in cow
existential mode.

Use SWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS configuration to set the default for
SILOptions.

This includes an IRGen fix to use the right projection in
emitMetatypeOfOpaqueExistential if SWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS is set.

Use unknownRetain instead of native retain in dynamicCastToExistential.
2017-03-15 14:54:55 -07:00
Hugh Bellamy
05a50fd978 Remove extern "C" from uses of SWIFT_RUNTIME_STDLIB_INTERFACE 2017-01-22 18:32:17 +00:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
b19481f887 [gardening] Fix 67 recently introduced typos 2016-09-16 11:16:07 +02:00
John McCall
81b27c210b Permit ConcurrentMap to be templated over an allocator and move
MetadataCache's allocator into it.

The major functional change here is that MetadataCache will now use
the slab allocator for tree nodes, but I also switched the Hashable
conformances cache to use ConcurrentMap directly instead of a
Lazy<ConcurrentMap<>>.
2016-09-01 14:09:43 -07:00
Dmitri Gribenko
dfb4f56e55 runtime: rename _TMps8Hashable to HashableProtocolDescriptor 2016-08-31 09:53:39 -07:00
Dmitri Gribenko
783fafa36a runtime: rename SwiftValue to _SwiftValue (it is a private class) 2016-08-10 15:45:16 -07:00
Dmitri Gribenko
f1ec334fe5 stdlib: make AnyHashable(SwiftValue) unbox the value
Previously AnyHashable would consider SwiftValue to be a subclass of
NSObject (which it is in practice) and return false when trying to
compare an AnyHashable of a SwiftValue box to an AnyHashable of the
unboxed value.
2016-08-09 01:38:53 -07:00
Dmitri Gribenko
b162f60070 runtime: make _SwiftNativeNSError use the Hashable conformance, if available
If the Swift error wrapped in a _SwiftNativeNSError box conforms to
Hashable, the box now uses the Swift's conformance to Hashable.

Part of rdar://problem/27574348.
2016-08-09 00:49:20 -07:00