Skip to content

Commit cf929d6

Browse files
authored
---
yaml --- r: 345570 b: refs/heads/master c: dbdfb5e h: refs/heads/master
1 parent 34aee8c commit cf929d6

File tree

68 files changed

+1009
-608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1009
-608
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bc622b8fa64ef0d4307d9e115df0642f3443fbd8
2+
refs/heads/master: dbdfb5e1d9a6277b69015772d5bb61d0f99ceac5
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ function(_add_variant_link_flags)
416416
endif()
417417
swift_windows_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
418418
list(APPEND library_search_directories ${${LFLAGS_ARCH}_LIB})
419+
420+
# NOTE(compnerd) workaround incorrectly extensioned import libraries from
421+
# the Windows SDK on case sensitive file systems.
422+
list(APPEND library_search_directories
423+
${CMAKE_BINARY_DIR}/winsdk_lib_${LFLAGS_ARCH}_symlinks)
419424
elseif("${LFLAGS_SDK}" STREQUAL "HAIKU")
420425
list(APPEND result "-lbsd" "-latomic" "-Wl,-Bsymbolic")
421426
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")

trunk/cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ function(_report_sdk prefix)
6262
endif()
6363
endif()
6464
message(STATUS " Object Format: ${SWIFT_SDK_${prefix}_OBJECT_FORMAT}")
65-
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
66-
if(SWIFT_SDK_${prefix}_ARCH_${arch}_LINKER)
67-
message(STATUS " Linker (${arch}): ${SWIFT_SDK_${prefix}_ARCH_${arch}_LINKER}")
68-
else()
69-
message(STATUS " Linker (${arch}): ${CMAKE_LINKER}")
70-
endif()
71-
endforeach()
7265

7366
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
7467
message(STATUS
@@ -205,11 +198,6 @@ macro(configure_sdk_unix name architectures)
205198
endif()
206199
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH
207200
"${SWIFT_ANDROID_NDK_PATH}/toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${_swift_android_prebuilt_build}")
208-
209-
# Resolve the correct linker based on the file name of CMAKE_LINKER (being 'ld' or 'ld.gold' the options)
210-
get_filename_component(SWIFT_ANDROID_LINKER_NAME "${CMAKE_LINKER}" NAME)
211-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_LINKER
212-
"${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH}/bin/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_LINKER_NAME}")
213201
else()
214202
if(NOT SWIFT_SDK_${prefix}_ARCH_${arch}_PATH)
215203
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/")
@@ -282,6 +270,26 @@ macro(configure_sdk_windows name environment architectures)
282270
# to the driver -- rely on the `INCLUDE` AND `LIB` environment variables
283271
# instead.
284272
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/")
273+
274+
# NOTE(compnerd) workaround incorrectly extensioned import libraries from
275+
# the Windows SDK on case sensitive file systems.
276+
swift_windows_arch_spelling(${arch} WinSDKArchitecture)
277+
set(WinSDK${arch}UMDir "$ENV{UniversalCRTSdkDir}/Lib/$ENV{UCRTVersion}/um/${WinSDKArchitecture}")
278+
set(OverlayDirectory "${CMAKE_BINARY_DIR}/winsdk_lib_${arch}_symlinks")
279+
280+
file(MAKE_DIRECTORY ${OverlayDirectory})
281+
282+
file(GLOB libraries RELATIVE "${WinSDK${arch}UMDir}" "${WinSDK${arch}UMDir}/*")
283+
foreach(library ${libraries})
284+
get_filename_component(name_we "${library}" NAME_WE)
285+
get_filename_component(ext "${library}" EXT)
286+
string(TOLOWER "${ext}" lowercase_ext)
287+
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
288+
if(NOT library STREQUAL lowercase_ext_symlink_name)
289+
execute_process(COMMAND
290+
"${CMAKE_COMMAND}" -E create_symlink "${WinSDK${arch}UMDir}/${library}" "${OverlayDirectory}/${lowercase_ext_symlink_name}")
291+
endif()
292+
endforeach()
285293
endforeach()
286294

287295
# Add this to the list of known SDKs.

trunk/docs/ABI/Mangling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Globals
8686

