@@ -225,128 +225,6 @@ void SILGenFunction::emitClassMemberDestruction(ManagedValue selfValue,
225
225
}
226
226
}
227
227
228
- // void SILGenFunction::emitClassMemberDestruction(ManagedValue selfValue,
229
- // ClassDecl *cd,
230
- // CleanupLocation cleanupLoc) {
231
- // assert(selfValue.getOwnershipKind() == OwnershipKind::Guaranteed);
232
- // ASTContext &ctx = getASTContext();
233
- // auto normalBB = createBasicBlock();
234
- //
235
- // // TODO(distributed): a remote actor does not have properties,
236
- // // so do not destroy them if the actor is remote
237
- // if (cd->isDistributedActor()) {
238
- // // FIXME(distributed): if remote, do the logic below, otherwise do the normal logic
239
- // auto selfType = cd->getDeclaredInterfaceType();
240
- //
241
- // auto loc = SILLocation(cd);
242
- // loc.markAutoGenerated();
243
- // Scope scope(Cleanups, CleanupLocation(loc));
244
- //
245
- // auto isRemoteBB = createBasicBlock();
246
- // auto isLocalBB = createBasicBlock();
247
- //
248
- // // TODO(distributed): de-duplicate with the thunk logic in SILGenDistributed
249
- // // if __isRemoteActor(self) {
250
- // // ...
251
- // // } else {
252
- // // ...
253
- // // }
254
- // {
255
- // FuncDecl *isRemoteFn = ctx.getIsRemoteDistributedActor();
256
- // assert(isRemoteFn && "Could not find 'is remote' function, is the "
257
- // "'_Distributed' module available?");
258
- //
259
- // ManagedValue selfAnyObject =
260
- // B.createInitExistentialRef(loc, getLoweredType(ctx.getAnyObjectType()),
261
- // CanType(selfType), selfValue, {});
262
- // auto result = emitApplyOfLibraryIntrinsic(
263
- // loc, isRemoteFn, SubstitutionMap(), {selfAnyObject}, SGFContext());
264
- //
265
- // SILValue isRemoteResult =
266
- // std::move(result).forwardAsSingleValue(*this, loc);
267
- // SILValue isRemoteResultUnwrapped =
268
- // emitUnwrapIntegerResult(loc, isRemoteResult);
269
- //
270
- // B.createCondBranch(loc, isRemoteResultUnwrapped, isRemoteBB, isLocalBB);
271
- // }
272
- //
273
- // // // if __isRemoteActor(self)
274
- // // {
275
- // // // nothing
276
- // // }
277
- // {
278
- // B.emitBlock(isRemoteBB);
279
- //
280
- // // TODO: deduplicate in this func, make another bb
281
- // auto builtinName = getASTContext().getIdentifier(
282
- // getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
283
- // auto resultTy = SGM.Types.getEmptyTupleType();
284
- //
285
- // B.createBuiltin(cleanupLoc, builtinName, resultTy, /*subs*/{},
286
- // { selfValue.getValue() });
287
- // }
288
- //
289
- // // // else (local distributed actor)
290
- // // {
291
- // // <continue normal deinit>
292
- // // }
293
- // {
294
- // B.emitBlock(isLocalBB);
295
- //
296
- // B.createBranch(loc, normalBB, {selfValue});
297
- // }
298
- // }
299
- //
300
- // {
301
- // if (cd->isDistributedActor())
302
- // B.emitBlock(normalBB);
303
- //
304
- // for (VarDecl *vd : cd->getStoredProperties()) {
305
- // const TypeLowering &ti = getTypeLowering(vd->getType());
306
- // if (!ti.isTrivial()) {
307
- // SILValue addr =
308
- // B.createRefElementAddr(cleanupLoc, selfValue.getValue(), vd,
309
- // ti.getLoweredType().getAddressType());
310
- // addr = B.createBeginAccess(
311
- // cleanupLoc, addr, SILAccessKind::Deinit, SILAccessEnforcement::Static,
312
- // false /*noNestedConflict*/, false /*fromBuiltin*/);
313
- // B.createDestroyAddr(cleanupLoc, addr);
314
- // B.createEndAccess(cleanupLoc, addr, false /*is aborting*/);
315
- // }
316
- // }
317
- //
318
- // if (cd->isRootDefaultActor()) {
319
- // auto builtinName = getASTContext().getIdentifier(
320
- // getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
321
- // auto resultTy = SGM.Types.getEmptyTupleType();
322
- //
323
- // B.createBuiltin(cleanupLoc, builtinName, resultTy, /*subs*/{},
324
- // { selfValue.getValue() });
325
- // }
326
- // }
327
- //
328
- //
329
- //
330
- // // // Additional destroy logic for actors
331
- // // {
332
- // // llvm::Optional<Identifier> builtinName;
333
- // // if (cd->isDistributedActor()) {
334
- // // builtinName = getASTContext().getIdentifier(
335
- // // getBuiltinName(BuiltinValueKind::DestroyDistributedActor));
336
- // // } else if (cd->isRootDefaultActor()) {
337
- // // builtinName = getASTContext().getIdentifier(
338
- // // getBuiltinName(BuiltinValueKind::DestroyDefaultActor));
339
- // // }
340
- // //
341
- // // if (builtinName.hasValue()) {
342
- // // auto resultTy = SGM.Types.getEmptyTupleType();
343
- // // B.createBuiltin(cleanupLoc, *builtinName, resultTy, /*subs*/ {},
344
- // // {selfValue.getValue()});
345
- // // }
346
- // // }
347
- // }
348
-
349
-
350
228
void SILGenFunction::emitObjCDestructor (SILDeclRef dtor) {
351
229
auto dd = cast<DestructorDecl>(dtor.getDecl ());
352
230
auto cd = cast<ClassDecl>(dd->getDeclContext ());
0 commit comments