mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Conformance manglings, which are used for witness tables and related witness thunks, mangle the generic signature of the conformance. Since conformances also describe the conforming type, mangle the conformances's generic signature relative to the conforming type's generic signature. In practice, this means that we don't mangle any part of the generic signature into a conformance mangling now, so we see a decent win: 2.3% smaller trie and 6.4% smaller strings section in the standard library binary. When conditional conformances land, we'll see some generic signatures mangling again (for the additional requirements of the constrained extension).
51 lines
1.1 KiB
Plaintext
Executable File
51 lines
1.1 KiB
Plaintext
Executable File
// RUN: %target-swift-frontend %s -module-name=test -emit-ir | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
protocol P {
|
|
}
|
|
|
|
struct PBox<T> where T : P {
|
|
init()
|
|
}
|
|
|
|
protocol HasSimpleAssoc {
|
|
associatedtype Assoc
|
|
}
|
|
|
|
protocol DerivedFromSimpleAssoc : HasSimpleAssoc {
|
|
}
|
|
|
|
struct GenericComputed<T> : DerivedFromSimpleAssoc where T : P {
|
|
typealias Assoc = PBox<T>
|
|
init()
|
|
}
|
|
|
|
sil_witness_table shared [serialized] <T where T : P> GenericComputed<T>: DerivedFromSimpleAssoc module nix {
|
|
base_protocol HasSimpleAssoc: <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix
|
|
}
|
|
|
|
sil_witness_table shared [serialized] <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix {
|
|
associated_type Assoc: PBox<T>
|
|
}
|
|
|
|
sil_default_witness_table hidden P {
|
|
}
|
|
|
|
sil_default_witness_table hidden HasSimpleAssoc {
|
|
no_default
|
|
}
|
|
|
|
sil_default_witness_table hidden DerivedFromSimpleAssoc {
|
|
no_default
|
|
}
|
|
|
|
// CHECK: @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWG = internal constant
|
|
// CHECK: define internal void @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWI
|
|
|
|
|