Commit Graph

45 Commits

Author SHA1 Message Date
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Andrew Trick
d8a3b1eef5 Guard _ArrayBuffer with #if _runtime(_ObjC) 2019-04-16 10:14:22 -07:00
Andrew Trick
700f81613b Rewrite SwiftOnoneSupport and add missing required prespecialization symbols.
In the prior revision, this file combined two approaches:

- the old approach of doing some fun things with arrays and hoping
  that any important public and internal generic symbols will happen
  to be specialized

- the new approach of explicitly specializing a generic symbol by
  annotating a dummy "proxy" function with the actual generic mangled
  name, then calling that proxy with an argument of the type to be
  specialized.

Unfortunately, the symbols exposed by SwiftOnoneSupport have become
ABI. Therefore, the old approach can break over time because changes
to the compiler and standard library will affect which symbols happen
to be specialized. It can be extremely difficult to debug why those
symbols have gone missing.

The new approach will work to ensure ABI stability, but the
implementation was incomplete and the style of implementation would
not work in many cases. It was still relying on the old approach to
cover the generic symbols that weren't explicitly specialized. Also,
it wasn't clear to anyone reading the source what specializations of
those generic symbols are intended and required by the ABI.

This commit completely removes the old approach to prespecialization.

All generic symbols required by the ABI are now explicitly listed.

There are now several different proxy functions declared as methods
within the generic type that they represent. The parameter types of
each proxy function now match the parameter types of the generic
function. This guarantees that the compiler can correctly apply the
proxy function's subsitution map to the generic function's generic
signature. For example, it now handles subtitution of dependent types
(like Range<T>), substitutions that are not in the first parameter
position, and subsitition that occur in multiple parameters.

The proxy functions are now directly invoked with the concrete
argument type needed for specialization. There's no other incidental
code.

It is now possible to read this source and understand which standard
library functions need to be prespecialized on which types.
2019-04-15 20:51:35 -07:00
Andrew Trick
3571f583fc Add -disable-access-control to the SwiftOnoneSupport library build.
The purpose of this module is to prespecialize generic methods in the
stdlib. All symbols exposed by the ABI must be explicitly identified
to maintain ABI compatibility. Some of those ABI-exposed symbols
reference internal stdlib types.

Given that we want the prespecialized code to live in the separate
SwiftOnoneSupport library, and we want the module to explicitly list
all the symbols required for ABI stability, there's no way around
disabling access control when building it. In fact, that flag does
precisely what we want.

