Skip to content

Commit

Permalink
Revert "Include access functions for the metadata and witness tables"
Browse files Browse the repository at this point in the history
This reverts commit 7576a91.
It broke the testsuite for swift-corelibs-foundation.
  • Loading branch information
gribozavr committed Dec 25, 2015
1 parent e0479df commit 11ab3d5
Show file tree
Hide file tree
Showing 30 changed files with 250 additions and 1,606 deletions.
14 changes: 6 additions & 8 deletions docs/ABI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -743,17 +743,15 @@ Globals
global ::= 'PA' .* // partial application forwarder
global ::= 'PAo' .* // ObjC partial application forwarder
global ::= 'w' value-witness-kind type // value witness
global ::= 'WV' type // value witness table
global ::= 'Wo' entity // witness table offset
global ::= 'Wv' directness entity // field offset
global ::= 'WP' protocol-conformance // protocol witness table
global ::= 'Wa' protocol-conformance // protocol witness table accessor
global ::= 'WG' protocol-conformance // generic protocol witness table
global ::= 'WI' protocol-conformance // generic protocol witness table instantiation function
global ::= 'Wl' type protocol-conformance // lazy protocol witness table accessor
global ::= 'WL' protocol-conformance // lazy protocol witness table cache variable
global ::= 'Wo' entity // witness table offset
global ::= 'WP' protocol-conformance // protocol witness table
global ::= 'Wt' protocol-conformance identifier // associated type metadata accessor
global ::= 'WT' protocol-conformance identifier nominal-type // associated type witness table accessor
global ::= 'Wv' directness entity // field offset
global ::= 'WV' type // value witness table
global ::= 'WD' protocol-conformance // dependent proto witness table generator
global ::= 'Wd' protocol-conformance // dependent proto witness table template
global ::= entity // some identifiable thing
global ::= 'TO' global // ObjC-as-swift thunk
global ::= 'To' global // swift-as-ObjC thunk
Expand Down
6 changes: 2 additions & 4 deletions include/swift/Basic/DemangleNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ NODE(ArchetypeRef)
NODE(ArgumentTuple)
NODE(AssociatedType)
NODE(AssociatedTypeRef)
NODE(AssociatedTypeMetadataAccessor)
NODE(AssociatedTypeWitnessTableAccessor)
NODE(AutoClosureType)
NODE(BoundGenericClass)
NODE(BoundGenericEnum)
Expand All @@ -51,6 +49,8 @@ NODE(DependentGenericSameTypeRequirement)
NODE(DependentGenericType)
NODE(DependentMemberType)
NODE(DependentGenericParamType)
NODE(DependentProtocolWitnessTableGenerator)
NODE(DependentProtocolWitnessTableTemplate)
CONTEXT_NODE(Destructor)
CONTEXT_NODE(DidSet)
NODE(Directness)
Expand All @@ -71,8 +71,6 @@ NODE(FunctionSignatureSpecializationParamKind)
NODE(FunctionSignatureSpecializationParamPayload)
NODE(FunctionType)
NODE(Generics)
NODE(GenericProtocolWitnessTable)
NODE(GenericProtocolWitnessTableInstantiationFunction)
NODE(GenericSpecialization)
NODE(GenericSpecializationParam)
NODE(GenericType)
Expand Down
8 changes: 0 additions & 8 deletions include/swift/Basic/RelativePointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ class RelativeDirectPointerImpl {
return reinterpret_cast<PointerTy>(absolute);
}

/// A zero relative offset encodes a null reference.
bool isNull() const & {
return RelativeOffset == 0;
}
};

/// A direct relative reference to an object.
Expand All @@ -126,8 +122,6 @@ class RelativeDirectPointer :
const typename super::ValueTy *operator->() const & {
return this->get();
}

using super::isNull;
};

/// A specialization of RelativeDirectPointer for function pointers,
Expand All @@ -145,8 +139,6 @@ class RelativeDirectPointer<RetTy (ArgTy...)> :
RetTy operator()(ArgTy...arg) {
return this->get()(std::forward<ArgTy>(arg)...);
}

using super::isNull;
};

}
Expand Down
33 changes: 0 additions & 33 deletions include/swift/Runtime/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -2106,25 +2106,6 @@ struct GenericMetadata {
}
};

