@@ -3319,18 +3319,26 @@ using SingletonMetadataCache =
3319
3319
template <typename Runtime>
3320
3320
struct TargetResilientClassMetadataPattern ;
3321
3321
3322
- // / An instantiation pattern for non-generic resilient class metadata.
3323
- // / Used in conjunction with SingletonMetadataInitialization .
3322
+ // / A function for allocating metadata for a resilient class, calculating
3323
+ // / the correct metadata size at runtime .
3324
3324
using MetadataRelocator =
3325
3325
Metadata *(const TargetTypeContextDescriptor<InProcess> *type,
3326
3326
const TargetResilientClassMetadataPattern<InProcess> *pattern);
3327
3327
3328
3328
// / An instantiation pattern for non-generic resilient class metadata.
3329
+ // /
3330
+ // / Used for classes with resilient ancestry, that is, where at least one
3331
+ // / ancestor is defined in a different resilience domain.
3332
+ // /
3333
+ // / The hasResilientSuperclass() flag in the class context descriptor is
3334
+ // / set in this case, and hasSingletonMetadataInitialization() must be
3335
+ // / set as well.
3336
+ // /
3337
+ // / The pattern is referenced from the SingletonMetadataInitialization
3338
+ // / record in the class context descriptor.
3329
3339
template <typename Runtime>
3330
3340
struct TargetResilientClassMetadataPattern {
3331
- // / If the class descriptor's hasResilientSuperclass() flag is set,
3332
- // / this field instead points at a function that allocates metadata
3333
- // / with the correct size at runtime.
3341
+ // / A function that allocates metadata with the correct size at runtime.
3334
3342
TargetRelativeDirectPointer<Runtime, MetadataRelocator> RelocationFunction;
3335
3343
3336
3344
// / The heap-destructor function.
@@ -3371,17 +3379,19 @@ struct TargetSingletonMetadataInitialization {
3371
3379
IncompleteMetadata;
3372
3380
3373
3381
// / If the class descriptor's hasResilientSuperclass() flag is set,
3374
- // / this field instead points at a function that allocates metadata
3375
- // / with the correct size at runtime.
3382
+ // / this field instead points at a pattern used to allocate and
3383
+ // / initialize metadata for this class, since it's size and contents
3384
+ // / is not known at compile time.
3376
3385
TargetRelativeDirectPointer<Runtime, TargetResilientClassMetadataPattern<Runtime>>
3377
3386
ResilientPattern;
3378
3387
};
3379
3388
3380
- // / The completion function. The pattern will always be null.
3389
+ // / The completion function. The pattern will always be null, even
3390
+ // / for a resilient class.
3381
3391
TargetRelativeDirectPointer<Runtime, MetadataCompleter>
3382
3392
CompletionFunction;
3383
3393
3384
- bool hasRelocationFunction (
3394
+ bool hasResilientClassPattern (
3385
3395
const TargetTypeContextDescriptor<Runtime> *description) const {
3386
3396
auto *classDescription =
3387
3397
dyn_cast<TargetClassDescriptor<Runtime>>(description);
@@ -3391,7 +3401,7 @@ struct TargetSingletonMetadataInitialization {
3391
3401
3392
3402
TargetMetadata<Runtime> *allocate (
3393
3403
const TargetTypeContextDescriptor<Runtime> *description) const {
3394
- if (hasRelocationFunction (description)) {
3404
+ if (hasResilientClassPattern (description)) {
3395
3405
return ResilientPattern->RelocationFunction (description,
3396
3406
ResilientPattern.get ());
3397
3407
}
0 commit comments