Commit Graph

146 Commits

Author SHA1 Message Date
Mike Ash
2d01be6ad8 [Test] Fix Runtime/protocol_conformance_collision.swift on 11.3+.
This test checks the OS version to decide how to operate but that check isn't right. Revert to a fake future version.

rdar://77389722
2021-05-04 15:28:12 -04:00
Mishal Shah
3116eed2e4 Update the branch to build with Xcode 12.5 (#37046) 2021-04-23 16:24:11 -07:00
Nate Chandler
6efadb051d [Test] Disabled several Runtime tests for back_deployment_runtime.
rdar://76567759
2021-04-13 15:42:33 -07:00
Arnold Schwaighofer
0e2f63a12c Disable some tests that will fail on back deployment library configurations
rdar://76567524
rdar://76567105
2021-04-13 07:48:03 -07:00
Doug Gregor
eb6e74a0a6 Handle demangling/remangling for concurrency-related builtin types.
Fixes rdar://75990281.
2021-04-08 23:49:37 -07:00
Richard Wei
fb66de6126 Unify mangling operators for async, @Sendable, @differentiable and @noDerivative.
Repurpose mangling operator `Y` as an umbrella operator that covers new attributes on function types. Free up operators `J`, `j`, and `k`.

```
async ::= 'Ya'                             // 'async' annotation on function types
sendable ::= 'Yb'                          // @Sendable on function types
throws ::= 'K'                             // 'throws' annotation on function types
differentiable ::= 'Yjf'                   // @differentiable(_forward) on function type
differentiable ::= 'Yjr'                   // @differentiable(reverse) on function type
differentiable ::= 'Yjd'                   // @differentiable on function type
differentiable ::= 'Yjl'                   // @differentiable(_linear) on function type
```

Resolves rdar://76299796.
2021-04-07 17:49:10 -07:00
Doug Gregor
52096a640e SE-0302: Rename ConcurrentValue/@concurrent to Sendable/@Sendable. 2021-03-18 23:48:21 -07:00
Doug Gregor
ba8819eb58 [Concurrent] Introduce concurrent function types.
Introduce `@concurrent` attribute on function types, including:
* Parsing as a type attribute
* (De-/re-/)mangling for concurrent function types
* Implicit conversion from @concurrent to non-@concurrent
- (De-)serialization for concurrent function types
- AST printing and dumping support
2021-01-27 14:22:32 -08:00
Mike Ash
47df40df1e [Test] Don't run protocol_conformance_collision.swift against older runtimes.
rdar://72856188
2021-01-06 13:21:46 -05:00
Mike Ash
043e709728 [Test] Mark protocol_conformance_collision.swift as requiring executable_test. (#35125) 2020-12-16 13:00:20 -05:00
Mike Ash
9ac3b0ee3b [Runtime] Add a disabled workaround for protocol conformance checking to check conformances in reverse order.
rdar://problem/72049977
2020-12-14 12:59:18 -05:00
John McCall
a8464dcaf1 Implicitly import _Concurrency under -enable-experimental-concurrency 2020-10-22 00:53:15 -04:00
Jonas Devlieghere
7a128470bd [test] Re-enable linux-fatal-backtrace.swift
This was fixed by #33235

rdar://66389949
2020-09-23 18:58:23 -07:00
Mishal Shah
a3cd8bc9e9 [Tests] Codesign the binary before executing the test 2020-08-07 00:26:07 -07:00
Rintaro Ishizaki
4e003dc8cc [Tests] Mark two test cases 'UNSUPPORTED: use_os_stdlib'
test/Runtime/demangleToMetadata.swift
test/stdlib/Casts.swift

rdar://problem/66394834
rdar://problem/66394791
2020-07-31 16:02:49 -07:00
Rintaro Ishizaki
f6b528e708 [Tests] Disable Runtime/linux-fatal-backtrace.swift
rdar://problem/66283479
2020-07-30 20:05:02 -07:00
tbkka
1e5591635c [Python3] Use correct Python version for LLDB-related tests (#33181)
* Use the correct Python executable to match LLDB

The linux-fatal-backtrace script needs to run with an LLDB
module loaded into Python.  This in turn requires that the
test be run with the exact same Python version as was used
by LLDB (not just the same Python module directory).  This
can get confused on systems with multiple versions of Python
installed.

This replaces `lldb-python-path` (the Python module directory path)
with `lldb-python` (which is the correct Python version run with
the LLDB path).  This should ensure that this test is always
run with the same Python version and module that LLDB used.

* Use consistent braces for the lldb-python substitution

* Use os.path utilities to dissect paths

* Allow `python3` as a path identifier

Previous code required a decimal point before it would
recognize a path component as a Python version identifier,
so it would accept `python2.7` but not `python3`.
2020-07-30 14:12:40 -07:00
Doug Gregor
06d322b211 [Concurrency] Rename -enable-experimental-async.
Use the more general name `-enable-experimental-concurrency` instead,
since async is one part of the model.
2020-07-28 09:38:54 -07:00
Doug Gregor
f6e9f352f0 [Concurrency] Add async to the Swift type system.
Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
2020-07-27 18:18:03 -07:00
Mishal Shah
92ca9fc924 [Apple Silicon] Generalize tests for other macOS architectures
Most of the changes fall into a few categories:
* Replace explicit "x86_64" with %target-cpu in lit tests
* Cope with architecture differences in IR/asm/etc. macOS-specific tests
2020-07-02 16:27:46 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Nate Chandler
03659813ca [Runtime] Scribble on metadata allocations.
Previously, when NDEBUG was not defined, the allocations made for value
metadata records were filled with 0xAA bytes.  Here, that behavior is
both expanded to all metadata records and enabled in release builds when
the environment variable SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE is set.
2020-06-16 12:46:43 -07:00
Mike Ash
306cb0d925 [Test] Exclude environment_variables.swift from testing against the OS stdlib.
rdar://problem/64301166
2020-06-12 13:00:41 -04:00
Saleem Abdulrasool
e9622edd51 test: mark test as executable_test
This should repair the android bots.
2020-06-08 18:33:37 -07:00
3405691582
a9007790b1 [stdlib][test] Fix message test expectation.
In #32137 direct environment variable parsing was introduced, the
availability of which is branched by a preprocessor symbol (`ENVIRON`)
if the environment is available directly on the platform, or if getenv
must be used.

The message expectation in the unit test in the however diverged on the
non-`ENVIRON` branch, causing a unit test failure. This PR fixes the
expectation, but also, while we're here, OpenBSD supports the `ENVIRON`
branch anyway.
2020-06-05 00:12:17 -04:00
Mike Ash
f2fb53967c [Runtime] Unify debug variable parsing from the environment and avoid getenv when possible.
There are a few environment variables used to enable debugging options in the
runtime, and we'll likely add more over time. These are implemented with
scattered getenv() calls at the point of use. This is inefficient, as most/all
OSes have to do a linear scan of the environment for each call. It's also not
discoverable, since the only way to find these variables is to inspect the
source.

This commit places all of these variables in a central location.
stdlib/public/runtime/EnvironmentVariables.def defines all of the debug
variables including their name, type, default value, and a help string. On OSes
which make an `environ` array available, the entire array is scanned in a single
pass the first time any debug variable is requested. By quickly rejecting
variables that do not start with `SWIFT_`, we optimize for the common case where
no debug variables are set. We also have a fallback to repeated `getenv()` calls
when a full scan is not possible.

Setting `SWIFT_HELP=YES` will print out all available debug variables along with
a brief description of what they do.
2020-06-04 10:00:06 -04:00
Jonas Devlieghere
3bbc99ea47 Revert "tests: temporarily disable Runtime/linux-fatal-backtrace.swift"
This reverts commit aed0d91fc9.
2020-05-28 11:51:02 -07:00
Erik Eckstein
aed0d91fc9 tests: temporarily disable Runtime/linux-fatal-backtrace.swift
It's blocking linux PR testing

rdar://problem/63666780
2020-05-27 10:55:47 +02:00
John McCall
6200df1d88 Make the lazy assignment of an assoociated type/wtable atomic.
Should fix SR-12760.
2020-05-13 20:37:41 -04:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Nate Chandler
b052210716 [Runtime] Disable some tests on swift on os bots.
Delete a comment that precedes an UNSUPPORTED line.

rdar://problem/61814353
2020-04-15 09:30:56 -07:00
Dario Rexin
999b93bfdb Merge pull request #30815 from ktoso/wip-mangledTypeName
Improve usability of _mangledTypeName with Any.Type arguments
2020-04-06 20:49:13 -07:00
Nate Chandler
ab2d3e84ad Disabled tests failing from missing objc symbol.
Two tests are currently failing with

dyld: lazy symbol binding failed: Symbol not found: _objc_opt_self
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_self
  Expected in: /usr/lib/libobjc.A.dylib

Here, they are disabled for now.

rdar://problem/61345988
2020-04-06 11:12:11 -07:00
Xi Ge
aa39afa32a test: disable Runtime/superclass_constraint_metadata_resilient_superclass_future.swift
rdar://61345988
2020-04-06 09:48:49 -07:00
Konrad `ktoso` Malawski
5faf82c553 Improve usability of _mangledTypeName with Any.Type arguments 2020-04-05 12:27:50 +09:00
Nate Chandler
2863f1964d [Runtime] Handle incomplete class metadata in _checkGenericRequirements.
When constructing the metadata for a type Gen<T : Super>
where Super is a superclass constraint, the generic argument K at which
the metadata for Gen is being instantiated is verified to be a subclass
of Super via _checkGenericRequirements.

Previously, that check was done using swift_dynamicCastMetatype.  That
worked for the most part but provided an incorrect answer if the
metadata for K was not yet complete.  These classes are incomplete more
often thanks to __swift_instantiateConcreteTypeFromMangledNameAbstract.

That issue occurred concretely in the following case:

  Framework with Library Evolution enabled:

    open class Super { ... }
    public struct Gen<T : Super> {
    }

  Target in a different resilience domain from that framework:

    class Sub : Super {
      var gen: Gen<Sub>?
    }

Here, the mechanism for checking whether the generic argument K at which
the metadata for Gen is being instantiated handles the case where K's
metadata is incomplete.  At worst, every superclass name from super(K)
up to Super are demangled to instantiate metadata.  A number of faster
paths are included as well.

rdar://problem/60790020
2020-04-03 13:28:54 -07:00
Konrad `ktoso` Malawski
33444489e5 Add _mangledTypeName to allow round trips T->mangledName->T 2020-03-10 12:20:08 +09:00
fischertony
f14604e225 Demangle: Test demangling of nested types with contextual where clauses 2020-03-05 07:29:28 +03:00
Jonas Devlieghere
21327e79d9 [test] Fix LLDB Python Path and re-enable linux-fatal-backtrace.swift 2020-02-10 16:17:04 -08:00
Mishal Shah
7952f051a3 Disable linux-fatal-backtrace.swift (59328972) 2020-02-10 15:44:31 -08:00
Xi Ge
624c2fc4a7 test: move demangle metadata for moved symbols to a separate file 2019-12-17 12:22:22 -08:00
Xi Ge
12d148b40b test: add a test for demangle moved type names during runtime 2019-12-17 11:13:44 -08:00
Lei Zhang
f04de1d4d3 Disable 4 tests on s390x 2019-09-20 19:48:33 +00:00
Stephen Canon
ca1e808bde Replace all 9999 availability in non-stdlib tests. (#26109)
Replace all 9999 availability in non-stdlib tests with the appropriate platform availability.
2019-07-12 14:48:37 -04:00
Brent Royal-Gordon
29bff80d49 Unskip most of associated_type_demangle_private (#25657)
There’s only one specific case that isn’t working correctly right now; re-enable the rest of the test. rdar://problem/51959305
2019-06-20 21:34:38 -07:00
Xi Ge
179a0ac99e test: disable Runtime/associated_type_demangle_private.swift
Related: rdar://51959305
2019-06-20 15:19:20 -07:00
Brent Royal-Gordon
4149c8f97d [Runtime] Fix private generic type witness demangling failure (#25611)
This one’s screwily specific--if you have:

* a private generic type,
* with a nested generic type in it,
* and the nested type conforms to a protocol with an associated type,
* and that associated type’s witness is a generic type,
* and some of the witness type’s generic parameters are generic parameters of the nested type,

demangling would fail. The problem is that the substitution machinery in the runtime would consider there to be three, not two, generic context depths involved. Depth 1, which should correspond to the nested type, would instead have no generic parameters. The fix is to skip over depths with zero generic parameters.

Fixes <rdar://problem/47773183>.
2019-06-20 12:02:01 -07:00
Julian Lettner
105e4ad592 [TSan] Add positive test for TSan + Dispatch on Linux
1) Enable tests that use `import Dispatch` on Linux. Add substitution
   `%import-libdispatch` that needs to be used for all cross-platform
   tests (i.e., tests that are intended to be run on other platforms
   than Darwin) that do `import Dispatch` or enable thread sanitizer.

2) Make sure as many existing Dispatch and TSan tests as possible run on
   Linux. Mark tests that would require substantial work with
   `UNSUPPORTED: OS=linux-gnu`.

3) Add integration-style Swift test that shows that TSan finds a simple
   race when using `Dispatch.async` incorrectly. A more complete test
   suite for TSan's libdispatch support lives on the LLVM/compiler-rt
   side.

rdar://problem/49177535
2019-06-10 14:24:53 -07:00
Mike Ash
20b24c54b5 [Test] Use --allow-empty in crash_without_backtrace[_optimized].swift. 2019-05-23 14:50:08 -04:00
Michael Gottesman
195672a201 Disable crash_without_backtrace.swift.
rdar://51076215
2019-05-23 11:39:55 -07:00