Skip to content

Commit 35aec69

Browse files
xedinktoso
authored andcommitted
[Distributed] Remove commented out code and print statements
1 parent 9258b4e commit 35aec69

File tree

8 files changed

+2
-81
lines changed

8 files changed

+2
-81
lines changed

include/swift/AST/StorageImpl.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ class AccessStrategy {
110110
/// separately performing a Read into a temporary variable followed by
111111
/// a Write access back into the storage.
112112
MaterializeToTemporary,
113-
114-
// /// The access is to a computed distributed property, and thus the
115-
// /// get-accessor is a distributed thunk which may perform a remote call.
116-
// DirectToDistributedThunkAccessor,
117113
};
118114

119115
private:
@@ -153,10 +149,6 @@ class AccessStrategy {
153149
return { dispatched ? DispatchToAccessor : DirectToAccessor, accessor };
154150
}
155151

156-
// static AccessStrategy getDistributedGetAccessor(AccessorKind accessor) {
157-
// assert(accessor == AccessorKind::Get);
158-
// return { DirectToDistributedThunkAccessor, accessor };
159-
// }
160152
static AccessStrategy getMaterializeToTemporary(AccessStrategy read,
161153
AccessStrategy write) {
162154
return { read, write };

lib/AST/Decl.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,17 +2138,6 @@ getDirectReadAccessStrategy(const AbstractStorageDecl *storage) {
21382138
llvm_unreachable("bad impl kind");
21392139
}
21402140

2141-
//static AccessStrategy
2142-
//getDirectToDistributedThunkAccessorStrategy(const AbstractStorageDecl *storage) {
2143-
// switch (storage->getReadImpl()) {
2144-
// case ReadImplKind::Get:
2145-
// return AccessStrategy::getDistributedGetAccessor(AccessorKind::Get);
2146-
// default:
2147-
// llvm_unreachable("bad impl kind for distributed property accessor");
2148-
// }
2149-
// llvm_unreachable("bad impl kind for distributed property accessor");
2150-
//}
2151-
21522141
static AccessStrategy
21532142
getDirectWriteAccessStrategy(const AbstractStorageDecl *storage) {
21542143
switch (storage->getWriteImpl()) {
@@ -2282,14 +2271,6 @@ AbstractStorageDecl::getAccessStrategy(AccessSemantics semantics,
22822271
if (shouldUseNativeDynamicDispatch())
22832272
return getOpaqueAccessStrategy(this, accessKind, /*dispatch*/ false);
22842273

2285-
// if (auto var = dyn_cast<VarDecl>(this)) {
2286-
// if (var->isDistributed()) {
2287-
// fprintf(stderr, "[%s:%d] (%s) DIST STRATEGY!!\n", __FILE__, __LINE__, __FUNCTION__);
2288-
// var->dump();
2289-
// return getDirectToDistributedThunkAccessorStrategy(this);
2290-
// }
2291-
// }
2292-
22932274
// If the storage is resilient from the given module and resilience
22942275
// expansion, we cannot use direct access.
22952276
//

lib/SILGen/SILGen.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,6 @@ void SILGenModule::visitVarDecl(VarDecl *vd) {
17661766
if (vd->hasStorage())
17671767
addGlobalVariable(vd);
17681768

1769-
fprintf(stderr, "[%s:%d] (%s) VISIT VAR DECL\n", __FILE__, __LINE__, __FUNCTION__);
1770-
vd->dump();
1771-
17721769
vd->visitEmittedAccessors([&](AccessorDecl *accessor) {
17731770
emitFunction(accessor);
17741771
});
@@ -1835,7 +1832,6 @@ SILGenModule::canStorageUseStoredKeyPathComponent(AbstractStorageDecl *decl,
18351832
case AccessStrategy::DirectToAccessor:
18361833
case AccessStrategy::DispatchToAccessor:
18371834
case AccessStrategy::MaterializeToTemporary:
1838-
// case AccessStrategy::DirectToDistributedThunkAccessor:
18391835
return false;
18401836
}
18411837
llvm_unreachable("unhandled strategy");

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
10871087

10881088
// If this is a direct reference to a vardecl, just emit its value directly.
10891089
// Recursive references to callable declarations are allowed.
1090-
if (auto var = dyn_cast<VarDecl>(e->getDecl())) {
1090+
if (isa<VarDecl>(e->getDecl())) {
10911091
visitExpr(e);
10921092
return;
10931093
}
@@ -1123,8 +1123,6 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
11231123

11241124
/// Some special handling may be necessary for thunks:
11251125
if (callSite && callSite->shouldApplyDistributedThunk()) {
1126-
fprintf(stderr, "[%s:%d] (%s) SHOULD APPLY DIST THUNK\n", __FILE__, __LINE__, __FUNCTION__);
1127-
11281126
if (auto distributedThunk = cast<AbstractFunctionDecl>(e->getDecl())->getDistributedThunk()) {
11291127
constant = SILDeclRef(distributedThunk).asDistributed();
11301128
}
@@ -5773,15 +5771,8 @@ RValue SILGenFunction::emitGetAccessor(SILLocation loc, SILDeclRef get,
57735771
// Scope any further writeback just within this operation.
57745772
FormalEvaluationScope writebackScope(*this);
57755773

5776-
auto constant = get;
5777-
5778-
// if (isDistributed) {
5779-
// get.dump();
5780-
// assert(false && "should use dist thunk");
5781-
// }
5782-
57835774
Callee getter = emitSpecializedAccessorFunctionRef(
5784-
*this, loc, constant, substitutions, selfValue, isSuper, isDirectUse,
5775+
*this, loc, get, substitutions, selfValue, isSuper, isDirectUse,
57855776
isDistributed, isOnSelfParameter);
57865777
bool hasSelf = (bool)selfValue;
57875778
CanAnyFunctionType accessType = getter.getSubstFormalType();

lib/SILGen/SILGenExpr.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,23 +3501,6 @@ getIdForKeyPathComponentComputedProperty(SILGenModule &SGM,
35013501
// stable identifier.
35023502
return SGM.getFunction(getterRef, NotForDefinition);
35033503
}
3504-
// case AccessStrategy::DirectToDistributedThunkAccessor: {
3505-
// assert(false && "dont need this");
3506-
// // Locate the distributed thunk for the getter of this property
3507-
// fprintf(stderr, "[%s:%d] (%s) CHECKING.... DirectToDistributedThunkAccessor\n", __FILE__, __LINE__, __FUNCTION__);
3508-
// auto representativeDecl = getRepresentativeAccessorForKeyPath(storage);
3509-
// assert(representativeDecl->isDistributed());
3510-
// fprintf(stderr, "[%s:%d] (%s) OK, representative is DIST\n", __FILE__, __LINE__, __FUNCTION__);
3511-
//
3512-
// auto getterThunkRef = SILDeclRef(representativeDecl->getDistributedThunk(),
3513-
// SILDeclRef::Kind::Func,
3514-
// /*isForeign=*/false,
3515-
// /*isDistributed=*/true);
3516-
// fprintf(stderr, "[%s:%d] (%s) THUNK\n", __FILE__, __LINE__, __FUNCTION__);
3517-
// getterThunkRef.dump();
3518-
//
3519-
// return SGM.getFunction(getterThunkRef, NotForDefinition);
3520-
// }
35213504
case AccessStrategy::DispatchToAccessor: {
35223505
// Identify the property by its vtable or wtable slot.
35233506
return SGM.getAccessorDeclRef(getRepresentativeAccessorForKeyPath(storage));

lib/SILGen/SILGenLValue.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,10 +1357,6 @@ namespace {
13571357
std::move(indices), isOnSelfParameter,
13581358
actorIso)
13591359
{
1360-
if (isDistributedAccessor) {
1361-
fprintf(stderr, "[%s:%d] (%s) DIST ACCESSOR GOOD!\n", __FILE__, __LINE__, __FUNCTION__);
1362-
decl->dump();
1363-
}
13641360
assert(getAccessorDecl()->isGetterOrSetter());
13651361
}
13661362

@@ -1651,11 +1647,6 @@ namespace {
16511647
ManagedValue base, SGFContext c) && override {
16521648
assert(getAccessorDecl()->isGetter());
16531649

1654-
if (IsDistributedAccessor) {
1655-
fprintf(stderr, "[%s:%d] (%s) EMIT DIST GETTER\n", __FILE__, __LINE__, __FUNCTION__);
1656-
base.dump();
1657-
}
1658-
16591650
SILDeclRef getter = Accessor;
16601651
ExecutorBreadcrumb prevExecutor;
16611652
RValue rvalue;

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ deriveBodyDistributed_thunk(AbstractFunctionDecl *thunk, void *context) {
238238
}
239239

240240
auto returnLocalPropertyAccess = new (C) ReturnStmt(sloc, localPropertyAccess, implicit);
241-
242-
fprintf(stderr, "[%s:%d] (%s) LOCAL BRANCH\n", __FILE__, __LINE__, __FUNCTION__);
243-
returnLocalPropertyAccess->dump();
244241
localBranchStmt =
245242
BraceStmt::create(C, sloc, {returnLocalPropertyAccess}, sloc, implicit);
246243
} else {

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,8 +2261,6 @@ namespace {
22612261
// But computed distributed properties are okay,
22622262
// and treated the same as a distributed func.
22632263
if (var && var->isDistributed()) {
2264-
fprintf(stderr, "[%s:%d] (%s) HERE\n", __FILE__, __LINE__, __FUNCTION__);
2265-
var->dump();
22662264
bool explicitlyThrowing = false;
22672265
if (auto getter = var->getAccessor(swift::AccessorKind::Get)) {
22682266
explicitlyThrowing = getter->hasThrows();
@@ -2313,25 +2311,18 @@ namespace {
23132311
// is it an access to a property?
23142312
if (isPropOrSubscript(decl)) {
23152313
// Cannot reference properties or subscripts of distributed actors.
2316-
fprintf(stderr, "[%s:%d] (%s) prop\n", __FILE__, __LINE__, __FUNCTION__);
23172314
if (isDistributed) {
2318-
fprintf(stderr, "[%s:%d] (%s) prop is dist\n", __FILE__, __LINE__, __FUNCTION__);
2319-
23202315
bool setThrows = false;
23212316
bool usesDistributedThunk = false;
23222317
if (auto access = checkDistributedAccess(declLoc, decl, context)) {
23232318
std::tie(setThrows, usesDistributedThunk) = *access;
23242319
} else {
2325-
fprintf(stderr, "[%s:%d] (%s) prop is dist -> NOPE \n", __FILE__, __LINE__, __FUNCTION__);
23262320
return AsyncMarkingResult::NotDistributed;
23272321
}
23282322

23292323
// distributed computed property access, mark it throws + async
23302324
if (auto lookupExpr = dyn_cast_or_null<LookupExpr>(context)) {
23312325
if (auto memberRef = dyn_cast<MemberRefExpr>(lookupExpr)) {
2332-
fprintf(stderr, "[%s:%d] (%s) SET DISTRIBUTED MEMBER REF\n", __FILE__, __LINE__, __FUNCTION__);
2333-
memberRef->dump();
2334-
23352326
memberRef->setImplicitlyThrows(true);
23362327
memberRef->setShouldApplyLookupDistributedThunk(true);
23372328
} else {
@@ -2400,7 +2391,6 @@ namespace {
24002391
if (isDistributed) {
24012392
if (auto access = checkDistributedAccess(declLoc, decl, context)) {
24022393
std::tie(setThrows, usesDistributedThunk) = *access;
2403-
fprintf(stderr, "[%s:%d] (%s) USE THUNK\n", __FILE__, __LINE__, __FUNCTION__);
24042394
} else {
24052395
return AsyncMarkingResult::NotDistributed;
24062396
}

0 commit comments

Comments
 (0)