@@ -3085,7 +3085,7 @@ class TargetGenericMetadataPatternTrailingObjects :
3085
3085
}
3086
3086
};
3087
3087
3088
- // / An instantiation pattern for class metadata.
3088
+ // / An instantiation pattern for generic class metadata.
3089
3089
template <typename Runtime>
3090
3090
struct TargetGenericClassMetadataPattern final :
3091
3091
TargetGenericMetadataPattern<Runtime>,
@@ -3138,7 +3138,7 @@ struct TargetGenericClassMetadataPattern final :
3138
3138
using GenericClassMetadataPattern =
3139
3139
TargetGenericClassMetadataPattern<InProcess>;
3140
3140
3141
- // / An instantiation pattern for value metadata.
3141
+ // / An instantiation pattern for generic value metadata.
3142
3142
template <typename Runtime>
3143
3143
struct TargetGenericValueMetadataPattern final :
3144
3144
TargetGenericMetadataPattern<Runtime>,
@@ -3316,10 +3316,43 @@ struct TargetInPlaceValueMetadataCache {
3316
3316
using InPlaceValueMetadataCache =
3317
3317
TargetInPlaceValueMetadataCache<InProcess>;
3318
3318
3319
+ template <typename Runtime>
3320
+ struct TargetResilientClassMetadataPattern ;
3321
+
3319
3322
// / An instantiation pattern for non-generic resilient class metadata.
3320
3323
// / Used in conjunction with InPlaceValueMetadataInitialization.
3321
3324
using MetadataRelocator =
3322
- Metadata *(const TargetTypeContextDescriptor<InProcess> *description);
3325
+ Metadata *(const TargetTypeContextDescriptor<InProcess> *type,
3326
+ const TargetResilientClassMetadataPattern<InProcess> *pattern);
3327
+
3328
+ // / An instantiation pattern for non-generic resilient class metadata.
3329
+ template <typename Runtime>
3330
+ 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.
3334
+ TargetRelativeDirectPointer<Runtime, MetadataRelocator> RelocationFunction;
3335
+
3336
+ // / The heap-destructor function.
3337
+ TargetRelativeDirectPointer<Runtime, HeapObjectDestroyer> Destroy;
3338
+
3339
+ // / The ivar-destructor function.
3340
+ TargetRelativeDirectPointer<Runtime, ClassIVarDestroyer> IVarDestroyer;
3341
+
3342
+ // / The class flags.
3343
+ ClassFlags Flags;
3344
+
3345
+ // The following fields are only present in ObjC interop.
3346
+
3347
+ // / Our ClassROData.
3348
+ TargetRelativeDirectPointer<Runtime, void > Data;
3349
+
3350
+ // / Our metaclass.
3351
+ TargetRelativeDirectPointer<Runtime, TargetAnyClassMetadata<Runtime>> Metaclass;
3352
+ };
3353
+
3354
+ using ResilientClassMetadataPattern =
3355
+ TargetResilientClassMetadataPattern<InProcess>;
3323
3356
3324
3357
// / The control structure for performing non-trivial initialization of
3325
3358
// / singleton value metadata, which is required when e.g. a non-generic
@@ -3340,8 +3373,8 @@ struct TargetInPlaceValueMetadataInitialization {
3340
3373
// / If the class descriptor's hasResilientSuperclass() flag is set,
3341
3374
// / this field instead points at a function that allocates metadata
3342
3375
// / with the correct size at runtime.
3343
- TargetRelativeDirectPointer<Runtime, MetadataRelocator >
3344
- RelocationFunction ;
3376
+ TargetRelativeDirectPointer<Runtime, TargetResilientClassMetadataPattern<Runtime> >
3377
+ ResilientPattern ;
3345
3378
};
3346
3379
3347
3380
// / The completion function. The pattern will always be null.
@@ -3358,8 +3391,10 @@ struct TargetInPlaceValueMetadataInitialization {
3358
3391
3359
3392
TargetMetadata<Runtime> *allocate (
3360
3393
const TargetTypeContextDescriptor<Runtime> *description) const {
3361
- if (hasRelocationFunction (description))
3362
- return RelocationFunction (description);
3394
+ if (hasRelocationFunction (description)) {
3395
+ return ResilientPattern->RelocationFunction (description,
3396
+ ResilientPattern.get ());
3397
+ }
3363
3398
return IncompleteMetadata.get ();
3364
3399
}
3365
3400
};
0 commit comments