Commit Graph

213 Commits

Author SHA1 Message Date
Greg Parker
96c0ef6e48 [runtime] Clean up an unnecessary C++ template trampoline. (#13381) 2017-12-11 19:26:52 -08:00
troughton
a1518031ec Fix Windows errno() and _stdlib_open 2017-12-04 11:12:11 +13:00
Greg Parker
da14cd79a6 [runtime] Clean up symbol exports in libc functions. (#13202) 2017-12-01 17:49:11 -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
Greg Parker
9a38e609af [IRGen][runtime] Reduce object header to 8 bytes on 32-bit platforms. (#12790)
SR-4353, rdar://29765800
2017-11-08 02:50:11 -08: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
Michael Ilseman
87a84d836d [stubs] Prefer __swift_uintptr_t over uintptr_t. NFC 2017-10-05 19:49:41 -07:00
Michael Ilseman
3d04fb5eac [shims] Move bit masks to SwiftShims and include/swift/ABI.
Move bits mask from Metadata.h to SwiftShims's HeapObject.h. This
exposes the bit masks to the stdlib, so that the stdlib doesn't have
to have its own magic numbers per-platform. This also enhances
readability for BridgeObject, whose magic numbers are mostly derived
from Swift's ABI.
2017-10-05 16:31:43 -07:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Arnold Schwaighofer
bc68d51ad8 Use the preserve_most calling convention for the increment slow path
This improves x86-64 code generation to not having any stack operations on the fast path.
2017-09-19 07:16:37 -07:00
Saleem Abdulrasool
7ae7cc5b17 Merge pull request #11976 from compnerd/llp64
runtime: make LLP64 clean
2017-09-18 21:26:12 -07:00
Saleem Abdulrasool
b38ed2f8fc Merge pull request #11949 from compnerd/windows-tls
stdlib: generalise TLS to support Windows
2017-09-18 14:21:13 -07:00
Saleem Abdulrasool
635bb00d61 runtime: make LLP64 clean
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.
2017-09-17 18:41:10 -07:00
Philippe Hausler
c8bbce6ef1 Data slice mutation support (#11939)
* Mutations of slices of data should preserve relative indexing as well as cow semantics of slices

* Ensure hashes of ranges are uniform to the expected hash for Data

* Correct a few mistakes in the slice mutation tests

* Update sequence initializations to avoid directly calling mutableCopy which prevents slice offset mismatches

* Avoid invalid index slices in creating mirrors

* Restore the original Data description

* Resetting a slice region should expand the slice to the maximum of the region (not a out of bounds index of the backing buffer)

* Remove stray comment and use a stack buffer for sequence appending

* Return false when allocations fail in _resizeConditionalAllocationBuffer (not yet in use)

* Enumeration of regions of a slice should be limited to the slice range in the case of custom backing (e.g. dispatch_data_t)

* adjust assertion warnings for data indexes that are negative
2017-09-16 13:22:01 -07:00
Saleem Abdulrasool
ba8cbe137c stdlib: generalise TLS to support Windows
Rename the explicit `pthread` to `thread` to indicate that this is not
`pthread` specifically.  This allows us to implement the TLS support for
Windows using Fibers.
2017-09-15 10:56:50 -07:00
Greg Parker
c262440e70 [runtime] Fix some const cast warnings. 2017-08-31 18:22:17 -07:00
George Karpenkov
020801beb4 Update -sanitize=fuzzer option to take into account new libFuzzer location. (#11595) 2017-08-28 17:16:55 -07:00
Maxim Moiseev
f630c2fb39 Merge pull request #11488 from moiseev/available-focus
[overlay] Make the UIKit shim function properly available
2017-08-16 17:00:20 -07:00
Slava Pestov
1c76f2af0f Merge pull request #11362 from lorentey/isunique-with-sidetable
[runtime] Implement sidetable path for isUniquelyReferenced
2017-08-16 19:12:59 -04:00
Max Moiseev
f1b1720769 [overlay] Make the UIKit shim function properly available
<rdar://problem/33789760>
2017-08-16 14:29:59 -07:00
Doug Gregor
7d65bb4e39 [CMake] Correct creation of LLVM headers symlink.
In Xcode project builds where LLVM/Clang are built differentually than
Swift  (e.g., RelWithDebInfo LLVM/Clang + Debug Swift, a Very Useful
Combination), the LLVM headers symlink pointed to nowhere. Follow the
same logic used for the Clang headers to deal with this case.
2017-08-15 14:37:07 -07:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
2017-08-07 18:16:51 -07:00
Károly Lőrentey
3f9abaa1f8 [runtime] Implement sidetable path for isUniquelyReferenced
https://bugs.swift.org/browse/SR-5633
2017-08-05 20:26:28 +02:00
Arnold Schwaighofer
d8abd2fed9 runtime: Fix overflow of swift_unownedRetain reference counts
On 32bit platforms there are 7 bits reserved for the unowned retain count. This
makes overflow a likely scenario. Implement overflow into the side table.

rdar://33495003
2017-08-02 07:12:47 -07:00
Huon Wilson
f94f16b358 [Foundation] Functions declared in a header should be static.
These were accidentally left as `extern` rather than the correct `static` or
`static inline` (etc.).
2017-07-13 15:57:30 -07:00
Huon Wilson
e8f522920d [Dispatch] Functions declared in a header should be static.
These were accidentally non-static.
2017-07-13 15:23:16 -07:00
Maxim Moiseev
b5f28bfb35 Merge pull request #10430 from moiseev/focus-shim
[overlay] Implement UIFocusEnvironment.contains using a shim
2017-06-21 08:56:29 -07:00
Max Moiseev
52522f118c [overlay] Implement UIFocusEnvironment.contains using a shim
Addresses: <rdar://problem/32538412>
2017-06-20 17:14:24 -07:00
Joe Groff
752beac4f1 KeyPaths: Pointer-align pointer fields within key path patterns.
To get the full benefit of dyld3 on Darwin platforms, pointer relocations need to be pointer-aligned, which unfortunately requires growing some key path data structures a little bit. This does tidy up some code that had to hack around our lack of unaligned load/store operations on UnsafeRawPointer, at least. While we're here, we can also simplify the identification strategy for reabstracted stored properties; we only need the property index to identify, not the absolute offset. rdar://problem/32318829
2017-06-20 14:42:05 -07:00
Arnold Schwaighofer
62c1f215ce Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library (#10373)
* Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library

Should fix the linkage issue on linux
2017-06-19 10:59:05 -07:00
Arnold Schwaighofer
48e889b51b IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums

We map nil to the .None case of Optional. Instead use a singleton object.

SR-5148
rdar://32618580
2017-06-17 09:33:41 -07:00
Joe Groff
fe88bd5f3f KeyPaths: Correctly instantiate offsets for final stored properties in NSObject subclasses.
We need to use the ivar offset variables in this case, since the Swift field offset vector doesn't pick up the adjusted offsets from the ObjC runtime. Fixes SR-5036 | rdar://problem/32488871.
2017-06-16 14:42:32 -07:00
Mishal Shah
c5ff1f2cac Update master to build with Xcode 9 beta 1, OS X 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-06-14 16:20:35 -07:00
John McCall
eb6cebdfa2 Annotate a couple of +1-returning functions appropriately instead of
trying to compensate in the caller.

One of the callers was apparently not _cocoaStringSlice trying to compensate,
so this probably also fixes a leak.
2017-06-12 20:42:57 -04:00
Amr Aboelela
dace2686ab Removed && !defined(__ANDROID__) to fix https://bugs.swift.org/browse/SR-5059 (#10060) 2017-06-02 08:10:11 -07:00
michael-yuji
e97123f9f7 A patch to make swiftc build in FreeBSD (#9940) 2017-05-26 13:36:48 -07:00
Amr Aboelela
7ba2af6b9d Fix by using __ANDROID__ #if 2017-05-25 10:34:12 -07:00
practicalswift
7e6830763a [gardening] Fix recently introduced \t:s 2017-05-24 21:27:47 +02:00
Michael Ilseman
948ba4d4e3 Merge pull request #9684 from milseman/tls_ftw
[stdlib] Unicode 9 and Thread Local Storage (again)
2017-05-17 18:32:25 -07:00
Michael Ilseman
ebe391cf5d [stdlib stubs] Fix up Linux build to know about pthread types.
Adds in Linux platform support for our pthread TLS. Replace usage of
PTHREAD_KEYS_MAX with a sentinel value, as it's tricky to define
cross-platform and was only lightly used inside sanity checks.
2017-05-16 20:30:02 -07:00
Michael Ilseman
b9da4e478a [stdlib] Linux definition of pthread_key_t 2017-05-16 20:29:21 -07:00
Michael Ilseman
5eb5e34897 [stdlib] Shims for UBreakIterator and thread local storage.
Introduce shims for using UBreakIterators from ICU. Also introduce
shims for using thread local storage via pthreads.

We will be relying on ICU and UBreakIterators for grapheme
breaking. But, UBreakIterators are very expensive to create,
especially for the way we do grapheme breaking, which is relatively
stateless. Thus, we will stash one or more into thread local storage
and reset it as needed.

Note: Currently, pthread_key_t is hard coded for a single platform
(Darwin), but I have a static_assert alongside directions on how to
adapt it to any future platforms who differ in key type.
2017-05-16 20:28:31 -07:00
practicalswift
c13ffcdb85 [gardening] Use consistent header format 2017-05-16 23:23:23 +02:00
Philippe Hausler
caf5f68c94 [Foundation] Correct symbolic availability for CFURL component characer set accessors (#9626) 2017-05-16 09:35:56 -07:00
Joe Groff
9830f394c1 SILGen/IRGen/KeyPaths: Components for ObjC properties need to be identified by selector.
A property imported from Objective-C, or marked in Swift with the `dynamic` keyword, doesn't have a vtable slot, so can't be identified that way. Use the ObjC selector as the unique identifier to ascribe equality to such components. Fixes rdar://problem/31768669. (While we're here, throw some more execution tests and a changelog note in.)
2017-05-11 14:28:19 -07:00
Michael Ilseman
f0abff5539 Revert "Merge pull request #9265 from milseman/tls_ftw"
This reverts commit 26f7659efe, reversing
changes made to 7b927e55e8.
2017-05-11 10:39:58 -07:00
Michael Ilseman
26f7659efe Merge pull request #9265 from milseman/tls_ftw
[stdlib] Unicode 9 and Thread Local Storage
2017-05-10 20:29:49 -07:00
Michael Ilseman
75741a9dde [stdlib stubs] Fix up Linux build to know about pthread types.
Adds in Linux platform support for our pthread TLS. Replace usage of
PTHREAD_KEYS_MAX with a sentinel value, as it's tricky to define
cross-platform and was only lightly used inside sanity checks.
2017-05-10 15:23:12 -07:00
Michael Ilseman
de8cb9fc54 [stdlib] Linux definition of pthread_key_t 2017-05-10 15:21:09 -07:00