Skip to content

Commit 11ab3d5

Browse files
committed
Revert "Include access functions for the metadata and witness tables"
This reverts commit 7576a91. It broke the testsuite for swift-corelibs-foundation.
1 parent e0479df commit 11ab3d5

30 files changed

+250
-1606
lines changed

docs/ABI.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -743,17 +743,15 @@ Globals
743743
global ::= 'PA' .* // partial application forwarder
744744
global ::= 'PAo' .* // ObjC partial application forwarder
745745
global ::= 'w' value-witness-kind type // value witness
746+
global ::= 'WV' type // value witness table
747+
global ::= 'Wo' entity // witness table offset
748+
global ::= 'Wv' directness entity // field offset
749+
global ::= 'WP' protocol-conformance // protocol witness table
746750
global ::= 'Wa' protocol-conformance // protocol witness table accessor
747-
global ::= 'WG' protocol-conformance // generic protocol witness table
748-
global ::= 'WI' protocol-conformance // generic protocol witness table instantiation function
749751
global ::= 'Wl' type protocol-conformance // lazy protocol witness table accessor
750752
global ::= 'WL' protocol-conformance // lazy protocol witness table cache variable
751-
global ::= 'Wo' entity // witness table offset
752-
global ::= 'WP' protocol-conformance // protocol witness table
753-
global ::= 'Wt' protocol-conformance identifier // associated type metadata accessor
754-
global ::= 'WT' protocol-conformance identifier nominal-type // associated type witness table accessor
755-
global ::= 'Wv' directness entity // field offset
756-
global ::= 'WV' type // value witness table
753+
global ::= 'WD' protocol-conformance // dependent proto witness table generator
754+
global ::= 'Wd' protocol-conformance // dependent proto witness table template
757755
global ::= entity // some identifiable thing
758756
global ::= 'TO' global // ObjC-as-swift thunk
759757
global ::= 'To' global // swift-as-ObjC thunk

include/swift/Basic/DemangleNodes.def

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ NODE(ArchetypeRef)
3030
NODE(ArgumentTuple)
3131
NODE(AssociatedType)
3232
NODE(AssociatedTypeRef)
33-
NODE(AssociatedTypeMetadataAccessor)
34-
NODE(AssociatedTypeWitnessTableAccessor)
3533
NODE(AutoClosureType)
3634
NODE(BoundGenericClass)
3735
NODE(BoundGenericEnum)
@@ -51,6 +49,8 @@ NODE(DependentGenericSameTypeRequirement)
5149
NODE(DependentGenericType)
5250
NODE(DependentMemberType)
5351
NODE(DependentGenericParamType)
52+
NODE(DependentProtocolWitnessTableGenerator)
53+
NODE(DependentProtocolWitnessTableTemplate)
5454
CONTEXT_NODE(Destructor)
5555
CONTEXT_NODE(DidSet)
5656
NODE(Directness)
@@ -71,8 +71,6 @@ NODE(FunctionSignatureSpecializationParamKind)
7171
NODE(FunctionSignatureSpecializationParamPayload)
7272
NODE(FunctionType)
7373
NODE(Generics)
74-
NODE(GenericProtocolWitnessTable)
75-
NODE(GenericProtocolWitnessTableInstantiationFunction)
7674
NODE(GenericSpecialization)
7775
NODE(GenericSpecializationParam)
7876
NODE(GenericType)

include/swift/Basic/RelativePointer.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ class RelativeDirectPointerImpl {
102102
return reinterpret_cast<PointerTy>(absolute);
103103
}
104104

105-
/// A zero relative offset encodes a null reference.
106-
bool isNull() const & {
107-
return RelativeOffset == 0;
108-
}
109105
};
110106

111107
/// A direct relative reference to an object.
@@ -126,8 +122,6 @@ class RelativeDirectPointer :
126122
const typename super::ValueTy *operator->() const & {
127123
return this->get();
128124
}
129-
130-
using super::isNull;
131125
};
132126

133127
/// A specialization of RelativeDirectPointer for function pointers,
@@ -145,8 +139,6 @@ class RelativeDirectPointer<RetTy (ArgTy...)> :
145139
RetTy operator()(ArgTy...arg) {
146140
return this->get()(std::forward<ArgTy>(arg)...);
147141
}
148-
149-
using super::isNull;
150142
};
151143

152144
}

include/swift/Runtime/Metadata.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,25 +2106,6 @@ struct GenericMetadata {
21062106
}
21072107
};
21082108

