Commit Graph

13406 Commits

Author SHA1 Message Date
Itai Ferber
6482c34077 Refine inlinability of _DataStorage 2019-01-09 14:18:33 -08:00
Jordan Rose
aea1ef8175 Move API notes out of the arch-specific subdirectories in lib/swift/ (#21690)
They're all the same anyway, and no longer even need to be compiled,
just copied in as text.

And drastically simplify how we "generate" them. Instead of attaching
their build jobs to the appropriate overlays, if present, "just" have
one job to copy them all and attach it to the Darwin overlay. That's
what we do for the overlay shim headers, and it's good enough.
(Eventually we want to get out of the business of shipping them
altogether.)

This does have the same flaw as the shim headers: if you /just/ change
API notes, the corresponding overlay does not get rebuilt. You have to
touch that too. But in practice that'll happen most of the time
anyway.

Part of rdar://problem/43545560
2019-01-09 14:06:21 -08:00
Itai Ferber
1d00e3c9b7 Migrate Data from hashValue to hash(into:) 2019-01-09 14:00:20 -08:00
Daniel Rodríguez Troitiño
7cfaf9fae2 [stdlib][SR-2239] Refactor AAPCS64 variable argument list support.
This refactoring uses large portions of the already existing code for
x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where
each implementation differ are the x86_64 header, and the order of the
general and vector registers.

The changes also addresses many of the request from the reviewers in
 #20862 which were not addressed originally, like the reuse of the
already existing code, and the generalizations for the code to be useful
for platforms different than Linux (Android, for example).
2019-01-09 13:45:04 -08:00
Saleem Abdulrasool
6c642859ce stdlib: better type for WinSDK constant
Alter the constant type for the FileOperationFlag type.  This allows the
type system check the paramter type better.
2019-01-08 22:40:26 -08:00
Saleem Abdulrasool
5282e92e47 Merge pull request #21707 from compnerd/placeholder-less
[build] remove special placeholder libraries
2019-01-08 16:23:32 -08:00
Lance Parker
15aaa1e777 [stdlib]String normalization functions (#21026)
* fast/foreignNormalize functions
2019-01-08 13:55:29 -08:00
Marc Rasi
0eff06e4f9 const evaluator: string values and init operations 2019-01-08 11:57:27 -08:00
Saleem Abdulrasool
6dac8dd092 build: cleanup swiftCore link definition
Colocate the target specific library specification.  Inline the single
site use of the place holder ICU_UC and ICU_I18N libraries rather than
trying to create special library processing code for that.
2019-01-08 08:31:35 -08:00
Saleem Abdulrasool
5482409fb7 build: clean up unused variable (NFC)
Remove the unused parameter from the build (NFC).
2019-01-08 08:31:35 -08:00
Pavol Vaskovic
66bc1661b2 Merge pull request #21658 from palimondo/within-one-stem
[stdlib] Use ContiguousArray internally in Sequence dropLast, prefix, suffix
2019-01-08 12:22:11 +01:00
Michael Munday
8d4608f8e4 [string] Improve some small string comments
Clarify the expected behavior of some small string helper functions.
2019-01-08 06:15:54 -05:00
swift-ci
75033ed05a Merge pull request #21699 from compnerd/constant 2019-01-07 21:44:15 -08:00
Saleem Abdulrasool
3bd86ab18b Windows: add FOF_NO_UI into the overlay
This constant is needed for SHFileOperation which is needed for
Foundation.  Unfortunately, it is a complex macro which will not be
imported by the ClangImporter.
2019-01-07 19:04:04 -08:00
Raj Barik
a10db0209d Merge pull request #21660 from rajbarik/raj-es-perf
Add @inline(__always) to stdlib function for performance parity
2019-01-07 10:22:42 -08:00
Michael Munday
9587582c86 [string] Fix string implementation for big endian platforms
This commit supersedes 2866b4a which was overwritten by 4ab45df.

Store small string code units in little-endian byte order. This way
the code units are in the same order on all machines and can be
safely treated as an array of bytes.
2019-01-07 09:01:43 -05:00
swift-ci
a6fb95dfe3 Merge pull request #21669 from compnerd/shell-paths 2019-01-06 21:18:21 -08:00
Saleem Abdulrasool
fe37d7752a Platform: extend WinSDK module
Update the module definitions to include ShellAPI and Path API Set.
These are used by Foundation for FileManager.
2019-01-06 20:26:56 -08:00
Saleem Abdulrasool
6827b68a75 SwiftPrivate: correct dependencies on Windows
Ensure that we explicitly state the dependency on WinSDK to avoid issues
in parallel builds.  Caught by the Windows nightlies.
2019-01-06 11:41:18 -08:00
Raj Barik
fc90a0009a Add @inline(__always) to stdlib function for performance parity 2019-01-05 17:39:59 -08:00
Pavol Vaskovic
c887116862 [stdlib] dropLast, prefix, suffix: ContiguousArray
Nano-optimization:
Following the template used in methods `map` and `_filter`, internally use ContiguousArray before converting to an Array on return.
2019-01-05 14:28:37 +01:00
Pavol Vaskovic
a1fb6f1278 [stdlib] Gardening: ringBuffer position index 2019-01-05 14:27:03 +01:00
Raj Barik
3faf741288 Merge pull request #21617 from rajbarik/raj-perf-stdlib
Add inline(always) to AnyCollection routines like _suffix, _prefix, _drop, ...
2019-01-04 08:39:57 -08:00
Johannes Weiss
3f4990dc3c Merge pull request #21611 from weissi/jw-make-urbp-contiguous
conform Unsafe(Mutable)RawBufferPointer conform to _HasContiguousBytes
2019-01-04 10:36:08 +00:00
Azoy
5532a16205 simplify _getCString 2019-01-03 22:00:58 -06:00
swift-ci
3fb401cd1d Merge pull request #21622 from compnerd/reporting-in 2019-01-03 19:37:59 -08:00
Saleem Abdulrasool
a3814052f2 winsdk: add the Heap API set 2019-01-03 17:43:01 -08:00
Kuba Mracek
b9b4c789f3 Fix a data race on _swiftEmptyArrayStorage reported by TSan. Array.append(contentsOf) used to write a 0 into _buffer.count causing a race. 2019-01-03 17:26:18 -08:00
Saleem Abdulrasool
bc58e5bc3f stdlib: disable abort reporting on Windows
Avoid the dialog when an assertion fails on Windows.  This is important to
ensure that the tests do not create a large number of prompts.
2019-01-03 16:56:42 -08:00
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00
Max Moiseev
decd65d543 Merge pull request #21356 from compnerd/harness
StdlibUnittest: port the test harness to Windows
2019-01-03 15:42:38 -08:00
Andrew Trick
0b5fa792e1 Force manual allocation (via Unsafe*Pointer) to use >= 16 alignment.
This fixes the Windows platform, where the aligned allocation path is
not malloc-compatible. It won't have any observable difference on
Darwin or Linux, aside from manually allocated memory on Linux now
being consistently 16-byte aligned (heap objects will still be 8-byte
aligned on Linux).

It is unfortunate that we can't guarantee Swift-allocated memory via
Unsafe*Pointer is malloc compatible on Windows. It would have been
nice for that to be a cross platform guarantee since it's normal to
allocate in C and deallocate in Swift or vice-versa. Now we have to
tell developers to always use _aligned_malloc/_aligned_free when
transitioning between Swift/C if they expect their code to work on
Windows.

Even though this fix isn't required today on Darwin/Linux, it makes
good sense to guarantee that the allocation/deallocation paths are
consistent.

This is done by specifying a constant that stdlib can use to round up
alignment, _swift_MinAllocationAlignment. The runtime asserts that
this constant is greater than MALLOC_ALIGN_MASK for all platforms.
This way, manually allocated buffers will always use the aligned
allocation path. If users specify an alignment less than m

round up so users don't need
to pass the same alignment to deallocate the buffer). This constant
does not need to be ABI.

Alternatives are:

1. Require users of Unsafe*Pointer to specify the same alignment
   during deallocation. This is obviously madness.

2. Introduce new runtime entry points:
   swift_alignedAlloc/swift_alignedDealloc, introduce corresponding
   new builtins, and have Unsafe*Pointer always call those. This would
   make the runtime API a little more obvious but would introduce
   complexity in other areas of the compiler and it doesn't have any
   other significant benefit. Less than 16-byte alignment of manually
   allocated buffers on Linux is a non-goal.
2019-01-03 12:35:51 -08:00
Raj Barik
4be5ab167e Add inline(always) to AnyCollection routines like _suffix, _prefix, _drop 2019-01-03 11:33:09 -08:00
Michael Ilseman
e6586ac209 Merge pull request #21465 from linux-on-ibm-z/s390x-unicode-scalar-fix
[stdlib] Fix Unicode.Scalar to String cast on big endian machines
2019-01-03 11:32:23 -07:00
Johannes Weiss
f87ffd2077 conform Unsafe(Mutable)RawBufferPointer conform to _HasContiguousBytes 2019-01-03 18:23:08 +00:00
Harlan Haskins
b29f1ee1a2 Merge pull request #21527 from nordicio/stdlib_warning_stringstorage
[stdlib] fixes warning: result of call to 'initialize(from:)' is unused
2019-01-03 10:03:49 -08:00
Valeriy Van
a4496d51d8 Fixes typo in var name in example snippet (#21553)
imagePaths is declared in line 320
2019-01-02 16:21:42 -06:00
Dennis Vennink
45429ffa24 Add Zip2Sequence.underestimatedCount (#21530) 2019-01-02 12:46:49 -05:00
Saleem Abdulrasool
b7e21da2d0 StdlibUnittest: add a VEH for TRAP on Windows
Add a vectored exception handler for illegal instructions on Windows.
This allows us to emulate `signal(SIGTRAP, ...)`.  This allows better
coverage of tests.
2019-01-02 09:38:18 -08:00
Saleem Abdulrasool
9421d0189c StdlibUnittest: prevent abort dialog on Windows
Adjust the abort behaviour on Windows.  The aborts would cause a large
number of dialogs to appear.  This reduces the load a bit and is crucial
for getting tests to run without manual intervention.
2019-01-02 09:37:34 -08:00
Saleem Abdulrasool
3027784bf7 StdlibUnittest: add a workraound for DOS lineendings
Windows uses DOS line endings which appear through the PIPE endpoints.
We currently split on line feeds only, leaving the carriage return in
place.  Without this, the messages on the communication pipe would not
be interpreted correctly.
2019-01-02 09:37:34 -08:00
Saleem Abdulrasool
335ea14beb stdlib: port StdlibUnittest to Windows 2019-01-02 09:37:34 -08:00
Saleem Abdulrasool
b7aca2bd06 Merge pull request #21462 from compnerd/build-host-target
build: differentiate better between host and target
2019-01-02 08:35:51 -08:00
Saleem Abdulrasool
c9e2e8c0d9 Merge pull request #21495 from compnerd/swift-private-io
stdlib: implement _FDStreams in terms of HANDLES
2019-01-02 08:32:07 -08:00
Saleem Abdulrasool
608b79ecc4 Merge pull request #21514 from compnerd/i-am-sensitive-okay
build: correct case for STREQUAL
2019-01-02 08:28:07 -08:00
Saleem Abdulrasool
fe5fca72d8 Merge pull request #21532 from compnerd/the-mathematics-of-compatibility
Platform: add legacy compatibility macros to MSVCRT
2019-01-02 08:22:10 -08:00
Saleem Abdulrasool
5af85942d8 Merge pull request #21534 from compnerd/tee-ell-ess
runtime: correct `_stdlib_thread_key_create`
2019-01-02 08:21:54 -08:00
Saleem Abdulrasool
8d08d5cd70 Merge pull request #21552 from compnerd/circular-logic
SwiftShims: break circular dependency in MSVCRT
2019-01-02 08:20:36 -08:00
Saleem Abdulrasool
59ce3b1461 Merge pull request #21555 from compnerd/everyone-gets-a-standard
stubs: add workaround for Windows c++ runtime behaviour
2019-01-02 08:20:19 -08:00
Saleem Abdulrasool
65da2148e1 Merge pull request #21561 from compnerd/canonical-path-separator
build: convert paths to CMake paths before use
2019-01-02 08:19:56 -08:00