Skip to content

Commit 9b81631

Browse files
committed
---
yaml --- r: 245758 b: refs/heads/marcrasi-static-assert c: dd8edef h: refs/heads/master
1 parent 5bda214 commit 9b81631

File tree

140 files changed

+10751
-60102
lines changed

Some content is hidden

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

140 files changed

+10751
-60102
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-09-20-a: 37a08a7edae5cf9ebde7866dbc974
10711071
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-09-21-a: a47bb052988de099ac2562a50cd1ee60a411e182
10721072
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-09-22-a: 141f61f3c887a81aa5d7a66e843f5e5e9a31ca02
10731073
refs/heads/anotherdayanothercommit: 983c399b25b26d80728c0bf11b12afac852768f6
1074-
refs/heads/marcrasi-static-assert: 4710c43b01a2a53a7e564c1e4baf47c58f67e203
1074+
refs/heads/marcrasi-static-assert: dd8edef2d5644c9228e8b3f5381d97f5b772dc87
10751075
refs/heads/revert-19500-updateValue-but-not-the-key: b4e27b110af0d7e3002b4f734a347f752d42b9a8
10761076
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-09-25-a: 2ed7952ddd7ef765b60efd13e169ea900ebb5e80
10771077
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-09-26-a: b7cbce34ef0921069091a65e5918640bb382a419

branches/marcrasi-static-assert/benchmark/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ set(SWIFT_BENCH_MODULES
8888
single-source/Hash
8989
single-source/HashQuadratic
9090
single-source/Histogram
91-
single-source/InsertCharacter
9291
single-source/Integrate
9392
single-source/IterateData
9493
single-source/Join

branches/marcrasi-static-assert/benchmark/single-source/InsertCharacter.swift

Lines changed: 0 additions & 98 deletions
This file was deleted.

branches/marcrasi-static-assert/benchmark/utils/main.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ import Hanoi
7676
import Hash
7777
import HashQuadratic
7878
import Histogram
79-
import InsertCharacter
8079
import Integrate
8180
import IterateData
8281
import Join
@@ -242,7 +241,6 @@ registerBenchmark(Hanoi)
242241
registerBenchmark(HashTest)
243242
registerBenchmark(HashQuadratic)
244243
registerBenchmark(Histogram)
245-
registerBenchmark(InsertCharacter)
246244
registerBenchmark(IntegrateTest)
247245
registerBenchmark(IterateData)
248246
registerBenchmark(Join)

branches/marcrasi-static-assert/docs/ABI/Mangling.rst

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

129129
global ::= protocol-conformance 'Mc' // protocol conformance descriptor
130130
global ::= protocol-conformance 'WP' // protocol witness table
131-
global ::= protocol-conformance 'Wa' // protocol witness table accessor (HISTORICAL)
131+
global ::= protocol-conformance 'Wa' // protocol witness table accessor
132132

133133
global ::= protocol-conformance 'WG' // generic protocol witness table (HISTORICAL)
134134
global ::= protocol-conformance 'Wp' // protocol witness table pattern

branches/marcrasi-static-assert/docs/GenericsManifesto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public struct ZipIterator<... Iterators : IteratorProtocol> : Iterator { // zer
346346
public mutating func next() -> Element? {
347347
if reachedEnd { return nil }
348348

349-
guard let values = (iterators.next()...) else { // call "next" on each of the iterators, put the results into a tuple named "values"
349+
guard let values = (iterators.next()...) { // call "next" on each of the iterators, put the results into a tuple named "values"
350350
reachedEnd = true
351351
return nil
352352
}

branches/marcrasi-static-assert/include/swift/ABI/Metadata.h

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,10 +2013,13 @@ struct TargetGenericWitnessTable {
20132013
/// to require instantiation.
20142014
uint16_t WitnessTablePrivateSizeInWordsAndRequiresInstantiation;
20152015

2016+
/// The pattern.
2017+
RelativeDirectPointer<const TargetWitnessTable<Runtime>> Pattern;
2018+
20162019
/// The instantiation function, which is called after the template is copied.
20172020
RelativeDirectPointer<void(TargetWitnessTable<Runtime> *instantiatedTable,
20182021
const TargetMetadata<Runtime> *type,
2019-
const void * const *instantiationArgs),
2022+
void ** const *instantiationArgs),
20202023
/*nullable*/ true> Instantiator;
20212024

20222025
using PrivateDataType = void *[swift::NumGenericMetadataPrivateDataWords];
@@ -2033,6 +2036,18 @@ struct TargetGenericWitnessTable {
20332036
uint16_t requiresInstantiation() const {
20342037
return WitnessTablePrivateSizeInWordsAndRequiresInstantiation & 0x01;
20352038
}
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+
}
20362051
};
20372052
using GenericWitnessTable = TargetGenericWitnessTable<InProcess>;
20382053

@@ -2264,8 +2279,15 @@ struct TargetProtocolConformanceDescriptor final
22642279
// Some description of the type that conforms to the protocol.
22652280
TargetTypeReference<Runtime> TypeRef;
22662281

2267-
/// The witness table pattern, which may also serve as the witness table.
2268-
RelativeDirectPointer<const TargetWitnessTable<Runtime>> WitnessTablePattern;
2282+
// The conformance, or a generator function for the conformance.
2283+
union {
2284+
/// A direct reference to the witness table for the conformance.
2285+
RelativeDirectPointer<const TargetWitnessTable<Runtime>> WitnessTable;
2286+
2287+
/// A function that produces the witness table given an instance of the
2288+
/// type.
2289+
RelativeDirectPointer<WitnessTableAccessorFn> WitnessTableAccessor;
2290+
};
22692291

22702292
/// Various flags, including the kind of conformance.
22712293
ConformanceFlags Flags;
@@ -2280,6 +2302,10 @@ struct TargetProtocolConformanceDescriptor final
22802302
return Flags.getTypeReferenceKind();
22812303
}
22822304

2305+
typename ConformanceFlags::ConformanceKind getConformanceKind() const {
2306+
return Flags.getConformanceKind();
2307+
}
2308+
22832309
const char *getDirectObjCClassName() const {
22842310
return TypeRef.getDirectObjCClassName(getTypeKind());
22852311
}
@@ -2299,18 +2325,6 @@ struct TargetProtocolConformanceDescriptor final
22992325
return this->template getTrailingObjects<RelativeContextPointer<Runtime>>();
23002326
}
23012327

2302-
/// Whether this conformance is non-unique because it has been synthesized
2303-
/// for a foreign type.
2304-
bool isSynthesizedNonUnique() const {
2305-
return Flags.isSynthesizedNonUnique();
2306-
}
2307-
2308-
/// Whether this conformance has any conditional requirements that need to
2309-
/// be evaluated.
2310-
bool hasConditionalRequirements() const {
2311-
return Flags.getNumConditionalRequirements() > 0;
2312-
}
2313-
23142328
/// Retrieve the conditional requirements that must also be
23152329
/// satisfied
23162330
llvm::ArrayRef<GenericRequirementDescriptor>
@@ -2319,12 +2333,31 @@ struct TargetProtocolConformanceDescriptor final
23192333
Flags.getNumConditionalRequirements()};
23202334
}
23212335

