Commit Graph

206 Commits

Author SHA1 Message Date
Tim Kientzle
9debfbc08c Merge pull request #75607 from tbkka/tbkka-remotemirror-unsafecontinuation
[RemoteMirror] Handle UnsafeContinuation
2024-08-01 13:46:09 -07:00
Tim Kientzle
8935510bcc Do not test with back deployment since this is a new-ish feature area 2024-08-01 07:27:11 -07:00
Tim Kientzle
71f010ead4 Merge pull request #75516 from tbkka/tbkka-new-actor-reflection-test
New reflect_Actor test
2024-07-31 21:01:29 -07:00
Tim Kientzle
9e1dcd6c9f [RemoteMirror] Handle UnsafeContinuation
UnsafeContinuations can be stored in variables or properties,
so it's important for RemoteMirror to be able to at least minimally
recognize them.

This just treats an UnsafeContinuation as a refcounted pointer.
Which might be "good enough" for now.

Working towards rdar://110351406
2024-07-31 18:15:27 -07:00
Tim Kientzle
725dc3c011 Merge pull request #75587 from tbkka/tbkka-remotemirror-generic-depth
[RemoteMirror] Fix generic depth calculation
2024-07-31 17:56:27 -07:00
Tim Kientzle
47de3339bb Only run this test on suitably new systems 2024-07-31 15:25:11 -07:00
Tim Kientzle
039e78d31a [RemoteMirror] Fix generic depth calculation
The "generic depth" is used to match up generic type variables.
For example:
```
struct Foo<T> { // `T` at generic depth 0
  struct Bar {
    struct Baz<U> { // 'U' at generic depth 1
      ...
}}}
```

Note in the above that `Bar` is not counted in the
generic depth.  The previous logic did count `Bar` in
the generic depth calculation, leading to mismatches
when trying to associate references to generic variables.

This adds a new test with cases like the above and of course
corrects the calculation.

Resolves rdar://127450037
2024-07-31 07:08:08 -07:00
LamTrinh.Dev
751a9d0127 Update reflect_multiple_types.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:12:12 +07:00
LamTrinh.Dev
a5b4f69f8e Update reflect_NSString.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:10:53 +07:00
LamTrinh.Dev
0d8d6070a7 Update reflect_NSSet.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:10:32 +07:00
LamTrinh.Dev
9ac94d3ffa Update reflect_NSNumber.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:10:13 +07:00
LamTrinh.Dev
ff63d2284e Update reflect_NSArray.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:09:15 +07:00
LamTrinh.Dev
b2f9976dd8 Update reflect_Enum_values_resilient.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:07:03 +07:00
LamTrinh.Dev
39224a1ebb Update reflect_Enum_values9.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:06:17 +07:00
LamTrinh.Dev
7c47570c63 Update reflect_Enum_values8.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:05:58 +07:00
LamTrinh.Dev
f3800be6d6 Update reflect_Enum_values7.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:05:37 +07:00
LamTrinh.Dev
f35c57e82b Update reflect_Enum_values6.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:05:17 +07:00
LamTrinh.Dev
baed1da4a9 Update reflect_Enum_values5.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:04:57 +07:00
LamTrinh.Dev
bf2f25cfa2 Update reflect_Enum_values4.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:04:36 +07:00
LamTrinh.Dev
aa0a602455 Update reflect_Enum_values3.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:04:15 +07:00
LamTrinh.Dev
cd14ab8e63 Update reflect_Enum_values2.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:03:54 +07:00
LamTrinh.Dev
450f1c6157 Update reflect_Enum_values11.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:02:12 +07:00
LamTrinh.Dev
a175465d5b Update reflect_Enum_values10.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:01:50 +07:00
LamTrinh.Dev
b81067d0b1 Update reflect_Enum_values.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:01:27 +07:00
LamTrinh.Dev
d3204c5433 Update reflect_Enum_value.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 23:00:42 +07:00
LamTrinh.Dev
a004b872c7 Update inherits_ObjCClasses.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 22:59:02 +07:00
LamTrinh.Dev
b9ec7744bf Update inherits_NSObject.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 22:58:24 +07:00
LamTrinh.Dev
6c2f3537fa Update functions_objc.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 22:57:54 +07:00
LamTrinh.Dev
999e287d99 Update existentials_objc.swift
Adding comment for "// REQUIRES: reflection_test_support"
2024-07-29 22:56:41 +07:00
LamTrinh.Dev
1684a50966 Update inherits_Swift.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 18:05:08 +07:00
LamTrinh.Dev
35c050df37 Update inherits_ObjCClasses.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 18:04:31 +07:00
LamTrinh.Dev
129126d5f1 Update inherits_NSObject.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 18:04:03 +07:00
LamTrinh.Dev
58ed9e7fd3 Update functions_objc.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 18:03:43 +07:00
LamTrinh.Dev
5db4317811 Update functions.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 18:03:18 +07:00
LamTrinh.Dev
971048907b Update existentials.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 17:59:08 +07:00
LamTrinh.Dev
86dc6271fe Update existentials_objc.swift
Adding more comment for "UNSUPPORTED: asan".
2024-07-27 17:55:48 +07:00
Tim Kientzle
cbd0c14407 New reflect_Actor test 2024-07-26 17:17:29 -07:00
Tim Kientzle
f73cfa7396 Reflection tests are incompatible with ASAN 2024-07-26 09:55:08 -07:00
Tim Kientzle
8d22ae449c More MPE improvements
This fills in a number of missing cases:
* MPEs with closure payloads
* MPEs with many non-payload cases
* MPEs with class existential payloads
* MPEs with existential metatype payloads

