Skip to content

Revert "[metadata prespecialization] Support for classes." #32097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/ABI/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ struct TargetAnyClassMetadata : public TargetHeapMetadata<Runtime> {
using TargetMetadata<Runtime>::setClassISA;
#endif

// Note that ObjC classes do not have a metadata header.
// Note that ObjC classes does not have a metadata header.

/// The metadata for the superclass. This is null for the root class.
ConstTargetMetadataPointer<Runtime, swift::TargetClassMetadata> Superclass;
Expand Down
12 changes: 1 addition & 11 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,17 +852,7 @@ class alignas(1 << TypeAlignInBits) TypeBase {
/// \returns The superclass of this type, or a null type if it has no
/// superclass.
Type getSuperclass(bool useArchetypes = true);

/// Retrieve the root class of this type by repeatedly retrieving the
/// superclass.
///
/// \param useArchetypes Whether to use context archetypes for outer generic
/// parameters if the class is nested inside a generic function.
///
/// \returns The base class of this type, or this type itself if it has no
/// superclasses.
Type getRootClass(bool useArchetypes = true);


/// True if this type is the exact superclass of another type.
///
/// \param ty The potential subclass.
Expand Down
4 changes: 0 additions & 4 deletions include/swift/Demangling/DemangleNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,5 @@ NODE(OpaqueTypeDescriptorAccessorVar)
NODE(OpaqueReturnType)
CONTEXT_NODE(OpaqueReturnTypeOf)

// Added in Swift 5.3
NODE(CanonicalSpecializedGenericMetaclass)
NODE(CanonicalSpecializedGenericTypeMetadataAccessFunction)

#undef CONTEXT_NODE
#undef NODE
31 changes: 3 additions & 28 deletions include/swift/IRGen/Linking.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class LinkEntity {
/// The nominal type descriptor for a nominal type.
/// The pointer is a NominalTypeDecl*.
NominalTypeDescriptor,

/// The descriptor for an opaque type.
/// The pointer is an OpaqueTypeDecl*.
OpaqueTypeDescriptor,
Expand Down Expand Up @@ -295,12 +295,12 @@ class LinkEntity {
/// The descriptor for an extension.
/// The pointer is an ExtensionDecl*.
ExtensionDescriptor,

/// The descriptor for a runtime-anonymous context.
/// The pointer is the DeclContext* of a child of the context that should
/// be considered private.
AnonymousDescriptor,

/// A SIL global variable. The pointer is a SILGlobalVariable*.
SILGlobalVariable,

Expand Down Expand Up @@ -384,15 +384,6 @@ class LinkEntity {

/// A global function pointer for dynamically replaceable functions.
DynamicallyReplaceableFunctionVariable,

/// A reference to a metaclass-stub for a statically specialized generic
/// class.
/// The pointer is a canonical TypeBase*.
CanonicalSpecializedGenericSwiftMetaclassStub,

/// An access function for prespecialized type metadata.
/// The pointer is a canonical TypeBase*.
CanonicalSpecializedGenericTypeMetadataAccessFunction,
};
friend struct llvm::DenseMapInfo<LinkEntity>;

Expand Down Expand Up @@ -1029,22 +1020,6 @@ class LinkEntity {
return entity;
}

static LinkEntity
forSpecializedGenericSwiftMetaclassStub(CanType concreteType) {
LinkEntity entity;
entity.setForType(Kind::CanonicalSpecializedGenericSwiftMetaclassStub,
concreteType);
return entity;
}

static LinkEntity
forPrespecializedTypeMetadataAccessFunction(CanType theType) {
LinkEntity entity;
entity.setForType(
Kind::CanonicalSpecializedGenericTypeMetadataAccessFunction, theType);
return entity;
}

void mangle(llvm::raw_ostream &out) const;
void mangle(SmallVectorImpl<char> &buffer) const;
std::string mangleAsString() const;
Expand Down
11 changes: 0 additions & 11 deletions lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,17 +1552,6 @@ Type TypeBase::getSuperclass(bool useArchetypes) {
return superclassTy.subst(subMap);
}

Type TypeBase::getRootClass(bool useArchetypes) {
Type iterator = this;
assert(iterator);

while (auto superclass = iterator->getSuperclass(useArchetypes)) {
iterator = superclass;
}

return iterator;
}

bool TypeBase::isExactSuperclassOf(Type ty) {
// For there to be a superclass relationship, we must be a class, and
// the potential subtype must be a class, superclass-bounded archetype,
Expand Down
6 changes: 0 additions & 6 deletions lib/Demangling/Demangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,9 +1874,6 @@ NodePointer Demangler::demangleMetatype() {
case 'A':
return createWithChild(Node::Kind::ReflectionMetadataAssocTypeDescriptor,
popProtocolConformance());
case 'b':
return createWithPoppedType(
Node::Kind::CanonicalSpecializedGenericTypeMetadataAccessFunction);
case 'B':
return createWithChild(Node::Kind::ReflectionMetadataBuiltinDescriptor,
popNode(Node::Kind::Type));
Expand Down Expand Up @@ -1920,9 +1917,6 @@ NodePointer Demangler::demangleMetatype() {
return createWithPoppedType(Node::Kind::TypeMetadataLazyCache);
case 'm':
return createWithPoppedType(Node::Kind::Metaclass);
case 'M':
return createWithPoppedType(
Node::Kind::CanonicalSpecializedGenericMetaclass);
case 'n':
return createWithPoppedType(Node::Kind::NominalTypeDescriptor);
case 'o':
Expand Down
10 changes: 0 additions & 10 deletions lib/Demangling/NodePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,6 @@ class NodePrinter {
case Node::Kind::OpaqueTypeDescriptorSymbolicReference:
case Node::Kind::OpaqueReturnType:
case Node::Kind::OpaqueReturnTypeOf:
case Node::Kind::CanonicalSpecializedGenericMetaclass:
case Node::Kind::CanonicalSpecializedGenericTypeMetadataAccessFunction:
return false;
}
printer_unreachable("bad node kind");
Expand Down Expand Up @@ -2420,14 +2418,6 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
case Node::Kind::AccessorFunctionReference:
Printer << "accessor function at " << Node->getIndex();
return nullptr;
case Node::Kind::CanonicalSpecializedGenericMetaclass:
Printer << "specialized generic metaclass for ";
print(Node->getFirstChild());
return nullptr;
case Node::Kind::CanonicalSpecializedGenericTypeMetadataAccessFunction:
Printer << "canonical specialized generic type metadata accessor for ";
print(Node->getChild(0));
return nullptr;
}
printer_unreachable("bad node kind!");
}
Expand Down
11 changes: 0 additions & 11 deletions lib/Demangling/OldRemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2133,17 +2133,6 @@ void Remangler::mangleAccessorFunctionReference(Node *node) {
unreachable("can't remangle");
}

void Remangler::mangleCanonicalSpecializedGenericMetaclass(Node *node) {
Buffer << "MM";
mangleSingleChildNode(node); // type
}

void Remangler::mangleCanonicalSpecializedGenericTypeMetadataAccessFunction(
Node *node) {
mangleSingleChildNode(node);
Buffer << "Mb";
}

/// The top-level interface to the remangler.
std::string Demangle::mangleNodeOld(NodePointer node) {
if (!node) return "";
Expand Down
11 changes: 0 additions & 11 deletions lib/Demangling/Remangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2533,17 +2533,6 @@ void Remangler::mangleAccessorFunctionReference(Node *node) {
unreachable("can't remangle");
}

void Remangler::mangleCanonicalSpecializedGenericMetaclass(Node *node) {
mangleChildNodes(node);
Buffer << "MM";
}

void Remangler::mangleCanonicalSpecializedGenericTypeMetadataAccessFunction(
Node *node) {
mangleSingleChildNode(node);
Buffer << "Mb";
}

} // anonymous namespace

/// The top-level interface to the remangler.
Expand Down
66 changes: 0 additions & 66 deletions lib/IRGen/ClassTypeInfo.h

This file was deleted.

Loading