/// \brief The control structure of a generic protocol conformance.
struct GenericWitnessTable {
/// The size of the witness table in words.
uint16_t WitnessTableSizeInWords;

/// The amount to copy from the pattern in words. The rest is zeroed.
uint16_t WitnessTableSizeInWordsToCopy;

/// The pattern.
RelativeDirectPointer<WitnessTable> Pattern;

/// The instantiation function, which is called after the template is copied.
RelativeDirectPointer<void(WitnessTable *instantiatedTable,
const Metadata *type,
void * const *instantiationArgs)> Instantiator;

void *PrivateData[swift::NumGenericMetadataPrivateDataWords];
};

/// The structure of a protocol conformance record.
///
/// This contains enough static information to recover the witness table for a
Expand Down Expand Up @@ -2352,20 +2333,6 @@ swift_allocateGenericClassMetadata(GenericMetadata *pattern,
extern "C" Metadata *
swift_allocateGenericValueMetadata(GenericMetadata *pattern,
const void *arguments);

/// Instantiate a generic protocol witness table.
///
///
/// \param instantiationArgs - An opaque pointer that's forwarded to
/// the instantiation function, used for conditional conformances.
/// This API implicitly embeds an assumption that these arguments
/// never form part of the uniquing key for the conformance, which
/// is ultimately a statement about the user model of overlapping
/// conformances.
extern "C" const WitnessTable *
swift_getGenericWitnessTable(GenericWitnessTable *genericTable,
const Metadata *type,
void * const *instantiationArgs);

/// \brief Fetch a uniqued metadata for a function type.
extern "C" const FunctionTypeMetadata *
Expand Down
71 changes: 20 additions & 51 deletions lib/Basic/Demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,6 @@ class Demangler {
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
return witnessTable;
}
if (Mangled.nextIf('G')) {
auto witnessTable =
NodeFactory::create(Node::Kind::GenericProtocolWitnessTable);
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
return witnessTable;
}
if (Mangled.nextIf('I')) {
auto witnessTable = NodeFactory::create(
Node::Kind::GenericProtocolWitnessTableInstantiationFunction);
DEMANGLE_CHILD_OR_RETURN(witnessTable, ProtocolConformance);
return witnessTable;
}
if (Mangled.nextIf('l')) {
auto accessor =
NodeFactory::create(Node::Kind::LazyProtocolWitnessTableAccessor);
Expand All @@ -609,20 +597,17 @@ class Demangler {
DEMANGLE_CHILD_OR_RETURN(tableTemplate, ProtocolConformance);
return tableTemplate;
}
if (Mangled.nextIf('t')) {
auto accessor = NodeFactory::create(
Node::Kind::AssociatedTypeMetadataAccessor);
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolConformance);
DEMANGLE_CHILD_OR_RETURN(accessor, DeclName);
return accessor;
if (Mangled.nextIf('D')) {
auto tableGenerator = NodeFactory::create(
Node::Kind::DependentProtocolWitnessTableGenerator);
DEMANGLE_CHILD_OR_RETURN(tableGenerator, ProtocolConformance);
return tableGenerator;
}
if (Mangled.nextIf('T')) {
auto accessor = NodeFactory::create(
Node::Kind::AssociatedTypeWitnessTableAccessor);
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolConformance);
DEMANGLE_CHILD_OR_RETURN(accessor, DeclName);
DEMANGLE_CHILD_OR_RETURN(accessor, ProtocolName);
return accessor;
if (Mangled.nextIf('d')) {
auto tableTemplate = NodeFactory::create(
Node::Kind::DependentProtocolWitnessTableTemplate);
DEMANGLE_CHILD_OR_RETURN(tableTemplate, ProtocolConformance);
return tableTemplate;
}
return nullptr;
}
Expand Down Expand Up @@ -2367,8 +2352,6 @@ class NodePrinter {

case Node::Kind::Allocator:
case Node::Kind::ArgumentTuple:
case Node::Kind::AssociatedTypeMetadataAccessor:
case Node::Kind::AssociatedTypeWitnessTableAccessor:
case Node::Kind::AutoClosureType:
case Node::Kind::CFunctionPointer:
case Node::Kind::Constructor:
Expand All @@ -2380,6 +2363,8 @@ class NodePrinter {
case Node::Kind::DependentGenericParamCount:
case Node::Kind::DependentGenericConformanceRequirement:
case Node::Kind::DependentGenericSameTypeRequirement:
case Node::Kind::DependentProtocolWitnessTableGenerator:
case Node::Kind::DependentProtocolWitnessTableTemplate:
case Node::Kind::Destructor:
case Node::Kind::DidSet:
case Node::Kind::DirectMethodReferenceAttribute:
Expand All @@ -2396,8 +2381,6 @@ class NodePrinter {
case Node::Kind::FunctionSignatureSpecializationParamPayload:
case Node::Kind::FunctionType:
case Node::Kind::Generics:
case Node::Kind::GenericProtocolWitnessTable:
case Node::Kind::GenericProtocolWitnessTableInstantiationFunction:
case Node::Kind::GenericSpecialization:
case Node::Kind::GenericSpecializationParam:
case Node::Kind::GenericType:
Expand Down Expand Up @@ -3182,6 +3165,14 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
case Node::Kind::PostfixOperator:
Printer << pointer->getText() << " postfix";
return;
case Node::Kind::DependentProtocolWitnessTableGenerator:
Printer << "dependent protocol witness table generator for ";
print(pointer->getFirstChild());
return;
case Node::Kind::DependentProtocolWitnessTableTemplate:
Printer << "dependent protocol witness table template for ";
print(pointer->getFirstChild());
return;
case Node::Kind::LazyProtocolWitnessTableAccessor:
Printer << "lazy protocol witness table accessor for type ";
print(pointer->getChild(0));
Expand All @@ -3202,14 +3193,6 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
Printer << "protocol witness table for ";
print(pointer->getFirstChild());
return;
case Node::Kind::GenericProtocolWitnessTable:
Printer << "generic protocol witness table for ";
print(pointer->getFirstChild());
return;
case Node::Kind::GenericProtocolWitnessTableInstantiationFunction:
Printer << "instantiation function for generic protocol witness table for ";
print(pointer->getFirstChild());
return;
case Node::Kind::ProtocolWitness: {
Printer << "protocol witness for ";
print(pointer->getChild(1));
Expand Down Expand Up @@ -3296,20 +3279,6 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
Printer << "lazy cache variable for type metadata for ";
print(pointer->getChild(0));
return;
case Node::Kind::AssociatedTypeMetadataAccessor:
Printer << "associated type metadata accessor for ";
print(pointer->getChild(1));
Printer << " in ";
print(pointer->getChild(0));
return;
case Node::Kind::AssociatedTypeWitnessTableAccessor:
Printer << "associated type witness table accessor for ";
print(pointer->getChild(1));
Printer << " : ";
print(pointer->getChild(2));
Printer << " in ";
print(pointer->getChild(0));
return;
case Node::Kind::NominalTypeDescriptor:
Printer << "nominal type descriptor for ";
print(pointer->getChild(0));
Expand Down
26 changes: 6 additions & 20 deletions lib/Basic/Remangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,17 +698,6 @@ void Remangler::mangleProtocolWitnessTable(Node *node) {
mangleSingleChildNode(node); // protocol conformance
}

void Remangler::mangleGenericProtocolWitnessTable(Node *node) {
Out << "WG";
mangleSingleChildNode(node); // protocol conformance
}

void Remangler::mangleGenericProtocolWitnessTableInstantiationFunction(
Node *node) {
Out << "WI";
mangleSingleChildNode(node); // protocol conformance
}

void Remangler::mangleProtocolWitnessTableAccessor(Node *node) {
Out << "Wa";
mangleSingleChildNode(node); // protocol conformance
Expand All @@ -724,17 +713,14 @@ void Remangler::mangleLazyProtocolWitnessTableCacheVariable(Node *node) {
mangleChildNodes(node); // type, protocol conformance
}

void Remangler::mangleAssociatedTypeMetadataAccessor(Node *node) {
Out << "Wt";
mangleChildNodes(node); // protocol conformance, identifier
void Remangler::mangleDependentProtocolWitnessTableGenerator(Node *node) {
Out << "WD";
mangleSingleChildNode(node); // protocol conformance
}

void Remangler::mangleAssociatedTypeWitnessTableAccessor(Node *node) {
Out << "WT";
assert(node->getNumChildren() == 3);
mangleChildNode(node, 0); // protocol conformance
mangleChildNode(node, 1); // identifier
mangleProtocolWithoutPrefix(node->begin()[2].get()); // type
void Remangler::mangleDependentProtocolWitnessTableTemplate(Node *node) {
Out << "Wd";
mangleSingleChildNode(node); // protocol conformance
}

void Remangler::mangleReabstractionThunkHelper(Node *node) {
Expand Down
Loading

0 comments on commit 11ab3d5

Please sign in to comment.