Commit Graph

53 Commits

Author SHA1 Message Date
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Tim Kientzle
713aafe68f Merge pull request #72354 from tbkka/tbkka-progress-for-bridge-object-test
Add some progress info to make failures here easier to understand
2024-08-01 13:08:20 -07:00
Tim Kientzle
fe82cde490 Use CHECK for general synchronization 2024-08-01 07:32:48 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Nate Chandler
548adb94df [Test] Fix uniqueness check lines for 64 bit.
rdar://125628293
2024-04-04 08:43:43 -07:00
Nate Chandler
b466ba4972 [Test] Disable a test on arm64_32.
At least while we're investigating.

rdar://125628293
2024-04-03 13:36:36 -07:00
Nate Chandler
9bc5ef1108 [Test] Update test and target to 5.6 aligned.
The test emits a different function based on deployment target.  And
that different function results in different behavior.  But some
platforms don't have old enough deployment targets to use the function
for older platforms.  So just target newer platforms.

rdar://124700033
2024-03-15 12:09:08 -07:00
Tim Kientzle
c63d181b25 Add some progress info to make failures here easier to understand 2024-03-15 10:55:40 -07:00
Nate Chandler
ddccaa7d9c [Frontend] Removed lexical-borrow-scope flag.
Adding `move_value [lexical]` and `begin_borrow [lexical]` should happen
all the time at this point.  Remove the ability to omit these
instructions and update the corresponding tests.
2024-02-05 17:34:10 -08:00
Karoy Lorentey
b82ce9c3be [stdlib] Adopt _pointerBitWidth conditional 2023-04-27 13:33:24 -07:00
Alsey Coleman Miller
62b7be4e9c [stdlib] Add RISCV64 support 2022-11-01 23:59:42 -07:00
Alsey Coleman Miller
0ab3eec987 Added PowerPC 32-bit support 2022-03-03 22:21:33 -05:00
Andrew Trick
4eb7351f4d Disable MandatoryCopyPropagation.
Mandatory copy propagation was primarily a stop-gap until lexcial
lifetimes were implemented. It supposedly made variables lifetimes
more consistent between -O and -Onone builds. Now that lexical
lifetimes are enabled, it is no longer needed for that purpose (and
will never satisfactorily meet that goal anyway).

Mandatory copy propagation may be enabled again later as a -Onone "
optimization. But that requires a more careful audit of the effect on
debug information.

For now, it should be disabled.
2022-02-18 17:29:04 -08:00
Nate Chandler
ea42e2f334 Enabling copy propagation enables lexical lifetimes.
The effect of passing -enable-copy-propagation is both to enable the
CopyPropagation pass to shorten object lifetimes and also to enable
lexical lifetimes to ensure that object lifetimes aren't shortened while
a variable is still in scope and used.

Add a new flag, -enable-lexical-borrow-scopes=true to override
-enable-copy-propagation's effect (setting it to ::ExperimentalLate) on
SILOptions::LexicalLifetimes that sets it to ::Early even in the face of
-enable-copy-propagation.  The old flag -disable-lexical-lifetimes is
renamed to -enable-lexical-borrow-scopes=false but continues to set that
option to ::Off even when -enable-copy-propagation is passed.
2021-12-08 19:13:21 -08:00
Michael Gottesman
785153045b [move-operator] Start having SILGen emit lexical lifetimes and teach the optimizer how to maintain lexical lifetimes until the lexical lifetime elimination.
I am doing this so that I can use lexical lifetimes to emit diagnostics such as
the move operator diagnostics.
2021-11-29 18:02:13 -08:00
Robert Widmann
0149ccd0ca Add arm64_32 support for Swift
Commit the platform definition and build script work necessary to
cross-compile for arm64_32.

