- Use SWIFT_RUNTIME_EXPORT instead of SWIFT_RT_ENTRY_VISIBILITY for exposed functions
- Use `_swift_` prefixes on the names of exposed functions
- Make the global counters and per-object counters cache thread-safe by using locks
So far single payload enums were implemented in terms of runtime functions which
internally emitted several calls to value witnesses.
This commit adds value witnesses to get and store the enum tag side stepping the
need for witness calls as this information is statically available in many cases
/// int (*getEnumTagSinglePayload)(const T* enum, UINT_TYPE emptyCases)
/// Given an instance of valid single payload enum with a payload of this
/// witness table's type (e.g Optional<ThisType>) , get the tag of the enum.
/// void (*storeEnumTagSinglePayload)(T* enum, INT_TYPE whichCase,
/// UINT_TYPE emptyCases)
/// Given uninitialized memory for an instance of a single payload enum with a
/// payload of this witness table's type (e.g Optional<ThisType>), store the
/// tag.
A simple 'for element in array' loop in generic code operating on a
ContigousArray of Int is ~25% faster on arm64.
rdar://31408033
This adds the swift include path manually to the builds for the stubs
and the runtime. This has no impact for the build currently. However,
adding the additional include directory will enable a standalone build
for the stdlib.
32-bit iOS 9 simulator and 32-bit watchOS 2 simulator do not support
C++ thread_local, even though clang's has_feature(cxx_thread_local)
thinks they do.
rdar://35063043
This changes layout of the parameter metadata from single tuple record
(in case of materializable type) to N records each corresponding to
invididual function parameter, where functions with no parameters
`() -> Void` get 0 records allocated.
The NTD now references the metadata accessor function for the type, which is a better interface for most things one would want to do with type metadata from a nominal type. The only remaining use in the runtime self really has no requirement to do so. For now, don't disturb the binary layout to prevent breaking downstream clients.
Alter the value metadata layout to use an absolute pointer for the
nominal type descriptor rather than a relative offset relative to the
complete type metadata. Although this is slightly less efficient in
terms of load times, this is more portable across different
environments. For example, PE/COFF does not provide a cross-section
relative offset relocation. Other platform ports are unable to provide
a 64-bit relative offset encoding.
Given that the value witness table reference in the value metadata is
currently an absolute pointer, this page is most likely going to be
dirtied by the loader.
We no longer need this for anything, so remove it from metadata
altogether. This simplifies logic for emitting type metadata and
makes type metadata smaller.
We still pass the parent metadata pointer to type constructors;
removing that is a separate change.
Wean the routine that builds a mangling tree from metadata from
looking at the parent metadata pointer, instead using the nested
depth to partition the arguments into a list of arguments for
each nesting depth.
Ensure that the proper DLL storage is annotated on the declaration.
This currently mismatched on Windows. On non-COFF targets, we would
just honour the visibility as specified on the definition.
On architectures where the calling convention uses the same argument register as
return register this allows the argument register to be live through the calls.
We use LLVM's 'returned' attribute on the parameter to facilitate this.
We used to perform this optimization via an optimization pass. This was ripped
out some time ago around commit 955e4ed652.
By using LLVM's 'returned' attribute on swift_*retain, we get the same
optimization from the LLVM backend.
This is a blanket pass replacing use of `__LP64__` with
`__POINTER_WIDTH__ == 64`. The latter is more expressive and also LLP64
clean. This change is needed to enable support for Windows x86_64 which
is a LLP64 environment.
This is a smorgasbord of warning cleanups in the runtime. This just
adjusts the casts for the various types. There were a number of casts
which lost const qualifiers on the type.
Use the Windows API `UnDecorateSymbolName` rather than `__cxa_demangle`
to undecorate the C++ symbols. `__cxa_demangle` is only available in
the itanium ABI, not under MS ABI. This allows us to properly
undecorate symbols on Windows.
This function is only used when backtracing is enabled. Use a
preprocessor guard to avoid defining the function when not used. This
prevents a -Wunused-function warning. NFC.