Commit Graph

8969 Commits

Author SHA1 Message Date
Joe Groff
a59af9855e Merge pull request #12725 from jckarter/key-path-optional-chain-out-of-bounds
KeyPath: Fix out-of-bounds access when instantiating keypaths with optional chaining components.
2017-11-02 22:34:33 +01:00
Joe Groff
993d795152 KeyPath: Fix out-of-bounds access when instantiating keypaths with optional chaining components.
When we pre-scan the components of a key path pattern to determine its runtime type and instance size, we would short-circuit upon seeing an optional-chaining component, since that makes a key path definitely read-only, but the loop also accumulates the size of the instance we're supposed to allocate, so…bad stuff happened. Leave out the short-circuit, fixing SR-6096 | rdar://problem/34889333 .
2017-11-02 13:32:35 -07:00
Doug Gregor
77282a3e8a Merge pull request #12713 from DougGregor/remove-extensions-of-IUO
Remove extensions on ImplicitlyUnwrappedOptional from the stdlib.
2017-11-01 19:31:57 -07:00
Greg Parker
e00745ce1a [runtime] Fix lookup of NSObject : Hashable conformance. (#12656) 2017-11-01 18:44:58 -07:00
Mark Lacey
26f6a751c4 Remove extensions on ImplicitlyUnwrappedOptional from the stdlib.
Extensions on ImplicitlyUnwrappedOptional are not actually accessible
because we force the optional (and thus can only access things on the
type it is wrapping).

Remove these from the stdlib in order to pave the way toward fully
implementing SE-0054.
2017-11-01 16:33:53 -07:00
Arnold Schwaighofer
34aca684a5 Merge pull request #12697 from aschwaighofer/reapply_enum_witness
Reapply the enum value witness patch
2017-11-01 07:56:04 -07:00
Arnold Schwaighofer
a77911ea93 Fix tuple witness instantiation 2017-10-31 17:46:37 -07:00
Arnold Schwaighofer
7ecac24c7e Zero undefined bits 2017-10-31 17:29:29 -07:00
Arnold Schwaighofer
865d85bd1c Reapply the enum value witness patch
Revert "Revert "Merge pull request #12606 from aschwaighofer/single_payload_enum_witness""

This reverts commit c422f80307.
2017-10-31 17:28:15 -07:00
Slava Pestov
278425a62a stdlib: Remove unnecessary @_inlineable and @_versioned declarations 2017-10-31 13:37:38 -07:00
Arnold Schwaighofer
c422f80307 Revert "Merge pull request #12606 from aschwaighofer/single_payload_enum_witness"
This reverts commit 0b414e45c5, reversing
changes made to fb27e7d32a.

There are failures on the resilient bot and lldb test case fails.
2017-10-31 08:24:26 -07:00
Arnold Schwaighofer
0b414e45c5 Merge pull request #12606 from aschwaighofer/single_payload_enum_witness
Add value witnesses for single payload enums
2017-10-30 13:31:49 -07:00
Mark Lacey
dded8391fb Merge pull request #12651 from rudkx/remove-illegal-use-of-iuo
Rework an initialization to remove a use of an IUO that was banned by…
2017-10-30 11:28:21 -07:00
Slava Pestov
a4147fce78 Merge pull request #12664 from slavapestov/ns-fast-enumerator-madness
stdlib: Fix for NSFastEnumerator breakage in resilient builds
2017-10-28 00:19:26 -07:00
Doug Gregor
5947ae9c00 Merge pull request #12645 from DougGregor/conformance-near-miss
Warn on “near-misses” when defaults are used for protocol witnesses.
2017-10-27 23:01:59 -07:00
Slava Pestov
7f73623532 stdlib: Fix for NSFastEnumerator breakage in resilient builds 2017-10-27 18:55:05 -07:00
Arnold Schwaighofer
2c4fefd546 Merge pull request #12659 from aschwaighofer/irgen_fix_conv_runtime_funcs
IRGen: Use swiftcc for swift_unexpectedError and swift_errorInMain
2017-10-27 13:02:02 -07:00
Arnold Schwaighofer
e0646d4321 IRGen: Use swiftcc for swift_unexpectedError and swift_errorInMain
It is a runtime function defined in swift. This currently did not have
ABI implications because the ABI happened to be compatible but ...

SR-6235
rdar://problem/35222489
2017-10-27 10:56:44 -07:00
Slava Pestov
a07e991093 SILOptimizer: Fix string switch optimization with resilient stdlib
Progress on <rdar://problem/34794790>, but since the build started failing
some other things broke.
2017-10-26 23:58:50 -07:00
Doug Gregor
e423640527 Merge pull request #12638 from glessard/umrbp-tweak
[stdlib] use Collection.isEmpty rather than Collection.count
2017-10-26 21:13:40 -07:00
Anton
e39f82f969 [FreeBSD] Fix a crash of produced executable 2017-10-26 18:26:09 -07:00
Mark Lacey
cbca1f23f6 Rework an initialization to remove a use of an IUO that was banned by SE-0054. 2017-10-26 18:13:03 -07:00
Doug Gregor
10ae35d070 Minor tweak to the standard library to reduce near-miss false positives. 2017-10-26 17:05:04 -07:00
Guillaume Lessard
99e5570376 use Collection.isEmpty rather than Collection.count 2017-10-26 16:11:35 -06:00
Greg Parker
8445bc6e63 [runtime] Fix a typo in Visibility.h on Cygwin. 2017-10-25 19:42:19 -07:00
Jordan Rose
5f2eb82ebf [runtime] Use an unnamed bitfield to avoid -Wglobal-constructor (#12617)
(instead of an unused field that we'd rather not initialize)

constexpr can't be 100% enforced in a template, so instead it gets
silently dropped if the instantiated function doesn't fulfill all the
requirements of being constexpr. In this case, that was a constructor
not explicitly initializing all fields, even the one we marked
unavailable. This meant we were using a non-constexpr constructor to
instantiate a global, which semantically requires static
initialization.

(The actual initialization is still optimized away at the LLVM
level. But the Clang frontend doesn't know that.)

Note that the warning will still fire unless you update your Clang
build; I just today cherry-picked the change that handles unnamed
bitfields correctly.
2017-10-25 14:23:51 -07:00
Roman Levenstein
6d3fd90948 Merge pull request #12605 from swiftix/resilience-performance1
Address post-commit review comments on PR #11910
2017-10-25 01:27:26 -07:00
Arnold Schwaighofer
c53807714a Fix small_memcpy of three bytes 2017-10-24 15:57:20 -07:00
Roman Levenstein
68d7778add Address post-commit review comments on PR #11910
- 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
2017-10-24 15:49:37 -07:00
Arnold Schwaighofer
0d06bea602 Fix generic *EnumTagSinglePayload implementation 2017-10-24 13:45:27 -07:00
Greg Parker
58c9b45c78 [runtime] Clean up symbols in StdlibUnittest and the internal leak checker.
* Export fewer symbols.
* Prefix exported but not-public symbols with `_swift_`.
2017-10-24 13:13:43 -07:00
Greg Parker
ac6e0bd164 [runtime] Remove function pointer hooks from Error implementation. 2017-10-24 13:13:09 -07:00
Valentin Pertuisot
4b9d5d54db Improve lowercased comments documentation (#12579)
Differentiate better between a full string character lowercased and a first character only lowercased
2017-10-24 13:11:00 -05:00
Greg Parker
bba9d4c652 [runtime] Delete unused _swift_fmod*().
These were once used by some func %() implementations.
2017-10-24 02:22:01 -07:00
Greg Parker
0fa818ed6b [runtime] Make ivars in the runtime's ObjC classes private. 2017-10-23 18:30:28 -07:00
Greg Parker
24be7ec680 Merge pull request #12515 from gparker42/GrP-PR-B214D8DD-7BCA-4F55-BB7E-3A86D30CA9BD
[runtime] Don't use C++ thread_local on two old Apple simulators.
2017-10-23 14:17:22 -07:00
Arnold Schwaighofer
43b9d13a2e Add value witnesses for single payload enums
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
2017-10-23 13:31:46 -07:00
swift-ci
db4a4b436a Merge pull request #12576 from compnerd/stdlib-includes 2017-10-22 23:00:29 -07:00
Saleem Abdulrasool
f3680a2783 stdlib: re-add include paths for swift headers
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.
2017-10-22 21:01:28 -07:00
Roman Levenstein
c3bc08ec06 Remove any mention of sil-serialize-all related flags from CMake files and build-script-impl
These flags are not needed anymore.
2017-10-21 19:18:15 -07:00
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
f2e8e0a448 Merge pull request #12493 from swiftix/sil-serialization-before-optimizations5
Enable serialization of witness tables by default
2017-10-21 08:40:59 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
swift-ci
8e7475b52a Merge pull request #12508 from glessard/patch-1 2017-10-19 20:56:15 -07:00
Philippe Hausler
b78b438897 Ensure that hashing data with zero bytes avoids empty allocations and fix bridged empty data hashes from de-referencing null values (#12509) 2017-10-19 17:53:19 -07:00
Greg Parker
1a0e3e7c31 [runtime] Don't use C++ thread_local on two old Apple simulators.
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
2017-10-19 16:55:19 -07:00
Guillaume Lessard
515b455aa1 fix a typo 2017-10-19 04:22:36 -06:00
Greg Parker
72c65ffcaf Revert "[stdlib] Fix FloatingPoint.init(exactly:) (#11311)"
This reverts commit c9f4df84f6.
It is causing test failures on 32-bit iOS simulator and on Linux.
2017-10-18 01:17:08 -07:00
Nate Cook
c9f4df84f6 [stdlib] Fix FloatingPoint.init(exactly:) (#11311)
* [stdlib] Fix FloatingPoint.init(exactly:)

This initializer wasn't actually checking the exact conversion. Corrects
the tests as well.
2017-10-17 13:52:11 -05:00
Pavel Yaskevich
8f26fb88d4 [Mangling] Improve handling of the variadic function parameters
Currently when function types like `(_: Int...) -> Void` are mangled
their names are going to include enclosing sugar BoundGenericType(Array),
which is not necessary and doesn’t play well with `AnyFunctionType::Param`
which strips the sugar away.

Resolves: rdar://problem/34941557
2017-10-17 00:16:12 -07:00