Commit Graph

231 Commits

Author SHA1 Message Date
artemcm
e7ba93f20f Restrict preserve_conformance_metadata_attr_macros.swift test to OS supported by binary metadata reading tooling 2024-05-24 09:15:53 -07:00
Augusto Noronha
dd39730d74 Merge pull request #73723 from augusto2112/default-actor-ti-main
[RemoteInspection] Hardcode DefaultActorStorage's type info
2024-05-22 11:14:47 -07:00
Augusto Noronha
4417786be4 [RemoteInspection] Hardcode DefaultActorStorage's type info
No metadata is emitted for the builtin DefaultActorStorage type. Since
its layout is fixed, hardcode its definition in Remote Mirrors.

rdar://128032250
2024-05-17 14:29:25 -07:00
artemcm
c47cd7a107 Apply the @_alwaysEmitConformanceMetadata semantics to conformances originating from macro-expanded declarations and extensions
Existing code does not visit such declarations and does not mark them to be preserved in the binary even if not public and used.

Resolves rdar://127903662
2024-05-16 15:58:11 -04:00
Ben Barham
c1031b4844 [Test] Temporarily mark typeref_decoding.swift as unsupported
This seems to be failing on Linux aarch64 on and off. Mark unsupported
while we investigate.
2024-05-10 09:43:18 -07:00
Konrad `ktoso` Malawski
2f361ae9e1 XFAIL typeref_decoding.swift (#73537) 2024-05-10 09:09:04 +09:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -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
Meghana Gupta
2d3d74b4eb Disable test Reflection/preserve_conformance_metadata_attr.swift 2024-04-08 11:55:18 -07:00
Slava Pestov
480592a7d5 Merge pull request #72847 from slavapestov/fix-rdar123645784
Fix two problems with opaque return types -vs- parameter packs
2024-04-05 07:31:34 -04:00
Slava Pestov
153da37521 IRGen: Use getMaximalTypeExpansionContext() 2024-04-04 19:36:25 -04:00
Artem Chikin
69fdc1356c Revert "Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute"" 2024-04-03 09:29:51 -07:00
Mishal Shah
74840cc60a Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute" 2023-11-06 22:41:12 -08:00
Artem Chikin
feb5d457f6 Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute
Ensuring that conformances to such protocols must have their type metadata always emitted into the binary, regardless of wheter they are used or `public`.
2023-11-02 09:26:08 -07:00
Arnold Schwaighofer
894095a5f2 Add a flag to enable/disable usage of objective c protocol symbolic references 2023-10-06 08:43:00 -07:00
Arnold Schwaighofer
b0424759d7 Add support for objective c protocol symbolic references
Using symbolic references instead of a text based mangling avoids the
expensive type descriptor scan when objective c protocols are requested.

rdar://111536582
2023-10-05 13:11:32 -07:00
Finagolfin
30ba49e7fa [android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
Also, make the analogous change to apple/swift-driver#1372, which gets the
sanitizer tests working on Android again, and remove the lld_lto feature in the
tests, which is now unused.
2023-08-12 16:36:35 +05:30
Artem Chikin
0fae0b4708 Re-enable now-passing 'Reflection/typeref_decoding.swift' 2023-04-27 16:49:13 -07:00
Tim Kientzle
b36de6a0fb XFAIL the other typeref decoding tests on Linux aarch64 2023-04-12 17:19:48 -07:00
Slava Pestov
cca91797ed IRGen: Hollow out NecessaryBindings
This removes the "optimization" where a function type, metatype or
tuple type was split up into structural components, because it seems
that in general we need this structural type metadata again.

Similarly, this no longer tries to split up dependent concrete
conformances and instead passes the witness table in the context.

This makes the context larger potentially, but it avoids calls to
metadata access functions and swift_getWitnessTable() every time the
closure is invoked.
2023-03-28 19:21:45 -04:00
Tim Kientzle
f087b5e0fb This PR aligns RemoteMirror more closely with the compiler's handling of enums
that contain zero-sized payloads, which should resolve a number of issues with
RemoteMirror incorrectly reflecting enum cases and/or measuring the layout of
structures containing enums.

Background: Enum cases that have zero-sized payloads are handled
differently from other payload-bearing cases.

1. For layout purposes, they're treated as
   non-payload cases.  This can cause an MPE to
   actually get represented in memory as a single-payload
   or non-payload enum.

2. However, zero-sized payloads are still considered for
   extra inhabitant calculations.  Since they have no
   extra inhabitants, this tends to cause such enums to
   also not expose extra inhabitants to containing enums.

This commit makes several change to how RemoteMirror determines
enum layout:

* The various "*EnumTypeInfo" classes now represent
  layout mechanisms -- as described in (1) above,
  this can differ from the source code concept.

* An Enum "kind" is separately computed to reflect the
  source code concept; this ensures that the dumped
  type information reflects the source code.

* For single-payload and no-payload _layouts_,
  the extra inhabitant calculation has been adjusted
  to ensure that zero-sized payloads are correctly
  considered.

Resolves: rdar://92945673
2023-01-06 11:16:07 -08:00
Slava Pestov
e4e2e034c0 IRGen: Workaround for inadvertent mangling of opened archetypes 2022-11-02 13:27:26 -04:00
Adrian Prantl
75c42ed43b [swift-reflection-dump] Turn --binary-filename into a positional argument.
I mostly find it annoying to type and this makes the usage of the tool more
consistent with other similar tools like dwarfdump or otool.
2022-10-12 11:18:59 -07:00
Arnold Schwaighofer
c91bc61f1a Disable Reflection/typeref_decoding(_asan).swift tests
They fail on arm64e on some bots.

rdar://100805115
2022-10-05 06:22:00 -07:00
Mike Ash
373000eb1d [Test] Re-disable some Reflection tests on ARM64e.
These tests are still broken on ARM64e:

Reflection/conformance_descriptors.swift
Reflection/typeref_decoding_imported.swift
Reflection/typeref_decoding_objc.swift
Reflection/typeref_lowering.swift

rdar://100558042
2022-09-29 09:07:20 -04:00
Mike Ash
cdfbd7b91d [Test] Reenable Reflection tests disabled on ARM64e.
Improvements in our ARM64e support seems to have made these test work again.

rdar://89754240
rdar://89986398
2022-09-22 11:16:21 -04:00
Anthony Latsis
9cb32f2852 Gardening: Migrate test suite to GH issues: Reflection 2022-09-02 06:12:44 +03:00
Slava Pestov
d222ac5f6e Sema: New syntax for @opened archetypes in textual SIL
The old syntax was

    @opened("UUID") constraintType

Where constraintType was the right hand side of a conformance requirement.

This would always create an archetype where the interface type was `Self`,
so it couldn't cope with member types of opened existential types.

Member types of opened existential types is now a thing with SE-0309, so
this lack of support prevented writing SIL test cases using this feature.

The new syntax is

    @opened("UUID", constraintType) interfaceType

The interfaceType is a type parameter rooted in an implicit `Self`
generic parameter, which is understood to be the underlying type of the
existential.

Fixes rdar://problem/93771238.
2022-08-07 19:03:46 -04:00
Artem Chikin
0c51443dc0 Restrict 'opaque_associated_type_requirements' to binaries without chained fixups 2022-07-25 14:52:08 -07:00
Artem Chikin
8716fd0a6f Gather opaque type same-type requirements when scanning associated type infos from a binary 2022-07-08 11:08:30 -07:00
Artem Chikin
f38f3ff1ac Merge pull request #59791 from artemcm/GatherOpaqueAssociatedTypeConformanceReqs
Gather opaque type conformance requirements when scanning associated type infos from a binary
2022-07-05 11:47:28 -07:00
Artem Chikin
44d7cf4460 [Swift Static Mirror] When resolving an external type's conformance, report the underlying type's mangled name, instead of the mangled name of the nominal type descriptor.
Resolves rdar://95990054
2022-06-30 14:47:04 -07:00
Artem Chikin
ea0899d375 Common-out protocol name and type name reading code into the 'QualifiedContextNameReader'. 2022-06-29 11:24:32 -07:00
Artem Chikin
92011f2f5a Gather opaque type conformance requirements when scanning associated type infos from a binary
When detecting that an associated type's substituted type is an opaque type, read out its opaque type descriptor to collect the names of protocols it must conform to.
2022-06-29 11:24:22 -07:00
Butta
3933fc0006 [android][test] Fix several tests on the Android CI
- #58975 switched many tests from XFAIL on linux to linux-gnu, so seven
  fail on the Android CI and two natively. They are now explicitly excluded.
- #39605 added several C++ Interop tests, 11 of which fail on the Android CI,
  so disable them for now.
- #42478 removed the @noescape attribute for the non-Android
  SIL/clang-function-types tests, so I remove it for Android too.
- My pull #40779 moved the Swift pointer tags to the second byte, so
  SILOptimizer/concat_string_literals.64 will need to be updated for that,
  disabled it for now.
- Compiler-rt moved the directory in which it places those libraries for
  Android, llvm/llvm-project@a68ccba, so lit.cfg is updated for that.
2022-06-09 14:35:41 +05:30
Artem Chikin
bc795187d7 [Static Mirror] Handle anonymous contexts when re-constructing fully-qualified type names
Anonymous contexts (e.g. types nested inside functons) require special handling when we are constructing a fully-qualified name. We construct the name by walking from a type's descriptor to its parent contexts. Previously, we would give up upon encountering an anonymous contexts.

This change refactors fully-qualified name construction to happen in two phases:
1. Collect a full context ancestor chain
2. Walk the chain backwards to reconstruct the fully-qualified name
As opposed to the previous approach which always constructed the name while recursively walking to the parent context. This is required because types nested inside anonymous contexts are represented in the fully-qualified type name as `(type_name in $XXXXXXXX)` where XXXXXXXX is the address of the context descriptor of the parent anonymous context.

Resolves rdar://91073103
2022-05-31 15:56:31 -07:00
Ben Barham
c163e0fe5e [Tests] Make OS features consistent
lit.py currently allows any substring of `target_triple` to be used as a
feature in REQUIRES/UNSUPPORTED/XFAIL. This results in various forms of
the OS spread across the tests and is also somewhat confusing since they
aren't actually listed in the available features.

Modify all OS-related features to use the `OS=` version that Swift adds
instead. We can later remove `config.target_triple` so that these don't
the non-OS versions don't work in the first place.
2022-05-20 19:51:23 -07:00
Artem Chikin
8d66336342 [Static Mirror] Gather local type extension conformance infos correctly
Conformance Infos for nominal type declarations reference the conforming type by storing an offset to the address in the binary where the type's type descriptor is located. Conformance infos for conformances applied to an extension of a type use a different mechanism: they use an indirect reference to a dynamic symbol, which may be an external symbol **or** a resolved address to a local type descriptor. It is the latter case that the conformance-gather implementation was missing that is added in this PR.

Resolves rdar://93578419
2022-05-19 08:48:50 -07:00
Artem Chikin
52353f8a89 [Static Mirror] Extract names of external-type conformances
Covering two cases: external ObjC class extensions that add a conformances, and extensions of external Swift types that add a conformance. For both cases, we were not previously reading out the type name correctly, or at all.

Resolves rdar://91832735
2022-04-18 10:09:20 -07:00
Artem Chikin
b1b9e07f79 [Swift Static Mirror] Report mangled names without a prefix
Leave it to the clients to add it, if necessary.

Resolves rdar://90040835
2022-03-15 13:47:39 -07:00
Hamish Knight
a872ee086a [test] Disable typeref_decoding_objc.swift on arm64e
rdar://89986398
2022-03-09 14:22:18 +00:00
Hamish Knight
2cba680599 [test] Disable conformance_descriptors.swift on arm64e
rdar://88579818
2022-03-08 13:37:45 +00:00
Hamish Knight
c5d5451c2f [test] Disable a couple of Reflection tests on arm64e
rdar://89754240
2022-03-04 14:17:14 +00:00
Artem Chikin
fcba475a36 Pass in libswiftCore.dylib as input to conformance_descriptors.swift
This will make the test more robust in being able to read out the conformances we are looking for (Hashable, Equatable)

Resolves rdar://88579818
2022-02-09 09:13:08 -08:00
Artem Chikin
bc9aedadc8 Disable conformance_descriptors.swift on Linux AArch64
Test failure tracked in rdar://88451721.
2022-02-03 13:18:46 -08:00
Artem Chikin
1d960370bf [Static Mirror] Add mangled names to image-extracted protocol conformance infos.
Collect the mapping of unmangled-to-mangled names from the read out `Fields` section reflection infos and use that to identify the mangled name of a conforming type of a given protocol conformance.
2022-01-30 10:53:09 -08:00
Artem Chikin
cd6d8f975f Extract fully-qualified names for protocol conformances by traversing their parent contexts and extracting their names 2022-01-28 10:51:48 -08:00
Artem Chikin
59d1960c7c Add support for reading protocol descriptors from an indirect protocol descriptor target in an conformance descriptor.
Previously, the code assumed that such an indirect target will always point to an external symbol pointer, but it can also be an absolute pointer to an in-image protocol descriptor.
2022-01-27 10:55:29 -08:00
Artem Chikin
e934fe201a Add extraction protocol conformance descriptor extraction, as read from an object file image, to TypeRefBuilder. 2022-01-26 13:54:02 -08:00
buttaface
30c292ca87 [android] Update to NDK 23b (#39921)
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.
2021-11-17 20:58:42 -08:00