Skip to content

Commit 376733a

Browse files
committed
reimplement distributed get type info impls
1 parent 74ab478 commit 376733a

File tree

8 files changed

+108
-199
lines changed

8 files changed

+108
-199
lines changed

include/swift/Demangling/Demangle.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ class Node {
256256
// Reverses the order of children.
257257
void reverseChildren(size_t StartingAt = 0);
258258

259+
// Find a node by its kind, traversing the node depth-first,
260+
// and bailing out early if not found at the 'maxDepth'.
261+
NodePointer findByKind(Node::Kind kind, int maxDepth);
262+
259263
/// Prints the whole node tree in readable form to stderr.
260264
///
261265
/// Useful to be called from the debugger.

include/swift/Demangling/TypeDecoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ return {}; // Not Implemented!
12621262
// TODO: Handle OpaqueReturnType, when we're in the middle of reconstructing
12631263
// the defining decl
12641264
default:
1265+
12651266
return MAKE_NODE_TYPE_ERROR0(Node, "unexpected kind");
12661267
}
12671268
}

lib/Demangling/Demangler.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,20 @@ void Node::reverseChildren(size_t StartingAt) {
417417
}
418418
}
419419

420+
Node* Node::findByKind(Node::Kind kind, int maxDepth) {
421+
if (getKind() == kind)
422+
return this;
423+
424+
if (maxDepth <= 0)
425+
return nullptr;
426+
427+
for (auto node : *this)
428+
if (auto matchingChild = node->findByKind(kind, maxDepth - 1))
429+
return matchingChild;
430+
431+
return nullptr;
432+
}
433+
420434
//////////////////////////////////
421435
// NodeFactory member functions //
422436
//////////////////////////////////

stdlib/public/Concurrency/Actor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,9 +2063,10 @@ void ::swift_distributed_execute_target(
20632063
void *resultBuffer) {
20642064
auto *accessor = findDistributedAccessor(targetNameStart, targetNameLength);
20652065
if (!accessor) {
2066-
assert(false && "no accessor");
2066+
assert(false && "no distributed accessor accessor");
20672067
return;
20682068
}
2069+
fprintf(stderr, "[%s:%d] (%s) found accessor\n", __FILE__, __LINE__, __FUNCTION__);
20692070

20702071
auto *asyncFnPtr = reinterpret_cast<
20712072
const AsyncFunctionPointer<DistributedAccessorSignature> *>(accessor);

stdlib/public/Distributed/DistributedActorSystem.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,7 @@ extension DistributedActorSystem {
251251
print("EXECUTE the target: \(mangledTargetName)")
252252
try await _executeDistributedTarget(
253253
on: actor,
254-
// mangledTargetName, UInt(mangledTargetName.count),
255-
// "\(mangledTargetName)TE", UInt(mangledTargetName.count) + 2,
256-
// "$s4main7GreeterC5helloSSyFTE", UInt("$s4main7GreeterC5helloSSyFTE".count),
257-
"$s4main7GreeterC5helloyyFTE", UInt("$s4main7GreeterC5helloyyFTE".count), // no return value
254+
mangledTargetName, UInt(mangledTargetName.count),
258255
argumentBuffer: hargs.buffer._rawValue,
259256
resultBuffer: resultBuffer?._rawValue
260257
)

0 commit comments

Comments
 (0)