2322-
/// Get the directly-referenced witness table pattern, which may also
2323-
/// serve as the witness table.
2324-
const swift::TargetWitnessTable<Runtime> *getWitnessTablePattern() const {
2325-
return WitnessTablePattern;
2336+
/// Get the directly-referenced static witness table.
2337+
const swift::TargetWitnessTable<Runtime> *getStaticWitnessTable() const {
2338+
switch (getConformanceKind()) {
2339+
case ConformanceFlags::ConformanceKind::WitnessTable:
2340+
break;
2341+
2342+
case ConformanceFlags::ConformanceKind::WitnessTableAccessor:
2343+
case ConformanceFlags::ConformanceKind::ConditionalWitnessTableAccessor:
2344+
assert(false && "not witness table");
2345+
}
2346+
return WitnessTable;
23262347
}
2327-
2348+
2349+
WitnessTableAccessorFn *getWitnessTableAccessor() const {
2350+
switch (getConformanceKind()) {
2351+
case ConformanceFlags::ConformanceKind::WitnessTableAccessor:
2352+
case ConformanceFlags::ConformanceKind::ConditionalWitnessTableAccessor:
2353+
break;
2354+
2355+
case ConformanceFlags::ConformanceKind::WitnessTable:
2356+
assert(false && "not witness table accessor");
2357+
}
2358+
return WitnessTableAccessor;
2359+
}
2360+
23282361
/// Get the canonical metadata for the type referenced by this record, or
23292362
/// return null if the record references a generic or universal type.
23302363
const TargetMetadata<Runtime> *getCanonicalTypeMetadata() const;

branches/marcrasi-static-assert/include/swift/ABI/MetadataValues.h

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,24 @@ class ConformanceFlags {
600600
public:
601601
typedef uint32_t int_type;
602602

603+
enum class ConformanceKind {
604+
/// A direct reference to a protocol witness table.
605+
WitnessTable,
606+
/// A function pointer that can be called to access the protocol witness
607+
/// table.
608+
WitnessTableAccessor,
609+
/// A function pointer that can be called to access the protocol witness
610+
/// table whose conformance is conditional on additional requirements that
611+
/// must first be evaluated and then provided to the accessor function.
612+
ConditionalWitnessTableAccessor,
613+
614+
First_Kind = WitnessTable,
615+
Last_Kind = ConditionalWitnessTableAccessor,
616+
};
617+
603618
private:
604619
enum : int_type {
605-
UnusedLowBits = 0x07, // historical conformance kind
620+
ConformanceKindMask = 0x07, // 8 conformance kinds
606621

607622
TypeMetadataKindMask = 0x7 << 3, // 8 type reference kinds
608623
TypeMetadataKindShift = 3,
@@ -622,6 +637,10 @@ class ConformanceFlags {
622637
public:
623638
ConformanceFlags(int_type value = 0) : Value(value) {}
624639

640+
ConformanceFlags withConformanceKind(ConformanceKind kind) const {
641+
return ConformanceFlags((Value & ~ConformanceKindMask) | int_type(kind));
642+
}
643+
625644
ConformanceFlags withTypeReferenceKind(TypeReferenceKind kind) const {
626645
return ConformanceFlags((Value & ~TypeMetadataKindMask)
627646
| (int_type(kind) << TypeMetadataKindShift));
@@ -658,6 +677,11 @@ class ConformanceFlags {
658677
: 0));
659678
}
660679

680+
/// Retrieve the conformance kind.
681+
ConformanceKind getConformanceKind() const {
682+
return ConformanceKind(Value & ConformanceKindMask);
683+
}
684+
661685
/// Retrieve the type reference kind kind.
662686
TypeReferenceKind getTypeReferenceKind() const {
663687
return TypeReferenceKind(
@@ -856,11 +880,7 @@ using FunctionTypeFlags = TargetFunctionTypeFlags<size_t>;
856880

857881
template <typename int_type>
858882
class TargetParameterTypeFlags {
859-
enum : int_type {
860-
ValueOwnershipMask = 0x7F,
861-
VariadicMask = 0x80,
862-
AutoClosureMask = 0x100,
863-
};
883+
enum : int_type { ValueOwnershipMask = 0x7F, VariadicMask = 0x80 };
864884
int_type Data;
865885

866886
constexpr TargetParameterTypeFlags(int_type Data) : Data(Data) {}
@@ -880,15 +900,8 @@ class TargetParameterTypeFlags {
880900
(isVariadic ? VariadicMask : 0));
881901
}
882902

883-
constexpr TargetParameterTypeFlags<int_type>
884-
withAutoClosure(bool isAutoClosure) const {
885-
return TargetParameterTypeFlags<int_type>(
886-
(Data & ~AutoClosureMask) | (isAutoClosure ? AutoClosureMask : 0));
887-
}
888-
889903
bool isNone() const { return Data == 0; }
890904
bool isVariadic() const { return Data & VariadicMask; }
891-
bool isAutoClosure() const { return Data & AutoClosureMask; }
892905

893906
ValueOwnership getValueOwnership() const {
894907
return (ValueOwnership)(Data & ValueOwnershipMask);

branches/marcrasi-static-assert/include/swift/AST/Decl.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,7 @@ class alignas(1 << DeclAlignInBits) Decl {
463463
HasStubImplementation : 1
464464
);
465465

466-
SWIFT_INLINE_BITFIELD_EMPTY(TypeDecl, ValueDecl);
467-
SWIFT_INLINE_BITFIELD_EMPTY(AbstractTypeParamDecl, TypeDecl);
466+
SWIFT_INLINE_BITFIELD_EMPTY(AbstractTypeParamDecl, ValueDecl);
468467

469468
SWIFT_INLINE_BITFIELD_FULL(GenericTypeParamDecl, AbstractTypeParamDecl, 16+16,
470469
: NumPadBits,
@@ -473,7 +472,7 @@ class alignas(1 << DeclAlignInBits) Decl {
473472
Index : 16
474473
);
475474

476-
SWIFT_INLINE_BITFIELD_EMPTY(GenericTypeDecl, TypeDecl);
475+
SWIFT_INLINE_BITFIELD_EMPTY(GenericTypeDecl, ValueDecl);
477476

478477
SWIFT_INLINE_BITFIELD(TypeAliasDecl, GenericTypeDecl, 1+1,
479478
/// Whether the typealias forwards perfectly to its underlying type.
@@ -573,22 +572,6 @@ class alignas(1 << DeclAlignInBits) Decl {
573572
HasAnyUnavailableValues : 1
574573
);
575574

576-
SWIFT_INLINE_BITFIELD(ModuleDecl, TypeDecl, 1+1+1+1,
577-
/// If the module was or is being compiled with `-enable-testing`.
578-
TestingEnabled : 1,
579-
580-
/// If the module failed to load
581-
FailedToLoad : 1,
582-
583-
/// Whether the module is resilient.
584-
///
585-
/// \sa ResilienceStrategy
586-
RawResilienceStrategy : 1,
587-
588-
/// Whether all imports have been resolved. Used to detect circular imports.
589-
HasResolvedImports : 1
590-
);
591-
592575
SWIFT_INLINE_BITFIELD(PrecedenceGroupDecl, Decl, 1+2,
593576
/// Is this an assignment operator?
594577
IsAssignment : 1,

0 commit comments

Comments
 (0)