Skip to content

[Serialization] Drop support for serializing LValueType. #9080

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

Merged
merged 1 commit into from
Apr 28, 2017
Merged
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/Serialization/DeclTypeRecordNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TYPE(TUPLE)
TRAILING_INFO(TUPLE_TYPE_ELT)
TYPE(FUNCTION)
TYPE(METATYPE)
TYPE(LVALUE)
TYPE(LVALUE_unused)
TYPE(INOUT)
TYPE(ARCHETYPE)
TYPE(PROTOCOL_COMPOSITION)
Expand Down
5 changes: 0 additions & 5 deletions include/swift/Serialization/ModuleFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,6 @@ namespace decls_block {
MetatypeRepresentationField // representation
>;

using LValueTypeLayout = BCRecordLayout<
LVALUE_TYPE,
TypeIDField // object type
>;

using InOutTypeLayout = BCRecordLayout<
INOUT_TYPE,
TypeIDField // object type
Expand Down
8 changes: 1 addition & 7 deletions lib/Serialization/Deserialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3841,15 +3841,9 @@ Expected<Type> ModuleFile::getTypeChecked(TypeID TID) {
break;
}

case decls_block::LVALUE_TYPE: {
TypeID objectTypeID;
decls_block::LValueTypeLayout::readRecord(scratch, objectTypeID);
typeOrOffset = LValueType::get(getType(objectTypeID));
break;
}
case decls_block::INOUT_TYPE: {
TypeID objectTypeID;
decls_block::LValueTypeLayout::readRecord(scratch, objectTypeID);
decls_block::InOutTypeLayout::readRecord(scratch, objectTypeID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before, we were serializing INOUT_TYPE using LValueTypeLayout. Is this what's causing the test failure here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, the test failure is completely unrelated. There's unfortunately no static or dynamic type-checking on the layout deserialization, although maybe there should be.


auto objectTy = getTypeChecked(objectTypeID);
if (!objectTy)
Expand Down
11 changes: 2 additions & 9 deletions lib/Serialization/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3449,14 +3449,6 @@ void Serializer::writeType(Type ty) {
break;
}

case TypeKind::LValue: {
auto lValueTy = cast<LValueType>(ty.getPointer());

unsigned abbrCode = DeclTypeAbbrCodes[LValueTypeLayout::Code];
LValueTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(lValueTy->getObjectType()));
break;
}
case TypeKind::InOut: {
auto iotTy = cast<InOutType>(ty.getPointer());

Expand Down Expand Up @@ -3506,6 +3498,8 @@ void Serializer::writeType(Type ty) {
break;
}

case TypeKind::LValue:
llvm_unreachable("lvalue types are only used in function bodies");
case TypeKind::TypeVariable:
llvm_unreachable("type variables should not escape the type checker");
}
Expand All @@ -3524,7 +3518,6 @@ void Serializer::writeAllDeclsAndTypes() {
registerDeclTypeAbbr<FunctionTypeLayout>();
registerDeclTypeAbbr<MetatypeTypeLayout>();
registerDeclTypeAbbr<ExistentialMetatypeTypeLayout>();
registerDeclTypeAbbr<LValueTypeLayout>();
registerDeclTypeAbbr<InOutTypeLayout>();
registerDeclTypeAbbr<ArchetypeTypeLayout>();
registerDeclTypeAbbr<ProtocolCompositionTypeLayout>();
Expand Down