Skip to content

Commit 9134153

Browse files
committed
Stop using -sil-serialize-all when building the standard library
We can finally get rid of -sil-serialize-all when building the standard library! This option will be completely eliminated in the future commits. Instead of serializing just everything as we did before, we now serialize only functions annotated with @_inlineable. This way we can selectively control what needs to be available to the clients. This is an important step towards building a resilient standard library. While this is a huge change for the serialization of the stdlib, it should be virtually invisible to the clients. For example, there are no noticeable performance regressions on any of the benchmarks.
1 parent e0d3175 commit 9134153

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

cmake/modules/SwiftSource.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ function(_compile_swift_files
256256
"-Xfrontend" "${GROUP_INFO_JSON_FILE}")
257257
if (NOT SWIFT_STDLIB_ENABLE_RESILIENCE)
258258
if (SWIFT_STDLIB_SIL_SERIALIZE_ALL)
259-
list(APPEND swift_flags "-Xfrontend" "-sil-serialize-all")
259+
list(APPEND swift_flags "-Xfrontend" "-sil-serialize-witness-tables"
260+
"-Xfrontend" "-sil-serialize-vtables")
260261
endif()
261262
endif()
262263
endif()

stdlib/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ add_custom_target(swift-test-stdlib ALL
9494
if(SWIFT_STDLIB_ENABLE_RESILIENCE)
9595
set(STDLIB_SIL_SERIALIZE_ALL)
9696
set(STDLIB_SIL_SERIALIZE_WITNESS_TABLES)
97+
set(STDLIB_SIL_SERIALIZE_VTABLES)
9798
else()
9899
if(SWIFT_STDLIB_SIL_SERIALIZE_ALL)
99-
set(STDLIB_SIL_SERIALIZE_ALL "-Xfrontend" "-sil-serialize-all")
100+
set(STDLIB_SIL_SERIALIZE_ALL)
100101
set(STDLIB_SIL_SERIALIZE_WITNESS_TABLES "-Xfrontend" "-sil-serialize-witness-tables")
102+
set(STDLIB_SIL_SERIALIZE_VTABLES "-Xfrontend" "-sil-serialize-vtables")
103+
list(APPEND STDLIB_SIL_SERIALIZE_ALL ${STDLIB_SIL_SERIALIZE_WITNESS_TABLES}
104+
${STDLIB_SIL_SERIALIZE_VTABLES})
101105
else()
102106
set(STDLIB_SIL_SERIALIZE_ALL)
103107
set(STDLIB_SIL_SERIALIZE_WITNESS_TABLES)
108+
set(STDLIB_SIL_SERIALIZE_VTABLES)
104109
endif()
105110
endif()
106111

stdlib/public/SDK/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if(SWIFT_BUILD_STATIC_SDK_OVERLAY)
99
endif()
1010

1111
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "${STDLIB_SIL_SERIALIZE_WITNESS_TABLES}")
12+
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "${STDLIB_SIL_SERIALIZE_VTABLES}")
1213

1314
set(all_overlays "Accelerate;AppKit;ARKit;AssetsLibrary;AVFoundation;CallKit;CloudKit;Contacts;CoreAudio;CoreData;CoreFoundation;CoreGraphics;CoreImage;CoreLocation;CoreMedia;CryptoTokenKit;Dispatch;Foundation;GameplayKit;GLKit;HomeKit;IOKit;Intents;MapKit;MediaPlayer;Metal;MetalKit;ModelIO;ObjectiveC;OpenCL;os;Photos;QuartzCore;SafariServices;SceneKit;simd;SpriteKit;UIKit;Vision;WatchKit;XCTest;XPC")
1415

0 commit comments

Comments
 (0)