@@ -226,27 +226,23 @@ class Callee {
226
226
CanType OrigFormalInterfaceType;
227
227
CanAnyFunctionType SubstFormalType;
228
228
Optional<SILLocation> SpecializeLoc;
229
- bool IsTransparent;
230
229
bool HasSubstitutions = false ;
231
230
232
231
// The pointer back to the AST node that produced the callee.
233
232
SILLocation Loc;
234
233
235
234
236
- public:
237
- void setTransparent (bool T) { IsTransparent = T; }
238
235
private:
239
236
240
237
Callee (ManagedValue indirectValue,
241
238
CanType origFormalType,
242
239
CanAnyFunctionType substFormalType,
243
- bool isTransparent, SILLocation L)
240
+ SILLocation L)
244
241
: kind(Kind::IndirectValue),
245
242
IndirectValue (indirectValue),
246
243
OrigFormalOldType(origFormalType),
247
244
OrigFormalInterfaceType(origFormalType),
248
245
SubstFormalType(substFormalType),
249
- IsTransparent(isTransparent),
250
246
Loc(L)
251
247
{}
252
248
@@ -273,7 +269,6 @@ class Callee {
273
269
OrigFormalInterfaceType(getConstantFormalInterfaceType(gen, SILValue(),
274
270
standaloneFunction)),
275
271
SubstFormalType(substFormalType),
276
- IsTransparent(standaloneFunction.isTransparent()),
277
272
Loc(l)
278
273
{
279
274
}
@@ -289,7 +284,6 @@ class Callee {
289
284
OrigFormalInterfaceType(getConstantFormalInterfaceType(gen, selfValue,
290
285
methodName)),
291
286
SubstFormalType(substFormalType),
292
- IsTransparent(false ),
293
287
Loc(l)
294
288
{
295
289
}
@@ -419,12 +413,11 @@ class Callee {
419
413
static Callee forIndirect (ManagedValue indirectValue,
420
414
CanType origFormalType,
421
415
CanAnyFunctionType substFormalType,
422
- bool isTransparent,
423
416
SILLocation l) {
424
417
return Callee (indirectValue,
425
418
origFormalType,
426
419
substFormalType,
427
- isTransparent, l);
420
+ l);
428
421
}
429
422
static Callee forDirect (SILGenFunction &gen, SILDeclRef c,
430
423
CanAnyFunctionType substFormalType,
@@ -514,7 +507,6 @@ class Callee {
514
507
getAtUncurryLevel (SILGenFunction &gen, unsigned level) const {
515
508
ManagedValue mv;
516
509
ApplyOptions options = ApplyOptions::None;
517
- if (IsTransparent) options |= ApplyOptions::Transparent;
518
510
SILConstantInfo constantInfo;
519
511
Optional<SILDeclRef> constant = None;
520
512
@@ -528,8 +520,6 @@ class Callee {
528
520
case Kind::StandaloneFunction: {
529
521
assert (level <= StandaloneFunction.uncurryLevel
530
522
&& " uncurrying past natural uncurry level of standalone function" );
531
- if (level < StandaloneFunction.uncurryLevel )
532
- options -= ApplyOptions::Transparent;
533
523
constant = StandaloneFunction.atUncurryLevel (level);
534
524
535
525
// If we're currying a direct reference to a class-dispatched method,
@@ -554,7 +544,6 @@ class Callee {
554
544
if (level < Method.MethodName .uncurryLevel ) {
555
545
SILValue ref = gen.emitGlobalFunctionRef (Loc, *constant, constantInfo);
556
546
mv = ManagedValue::forUnmanaged (ref);
557
- options -= ApplyOptions::Transparent;
558
547
break ;
559
548
}
560
549
@@ -596,7 +585,6 @@ class Callee {
596
585
if (level < Method.MethodName .uncurryLevel ) {
597
586
SILValue ref = gen.emitGlobalFunctionRef (Loc, *constant, constantInfo);
598
587
mv = ManagedValue::forUnmanaged (ref);
599
- options -= ApplyOptions::Transparent;
600
588
break ;
601
589
}
602
590
@@ -925,39 +913,16 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
925
913
926
914
// / Fall back to an unknown, indirect callee.
927
915
void visitExpr (Expr *e) {
928
- // This marks all calls to auto closure typed variables as transparent.
929
- // As of writing, local variable auto closures are currently allowed by
930
- // the parser, but the plan is that they will be disallowed, so this will
931
- // actually only apply to auto closure parameters, which is what we want
932
- auto *t = e->getType ()->castTo <AnyFunctionType>();
933
- bool isTransparent = t->getExtInfo ().isAutoClosure ();
934
-
935
916
ManagedValue fn = SGF.emitRValueAsSingleValue (e);
936
917
auto origType = cast<AnyFunctionType>(e->getType ()->getCanonicalType ());
937
- setCallee (Callee::forIndirect (fn, origType, getSubstFnType (), isTransparent,
938
- e));
918
+ setCallee (Callee::forIndirect (fn, origType, getSubstFnType (), e));
939
919
}
940
920
941
921
void visitLoadExpr (LoadExpr *e) {
942
- bool isTransparent = false ;
943
- if (DeclRefExpr *d = dyn_cast<DeclRefExpr>(e->getSubExpr ())) {
944
- // This marks all calls to auto closure typed variables as transparent.
945
- // As of writing, local variable auto closures are currently allowed by
946
- // the parser, but the plan is that they will be disallowed, so this will
947
- // actually only apply to auto closure parameters, which is what we want
948
- Type Ty = d->getDecl ()->getType ()->getInOutObjectType ();
949
-
950
- // If the decl type is a function type, figure out if it is an auto
951
- // closure.
952
- if (auto *AnyF = Ty->getAs <AnyFunctionType>()) {
953
- isTransparent = AnyF->getExtInfo ().isAutoClosure ();
954
- }
955
- }
956
922
// TODO: preserve the function pointer at its original abstraction level
957
923
ManagedValue fn = SGF.emitRValueAsSingleValue (e);
958
924
auto origType = cast<AnyFunctionType>(e->getType ()->getCanonicalType ());
959
- setCallee (Callee::forIndirect (fn, origType, getSubstFnType (),
960
- isTransparent, e));
925
+ setCallee (Callee::forIndirect (fn, origType, getSubstFnType (), e));
961
926
}
962
927
963
928
// / Add a call site to the curry.
@@ -1538,11 +1503,6 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1538
1503
: SILDeclRef::Kind::Initializer,
1539
1504
SILDeclRef::ConstructAtBestResilienceExpansion),
1540
1505
getSubstFnType (useAllocatingCtor), fn));
1541
- // In direct peer delegation cases, do not mark the apply as @transparent
1542
- // even if the underlying implementation is @transparent. This is a hack
1543
- // but is important because transparent inlining happends before DI, and
1544
- // DI needs to see the call to the delegated constructor.
1545
- ApplyCallee->setTransparent (false );
1546
1506
}
1547
1507
1548
1508
// Set up the substitutions, if we have any.
0 commit comments