2109-
/// \brief The control structure of a generic protocol conformance.
2110-
struct GenericWitnessTable {
2111-
/// The size of the witness table in words.
2112-
uint16_t WitnessTableSizeInWords;
2113-
2114-
/// The amount to copy from the pattern in words. The rest is zeroed.
2115-
uint16_t WitnessTableSizeInWordsToCopy;
2116-
2117-
/// The pattern.
2118-
RelativeDirectPointer<WitnessTable> Pattern;
2119-
2120-
/// The instantiation function, which is called after the template is copied.
2121-
RelativeDirectPointer<void(WitnessTable *instantiatedTable,
2122-
const Metadata *type,
2123-
void * const *instantiationArgs)> Instantiator;
2124-
2125-
void *PrivateData[swift::NumGenericMetadataPrivateDataWords];
2126-
};
2127-
21282109
/// The structure of a protocol conformance record.
21292110
///
21302111
/// This contains enough static information to recover the witness table for a
@@ -2352,20 +2333,6 @@ swift_allocateGenericClassMetadata(GenericMetadata *pattern,
23522333
extern "C" Metadata *
23532334
swift_allocateGenericValueMetadata(GenericMetadata *pattern,
23542335
const void *arguments);
2355-
2356-
/// Instantiate a generic protocol witness table.
2357-
///
2358-
///
2359-
/// \param instantiationArgs - An opaque pointer that's forwarded to
2360-
/// the instantiation function, used for conditional conformances.
2361-
/// This API implicitly embeds an assumption that these arguments
2362-
/// never form part of the uniquing key for the conformance, which
2363-
/// is ultimately a statement about the user model of overlapping
2364-
/// conformances.
2365-
extern "C" const WitnessTable *
2366-
swift_getGenericWitnessTable(GenericWitnessTable *genericTable,
2367-
const Metadata *type,
2368-
void * const *instantiationArgs);
23692336

23702337
/// \brief Fetch a uniqued metadata for a function type.
23712338
extern "C" const FunctionTypeMetadata *

lib/Basic/Demangle.cpp

Lines changed: 20 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -577,18 +577,6 @@ class Demangler {
577577
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
578578
return witnessTable;
579579
}
580-
if (Mangled.nextIf('G')) {
581-
auto witnessTable =
582-
NodeFactory::create(Node::Kind::GenericProtocolWitnessTable);
583-
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
584-
return witnessTable;
585-
}
586-
if (Mangled.nextIf('I')) {
587-
auto witnessTable = NodeFactory::create(
588-
Node::Kind::GenericProtocolWitnessTableInstantiationFunction);
589-
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
590-
return witnessTable;
591-
}
592580
if (Mangled.nextIf('l')) {
593581
auto accessor =
594582
NodeFactory::create(Node::Kind::LazyProtocolWitnessTableAccessor);
@@ -609,20 +597,17 @@ class Demangler {
609597
DEMANGLE_CHILD_OR_RETURN(tableTemplate, ProtocolConformance);
610598
return tableTemplate;
611599
}
612-
if (Mangled.nextIf('t')) {
613-
auto accessor = NodeFactory::create(
614-
Node::Kind::AssociatedTypeMetadataAccessor);
615-
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolConformance);
616-
DEMANGLE_CHILD_OR_RETURN(accessor, DeclName);
617-
return accessor;
600+
if (Mangled.nextIf('D')) {
601+
auto tableGenerator = NodeFactory::create(
602+
Node::Kind::DependentProtocolWitnessTableGenerator);
603+
DEMANGLE_CHILD_OR_RETURN(tableGenerator, ProtocolConformance);
604+
return tableGenerator;
618605
}
619-
if (Mangled.nextIf('T')) {
620-
auto accessor = NodeFactory::create(
621-
Node::Kind::AssociatedTypeWitnessTableAccessor);
622-
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolConformance);
623-
DEMANGLE_CHILD_OR_RETURN(accessor, DeclName);
624-
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolName);
625-
return accessor;
606+
if (Mangled.nextIf('d')) {
607+
auto tableTemplate = NodeFactory::create(
608+
Node::Kind::DependentProtocolWitnessTableTemplate);
609+
DEMANGLE_CHILD_OR_RETURN(tableTemplate, ProtocolConformance);
610+
return tableTemplate;
626611
}
627612
return nullptr;
628613
}
@@ -2367,8 +2352,6 @@ class NodePrinter {
23672352

23682353
case Node::Kind::Allocator:
23692354
case Node::Kind::ArgumentTuple:
2370-
case Node::Kind::AssociatedTypeMetadataAccessor:
2371-
case Node::Kind::AssociatedTypeWitnessTableAccessor:
23722355
case Node::Kind::AutoClosureType:
23732356
case Node::Kind::CFunctionPointer:
23742357
case Node::Kind::Constructor:
@@ -2380,6 +2363,8 @@ class NodePrinter {
23802363
case Node::Kind::DependentGenericParamCount:
23812364
case Node::Kind::DependentGenericConformanceRequirement:
23822365
case Node::Kind::DependentGenericSameTypeRequirement:
2366+
case Node::Kind::DependentProtocolWitnessTableGenerator:
2367+
case Node::Kind::DependentProtocolWitnessTableTemplate:
23832368
case Node::Kind::Destructor:
23842369
case Node::Kind::DidSet:
23852370
case Node::Kind::DirectMethodReferenceAttribute:
@@ -2396,8 +2381,6 @@ class NodePrinter {
23962381
case Node::Kind::FunctionSignatureSpecializationParamPayload:
23972382
case Node::Kind::FunctionType:
23982383
case Node::Kind::Generics:
2399-
case Node::Kind::GenericProtocolWitnessTable:
2400-
case Node::Kind::GenericProtocolWitnessTableInstantiationFunction:
24012384
case Node::Kind::GenericSpecialization:
24022385
case Node::Kind::GenericSpecializationParam:
24032386
case Node::Kind::GenericType:
@@ -3182,6 +3165,14 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
31823165
case Node::Kind::PostfixOperator:
31833166
Printer << pointer->getText() << " postfix";
31843167
return;
3168+
case Node::Kind::DependentProtocolWitnessTableGenerator:
3169+
Printer << "dependent protocol witness table generator for ";
3170+
print(pointer->getFirstChild());
3171+
return;
3172+
case Node::Kind::DependentProtocolWitnessTableTemplate:
3173+
Printer << "dependent protocol witness table template for ";
3174+
print(pointer->getFirstChild());
3175+
return;
31853176
case Node::Kind::LazyProtocolWitnessTableAccessor:
31863177
Printer << "lazy protocol witness table accessor for type ";
31873178
print(pointer->getChild(0));
@@ -3202,14 +3193,6 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
32023193
Printer << "protocol witness table for ";
32033194
print(pointer->getFirstChild());
32043195
return;
3205-
case Node::Kind::GenericProtocolWitnessTable:
3206-
Printer << "generic protocol witness table for ";
3207-
print(pointer->getFirstChild());
3208-
return;
3209-
case Node::Kind::GenericProtocolWitnessTableInstantiationFunction:
3210-
Printer << "instantiation function for generic protocol witness table for ";
3211-
print(pointer->getFirstChild());
3212-
return;
32133196
case Node::Kind::ProtocolWitness: {
32143197
Printer << "protocol witness for ";
32153198
print(pointer->getChild(1));
@@ -3296,20 +3279,6 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
32963279
Printer << "lazy cache variable for type metadata for ";
32973280
print(pointer->getChild(0));
32983281
return;
3299-
case Node::Kind::AssociatedTypeMetadataAccessor:
3300-
Printer << "associated type metadata accessor for ";
3301-
print(pointer->getChild(1));
3302-
Printer << " in ";
3303-
print(pointer->getChild(0));
3304-
return;
3305-
case Node::Kind::AssociatedTypeWitnessTableAccessor:
3306-
Printer << "associated type witness table accessor for ";
3307-
print(pointer->getChild(1));
3308-
Printer << " : ";
3309-
print(pointer->getChild(2));
3310-
Printer << " in ";
3311-
print(pointer->getChild(0));
3312-
return;
33133282
case Node::Kind::NominalTypeDescriptor:
33143283
Printer << "nominal type descriptor for ";
33153284
print(pointer->getChild(0));

lib/Basic/Remangle.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -698,17 +698,6 @@ void Remangler::mangleProtocolWitnessTable(Node *node) {
698698
mangleSingleChildNode(node); // protocol conformance
699699
}
700700

701-
void Remangler::mangleGenericProtocolWitnessTable(Node *node) {
702-
Out << "WG";
703-
mangleSingleChildNode(node); // protocol conformance
704-
}
705-
706-
void Remangler::mangleGenericProtocolWitnessTableInstantiationFunction(
707-
Node *node) {
708-
Out << "WI";
709-
mangleSingleChildNode(node); // protocol conformance
710-
}
711-
712701
void Remangler::mangleProtocolWitnessTableAccessor(Node *node) {
713702
Out << "Wa";
714703
mangleSingleChildNode(node); // protocol conformance
@@ -724,17 +713,14 @@ void Remangler::mangleLazyProtocolWitnessTableCacheVariable(Node *node) {
724713
mangleChildNodes(node); // type, protocol conformance
725714
}
726715

727-
void Remangler::mangleAssociatedTypeMetadataAccessor(Node *node) {
728-
Out << "Wt";
729-
mangleChildNodes(node); // protocol conformance, identifier
716+
void Remangler::mangleDependentProtocolWitnessTableGenerator(Node *node) {
717+
Out << "WD";
718+
mangleSingleChildNode(node); // protocol conformance
730719
}
731720

732-
void Remangler::mangleAssociatedTypeWitnessTableAccessor(Node *node) {
733-
Out << "WT";
734-
assert(node->getNumChildren() == 3);
735-
mangleChildNode(node, 0); // protocol conformance
736-
mangleChildNode(node, 1); // identifier
737-
mangleProtocolWithoutPrefix(node->begin()[2].get()); // type
721+
void Remangler::mangleDependentProtocolWitnessTableTemplate(Node *node) {
722+
Out << "Wd";
723+
mangleSingleChildNode(node); // protocol conformance
738724
}
739725

740726
void Remangler::mangleReabstractionThunkHelper(Node *node) {

0 commit comments

Comments
 (0)