8787
global ::= protocol-conformance 'WG' // generic protocol witness table
8888
global ::= protocol-conformance 'Wp' // protocol witness table pattern
89-
global ::= protocol-conformance 'Wr' // resilient witness table
89+
global ::= protocol-conformance 'Wr' // resilient witness table (HISTORICAL)
9090
global ::= protocol-conformance 'WI' // generic protocol witness table instantiation function
9191
global ::= type protocol-conformance 'WL' // lazy protocol witness table cache variable
9292

trunk/include/swift/ABI/Metadata.h

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,17 +2013,9 @@ struct TargetGenericWitnessTable {
20132013
/// to require instantiation.
20142014
uint16_t WitnessTablePrivateSizeInWordsAndRequiresInstantiation;
20152015

2016-
/// The protocol descriptor. Only used for resilient conformances.
2017-
RelativeIndirectablePointer<ProtocolDescriptor,
2018-
/*nullable*/ true> Protocol;
2019-
20202016
/// The pattern.
20212017
RelativeDirectPointer<const TargetWitnessTable<Runtime>> Pattern;
20222018

2023-
/// The resilient witness table, if any.
2024-
RelativeDirectPointer<const TargetResilientWitnessTable<Runtime>,
2025-
/*nullable*/ true> ResilientWitnesses;
2026-
20272019
/// The instantiation function, which is called after the template is copied.
20282020
RelativeDirectPointer<void(TargetWitnessTable<Runtime> *instantiatedTable,
20292021
const TargetMetadata<Runtime> *type,
@@ -2044,6 +2036,18 @@ struct TargetGenericWitnessTable {
20442036
uint16_t requiresInstantiation() const {
20452037
return WitnessTablePrivateSizeInWordsAndRequiresInstantiation & 0x01;
20462038
}
2039+
2040+
/// Retrieve the protocol conformance descriptor.
2041+
ConstTargetPointer<Runtime, TargetProtocolConformanceDescriptor<Runtime>>
2042+
getConformance() const {
2043+
return Pattern->Description;
2044+
}
2045+
2046+
/// Retrieve the protocol.
2047+
ConstTargetPointer<Runtime, TargetProtocolDescriptor<Runtime>>
2048+
getProtocol() const {
2049+
return Pattern->Description->getProtocol();
2050+
}
20472051
};
20482052
using GenericWitnessTable = TargetGenericWitnessTable<InProcess>;
20492053

@@ -2222,6 +2226,14 @@ struct TargetTypeReference {
22222226
};
22232227
using TypeReference = TargetTypeReference<InProcess>;
22242228

2229+
/// Header containing information about the resilient witnesses in a
2230+
/// protocol conformance descriptor.
2231+
template <typename Runtime>
2232+
struct TargetResilientWitnessesHeader {
2233+
uint32_t NumWitnesses;
2234+
};
2235+
using ResilientWitnessesHeader = TargetResilientWitnessesHeader<InProcess>;
2236+
22252237
/// The structure of a protocol conformance.
22262238
///
22272239
/// This contains enough static information to recover the witness table for a
@@ -2231,12 +2243,16 @@ struct TargetProtocolConformanceDescriptor final
22312243
: public swift::ABI::TrailingObjects<
22322244
TargetProtocolConformanceDescriptor<Runtime>,
22332245
RelativeContextPointer<Runtime>,
2234-
TargetGenericRequirementDescriptor<Runtime>> {
2246+
TargetGenericRequirementDescriptor<Runtime>,
2247+
TargetResilientWitnessesHeader<Runtime>,
2248+
TargetResilientWitness<Runtime>> {
22352249

22362250
using TrailingObjects = swift::ABI::TrailingObjects<
22372251
TargetProtocolConformanceDescriptor<Runtime>,
22382252
RelativeContextPointer<Runtime>,
2239-
TargetGenericRequirementDescriptor<Runtime>>;
2253+
TargetGenericRequirementDescriptor<Runtime>,
2254+
TargetResilientWitnessesHeader<Runtime>,
2255+
TargetResilientWitness<Runtime>>;
22402256
friend TrailingObjects;
22412257

22422258
template<typename T>
@@ -2250,6 +2266,9 @@ struct TargetProtocolConformanceDescriptor final
22502266
using GenericRequirementDescriptor =
22512267
TargetGenericRequirementDescriptor<Runtime>;
22522268

2269+
using ResilientWitnessesHeader = TargetResilientWitnessesHeader<Runtime>;
2270+
using ResilientWitness = TargetResilientWitness<Runtime>;
2271+
22532272
private:
22542273
/// The protocol being conformed to.
22552274
RelativeIndirectablePointer<ProtocolDescriptor> Protocol;
@@ -2271,7 +2290,8 @@ struct TargetProtocolConformanceDescriptor final
22712290
ConformanceFlags Flags;
22722291

22732292
public:
2274-
const ProtocolDescriptor *getProtocol() const {
2293+
ConstTargetPointer<Runtime, TargetProtocolDescriptor<Runtime>>
2294+
getProtocol() const {
22752295
return Protocol;
22762296
}
22772297

@@ -2345,6 +2365,16 @@ struct TargetProtocolConformanceDescriptor final
23452365
const swift::TargetWitnessTable<Runtime> *
23462366
getWitnessTable(const TargetMetadata<Runtime> *type) const;
23472367

2368+
/// Retrieve the resilient witnesses.
2369+
ArrayRef<ResilientWitness> getResilientWitnesses() const{
2370+
if (!Flags.hasResilientWitnesses())
2371+
return { };
2372+
2373+
return ArrayRef<ResilientWitness>(
2374+
this->template getTrailingObjects<ResilientWitness>(),
2375+
numTrailingObjects(OverloadToken<ResilientWitness>()));
2376+
}
2377+
23482378
#if !defined(NDEBUG) && SWIFT_OBJC_INTEROP
23492379
void dump() const;
23502380
#endif
@@ -2368,6 +2398,17 @@ struct TargetProtocolConformanceDescriptor final
23682398
size_t numTrailingObjects(OverloadToken<GenericRequirementDescriptor>) const {
23692399
return Flags.getNumConditionalRequirements();
23702400
}
2401+
2402+
size_t numTrailingObjects(OverloadToken<ResilientWitnessesHeader>) const {
2403+
return Flags.hasResilientWitnesses() ? 1 : 0;
2404+
}
2405+
2406+
size_t numTrailingObjects(OverloadToken<ResilientWitness>) const {
2407+
return Flags.hasResilientWitnesses()
2408+
? this->template getTrailingObjects<ResilientWitnessesHeader>()
2409+
->NumWitnesses
2410+
: 0;
2411+
}
23712412
};
23722413
using ProtocolConformanceDescriptor
23732414
= TargetProtocolConformanceDescriptor<InProcess>;

trunk/include/swift/ABI/MetadataValues.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ class ConformanceFlags {
627627

628628
NumConditionalRequirementsMask = 0xFF << 8,
629629
NumConditionalRequirementsShift = 8,
630+
631+
HasResilientWitnessesMask = 0x01 << 16,
630632
};
631633

632634
int_type Value;
@@ -660,6 +662,12 @@ class ConformanceFlags {
660662
| (n << NumConditionalRequirementsShift));
661663
}
662664

665+
ConformanceFlags withHasResilientWitnesses(bool hasResilientWitnesses) const {
666+
return ConformanceFlags((Value & ~HasResilientWitnessesMask)
667+
| (hasResilientWitnesses? HasResilientWitnessesMask
668+
: 0));
669+
}
670+
663671
/// Retrieve the conformance kind.
664672
ConformanceKind getConformanceKind() const {
665673
return ConformanceKind(Value & ConformanceKindMask);
@@ -696,6 +704,11 @@ class ConformanceFlags {
696704
>> NumConditionalRequirementsShift;
697705
}
698706

707+
/// Whether this conformance has any resilient witnesses.
708+
bool hasResilientWitnesses() const {
709+
return Value & HasResilientWitnessesMask;
710+
}
711+
699712
int_type getIntValue() const { return Value; }
700713
};
701714

0 commit comments

Comments
 (0)