Skip to content

Commit 37eb246

Browse files
authored
Merge pull request #2967 from swiftwasm/main
[pull] swiftwasm from main
2 parents 1c992c7 + eae6c00 commit 37eb246

File tree

78 files changed

+956
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+956
-620
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8429,6 +8429,7 @@ Swift 1.0
84298429
[SE-0284]: <https://github.com/apple/swift-evolution/blob/main/proposals/0284-multiple-variadic-parameters.md>
84308430
[SE-0286]: <https://github.com/apple/swift-evolution/blob/main/proposals/0286-forward-scan-trailing-closures.md>
84318431
[SE-0287]: <https://github.com/apple/swift-evolution/blob/main/proposals/0287-implicit-member-chains.md>
8432+
[SE-0293]: <https://github.com/apple/swift-evolution/blob/main/proposals/0293-extend-property-wrappers-to-function-and-closure-parameters.md>
84328433
[SE-0296]: <https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md>
84338434
[SE-0297]: <https://github.com/apple/swift-evolution/blob/main/proposals/0297-concurrency-objc.md>
84348435
[SE-0298]: <https://github.com/apple/swift-evolution/blob/main/proposals/0298-asyncsequence.md>

include/swift/ABI/Metadata.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,9 @@ struct TargetAnyClassMetadata : public TargetHeapMetadata<Runtime> {
10351035
// Note that ObjC classes do not have a metadata header.
10361036

10371037
/// The metadata for the superclass. This is null for the root class.
1038-
ConstTargetMetadataPointer<Runtime, swift::TargetClassMetadata> Superclass;
1038+
TargetSignedPointer<Runtime, const TargetClassMetadata<Runtime> *
1039+
__ptrauth_swift_objc_superclass>
1040+
Superclass;
10391041

10401042
#if SWIFT_OBJC_INTEROP
10411043
/// The cache data is used for certain dynamic lookups; it is owned

include/swift/ABI/MetadataValues.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,10 @@ namespace SpecialPointerAuthDiscriminators {
12091209
const uint16_t OpaqueReadResumeFunction = 56769;
12101210
const uint16_t OpaqueModifyResumeFunction = 3909;
12111211

1212+
/// ObjC class pointers.
1213+
const uint16_t ObjCISA = 0x6AE1;
1214+
const uint16_t ObjCSuperclass = 0xB5AB;
1215+
12121216
/// Resilient class stub initializer callback
12131217
const uint16_t ResilientClassStubInitCallback = 0xC671;
12141218

include/swift/Parse/Token.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class Token {
130130
}
131131

132132
bool isContextualKeyword(StringRef ContextKW) const {
133-
return is(tok::identifier) && !isEscapedIdentifier() &&
134-
Text == ContextKW;
133+
return isAny(tok::identifier, tok::contextual_keyword) &&
134+
!isEscapedIdentifier() && Text == ContextKW;
135135
}
136136

137137
/// Return true if this is a contextual keyword that could be the start of a

include/swift/Remote/MetadataReader.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class MetadataReader {
500500
return StoredPointer();
501501

502502
auto classMeta = cast<TargetClassMetadata<Runtime>>(meta);
503-
return classMeta->Superclass;
503+
return stripSignedPointer(classMeta->Superclass);
504504
}
505505

506506
/// Given a remote pointer to class metadata, attempt to discover its class
@@ -534,9 +534,9 @@ class MetadataReader {
534534
size_t start = isaAndRetainCountSize;
535535

536536
auto classMeta = cast<TargetClassMetadata<Runtime>>(meta);
537-
while (classMeta->Superclass) {
537+
while (stripSignedPointer(classMeta->Superclass)) {
538538
classMeta = cast<TargetClassMetadata<Runtime>>(
539-
readMetadata(classMeta->Superclass));
539+
readMetadata(stripSignedPointer(classMeta->Superclass)));
540540

541541
// Subtract the size contribution of the isa and retain counts from
542542
// the super class.
@@ -1751,7 +1751,8 @@ class MetadataReader {
17511751
if (descriptorAddress || !skipArtificialSubclasses)
17521752
return static_cast<StoredPointer>(descriptorAddress);
17531753

1754-
auto superclassMetadataAddress = classMeta->Superclass;
1754+
auto superclassMetadataAddress =
1755+
stripSignedPointer(classMeta->Superclass);
17551756
if (!superclassMetadataAddress)
17561757
return 0;
17571758

@@ -2661,11 +2662,11 @@ class MetadataReader {
26612662
BuiltType BuiltObjCClass = Builder.createObjCClassType(std::move(className));
26622663
if (!BuiltObjCClass) {
26632664
// Try the superclass.
2664-
if (!classMeta->Superclass)
2665+
if (!stripSignedPointer(classMeta->Superclass))
26652666
return BuiltType();
26662667

2667-
BuiltObjCClass = readTypeFromMetadata(classMeta->Superclass,
2668-
skipArtificialSubclasses);
2668+
BuiltObjCClass = readTypeFromMetadata(
2669+
stripSignedPointer(classMeta->Superclass), skipArtificialSubclasses);
26692670
}
26702671

26712672
TypeCache[origMetadataPtr] = BuiltObjCClass;

include/swift/Runtime/Config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
250250
#define __ptrauth_swift_dispatch_invoke_function \
251251
__ptrauth(ptrauth_key_process_independent_code, 1, \
252252
SpecialPointerAuthDiscriminators::DispatchInvokeFunction)
253+
#define __ptrauth_swift_objc_superclass \
254+
__ptrauth(ptrauth_key_process_independent_data, 1, \
255+
swift::SpecialPointerAuthDiscriminators::ObjCSuperclass)
253256
#define swift_ptrauth_sign_opaque_read_resume_function(__fn, __buffer) \
254257
ptrauth_auth_and_resign(__fn, ptrauth_key_function_pointer, 0, \
255258
ptrauth_key_process_independent_code, \
@@ -276,6 +279,7 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
276279
#define __ptrauth_swift_cancellation_notification_function
277280
#define __ptrauth_swift_escalation_notification_function
278281
#define __ptrauth_swift_dispatch_invoke_function
282+
#define __ptrauth_swift_objc_superclass
279283
#define __ptrauth_swift_runtime_function_entry
280284
#define __ptrauth_swift_runtime_function_entry_with_key(__key)
281285
#define __ptrauth_swift_runtime_function_entry_strip(__fn) (__fn)

include/swift/SIL/MemAccessUtils.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ class AccessUseDefChainVisitor {
13721372
Result visitGlobalAccess(SILValue global) {
13731373
return asImpl().visitBase(global, AccessedStorage::Global);
13741374
}
1375-
Result visitYieldAccess(BeginApplyResult *yield) {
1375+
Result visitYieldAccess(MultipleValueInstructionResult *yield) {
13761376
return asImpl().visitBase(yield, AccessedStorage::Yield);
13771377
}
13781378
Result visitStackAccess(AllocStackInst *stack) {
@@ -1448,8 +1448,10 @@ Result AccessUseDefChainVisitor<Impl, Result>::visit(SILValue sourceAddr) {
14481448

14491449
// A yield is effectively a nested access, enforced independently in
14501450
// the caller and callee.
1451-
case ValueKind::BeginApplyResult:
1452-
return asImpl().visitYieldAccess(cast<BeginApplyResult>(sourceAddr));
1451+
case ValueKind::MultipleValueInstructionResult:
1452+
if (auto *baResult = isaResultOf<BeginApplyInst>(sourceAddr))
1453+
return asImpl().visitYieldAccess(baResult);
1454+
break;
14531455

14541456
// A function argument is effectively a nested access, enforced
14551457
// independently in the caller and callee.

include/swift/SIL/OwnershipUtils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,10 @@ class OwnedValueIntroducerKind {
894894
;
895895
case ValueKind::ApplyInst:
896896
return Kind::Apply;
897-
case ValueKind::BeginApplyResult:
898-
return Kind::BeginApply;
897+
case ValueKind::MultipleValueInstructionResult:
898+
if (isaResultOf<BeginApplyInst>(value))
899+
return Kind::BeginApply;
900+
return Kind::Invalid;
899901
case ValueKind::StructInst:
900902
return Kind::Struct;
901903
case ValueKind::TupleInst:

include/swift/SIL/PatternMatch.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ template <typename LTy> struct tupleextractoperation_ty {
411411
L.match((ValueBase *)TEI->getOperand());
412412
}
413413

414-
if (auto *DTR = dyn_cast<DestructureTupleResult>(V)) {
415-
return DTR->getIndex() == index &&
416-
L.match((ValueBase *)DTR->getParent()->getOperand());
414+
if (auto *DTR = dyn_cast<MultipleValueInstructionResult>(V)) {
415+
if (auto *DT = dyn_cast<DestructureTupleInst>(DTR->getParent())) {
416+
return DTR->getIndex() == index &&
417+
L.match((ValueBase *)DT->getOperand());
418+
}
417419
}
418420

419421
return false;

0 commit comments

Comments
 (0)