arm64_32 is a variant of AARCH64 that supports an ILP32 architecture.
2021-04-20 14:59:04 -07:00
Andrew Trick
7205e46f41 Disable -O copy propagation (lifetime shortening) by default
Problem: We continue to uncover code that assumes either precise local
variable lifetimes (to the end of the lexical scope) or extended
temporary lifetimes (to the end of the statement). These bugs require
heroic debugging to find the root cause. Because they only show up in
Release builds, they often manifest just before the affected project
“ships” under an impending deadline.

We now have enough information from projects that have been tested
with copy propagation that we can both understand common patterns and
identify some specific APIs that may cause trouble. We know what API
annotations the compiler will need for helpful warnings and can begin
adding those annotations.

Disabling copy propagation now is only a temporary deferral, we will
still need to bring it back by default. However, by then we should
have:

- LLDB and runtime support for debugging deinitialized objects

- A variant of lifetime sortening that can run in Debug builds to
  catch problems before code ships

- Static compiler warnings for likely invalid lifetime assumptions

- Source annotations that allow those warnings to protect programmers
  against existing dangerous APIs

In the meantime...

Projects can experiment with the behavior and gradually migrate.

Copy propagation will automatically be enabled in -enable-ossa-modules
mode. It is important to work toward a single performance
target. Supporting full OSSA and improving ARC performance without
copy propagation would be prohibitively complicated.

rdar://76438920 (Temporarily disable -O copy propagation by default)
2021-04-09 00:12:09 -07:00
Andrew Trick
b1b2eff075 Disable mandatory-copy-propagation (-Onone only)
This feature degrades the debugging experience and causes a large
number of unit test failures.

These were both known issues, but our planned debugger improvements
won't be ready for a while. Until then, we'll leave the feature under
a compiler option, and developers can adopt it at there own speed for
now when they are ready to fix lifetime issues in their code.

rdar://76177280 (Disable mandatory-copy-propagation (-Onone only))
2021-04-02 22:33:50 -07:00
Andrew Trick
11a641ff03 Enable mandatory copy propagation SIL pass.
This shortens -Onone lifetimes.

To eliminate ARC traffic, the optimizer reorders object
destruction. This changes observable program behavior. If a custom
deinitializer produces side effects, code may observe those side
effects earlier after optimization. Similarly, code that dereferences
a weak reference may observe a 'nil' reference after optimization,
while the unoptimized code observed a valid object.

Developers have overwhelmingly requested that object lifetimes have
similar behavior in -Onone and -O builds in order to find and diagnose
program bugs involving weak references and other lifetime assumptions.

Enabling the copy propagation at -Onone is simply a matter of flipping
a switch. -Onone runtime and code size will improve. By design, copy
propagation, has no direct affect on compile time. It will indirectly
improve optimized compile times, but in debug builds, it simply isn't
a factor.

To support debugging, a "poison" flag was (in prior commits) added to
new destroy_value instructions generated by copy propagation.  When
OwnershipModelEliminator lowers destroy_value [poison] it will
generate new debug_value instructions with a “poison” flag.

These additional poison stores to the stack could increase both code
size and -Onone runtime.

rdar://75012368 (-Onone compiler support for early object deinitialization with sentinel dead references)
2021-03-12 19:34:39 -08:00
Andrew Trick
93a514c136 Enable the CopyPropagation pass.
For now simply run the pass before SemanticARCOpts. This will probably
be called as a utility from within SemanticARCOpts so it can be
iteratively applied after other ARC-related transformations.
2021-01-16 23:57:14 -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
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
Azoy
a2dafc3d26 Remove _getBool 2018-12-01 18:51:25 -06:00
Arnold Schwaighofer
6eca97add6 Codesign test/Interpreter 2018-08-10 06:58:40 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Rintaro Ishizaki
c6f4bcd01e [SE-0101] MemoryLayout: Migrate testsuite and benchmarks 2016-07-30 03:11:45 +09:00
Bryan Chan
85fde8b1fb Add support for Linux s390x. LLVM's Swift calling convention support is used to ensure correct operations of C++ code in the runtime. This patch also includes some (incomplete) changes to enum handling to make enums work in most common cases. 2016-05-24 20:03:28 -04:00
Chris Willmore
73d5077bae Add API notes for Foundation following internal Swift 3 naming audit. 2016-04-07 20:35:18 -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
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Anton Blanchard
b1827d8a8f Add powerpc64le Linux support
This patch adds powerpc64le Linux support. While the patch also adds
the matching powerpc64 bits, there are endian issues that need to be
sorted out.

