Fix SIL serialization of witness tables and protocol witness thunks #10380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Serialize witness tables only if it -sil-serialize-all or -sil-serialize-witness-tables options are provided, which should happen only when building the stdlib and overlays, or it is a compilation with explicitly enabled resilience support. Disable serialization of witness tables in all other cases.
Disabling the serialization of witness tables also avoids serialization of protocol witness thunks, whose serialization in 3rd party code sometimes resulted in performance degradation, because resilience checking rules used by many parts of the compiler would prohibit certain optimizations like inlining or specialization, if the caller was serialized and the callee would not be serialized.
This should fix rdar://32718853 and address rdar://32743391