Commit Graph

2588 Commits

Author SHA1 Message Date
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
Nate Chandler
8b662a7fea [Sema] Allow implicit dynamic @nonobjc.
Back in https://github.com/apple/swift/pull/24959, marking a decl both
dynamic and @nonobjc was allowed.  So implicitly mark decls that are
@nonobjc dynamic when -enable-implicit-dynamic is specified.

rdar://112152116
2023-07-12 14:23:50 -07:00
Rintaro Ishizaki
2b13365f0b Merge pull request #67206 from rintaro/parse-each-self-rdar107450487
[Parse] Accept 'self' after 'each'
2023-07-11 15:02:26 -07:00
Michael Gottesman
adeae2f63e [reference-bindings] Inout Binding ensure that we handle fields correctly
I also:

1. Added some basic SILGen/SILOptimizer/Interpreter tests.
2. Added some logging and cleaned up the pass a little bit.

rdar://112033023
2023-07-11 13:27:51 -07:00
Pavel Yaskevich
4760b95282 Merge pull request #67183 from xedin/convert-effects-into-storageRestrictions
[AST/Sema] Implement @storageRestrictions attribute
2023-07-11 11:57:14 -07:00
Rintaro Ishizaki
ababa1e461 [Parse] Accept 'self' after 'each'
Also move 'repeat', 'each', and 'any' expression parsing to
'parseExprSequenceElement'

rdar://107450487
2023-07-10 15:37:00 -07:00
Slava Pestov
b19fc60a52 Merge pull request #67180 from slavapestov/type-decoder-one-element-tuple
TypeDecoder: Unwrap unlabeled one-element tuples when expanding pack expansions
2023-07-07 17:14:14 -04:00
Pavel Yaskevich
06216fc0f1 [Sema] InitAccessors: Synthesize memberwise inits only with init accessor properties 2023-07-07 13:56:02 -07:00
Pavel Yaskevich
e84cd810d1 [AST] InitAccessors: fallback to init accessor effects if @storageRestrictions is not used 2023-07-07 11:21:37 -07:00
Slava Pestov
6a4036343f TypeDecoder: Unwrap unlabeled one-element tuples when expanding pack expansions 2023-07-07 14:14:51 -04:00
Pavel Yaskevich
fe17491982 [AST] InitAccessors: Switch from init accessor effects (initializes/accesses) to @storageRestrictions 2023-07-07 10:00:36 -07:00
Pavel Yaskevich
00729ad958 Merge pull request #67107 from xedin/setterless-init-accessor-properties
[SILGen/DI] Add support for init accessor properties without setters
2023-07-07 00:16:07 -07:00
Dario Rexin
b3cdcda6c7 Merge pull request #67173 from drexin/wip-singleton-inject
Support destructiveInjectEnumTag in singleton enums with layout strings
2023-07-06 19:33:05 -07:00
Dario Rexin
c046253039 [IRGen] Emit swift_singletonEnum_destructiveInjectEnumTag 2023-07-06 15:47:51 -07:00