Skip to content

Commit 05a17cc

Browse files
authored
Enable -disable-preallocated-instantiation-caches for the freestanding stdlib (#41170)
1 parent a268f02 commit 05a17cc

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

stdlib/cmake/modules/StdlibOptions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ option(SWIFT_STDLIB_PASSTHROUGH_METADATA_ALLOCATOR
139139
"Build stdlib without a custom implementation of MetadataAllocator, relying on malloc+free instead."
140140
FALSE)
141141

142+
option(SWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES
143+
"Build stdlib with -disable-preallocated-instantiation-caches"
144+
FALSE)
145+
142146
option(SWIFT_STDLIB_HAS_COMMANDLINE
143147
"Build stdlib with the CommandLine enum and support for argv/argc."
144148
TRUE)

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,10 @@ function(_compile_swift_files
526526
list(APPEND swift_flags "-experimental-hermetic-seal-at-link")
527527
endif()
528528

529+
if(SWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES)
530+
list(APPEND swift_flags "-Xfrontend -disable-preallocated-instantiation-caches")
531+
endif()
532+
529533
list(APPEND swift_flags ${SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS})
530534

531535
list(APPEND swift_flags ${SWIFT_EXPERIMENTAL_EXTRA_FLAGS})

test/lit.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,9 @@ if run_vendor == 'apple':
10021002
if not config.swift_freestanding_is_darwin:
10031003
swift_execution_tests_extra_flags += ' -experimental-hermetic-seal-at-link -lto=llvm-full'
10041004

1005+
if not config.swift_freestanding_is_darwin:
1006+
swift_execution_tests_extra_flags += ' -Xfrontend -disable-preallocated-instantiation-caches'
1007+
10051008
# Build a resource dir for freestanding tests.
10061009
new_resource_dir = os.path.join(config.test_exec_root, "resource_dir")
10071010
if not os.path.exists(new_resource_dir): os.mkdir(new_resource_dir)

utils/build-presets.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,6 +2527,7 @@ swift-stdlib-enable-prespecialization=0
25272527
swift-stdlib-passthrough-metadata-allocator=1
25282528
swift-stdlib-short-mangling-lookups=0
25292529
swift-stdlib-experimental-hermetic-seal-at-link=1
2530+
swift-stdlib-disable-instantiation-caches=1
25302531
swift-stdlib-has-type-printing=0
25312532

25322533
[preset: stdlib_S_standalone_minimal_macho_x86_64,build]

utils/build-script-impl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ KNOWN_SETTINGS=(
219219
swift-stdlib-passthrough-metadata-allocator "0" "whether stdlib should be built without a custom implementation of MetadataAllocator, relying on malloc+free instead"
220220
swift-stdlib-short-mangling-lookups "1" "whether to build stdlib with fast-path context descriptor lookups based on well-known short manglings"
221221
swift-stdlib-experimental-hermetic-seal-at-link "0" "whether stdlib should be built with -experimental-hermetic-seal-at-link"
222+
swift-stdlib-disable-instantiation-caches "0" "whether to build stdlib with -disable-preallocated-instantiation-caches"
222223
swift-stdlib-has-type-printing "1" "whether stdlib should support printing user-friendly type name as strings at runtime"
223224
swift-disable-dead-stripping "0" "turns off Darwin-specific dead stripping for Swift host tools"
224225
common-swift-flags "" "Flags used for Swift targets other than the stdlib, like the corelibs"
@@ -2010,6 +2011,7 @@ for host in "${ALL_HOSTS[@]}"; do
20102011
-DSWIFT_STDLIB_SHORT_MANGLING_LOOKUPS:BOOL=$(true_false "${SWIFT_STDLIB_SHORT_MANGLING_LOOKUPS}")
20112012
-DSWIFT_STDLIB_HAS_TYPE_PRINTING:BOOL=$(true_false "${SWIFT_STDLIB_HAS_TYPE_PRINTING}")
20122013
-DSWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK:BOOL=$(true_false "${SWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK}")
2014+
-DSWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES:BOOL=$(true_false "${SWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES}")
20132015
-DSWIFT_NATIVE_LLVM_TOOLS_PATH:STRING="${native_llvm_tools_path}"
20142016
-DSWIFT_NATIVE_CLANG_TOOLS_PATH:STRING="${native_clang_tools_path}"
20152017
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH:STRING="${native_swift_tools_path}"

0 commit comments

Comments
 (0)