File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2721,7 +2721,12 @@ static void initClassFieldOffsetVector(ClassMetadata *self,
2721
2721
// situations where our entire superclass hierarchy is defined
2722
2722
// in Swift. (But note that ObjC might think we have a superclass
2723
2723
// even if Swift doesn't, because of SwiftObject.)
2724
- rodata->InstanceStart = size;
2724
+ //
2725
+ // The rodata may be in read-only memory if the compiler knows that the size
2726
+ // it generates is already definitely correct. Don't write to this value
2727
+ // unless it's necessary.
2728
+ if (rodata->InstanceStart != size)
2729
+ rodata->InstanceStart = size;
2725
2730
#endif
2726
2731
2727
2732
// Okay, now do layout.
@@ -2745,7 +2750,8 @@ static void initClassFieldOffsetVector(ClassMetadata *self,
2745
2750
2746
2751
#if SWIFT_OBJC_INTEROP
2747
2752
// Save the size into the Objective-C metadata as well.
2748
- rodata->InstanceSize = size;
2753
+ if (rodata->InstanceSize != size)
2754
+ rodata->InstanceSize = size;
2749
2755
#endif
2750
2756
}
2751
2757
You can’t perform that action at this time.
0 commit comments