This should be harmless because
- no one imports SwiftOnoneSupport.swiftmodule
- these internal symbols were always being exposed in
SwiftOnoneSupport.dylib, so nothing changes there
2019-04-11 12:14:35 -07:00
Mike Ash
965953d7a0 Merge pull request #23451 from mikeash/magic-symbols-for-install-name
[Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
2019-03-27 08:10:30 -07:00
Erik Eckstein
00599eeb3c Check for completeness of the SwiftOnoneSupport library
When compiling SwiftOnoneSupport, issue errors for missing functions which are expected in the module.
This ensures ABI compatibility.

rdar://problem/48924409
2019-03-25 14:57:03 -07:00
Erik Eckstein
218cc9b187 Add some pre-specializations for internal stdlib functions in SwiftOnoneSupport
It's very unlikely that those functions are really referenced by Onone executables, but we want to be ABI compatible.
Also, there is no guarantee that this version of SwiftOnoneSupport will always trigger all symbol to be pre-specialized.
If the optimizer changes, we might need to add other explicit pre-specializations of internal stdlib symbols.

rdar://problem/48924409
2019-03-25 14:57:03 -07:00
Mike Ash
4fb99998ae [Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
Magic symbols of the form $ld$install_name$os9.0$@rpath/libswiftCore.dylib tell the linker to use that install name when targeting that OS version. Use these symbols to specify an @rpath install name for all back-deployment libraries when targeting watchOS 2.0-5.1, iOS 7.0-12.1, and macOS 10.9-10.14.

rdar://problem/45027809
2019-03-22 10:04:39 -04:00
Saleem Abdulrasool
59fb469ae9 SwiftOnoneSupport: create the import library always
This needs to be added to the release mode builds as well which stopped
generating exported interfaces.
2019-03-16 19:34:35 -07:00
Nathan Lanza
4627ee72cc Fix swiftSwiftOnoneSupport.lib not being generated on windows debugbuilds 2019-02-08 17:54:21 -08:00
Saleem Abdulrasool
0a1abdccfc build: attempt to repair Windows debug builds
The debug build of the standard library on Windows does not generate the
import library for SwiftOnoneSupport which prevents the build of debug
programs against the debug runtime.  Because the linker must find the
import library in order to satisfy the forced link that we emit for the
link against the SwiftOnoneSupport library, without this, the build is
not usable.  Furthermore, this requires a debug build of the runtime
since in the optimized build, the interfaces that this library provides
are not provided by swiftCore and this supplements the library to allow
building the debug program.
2019-02-04 15:13:46 -08:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Ben Cohen
412a045f71 [stdlib] JAFIA (#19074)
* Lazy/generic types needing specialization

* Move DictionaryLiteral typealias to compatibility shims file

* Static String is mainly transparent so needs no inlining

* UnboundedRange hack doesn't need inlining

* Unmanaged needs unsafe performance

* Onone enum namespace

* Output stream specialize-never and calls to lock/unlock don't need inlining

* no need for @_frozen on internal enum

* DropWhile needs lazy-performance
2018-09-19 19:41:06 -07:00
Huon Wilson
caa3dd4d29 [Frontend] Turn symbols-missing-from-TBD validation on by default in debug builds on Apple platforms.
TBD validation is effectively an expensive assertion, and is currently only
tuned for Apple platforms. However, we don't want it to regress more, and it
would be nice to start getting validation from people using master
snapshots. Together, this means that turning it on by default for the cases
mentioned above is an appropriate course of action.

At the very least, this has the benefit of running validation across the stdlib,
the overlays and the whole testsuite on each build, so people making changes to
the compiler that change symbols are hopefully alerted.

One limitation here is that this is only validating that the TBD is a superset
of the true set of symbols: it could include spurious symbols that aren't
actually in the binary. This case is less problematic for Swift than symbols
missing from the TBD file, and so we've focused energy on this. Once we've fixed
the extra-symbols problems and are confident in it, this validation can be
upgraded to validate that too.

Half of rdar://problem/40431434.
2018-06-28 10:34:45 +10:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Jordan Rose
9034ba617b Ban @_fixed_layout on enums in favor of @_frozen
In theory there could be a "fixed-layout" enum that's not exhaustive
but promises not to add any more cases with payloads, but we don't
need that distinction today.

(Note that @objc enums are still "fixed-layout" in the actual sense of
"having a compile-time known layout". There's just no special way to
spell that.)
2018-03-20 14:49:10 -07:00
Sho Ikeda
415ee8d703 [gardening] Change static internal to internal static for consistency
Before the changes:

- `git grep "internal static " | wc -l`: 161
- `git grep "static internal " | wc -l`: 10
2018-03-13 02:29:56 +09:00
Sho Ikeda
077aa52cc5 [gardening][SwiftOnoneSupport] Replace let _ with _ 2018-03-11 11:20:39 +09:00
Max Moiseev
e13ec74702 Merge branch 'master' into prespecialize-enum 2018-01-10 09:50:08 -08:00
Max Moiseev
5650f80937 [stdlib] Annotate types with @_fixed_layout
This will allows us to build the standard library in resilient mode by
default, hopefully, without performance regression.

<rdar://problem/36362648>
2018-01-09 14:46:30 -08:00
Max Moiseev
2093df6798 Use enum instead of an empty struct [NFC] 2018-01-09 13:15:33 -08:00
Erik Eckstein
76f281510f Remove @_semantics("optimize.sil.never")
The replacement is @_optimize(none)
2017-11-16 14:11:52 -08: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
Max Moiseev
ff105c5ab2 [benchmark] Eliminate usages of String.characters and CharacterView
To avoid compiler warnings.
<rdar://problem/34750654>
2017-10-04 15:50:34 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Roman Levenstein
658a9cc93f Do not use the inlining of generics for creation of pre-specializations
We want to produce as many of the required specializations as possible, instead of generically inlining their implementations.
2017-02-16 13:05:04 -08:00
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
Jordan Rose
1c60910198 Revert "Merge pull request #6092 from swiftix/wip-generics-inlining-flag-4"
This reverts commit 1b3d29a163, reversing
changes made to b32424953e.

We're seeing a handful of issues from turning on inlining of generics,
so I'm reverting to unblock the bots.
2017-02-13 10:52:17 -08:00
Roman Levenstein
a755f5e133 Disable inlining of generics when creating the set of pre-specializations for -Onone. 2017-02-10 16:44:48 -08:00
Roman Levenstein
506b2b1591 Merge pull request #6582 from djwbrown/djwbrown-OnoneSupport-reversed
[Onone][prespecialize] Added iteration through reversed() arrays.
2017-01-06 08:37:43 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Dylan Brown
0e024a694b [Onone][prespecialize] Added iteration through reversed() arrays.
In response to [SR-3334], which pointed out a large cost to iteration over
ReversedRandomAccessCollections at optimization level -Onone. By adding
iteration through a.reversed() in the _Prespecialize struct, we can get to
about the same performance as forward iteration.
2016-12-27 00:00:18 +02:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Michael Gottesman
06a70d3942 [cmake] Add cmake support for only applying tsan to the swift stdlib/runtime. 2016-08-03 17:53:57 -07:00
Dmitri Gribenko
8fc9cf9c1e SwiftOnoneSupport: remove unused type 2016-06-22 11:16:13 -07:00
Brian Gesiak
328de9e280 [SR-1738] add_swift_library takes SHARED/STATIC arg
As a first step to allowing the build script to build *only*
static library versions of the stdlib, change `add_swift_library`
such that callers must pass in `SHARED`, `STATIC`, or `OBJECT_LIBRARY`.

Ideally, only these flags would be used to determine whether to
build shared, static, or object libraries, but that is not currently
the case -- `add_swift_library` also checks whether the library
`IS_STDLIB` before performing certain additional actions. This will be
cleaned up in a future commit.
2016-06-16 13:15:58 -04:00
Trent Nadeau
6e327b4ddb Updated stdlib to use @discardableResult and _ = . 2016-05-11 22:53:37 -04:00
practicalswift
db452dcbe9 [gardening] "[ a, b ]" → "[a, b]" 2016-04-17 21:26:08 +02:00
Roman Levenstein
27bcabcde3 Improve handling of pre-specializations.
This commit does not result in any visible functionality changes yet.
This is a preparation for some changes on the swift-3-indexing branch.
2016-04-13 15:49:36 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Roman Levenstein
8dff92ad4d Move pre-specializations of popular types away from the standard library.
Pre-specializations were only used by Onone builds, but were kept inside the standard library dylyb anyways. This commit moves all the pre-specializations into a dedicated Swift module and a dynamic library, which are only used by Onone builds.

This reduces the code size of libswiftCore.dylib by 4%-5%.
2016-02-25 11:23:15 -08:00
Todd Fiala
8ff40a3a22 Revert "Move pre-specializations of popular types away from the standard library."
This reverts commit 4d4c2cdba9.
2016-02-22 21:18:32 -08:00
Roman Levenstein
4d4c2cdba9 Move pre-specializations of popular types away from the standard library.
Pre-specializations were only used by Onone builds, but were kept inside the standard library dylyb anyways. This commit moves all the pre-specializations into a dedicated Swift module and a dynamic library, which are only used by Onone builds.

This reduces the code size of libswiftCore.dylib by 5%.
2016-02-22 07:54:44 -08:00