Commit Graph

2251 Commits

Author SHA1 Message Date
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Pavel Yaskevich
416bbaec8d [TypeChecker] InitAccessors: Fix handling of defaultable init accessor properties during default init synthesis
Default initializable init properties shouldn't prevent default
init synthesis and such properties without anything to initialize
should be considered by it.
2023-08-21 09:05:26 -07:00
Pavel Yaskevich
1542bb5a71 Merge pull request #67763 from xedin/rdar-113412104
[DI] Properties with init accessors without "initializes" act as stored
2023-08-21 09:03:43 -07:00
zachary0kent
802e63a778 Merge pull request #67973 from zachary0kent/lazy-immediate-globals
[Immediate] JIT'ing Globals
2023-08-18 08:53:18 -07:00
Zak Kent
6aafeec181 [Immediate] [SILGen] Implement on-demand compilation of globals 2023-08-17 11:03:11 -07:00
Zak Kent
f82fa91de9 [Immediate] Promote linkage of lazily discovered internal symbols 2023-08-17 09:56:40 -07:00
Saleem Abdulrasool
39a47a0733 Merge pull request #65968 from finagolfin/droid
[android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
2023-08-17 08:47:29 -07:00
zachary0kent
25f078adb5 Merge branch 'main' into lazy-immediate 2023-08-16 19:45:27 -07:00
Allan Shortlidge
117a5ecdae Merge pull request #67920 from tshortli/unavailable-decl-opt-complete-resilient-enum-switch
SILOptimizer: Remove switch cases matching unavailable enum elements
2023-08-16 09:06:20 -07:00
Alejandro Alonso
44198d16a4 Merge pull request #67611 from Azoy/raw-types-are-cool!
[WIP] Implement dependent layouts for raw types
2023-08-16 06:55:42 -07:00
Allan Shortlidge
e2bb7e8c8b SILOptimizer: Remove switch cases matching unavailable enum elements.
Unavailable enum elements cannot be instantiated at runtime without invoking
UB. Therefore the optimizer can consider a basic block unreachable if its only
predecessor is a block that terminates in a switch instruction matching an
unavailable enum element. Furthermore, removing the switch instruction cases
that refer to unavailable enum elements is _mandatory_ when
`-unavailable-decl-optimization=complete` is specified because otherwise
lowered IR for these instructions could refer to enum tag accessors that will
not be lowered, resulting in a failure during linking.

Resolves rdar://113872720.
2023-08-15 17:13:10 -07:00
Zak Kent
c59459940c [Test] Only run lazy tests on macOS 2023-08-14 13:28:23 -07:00
Zak Kent
5e75c76386 [Test] Add tests for lazy immediate mode 2023-08-14 13:28:22 -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
Michael Gottesman
bac26aa8c5 [reference-bindings] Fix a verifier error and add a test that validates that we do not crash anymore. 2023-08-11 15:57:50 -07:00
Mike Ash
dbd2f82739 [Runtime] Fix up the heap destroyer in objc_setClassCopyFixupHandler.
We fix up the VWT pointer, but not the heap destroyer. This doesn't matter for classes which use ObjC refcounting, which is the common case for dynamic subclasses, because that doesn't use the heap destroyer pointer. But it does matter for classes that use native Swift refcounting, such as classes that don't inherit from NSObject, or actors.

rdar://113657917
2023-08-10 15:19:18 -04:00
Pavel Yaskevich
11f1b08ada [DI] Properties with init accessors without "initializes" act as stored
Adjust DI to treat init accessor properties that have only 'accesses'
or no restrictions as if they are stored properties, this means that
if such property doesn't have a default initializer users would have
to reference it explicitly in their custom initializers.

We also need to suppress default init synthesis for such cases which
would be done in a followup commit.

Resolves: rdar://113401979
2023-08-04 21:05:07 -07:00
Slava Pestov
59fd29551e IRGen: Emitting metadata for function types containing pack expansion parameters 2023-08-03 22:12:05 -04:00
Alejandro Alonso
a445cf29bf Use a simpler interpreter test 2023-08-03 15:17:41 -07:00
Alejandro Alonso
f840191e14 Emit call to old initialization function for older OSes
Add test

Update raw_layout.swift

Update raw_layout.swift
2023-08-03 09:30:37 -07:00
Dario Rexin
7f1bf3bdcb Merge pull request #67673 from drexin/wip-113276992
[Test] Codesign dylib in layout_string_witnesses_objc.swift
2023-08-02 21:30:14 -07:00
Dario Rexin
da602b27fd [Test] Codesign dylib in layout_string_witnesses_objc.swift
rdar://113276992
2023-08-02 10:29:06 -07:00
Allan Shortlidge
7c0a9cc92e Merge pull request #67636 from tshortli/enum-unavailable-element-derived-equatable-hashable
Sema: Fix unavailable enum element cases in derived hashable/equatable impls
2023-08-01 16:22:28 -07:00
Pavel Yaskevich
bb135181bd Merge pull request #67625 from xedin/enable-init-accessors-feature
[Frontend/NFC] SE-0400: Enable `InitAccessors` feature by default
2023-08-01 15:54:43 -07:00
Alejandro Alonso
df17f7be90 Implement dependent layouts for raw types
Update raw_layout.swift

Allow for concrete specializations of raw layout

Make test platform agnostic
2023-08-01 14:09:23 -07:00
Joe Groff
984b4f2387 Merge pull request #67633 from jckarter/raw-layout-initialization
Fix `@_rawLayout` initialization to avoid spurious lifetime ends.
2023-08-01 13:34:29 -07:00
Joe Groff
9b783560ad Fix @_rawLayout initialization to avoid spurious lifetime ends.
We can't really treat them as always-initialized because that makes move checking
think that there's a value to destroy even on initialization, causing deinits to
run on uninitialized memory. Remove my previous hack, and use a `zeroInitializer`
to initialize the value state when emitting `init`, which is where we really need
the bootstrapping-into-initialized behavior. rdar://113057256
2023-08-01 08:34:02 -07:00
Allan Shortlidge
e4810f5304 Sema: Fix unavailable enum element cases in derived hashable/equatable impls.
When deriving the `hash(into:)` and `==` witnesses for `Hashable`/`Equatable`
enums, call `_diagnoseUnavailableCodeReached()` in the case bodies for
unavailable enum elements. This is needed because the previously derived code
would operate on the values associated with unavailable enum elements, which is
illegal if the types of those associated values are also unavailable (these
case bodies would have failed typechecking had they been hand-written). The new
structure also more explicitly documents that reaching these cases is
unexpected, since unavailable enum elements should not be instantiated at run
time.
2023-07-31 22:44:52 -07:00
Pavel Yaskevich
2a0651e8b0 [Frontend/NFC] SE-0400: Enable InitAccessors feature by default 2023-07-31 13:18:59 -07:00
Dario Rexin
fb11b50acd [Test] Fix FileCheck comments in test/Interpreter/layout_string_witnesses_objc.swift 2023-07-28 15:09:58 -07:00
Dario Rexin
b82ac6bcdf Merge pull request #67599 from drexin/wip-112474091
[Runtime] Fix _swift_refCountBytesForMetatype for reference types
2023-07-28 14:53:56 -07:00
Dario Rexin
f257b3bbab [Runtime] Fix _swift_refCountBytesForMetatype for reference types
_swift_addRefCountStringForMetatype and _swift_refCountBytesForMetatype diverged in the code that determines whether a type is a reference, causing the size number of ref count bytes to differ from the actually used bytes. This can cause early termination of the runtime interpreter functions, which in turn causes unbalanced reference counts.

rdar://112474091
2023-07-28 11:55:53 -07:00
Slava Pestov
e25172f1d4 Merge pull request #67573 from slavapestov/dynamic-tuple-labels
IRGen: Support tuple labels in emitDynamicTupleTypeMetadataRef()
2023-07-27 23:10:28 -04:00
Alex Hoppen
563a6805dc [test] Use @storageRestriction instead of initializes and access effects in test/Interpreter/init_accessors.swift 2023-07-27 14:54:19 -07:00
Slava Pestov
8dfeeebeb5 IRGen: Support tuple labels in emitDynamicTupleTypeMetadataRef() 2023-07-27 13:39:52 -04:00
Dario Rexin
6fb232510b [Runtime] Fix SinglePayloadEnumSimple read offset in swift_resolve_resilientAccessors
The offset was off by 1, causing subsequent tags to not be resolved properly.
2023-07-24 09:47:42 -07:00
Dario Rexin
10685367ce [Runtime] Use the properly resolved tag when adding offset after resolving relative pointers in layout strings
The tag was overwritten after resolve when a prior field caused a non-zero offset. This then caused the runtime to treat is a relative instead of an absolute pointer, causing invalid pointers to be dereferenced.
2023-07-24 09:36:26 -07:00
Holly Borla
7b586d20cc [Type Resolution] Only allow each applied directly to a type parameter pack. 2023-07-20 15:29:53 -07:00
Dario Rexin
69c8ae6ff3 [IRGen] Fix extra inhabitant offset for simple single payload enums with layout strings 2023-07-19 16:03:52 -07:00
Pavel Yaskevich
52ac782184 [DI] InitAccessors: Use of SILModule::getFieldIndex is incompatible with DI data structures
DI cares only about stored fields of the current type but `SILModule::getFieldIndex`
goes through all of the supertypes as well.
2023-07-18 17:19:42 -07:00
Pavel Yaskevich
2bfbb43af5 [CodeSynthesis] Teach AreAllStoredPropertiesDefaultInitableRequest about init accessors
If stored property is covered by one or more init accessor property,
it's default initializable when at least one of the init accessor
properties has default value.
2023-07-18 17:19:42 -07:00
Pavel Yaskevich
fd2a7d5ad3 [Sema] InitAccessors: Make sure that init accessor default subsumes initialization of stored properties
Default expression associated with an init accessor property
should always subsume that of any property listed in "initializes".
2023-07-18 17:19:42 -07:00
Pavel Yaskevich
aa52e42b3e [SILGen] InitAccessors: Start emitting init property initialization expressions
Similar to regular stored properties emit initialization expressions
for properties with init accessors at constructor's prolog.
2023-07-18 17:19:42 -07:00
Dario Rexin
93a70a0e38 Merge pull request #67349 from drexin/wip-resilient-metadata-inst
[IRGen] Fix enum metadata instantiation for resilient payload
2023-07-18 13:11:36 -07:00
Dario Rexin
8a260ff089 [Test] Add tests for prespecialized single payload enums with layout strings 2023-07-18 09:43:39 -07:00
Dario Rexin
649aa1ad72 [Test] Add tests for prespecialized single payload enums with layout strings 2023-07-18 09:41:22 -07:00
Dario Rexin
c8537963fa [Test] Add tests for prespecialized singleton enums with layout strings 2023-07-18 09:12:47 -07:00
Dario Rexin
937d1727a3 [IRGen] Fix enum metadata instantiation for resilient payload
The metadata can't be constant when we generate a layout string at runtime.
2023-07-17 16:00:41 -07:00
nate-chandler
400d3d1422 Merge pull request #67272 from nate-chandler/rdar112152116
[Sema] Allow implicit dynamic @nonobjc.
2023-07-14 10:49:19 -07:00
Michael Gottesman
377d5e1148 Merge pull request #67203 from gottesmm/pr-926bc2579371ebafa050d23a22d39b2a177ecd6a
[reference-bindings] Inout Binding ensure that we handle fields correctly
2023-07-12 15:06:59 -07:00