The PowerPC LLVM changes for the swift ABI (eg returning three element
non-homogeneous aggregates) are still in the works, but a simple LLVM
fix to allow those aggregates results in swift passing all but 8
test cases.
2016-01-15 06:48:31 +00:00
Greg Parker
0386c7fe60 [test] Fix some watchOS test failures.
Swift SVN r29315
2015-06-05 05:47:16 +00:00
Arnold Schwaighofer
f7771859d8 Rename the optimize_test feature to executable_test and document that feature.
Swift SVN r29213
2015-06-01 23:44:13 +00:00
Arnold Schwaighofer
3643c614a3 Run tests in optimize test modes
This runs all files that have a target-build-swift or target-run-stdlib-swift
RUN line in optimize test mode.

Swift SVN r29206
2015-06-01 21:23:31 +00:00
Arnold Schwaighofer
1301212d4d Fix test for optimize mode
In optimized mode the old 'bo's lifetime ends at the assignment. C's destructor
is called and its print deallocated triggered.

Swift SVN r28682
2015-05-17 16:55:50 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Andrew Trick
75892559cf Update test cases for Builtin.isUnique.
Swift SVN r28269
2015-05-07 16:39:26 +00:00
Andrew Trick
8346eba525 Revert "Update test cases for Builtin.isUnique."
This reverts commit f835a115e283dd03001f397ae1538b3745ad779a.

ExistentialCollection tests failed in the release+asserts build.

Swift SVN r27939
2015-04-29 22:53:55 +00:00
Andrew Trick
041bf1c61d Update test cases for Builtin.isUnique.
Swift SVN r27931
2015-04-29 21:59:21 +00:00
Chris Willmore
98d17e318d Add support for AppleTV simulator tests.
You can run tests with e.g. 'ninja check-swift-appletvsimulator-x86_64'.

Swift SVN r27297
2015-04-14 23:53:03 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
877a34e388 stdlib: remove (almost) the assumption that Swift.Int is implemented
in terms of Builtin.Word

Swift SVN r24721
2015-01-25 13:11:37 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Joe Groff
805191954d Update tests for isUniquelyReferenced change.
Swift SVN r23552
2014-11-22 16:59:27 +00:00
Dave Abrahams
a76fbb0b56 Fix Interpreter/builtin_bridge_object.swift test
It hadn't been adjusted for the new scheme where un-tagged non-native
BridgeObjects have all the spare bits set.

Swift SVN r23508
2014-11-21 02:45:28 +00:00
Dave Abrahams
b297c1f51b Make better use of Builtin.BridgeObject bits
We used to reserve a specific spare bit to say "this is a native
object."  Now, we're going to say, "if *any* spare bit is set, this is a
native object."  At the cost of having no spare bits to work with in the
non-native case, this allows us to store a number in 1..<4 (actually
0..<4, at some cost in speed for the 0 case) along with any native
object on all platforms.

This half bit advantage is important on 32-bit platforms, we have only
spare 2 bits to work with.

Given that on the 64-bit platforms there are *no* spare bits in the case
where the object is a non-native tagged pointer, we have no guarantee of
being able to store extra information along with an arbitrary non-native
object.  Giving up the ability to store bits for *all* non-native
objects (even non-tagged ones) is therefore not much of a sacrifice.

Fixes <rdar://problem/18920415> More useful spare bits in Builtin.BridgeObject

Swift SVN r23345
2014-11-15 00:53:39 +00:00
Dave Abrahams
9fa1cc7a3a [stdlib] BridgeObject uniqueness checking
Also, more complete testing overall

Swift SVN r23268
2014-11-12 15:00:57 +00:00