Commit Graph

2588 Commits

Author SHA1 Message Date
swift-ci
83919806d2 Merge pull request #22525 from drodriguez/mark-executable-test 2019-02-13 14:50:13 -08:00
Daniel Rodríguez Troitiño
53d04d1365 [test] Mark dynamic_replacement_dlclose as an executable test. 2019-02-11 15:08:30 -08:00
Slava Pestov
b64db715a8 IRGen: Remove -enable-class-resilience staging flag 2019-02-08 14:22:00 -05:00
Michael Gottesman
21a4d5437e Merge pull request #22449 from gottesmm/pr-fb26d1bf402324ef5ab4eac767964caff06d3e39
[silgenpattern] Fix the box handling in the old silgenpattern enum co…
2019-02-07 14:01:00 -08:00
Michael Gottesman
d364bb359b [silgenpattern] Fix the box handling in the old silgenpattern enum code to not pass a load_borrow payload as BorrowAlways instead of TakeAlways.
Thanks to Luiz Fernando Silva for the test case!

SR-9871
rdar://problem/47852446
2019-02-07 12:35:28 -08:00
Daniel Rodríguez Troitiño
d08b46c47e [tests] Standarize the checks for Darwin, Glibc and MSVCRT.
Different tests used different os checks for importing Darwin, Glibc and
MSVCRT. This commit use the same pattern for importing those libraries,
in order to avoid the #else branches of the incorrect patterns to be
applied to the wrong platform. This was very normal for Android, which
normally should follow the Linux branches, but sometimes was trying to
import Darwin or not importing anything.

The standarized pattern imports Darwin for macOS, iOS, tvOS and watchOS.
It imports Glibc for Linux, FreeBSD, PS4, Android, Cygwin and Haiku; and
imports MSVCRT for Windows. If a new platform is introduced, the else
branch will report an error, so the new platform can be added to one of
the branches (or maybe add a new specific branch).

In some cases  the standard pattern was modified because some test required
it (importing extra modules, or extra type aliases), and in some other
cases some branches were removed because the test will not have used
them (but it is not exhaustive, so there might be some unnecessary
branches).

This should, at least, fix three tests for Android (the three
dynamic_replacement*.swift ones).
2019-02-06 10:51:55 -08:00
Mishal Shah
42633218c5 Update master to build with Xcode 10.2 beta 1 2019-01-31 14:48:29 -08:00
Arnold Schwaighofer
eb6b1a1478 Try to fix linux 2019-01-25 17:55:52 -08:00
Arnold Schwaighofer
8394fc525e DynamicReplacement: Don't fail when a library is closed and reloaded
rdar://47560273
2019-01-25 13:50:27 -08:00
Mike Ash
60f51bfedb [Tests] Disable a few tests that hit bugs on macOS 10.9.
rdar://problem/47053588
2019-01-23 18:15:51 -05:00
Arnold Schwaighofer
d05629782f Fix dynamic_replacement test on devices
We need the absolute path to the dylib
2019-01-22 13:53:04 -08:00
Saleem Abdulrasool
1d2290cdfa Merge pull request #21902 from compnerd/interpreter-tests
test: port most of the interpreter tests to Windows
2019-01-20 18:52:26 -08:00
sarveshtamba
c1612c73c3 Merge branch 'master' of https://github.com/apple/swift 2019-01-17 06:57:21 +00:00
sarveshtamba
7cb42b740c Changes for #SR-9413:Swift 5.0 test failures on PowerPC #21541 2019-01-16 11:05:02 +00:00
Saleem Abdulrasool
d2aad4121c test: port most of the interpreter tests to Windows
This ports most of the interpreter tests to Windows.  A few remaining
failures need to be diagnosed still.
2019-01-15 18:47:13 -08:00
Jordan Rose
80ef1f519f [test] Tweak new convenience init test for swift_test_mode=optimize
The optimizer was smart enough to stack-promote the test objects I was
using, which foiled my interposition on swift_allocObject. Change the
tests to "escape" each allocation by returning it.