Resolves rdar://132270733
Resolves rdar://128705332
2024-07-23 16:08:57 -07:00
Tim Kientzle
eba980af03 Limit this test to macOS 2024-06-05 17:47:30 -07:00
Tim Kientzle
40eb3c084d Expand the work from #73491 to support more MPE layouts. This also switches the
MPE layout code to exclusively use the new code.  The key observation: existing
reflection metadata seems to already provide enough information in all cases, so
we can abandon an earlier effort to add spare bitmask data.

Resolves rdar://129281368
2024-06-05 10:15:58 -07:00
Tim Kientzle
ea87a273d7 Redesign the spare bit mask calculation
This adds a `getSpareBits` method to all the TypeInfo classes
that returns a suitable bitmask indicating the spare bits available
in values of this type.  This gives us a way to recursively explore
the type tree and build up a full spare bit mask for an arbitrary type.

Happily, it appears we actually do have enough information to do this
calculation entirely from first principles, without requiring additional
reflection information.  So once this is stable, we should remove my
earlier incomplete effort to publish spare bit mask info in the reflection
data, as that adds unnecessary metadata to every binary.

This doubtless still has plenty of holes, but seems sufficient
to handle a few basic enum types, including the stdlib DecodingError
which was used as an example to work out some key issues.
2024-05-07 14:17:00 -07:00
Tim Kientzle
35a98aad20 Fix enum inspection of a no-payload enum inside another enum
When a no-payload enum is stored inside a multi-payload enum,
the outer enum may be using some of the extra high-order bits.
So when we examine the inner enum, we should just strip those bits.
2024-03-13 09:14:37 -07:00
Tim Kientzle
5d4c29cd09 Fix a bunch of reflection tests to be correct for Ubuntu
These tests had Darwin-specific code in them, mostly unnecessary,
that caused them to break on non-Darwin platforms.

Only one (reflect_Enum_SingleCaseCFPayload.swift) was actually
specific to Darwin.  That one has been disabled.  For the rest,
just delete the unnecessary `import Darwin` and similar.
2023-10-24 06:58:41 -07:00
Tim Kientzle
8bb3a55702 [RemoteInspection] Allow enums to be trivial even with a formal payload
A "trivial" enum is one that carries no information.
The previous logic asserted that a trivial enum had only one
case and that case had no payload.
But this is also a trivial payload:
```
// Trivial, so zero-sized
enum MyFormatVersion {
  case v4
}
// Also trivial, since the payload carries no information
enum Format {
  case MyFormat(MyFormatVersion)
}
```

This commit adds a test case similar to the above
and corrects the assertions for trivial enums to
assert that there is either no payload, or that the
payload is zero-sized.

Resolves rdar://116406504
2023-10-03 14:06:12 -07:00
Hiroshi Yamauchi
ed58501ecd Account for the generic zero-sized payload enum cases.
Disable the assert:

    // At least one payload is non-empty (otherwise this                                                                                                                  // would get laid out as a non-payload enum)                                                                                                                          assert(getNumNonEmptyPayloadCases() > 0);

in TaggedMultiPayloadEnumTypeInfo because it fails when you have
generic but zero-sized payload enum cases.

Also remove unnecessary "REQUIRES: objc_interop" lines from the enum
reflection tests.
2023-09-21 09:31:24 -07:00
Tim Kientzle
a897fcb47c Correctly project enums with zero-sized payloads
I earlier overhauled the enum layout logic to correctly consider
enums with generic cases and cases that have zero size.
This updates the enum projection logic to use that information
as well.

In particular, this fixes a bug where an MPE with zero-sized cases
would be incorrectly projected by RemoteMirror (with consequences
for the `leaks` tool and lldb).

Resolves rdar://111705059
2023-07-12 08:46:32 -07:00
Tim Kientzle
3f70b051a3 Fix this on 32 bit targets 2023-05-01 12:03:26 -07:00
Tim Kientzle
5d67b814f5 Fix case calculation for SPE with zero-sized payload 2023-04-25 15:00:51 -07:00
Tim Kientzle
8da561c8cb More tests! 2023-04-24 16:42:08 -07:00