Commit Graph

338 Commits

Author SHA1 Message Date
Michael Ilseman
b572bfe2f4 [stubs] Add CFString*Bytes stubs, drop some dead ones.
NFC, just stubs and plumbing.
2018-03-13 15:32:20 -07:00
Karoy Lorentey
b0108336f7 Merge pull request #15207 from lorentey/seedless-hashes
[runtime] Add better control over the random hashing seed
2018-03-13 19:46:51 +00:00
Karoy Lorentey
879e4f9ce5 [runtime][stdlib] Better support for random hash seeds
- Hash seed randomization can now be disabled by defining the SWIFT_DETERMINISTIC_HASHING environment value with a value of "1".
- The random hash seed is now generated using arc4random, where available. On platforms where it isn't, don't construct std::random_device twice.
- _Hasher._secretKey is renamed _Hashing._seed, with no setter.
- _Hasher._isDeterministic is a new property exposing whether we're running with non-random hashes. (Set/Dictionary will need this information to decide if they're allowed to use per-instance seeding.)
2018-03-13 16:15:09 +00:00
Ben Cohen
f9b3e14137 [stdlib] Use Swift-native Character iteration for hasPrefix/Suffix (#14390)
* Use Swift-native Character iteration for hasPrefix/Suffix

* Remove old tests for removed C shims
2018-03-12 17:41:55 -07:00
Arnold Schwaighofer
e106161d8f Speculative fix for linux bot linker failure 2018-03-09 17:55:39 -08:00
Arnold Schwaighofer
b9602754cd Untangle the dependency on swiftStdlibStubs from swiftRuntime that I introduced
rdar://35525730
2018-03-07 11:17:19 -08:00
Nathan Lanza
d00223e687 change icu version check in UnicodeNormalization to 59 2018-02-26 14:38:16 -08:00
Joe Groff
be19535802 Merge pull request #14831 from jckarter/protected-runtime-visibility
Visibility fixes for ELF.
2018-02-26 13:26:14 -08:00
swift-ci
ac54feca49 Merge pull request #14734 from compnerd/icu-signature 2018-02-26 12:36:01 -08:00
Joe Groff
8656807b90 Visibility fixes for ELF.
- `_swiftEmpty{Array,Dictionary,Set}Storage` should be marked with `SWIFT_RUNTIME_STDLIB_INTERFACE` so that they can be linked from the standard library implementation.
- Runtime export symbols ought to have protected visibility.
2018-02-26 10:39:10 -08:00
Saleem Abdulrasool
73c04d1dd9 stubs: match ICU signature for unorm2_normalize (NFC)
Adjust the signature to match the ICU declaration for
`unorm2_normalize`.  This was adjusted to allow building against ICU
59.1.  The shim type definition for the UChar ensures that the signature
is correct on all the targets.  NFC.
2018-02-25 22:48:27 -08:00
Chris Lattner
ba7ed9afee Mark the runtime's reimplementation of
llvm::hashing::detail::fixed_seed_override as weak in case it is
staticly linked into an app that includes a real definition from
LLVM.
2018-02-22 14:57:09 -08:00
Lance Parker
0661de22a2 [stdlib]Un-revert string comparison (#14694)
Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
2018-02-18 10:50:33 -08:00
Saleem Abdulrasool
cd58f5c1c9 Shims: adjust the ICU interface
The default ICU build will change the underlying type of the UChar type,
with C++ using the builtin `char16_t` rather than `unsigned short`.
This adjusts the interface to account for that.  I've verified across
Apple's implementation that they always use the `unsigned short` as the
type for `UChar`.  Since we cannot guarantee that the ICU interfaces are
built the same way on all targets, especially when using the underlying
system's ICU.

Adjust the stubs implementation declaration to match the ICU header's
declaration.
2018-02-15 21:11:06 -08:00
Lance Parker
abe6a6d177 Revert string comparison (#14657) 2018-02-15 14:37:43 -08:00
Lance Parker
db2de58dd6 Remove unecessary unicode collation algorithm shims 2018-02-14 15:44:11 -08:00
Lance Parker
32d21c489f Add unicode normalization shims 2018-02-14 15:44:11 -08:00
Thomas Roughton
7422973c70 [stdlib] Fix bug in Windows FloatingPoint parsing
On `istringstream`, `tellg()` returns -1 if the stream is at the end of the file. This indicates success in this circumstance, so we should update `pos` to reflect that the whole string has been read.

NFC on platforms other than Windows, Cygwin, and Haiku.
2018-02-13 18:50:15 +13: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
Michael Gottesman
18bcc1e143 [+0-args] Change SWIFT_CC(Swift) functions to use SWIFT_NS_RELEASES_ARGUMENT instead of NS_RELEASES_ARGUMENT.
rdar://34222540
2018-01-23 16:01:27 -08:00
Thomas Roughton
b4391f35de Fix comment on #endif for defined(_Win32) 2017-12-04 11:39:22 +13: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
David Zarzycki
6a93b07cfb NFC: Use standardized locale header
On Linux, glibc removed xlocale.h, which was non-standard.
2017-11-25 13:09:06 -05: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
David Zarzycki
56a3aa97ac [Cross compile] Add missing standard include from C++ 2017-11-11 14:55:15 -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
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
Arnold Schwaighofer
b6eef4fc75 Merge pull request #12312 from aschwaighofer/fix_hashvalue_leak
runtime: Move String implementation stubs that want need the auto-rel…
2017-10-08 08:12:21 -07:00
Arnold Schwaighofer
f9c004945f Update comments 2017-10-07 09:15:55 -07:00
Saleem Abdulrasool
d7fc6a0359 stdlib: initialize va_list variables (NFC)
This silences `-Wuninitialized` warnings from clang when building the
swift stdlib for Windows ARM.  NFC.
2017-10-06 15:33:43 -07:00
Arnold Schwaighofer
f691657f3e Use an autorelease pool on i386 instead 2017-10-06 14:41:56 -07:00
Arnold Schwaighofer
362f91052a Not a doc comment 2017-10-06 14:11:38 -07:00
Arnold Schwaighofer
16552c003c Fix linux build 2017-10-06 13:04:03 -07:00
Arnold Schwaighofer
513303fd63 Also fix and test uppercased and lowercased 2017-10-06 13:04:03 -07:00
Arnold Schwaighofer
ec5f40f12f runtime: Move String implementation stubs that want need the auto-released return value optimization to an ARC compiled file
String's hashValue function is implemented in terms of Foundation's hash
function in a runtime function on darwin platforms. For non-ASCII strings we
will call str.decomposedStringWithCanonicalMapping inside this runtime function
which will allocate a new NSString and return the result in the current
autorelease pool. We implemented this function in a file compiled without ARC.
This meant that we would leak said NSString into the current active autorelease
pool.
This patch moves the implementation to a file compiled with ARC. ARC will insert
objc_retainAutoreleasedReturnValue call and on platforms that require it an
marker for the hand-off of the autoreleased return value optimization.

SR-4889
rdar://32199117
2017-10-06 11:12:22 -07:00
Saleem Abdulrasool
62c9a3dd54 Merge pull request #12134 from compnerd/windows-icu
stubs: fix Windows link
2017-09-27 18:59:58 -07:00
Karoy Lorentey
cce185e257 Merge pull request #12129 from lorentey/retainCount
[stdlib] Implement -retainCount in _SwiftNativeNS*Base
2017-09-26 18:32:04 -07:00
Saleem Abdulrasool
05edabff5e stubs: fix Windows link
There is no icucore.lib in the official ICU distribution for Windows.
Remove the autolink directive for now.
2017-09-26 16:13:47 -07:00
Saleem Abdulrasool
13213efe6a stubs: fix architecture check for Windows
Fix a typo in the architecture check.  The missing `I` in the x86 check
prevented the x86 build from succeeding.
2017-09-26 16:11:34 -07:00
Karoy Lorentey
ed5b202c8f [stdlib] Implement -retainCount in _SwiftNativeNS*Base
Fixes rdar://problem/28002554.
2017-09-26 14:32:20 -07:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Saleem Abdulrasool
42c98e63d0 stubs: fix Windows x86 TLS callback CC violation
Windows x86 requires that the TLS destructor callback uses the "stdcall"
calling convention.  Provide a shim which will adjust the calling
convention and call back into the swift portion of the code code with
the expected calling convention.
2017-09-21 11:29:56 -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
de687ac245 Merge pull request #11960 from compnerd/stub-unicode-complexity
Stub unicode complexity
2017-09-18 13:53:50 -07:00
swift-ci
9fc2f8ad8a Merge pull request #11959 from compnerd/stub-unicode-spacing 2017-09-15 17:45:57 -07:00
Saleem Abdulrasool
e1f98943ba stubs: simplify the Unicode stubs
Force the autolinking on Windows and Darwin as both have mechanisms to
support this.  ELFish targets are unfortunately not supported yet as
there is no portable mechanism to do this.

Remove the unnecessary handling of specific targets.  Always perform the
cast as it adds no overhead and will always be correct (worst case is
that the type is cast to itself).  This simplifies the logic.

Move the forward declarations to avoid inclusion to the same location as
the inclusion.
2017-09-15 15:59:27 -07:00
Saleem Abdulrasool
21d407529f stdlib: clean up some whitespace issues
Clean up incorrect whitespace.  NFC.
2017-09-15 15:58:38 -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