IRGen: re-enable generate static arrays in read-only data sections.

So far, static arrays had to be put into a writable section, because the isa pointer and the (immortal) ref count field were initialized dynamically at the first use of such an array.

But with a new runtime library, which exports the symbols for the (immortal) ref count field and the isa pointer, it's possible to put the whole array into a read-only section. I.e. make it a constant global.

rdar://94185998

This reverts the revert commit df353ff3c0.
Also, I added a frontend option to disable this optimization: `-disable-readonly-static-objects`
This commit is contained in:
Erik Eckstein
2022-06-21 14:36:53 +02:00
parent 8b20c88914
commit 24d077e78b
13 changed files with 213 additions and 36 deletions

View File

@@ -2329,6 +2329,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Opts.NoPreallocatedInstantiationCaches = true;
}
if (Args.hasArg(OPT_disable_readonly_static_objects)) {
Opts.DisableReadonlyStaticObjects = true;
}
// Default to disabling swift async extended frame info on anything but
// darwin. Other platforms are unlikely to have support for extended frame
// pointer information.