rdar://problem/47266149
2019-01-14 16:16:38 -08:00
Jordan Rose
425c190086 Restore initializing entry points for @objc convenience initializers (#21815)
This undoes some of Joe's work in 8665342 to add a guarantee: if an
@objc convenience initializer only calls other @objc initializers that
eventually call a designated initializer, it won't result in an extra
allocation. While Objective-C /allows/ returning a different object
from an initializer than the allocation you were given, doing so
doesn't play well with some very hairy implementation details of
compiled nib files (or NSCoding archives with cyclic references in
general).

This guarantee only applies to
(1) calling `self.init`
(2) where the delegated-to initializer is @objc
because convenience initializers must do dynamic dispatch when they
delegate, and Swift only stores allocating entry points for
initializers in a class's vtable. To dynamically find an initializing
entry point, ObjC dispatch must be used instead.

(It's worth noting that this patch does NOT check that the calling
initializer is a convenience initializer when deciding whether to use
ObjC dispatch for `self.init`. If we ever add peer delegation to
designated initializers, which is totally a valid feature, that should
use static dispatch and therefore should not go through objc_msgSend.)

This change doesn't /always/ result in fewer allocations; if the
delegated-to initializer ends up returning a different object after
all, the original allocation was wasted. Objective-C has the same
problem (one of the reasons why factory methods exist for things like
NSNumber and NSArray).

We do still get most of the benefits of Joe's original change. In
particular, vtables only ever contain allocating initializer entry
points, never the initializing ones, and never /both/ (which was a
thing that could happen with 'required' before).

rdar://problem/46823518
2019-01-14 13:06:50 -08:00
swift-ci
749f319223 Merge pull request #21745 from gottesmm/pr-7badf1ef083f46a99dde5777619f7f410168e8a5 2019-01-09 16:12:38 -08:00
Michael Gottesman
a53e351d37 [silgenpattern] Fix a leak in tuple pattern emission.
Today SILGenPattern maintains the following invariants:

1. All values passed into a switch must be either TakeAlways or BorrowAlways and
   loadable input values will be loaded.

2. Loadable types passed to a subtree must be loaded.

3. TakeOnSuccess can only occur with address only types and only in subtrees.

4. A TakeOnSuccess value must go through "fake borrowing"
   (i.e. forward/unforwarding) to ensure that along failing cases, we properly
   re-enable the cleanup on the aggregate. This means that TakeOnSuccess can
   never be handled as a loadable value with ownership enabled and that any
   take_on_success value since the original cleanup on the parent value was
   disabled must be at +1.

5. We use BorrowAlways instead of TakeOnSuccess for objects to express the
   notion that the object is not owned by the sub-tree.

The bug in this tuple code occured at the a place in the code where we go from
an address only parent type to a loadable subtype via TakeOnSuccess. I was
trying to follow (5) and thus I converted the subvalue to use a {load_borrow,
BorrowAlways}. The problem with this is that I lost the cleanup from the tuple
subvalue since take_on_success is just simulating +0 and thus entails having a
cleanup for each of the underlying tuple values.

The fix here was to:

* Create a cleanup for the loadable subvalue leaving it in memory. This address
  version of the subvalue we use for the purposes of unforwarding. This avoids
  (4).
* load_borrow the subvalue and pass that off to the subtree. This ensures that
  we respect (2), (3), (4).
* Unforward in the failure case the in memory subvalue.

This gives us both characteristics as well as in the future the possibility of
enforcing via the ownership verifier that the borrow ends before the
destroy_addr.

I also sprinkled some assertions liberally to maintain invariants.

rdar://47034816
2019-01-09 15:14:15 -08:00
Pavel Yaskevich
fc22ba6b59 [TypeChecker] Don't verify override access control if it has been disabled by a flag 2019-01-08 18:13:04 -08:00
Pavel Yaskevich
ef9e46c4ed [TypeChecker] Respect access control flag while validating superclass relation
Otherwise it's impossible to declare a subclass in integrated REPL
2019-01-07 18:23:54 -08:00
Raj Barik
468dfa7ea4 Merge pull request #21195 from rajbarik/mike-pca-fix
Fix ProtocolConformanceAnalysis for extensions
2019-01-04 09:50:24 -08:00
Arnold Schwaighofer
a39b07d2d4 Fix test builtin_bridge_object.swift
The bottom 4 bits of the top byte are now reserved on arm64
2019-01-03 09:45:18 -08:00
sarveshtamba
56318f3e1f Changes for #SR-9413:Swift 5.0 test failures on PowerPC 2018-12-24 11:37:38 +00:00
Greg Parker
7200e109d7 [runtime] Add tests of pre-stable ABI objects with the stable ABI runtime (#21403)
* [test] Fix objc_old_swift when objc/objc-internal.h is not in the SDK.
2018-12-20 18:32:03 -08:00
Saleem Abdulrasool
e94abbca4b Merge pull request #21279 from compnerd/rpath
test: define and use `%target-rpath`
2018-12-17 12:37:30 -08:00
Raj Barik
07662a1321 Fix for extensions in ProtocolConformanceAnalysis 2018-12-17 10:39:40 -08:00
Saleem Abdulrasool
5f660ba7e7 Interpreter: mark some tests as REQUIRES: objc_interop
These tests require the ObjC Foundation framework currently (although it
should be possible have them use the swift corelibs Foundation project
to satisfy this requirement).  Marking the tests indicates that these
tests do not have the dependencies to run on Windows.
2018-12-14 20:41:47 -08:00
Saleem Abdulrasool
d77801abaf test: define and use %target-rpath
Create a new capturing substitution for adding a rpath to a target
library.  This is needed as Windows doesn't really support the concept
of a rpath.  This also makes it possible to remove the parameter from
the command line on windows.
2018-12-12 19:51:08 -08:00
Saleem Abdulrasool
ed1ec54958 test: make %target-library-name work in captures
Thanks to @jrose for the hint about the substitution ordering, the new
substitution now works even inside the capture group.  Replace the
remaining uses to the new macro.
2018-12-12 10:09:58 -08:00
Saleem Abdulrasool
8968fcad5f test: create and use target-library-name 2018-12-12 08:37:59 -08:00
Saleem Abdulrasool
b212229db1 test: add and use prefix substitutions for libraries
The naming convention is different on Windows than on Unix-like
environments.  In order to follow the convention we need to substitute
the prefix and the suffix.  Take the opportunity to rename the
`target-dylib-extension` to the CMake-like variable
`target-shared-library-suffix` and introduce
`target-shared-library-prefix`.  This helps linking the test suite
binaries on Windows.
2018-12-11 15:56:06 -08:00
Joe Groff
6413d80bc6 Merge pull request #21065 from jckarter/multi-payload-extra-inhabitant-bit-order
IRGen: Fix extra inhabitants of multi-payload enums with more spare bits than tag bits.
2018-12-06 15:40:58 -08:00
Joe Groff
bf593b420c IRGen: Fix extra inhabitants of multi-payload enums with more spare bits than tag bits.
Because layout minimizes the number of tag bits used, and favors high spare bits, the
spare bit representations end up overlapping the extra inhabitant representations, since we
just counted down from -1. If there are fewer tag bits than total spare bits, rotate the
extra inhabitant values so they correctly line up with the tag representations in this
situation. rdar://problem/46468090
2018-12-06 13:01:04 -08:00
Jordan Rose
b126768319 [test] Add missing "executable_test" requirements (#21050) 2018-12-05 20:08:55 -08:00
John McCall
8112f68b96 Merge pull request #20629 from rjmccall/error-self-conformance
Allow Error to conform to itself
2018-12-05 19:58:08 -05:00
Michael Gottesman
4c98f130a5 Add test case for leak fixed by my SILGenPattern work.
The problem here was that we were performing a copy_on_success and then not
destroying that copy. We now do destroy that copy on master. This test will make
sure that we do not regress.

rdar://43076139
2018-12-05 13:52:28 -08:00
Arnold Schwaighofer
972c2a1319 More feedback 2018-12-05 09:50:23 -08:00
Arnold Schwaighofer
ce6ffd6959 Address review feedback 2018-12-05 07:40:41 -08:00
Arnold Schwaighofer
11f9d19cec IRGen: gatherbits - extend the bits before we shift left
SR-9335
rdar://46264497
2018-12-04 15:44:59 -08:00
Azoy
a2dafc3d26 Remove _getBool 2018-12-01 18:51:25 -06:00
Karoy Lorentey
1ef6cf4813 Merge pull request #20866 from lorentey/deprecate-hashValue-1
[test] Modernize hashing throughout the test suite
2018-11-30 14:21:04 +00:00
Slava Pestov
ff09603f30 IRGen: @_fixed_layout classes still have resilient metadata 2018-11-29 23:20:02 -05:00
Greg Parker
70bbeaab78 [runtime] Register a hook for class name lookup from libobjc (#20650)
libobjc needs to look up classes by name. Some Swift classes, such as
instantiated generics and their subclasses, are created only on demand.
Now a by-name lookup from libobjc counts as a demand for those classes.

rdar://problem/27808571
2018-11-29 17:06:28 -08:00
Stephen Canon
fb8b9e143d SIMD into stdlib
Implements SE-0229.

Also updates simd module types in the Apple SDKs to use the new types, and updates a couple tests to work with the new types and protocols.
2018-11-29 17:09:01 -05:00
Karoy Lorentey
666a22feff [test] Modernize hashing throughout the test suite 2018-11-29 17:38:29 +00:00
Saleem Abdulrasool
ce40d72641 stdlib: implement _stdlib_pthread_join in terms of Windows threading
Implement `_stdlib_pthread_join` in terms of windows threading.
Additionally, rename it to `_stdlib_thread_join`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
6bf7b9e711 stdlib: implement _stdlib_create_pthread_block in terms of Windows threaing
Port the block based thread constructor to Windows threading model, and
rename it to `_stdlib_create_thread_block`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
940db1b0cf stdlib: remove pthread_attr_t from _stdlib_pthread_create_block
The attributes were not being used currently.  Since this is a private
interface, remove the parameter as it makes it easier to port to
Windows.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
0693bec1f1 sdlib: rename SwiftPrivatePthreadExtras to SwiftPrivateThreadExtras
This is in preparation to make the code here more target agnostic for
porting to the Windows threading primitives.  This is used pretty
extensively in the tests, so disabling tests would lose a chunk of
coverage.
2018-11-26 13:09:31 -08:00