@@ -170,6 +170,8 @@ struct SILDeclRef {
170
170
unsigned isForeign : 1 ;
171
171
// / True if this references a distributed function.
172
172
unsigned isDistributed : 1 ;
173
+ // / True if this references a back deployed entry point for the referenced decl.
174
+ unsigned isBackDeployed : 1 ;
173
175
// / The default argument index for a default argument getter.
174
176
unsigned defaultArgIndex : 10 ;
175
177
@@ -204,13 +206,15 @@ struct SILDeclRef {
204
206
205
207
// / Produces a null SILDeclRef.
206
208
SILDeclRef ()
207
- : loc(), kind(Kind::Func), isForeign(0 ), isDistributed(0 ), defaultArgIndex(0 ) {}
209
+ : loc(), kind(Kind::Func), isForeign(0 ), isDistributed(0 ),
210
+ isBackDeployed (0 ), defaultArgIndex(0 ) {}
208
211
209
212
// / Produces a SILDeclRef of the given kind for the given decl.
210
213
explicit SILDeclRef (
211
214
ValueDecl *decl, Kind kind,
212
215
bool isForeign = false ,
213
216
bool isDistributed = false ,
217
+ bool isBackDeployed = false ,
214
218
AutoDiffDerivativeFunctionIdentifier *derivativeId = nullptr );
215
219
216
220
// / Produces a SILDeclRef for the given ValueDecl or
@@ -224,7 +228,11 @@ struct SILDeclRef {
224
228
// / for the containing ClassDecl.
225
229
// / - If 'loc' is a global VarDecl, this returns its GlobalAccessor
226
230
// / SILDeclRef.
227
- explicit SILDeclRef (Loc loc, bool isForeign = false , bool isDistributed = false );
231
+ explicit SILDeclRef (
232
+ Loc loc,
233
+ bool isForeign = false ,
234
+ bool isDistributed = false ,
235
+ bool isBackDeployed = false );
228
236
229
237
// / See above put produces a prespecialization according to the signature.
230
238
explicit SILDeclRef (Loc loc, GenericSignature prespecializationSig);
@@ -360,6 +368,7 @@ struct SILDeclRef {
360
368
return loc.getOpaqueValue () == rhs.loc .getOpaqueValue () &&
361
369
kind == rhs.kind && isForeign == rhs.isForeign &&
362
370
isDistributed == rhs.isDistributed &&
371
+ isBackDeployed == rhs.isBackDeployed &&
363
372
defaultArgIndex == rhs.defaultArgIndex &&
364
373
pointer == rhs.pointer ;
365
374
}
@@ -378,6 +387,7 @@ struct SILDeclRef {
378
387
return SILDeclRef (loc.getOpaqueValue (), kind,
379
388
/* foreign=*/ foreign,
380
389
/* distributed=*/ false ,
390
+ /* backDeployed=*/ false ,
381
391
defaultArgIndex,
382
392
pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
383
393
}
@@ -387,6 +397,17 @@ struct SILDeclRef {
387
397
return SILDeclRef (loc.getOpaqueValue (), kind,
388
398
/* foreign=*/ false ,
389
399
/* distributed=*/ distributed,
400
+ /* backDeployed=*/ false ,
401
+ defaultArgIndex,
402
+ pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
403
+ }
404
+ // / Returns the back deployment entry point corresponding to the same
405
+ // / decl.
406
+ SILDeclRef asBackDeployed (bool backDeployed = true ) const {
407
+ return SILDeclRef (loc.getOpaqueValue (), kind,
408
+ /* foreign=*/ false ,
409
+ /* distributed=*/ false ,
410
+ /* backDeployed=*/ backDeployed,
390
411
defaultArgIndex,
391
412
pointer.get <AutoDiffDerivativeFunctionIdentifier *>());
392
413
}
@@ -431,6 +452,10 @@ struct SILDeclRef {
431
452
// / True if the decl ref references a thunk handling potentially distributed actor functions
432
453
bool isDistributedThunk () const ;
433
454
455
+ // / True if the decl ref references a thunk handling a call to a back deployed
456
+ // / function.
457
+ bool isBackDeployedThunk () const ;
458
+
434
459
// / True if the decl ref references a method which introduces a new vtable
435
460
// / entry.
436
461
bool requiresNewVTableEntry () const ;
@@ -508,11 +533,12 @@ struct SILDeclRef {
508
533
explicit SILDeclRef (void *opaqueLoc, Kind kind,
509
534
bool isForeign,
510
535
bool isDistributed,
536
+ bool isBackDeployed,
511
537
unsigned defaultArgIndex,
512
538
AutoDiffDerivativeFunctionIdentifier *derivativeId)
513
539
: loc(Loc::getFromOpaqueValue(opaqueLoc)), kind(kind),
514
540
isForeign(isForeign), isDistributed(isDistributed),
515
- defaultArgIndex(defaultArgIndex),
541
+ isBackDeployed(isBackDeployed), defaultArgIndex(defaultArgIndex),
516
542
pointer(derivativeId) {}
517
543
};
518
544
@@ -534,12 +560,12 @@ template<> struct DenseMapInfo<swift::SILDeclRef> {
534
560
using UnsignedInfo = DenseMapInfo<unsigned >;
535
561
536
562
static SILDeclRef getEmptyKey () {
537
- return SILDeclRef (PointerInfo::getEmptyKey (), Kind::Func, false , false , 0 ,
538
- nullptr );
563
+ return SILDeclRef (PointerInfo::getEmptyKey (), Kind::Func, false , false ,
564
+ false , 0 , nullptr );
539
565
}
540
566
static SILDeclRef getTombstoneKey () {
541
567
return SILDeclRef (PointerInfo::getTombstoneKey (), Kind::Func, false , false ,
542
- 0 , nullptr );
568
+ false , 0 , nullptr );
543
569
}
544
570
static unsigned getHashValue (swift::SILDeclRef Val) {
545
571
unsigned h1 = PointerInfo::getHashValue (Val.loc .getOpaqueValue ());
@@ -550,7 +576,9 @@ template<> struct DenseMapInfo<swift::SILDeclRef> {
550
576
unsigned h4 = UnsignedInfo::getHashValue (Val.isForeign );
551
577
unsigned h5 = PointerInfo::getHashValue (Val.pointer .getOpaqueValue ());
552
578
unsigned h6 = UnsignedInfo::getHashValue (Val.isDistributed );
553
- return h1 ^ (h2 << 4 ) ^ (h3 << 9 ) ^ (h4 << 7 ) ^ (h5 << 11 ) ^ (h6 << 8 );
579
+ unsigned h7 = UnsignedInfo::getHashValue (Val.isBackDeployed );
580
+ return h1 ^ (h2 << 4 ) ^ (h3 << 9 ) ^ (h4 << 7 ) ^ (h5 << 11 ) ^ (h6 << 8 ) ^
581
+ (h7 << 10 );
554
582
}
555
583
static bool isEqual (swift::SILDeclRef const &LHS,
556
584
swift::SILDeclRef const &RHS) {
0 commit comments