Skip to content

Commit bb3c7f5

Browse files
committedJan 26, 2024
[RemoteMirror] Allow clients to specify whether Obj-C interop is enabled.
rdar://119570103

File tree

7 files changed

+459
-369
lines changed

7 files changed

+459
-369
lines changed
 

‎include/swift/Remote/InProcessMemoryReader.h

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class InProcessMemoryReader final : public MemoryReader {
8888
}
8989
return true;
9090
}
91+
case DLQ_GetObjCInteropIsEnabled:
92+
break;
9193
}
9294
return false;
9395
}

‎include/swift/Remote/MemoryReader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class MemoryReader {
195195
return resolvePointer(address, pointerData);
196196
}
197197

198-
// Parse extra inhabitants stored in a pointer.
198+
// Parse extra inhabitants stored in a pointer.
199199
// Sets *extraInhabitant to -1 if the pointer at this address
200200
// is actually a valid pointer.
201201
// Otherwise, it sets *extraInhabitant to the inhabitant

‎include/swift/Remote/MetadataReader.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,11 @@ class MetadataReader {
647647

648648
auto classMeta = cast<TargetClassMetadata>(meta);
649649
while (stripSignedPointer(classMeta->Superclass)) {
650-
classMeta = cast<TargetClassMetadata>(
651-
readMetadata(stripSignedPointer(classMeta->Superclass)));
650+
meta = readMetadata(stripSignedPointer(classMeta->Superclass));
651+
if (!meta || meta->getKind() != MetadataKind::Class)
652+
return llvm::None;
653+
654+
classMeta = cast<TargetClassMetadata>(meta);
652655

653656
// Subtract the size contribution of the isa and retain counts from
654657
// the super class.

‎include/swift/SwiftRemoteMirror/MemoryReaderInterface.h

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ typedef enum {
103103
/// process. This is currently 0x1000 (4096) except on 64-bit Apple platforms
104104
/// where it is 0x100000000.
105105
DLQ_GetLeastValidPointerValue,
106+
107+
/// The query should ignore inBuffer, and treat outBuffer as bool* which
108+
/// should be populated with whether the target runtime uses Obj-C interop.
109+
DLQ_GetObjCInteropIsEnabled,
106110
} DataLayoutQueryType;
107111

108112
/// Data layout query function, which returns answers based on query types (from

‎lib/StaticMirror/ObjectFileContext.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ bool ObjectMemoryReader::queryDataLayout(DataLayoutQueryType type,
431431
}
432432
return true;
433433
}
434+
case DLQ_GetObjCInteropIsEnabled:
435+
break;
434436
}
435437

436438
return false;

‎stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp

+443-366
Large diffs are not rendered by default.

‎stdlib/tools/swift-reflection-test/swift-reflection-test.c

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ static int PipeMemoryReader_queryDataLayout(void *Context,
180180
}
181181
return 1;
182182
}
183+
case DLQ_GetObjCInteropIsEnabled:
184+
break;
183185
}
184186

185187
return 0;

0 commit comments

Comments
 (0)
Please sign in to comment.