diff --git a/compiler/ir/serialization.common/src/KotlinIr.proto b/compiler/ir/serialization.common/src/KotlinIr.proto index 1bf961e6b06..c075eb71ac1 100644 --- a/compiler/ir/serialization.common/src/KotlinIr.proto +++ b/compiler/ir/serialization.common/src/KotlinIr.proto @@ -20,7 +20,9 @@ message IrFile { repeated int32 fq_name = 3 [packed=true]; repeated IrConstructorCall annotation = 4; repeated int64 explicitly_exported_to_compiler = 5 [packed=true]; - repeated Actual actual = 6; + + // WARNING: Don't occupy index 6 which was previously used for storing expect/actual table. + // repeated Actual actual = 6; } /* ------ IdSignature -------------------------------------------- */ @@ -72,13 +74,6 @@ message IdSignature { } } -/* ------ IrSymbols --------------------------------------------- */ - -message Actual { - required int64 actual_symbol = 1; - required int64 expect_symbol = 2; -} - /* ------ IrTypes --------------------------------------------- */ // Note: IrTypeArgument [63..2 - IrType index | 1..0 - Variance] diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/BasicIrModuleDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/BasicIrModuleDeserializer.kt index 5750cd628f5..afb98734250 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/BasicIrModuleDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/BasicIrModuleDeserializer.kt @@ -69,25 +69,6 @@ abstract class BasicIrModuleDeserializer( if (shouldSaveDeserializationState) { this.fileDeserializationStates = fileDeserializationStates } - - fileToDeserializerMap.values.forEach { it.symbolDeserializer.deserializeExpectActualMapping() } - } - - private fun IrSymbolDeserializer.deserializeExpectActualMapping() { - actuals.forEach { - val expectSymbol = parseSymbolData(it.expectSymbol) - val actualSymbol = parseSymbolData(it.actualSymbol) - - val expect = deserializeIdSignature(expectSymbol.signatureId) - val actual = deserializeIdSignature(actualSymbol.signatureId) - - assert(linker.expectIdSignatureToActualIdSignature[expect] == null) { - "Expect signature $expect is already actualized by ${linker.expectIdSignatureToActualIdSignature[expect]}, while we try to record $actual" - } - linker.expectIdSignatureToActualIdSignature[expect] = actual - // Non-null only for topLevel declarations. - findModuleDeserializerForTopLevelId(actual)?.let { md -> linker.topLevelActualIdSignatureToModuleDeserializer[actual] = md } - } } override fun referenceSimpleFunctionByLocalSignature(file: IrFile, idSignature: IdSignature) : IrSimpleFunctionSymbol = diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/ExpectActualTable.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/ExpectActualTable.kt deleted file mode 100644 index 5312ecb4369..00000000000 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/ExpectActualTable.kt +++ /dev/null @@ -1,119 +0,0 @@ -package org.jetbrains.kotlin.backend.common.serialization - -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.ir.IrElement -import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.symbols.IrSymbol -import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid -import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid -import org.jetbrains.kotlin.ir.visitors.acceptVoid -import org.jetbrains.kotlin.resolve.descriptorUtil.module -import org.jetbrains.kotlin.resolve.multiplatform.findActuals -import org.jetbrains.kotlin.resolve.multiplatform.findExpects - -class ExpectActualTable(val expectDescriptorToSymbol: MutableMap) { - val table = mutableMapOf() - - private fun IrElement.recordActuals(rightHandSide: Map, inModule: ModuleDescriptor) { - this.acceptVoid(object : IrElementVisitorVoid { - - private fun recordDeclarationActuals(declaration: IrDeclaration) { - - expectDescriptorToSymbol.put(declaration.descriptor, (declaration as IrSymbolOwner).symbol) - - declaration.descriptor.findActuals(inModule).forEach { - val realActual = if (it is TypeAliasDescriptor) - it.expandedType.constructor.declarationDescriptor as? ClassDescriptor - ?: error("Unexpected actual typealias right hand side: $it") - else it - - // TODO: what to do with fake overrides??? - if (!(realActual is CallableMemberDescriptor && realActual.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE)) { - table.put( - declaration.descriptor, rightHandSide[realActual] - ?: error("Could not find actual type alias target member for: ${declaration.descriptor} -> $it") - ) - } - } - } - - override fun visitElement(element: IrElement) { - element.acceptChildrenVoid(this) - } - - override fun visitFunction(declaration: IrFunction) { - recordDeclarationActuals(declaration) - super.visitFunction(declaration) - } - override fun visitClass(declaration: IrClass) { - recordDeclarationActuals(declaration) - super.visitClass(declaration) - } - override fun visitProperty(declaration: IrProperty) { - recordDeclarationActuals(declaration) - super.visitProperty(declaration) - } - override fun visitEnumEntry(declaration: IrEnumEntry) { - recordDeclarationActuals(declaration) - super.visitEnumEntry(declaration) - } - }) - } - - private fun IrDeclaration.recordRightHandSide(): Map { - val rightHandSide = hashMapOf() - - this.acceptVoid(object : IrElementVisitorVoid { - override fun visitElement(element: IrElement) { - element.acceptChildrenVoid(this) - } - override fun visitFunction(declaration: IrFunction) { - rightHandSide.put(declaration.descriptor, declaration.symbol) - super.visitFunction(declaration) - } - override fun visitClass(declaration: IrClass) { - rightHandSide.put(declaration.descriptor, declaration.symbol) - super.visitClass(declaration) - } - override fun visitProperty(declaration: IrProperty) { - rightHandSide.put(declaration.descriptor, declaration.symbol) - super.visitProperty(declaration) - } - override fun visitEnumEntry(declaration: IrEnumEntry) { - rightHandSide.put(declaration.descriptor, declaration.symbol) - super.visitEnumEntry(declaration) - } - }) - return rightHandSide - } - - fun findExpectsForActuals(declaration: IrDeclaration) { - if (declaration.descriptor !is MemberDescriptor) return - - val descriptor = declaration.symbol.descriptor - - if (declaration is IrTypeAlias && declaration.isActual) { - val rightHandSide = declaration.expandedType.classOrNull?.owner?.recordRightHandSide() - ?: error("Unexpected right hand side of actual typealias: ${declaration.descriptor}") - - - declaration.descriptor.findExpects().forEach { - expectDescriptorToSymbol[it]?.owner?.recordActuals(rightHandSide, declaration.descriptor.module) - } - return - } - - val expects: List = if (descriptor is ClassConstructorDescriptor && descriptor.isPrimary) { - descriptor.containingDeclaration.findExpects().mapNotNull { - (it as ClassDescriptor).unsubstitutedPrimaryConstructor - } - } else { - descriptor.findExpects() - } - - expects.forEach { expect -> - table.put(expect, declaration.symbol) - } - } -} diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt index 9af04d304cf..7ff867039c7 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt @@ -70,7 +70,6 @@ class FileDeserializationState( val symbolDeserializer = IrSymbolDeserializer( linker.symbolTable, fileReader, file.symbol, - fileProto.actualList, ::addIdSignature, linker::handleExpectActualMapping, symbolProcessor = linker.symbolProcessor, diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt index 5eff12eeb6a..466d4095113 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt @@ -29,7 +29,6 @@ import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.filterIsInstanceAnd import java.io.File import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature -import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual import org.jetbrains.kotlin.backend.common.serialization.proto.CommonIdSignature as ProtoCommonIdSignature import org.jetbrains.kotlin.backend.common.serialization.proto.CompositeSignature as ProtoCompositeSignature import org.jetbrains.kotlin.backend.common.serialization.proto.FieldAccessCommon as ProtoFieldAccessCommon @@ -115,21 +114,17 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.NullableIrExpress open class IrFileSerializer( val messageLogger: IrMessageLogger, private val declarationTable: DeclarationTable, - private val expectDescriptorToSymbol: MutableMap, + @Suppress("UNUSED_PARAMETER") expectDescriptorToSymbol: MutableMap = mutableMapOf(), // TODO: to be removed later private val compatibilityMode: CompatibilityMode, private val languageVersionSettings: LanguageVersionSettings, private val bodiesOnlyForInlines: Boolean = false, - private val skipExpects: Boolean = false, + @Suppress("UNUSED_PARAMETER") skipExpects: Boolean = true, // TODO: to be removed later private val normalizeAbsolutePaths: Boolean = false, private val sourceBaseDirs: Collection ) { private val loopIndex = hashMapOf() private var currentLoopIndex = 0 - // For every actual we keep a corresponding expects' uniqIds. - // The linker substitutes actual symbols when asked for an expect uniqId. - private val expectActualTable = ExpectActualTable(expectDescriptorToSymbol) - // The same type can be used multiple times in a file // so use this index to store type data only once. private val protoTypeMap = hashMapOf() @@ -1092,7 +1087,6 @@ open class IrFileSerializer( } private fun serializeIrDeclarationBase(declaration: IrDeclaration, flags: Long?): ProtoDeclarationBase { - if (!skipExpects) expectActualTable.findExpectsForActuals(declaration) return with(ProtoDeclarationBase.newBuilder()) { symbol = serializeIrSymbol((declaration as IrSymbolOwner).symbol) coordinates = serializeCoordinates(declaration.startOffset, declaration.endOffset) @@ -1427,7 +1421,7 @@ open class IrFileSerializer( .addAllAnnotation(serializeAnnotations(file.annotations)) file.declarations.forEach { - if (skipExpects && it.descriptor.isExpectMember && !it.descriptor.isSerializableExpectClass) { + if (it.descriptor.isExpectMember && !it.descriptor.isSerializableExpectClass) { // Skip the declaration unless it is `expect annotation class` marked with `OptionalExpectation` // without the corresponding `actual` counterpart for the current leaf target. return@forEach @@ -1456,7 +1450,6 @@ open class IrFileSerializer( } fillPlatformExplicitlyExported(file, proto) - serializeExpectActualSubstitutionTable(proto) return SerializedIrFile( fileData = proto.build().toByteArray(), @@ -1495,19 +1488,4 @@ open class IrFileSerializer( return name.replace(File.separatorChar, '/') } - - private fun serializeExpectActualSubstitutionTable(proto: ProtoFile.Builder) { - if (skipExpects) return - - expectActualTable.table.forEach next@{ (expect, actualSymbol) -> - val expectSymbol = expectDescriptorToSymbol[expect] ?: error("Could not find expect symbol for expect descriptor $expect") - - proto.addActual( - ProtoActual.newBuilder() - .setExpectSymbol(serializeIrSymbol(expectSymbol)) - .setActualSymbol(serializeIrSymbol(actualSymbol)) - .build() - ) - } - } } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrSymbolDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrSymbolDeserializer.kt index 249b2552a13..8aa4c2b8b38 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrSymbolDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrSymbolDeserializer.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.backend.common.serialization import org.jetbrains.kotlin.backend.common.serialization.encodings.BinarySymbolData -import org.jetbrains.kotlin.backend.common.serialization.proto.Actual import org.jetbrains.kotlin.ir.symbols.IrFileSymbol import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol @@ -22,7 +21,6 @@ class IrSymbolDeserializer( val symbolTable: ReferenceSymbolTable, val libraryFile: IrLibraryFile, val fileSymbol: IrFileSymbol, - val actuals: List, val enqueueLocalTopLevelDeclaration: (IdSignature) -> Unit, val handleExpectActualMapping: (IdSignature, IrSymbol) -> IrSymbol, internationService: IrInterningService, diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/Actual.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/Actual.java deleted file mode 100644 index ba34b3be48f..00000000000 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/Actual.java +++ /dev/null @@ -1,428 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: compiler/ir/serialization.common/src/KotlinIr.proto - -package org.jetbrains.kotlin.backend.common.serialization.proto; - -/** - * Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Actual} - */ -public final class Actual extends - org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements - // @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Actual) - ActualOrBuilder { - // Use Actual.newBuilder() to construct. - private Actual(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Actual(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;} - - private static final Actual defaultInstance; - public static Actual getDefaultInstance() { - return defaultInstance; - } - - public Actual getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.jetbrains.kotlin.protobuf.ByteString unknownFields; - private Actual( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput = - org.jetbrains.kotlin.protobuf.ByteString.newOutput(); - org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput = - org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance( - unknownFieldsOutput, 1); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFieldsCodedOutput, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - actualSymbol_ = input.readInt64(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - expectSymbol_ = input.readInt64(); - break; - } - } - } - } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - try { - unknownFieldsCodedOutput.flush(); - } catch (java.io.IOException e) { - // Should not happen - } finally { - unknownFields = unknownFieldsOutput.toByteString(); - } - makeExtensionsImmutable(); - } - } - public static org.jetbrains.kotlin.protobuf.Parser PARSER = - new org.jetbrains.kotlin.protobuf.AbstractParser() { - public Actual parsePartialFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return new Actual(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.jetbrains.kotlin.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int ACTUAL_SYMBOL_FIELD_NUMBER = 1; - private long actualSymbol_; - /** - * required int64 actual_symbol = 1; - */ - public boolean hasActualSymbol() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int64 actual_symbol = 1; - */ - public long getActualSymbol() { - return actualSymbol_; - } - - public static final int EXPECT_SYMBOL_FIELD_NUMBER = 2; - private long expectSymbol_; - /** - * required int64 expect_symbol = 2; - */ - public boolean hasExpectSymbol() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int64 expect_symbol = 2; - */ - public long getExpectSymbol() { - return expectSymbol_; - } - - private void initFields() { - actualSymbol_ = 0L; - expectSymbol_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasActualSymbol()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasExpectSymbol()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt64(1, actualSymbol_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, expectSymbol_); - } - output.writeRawBytes(unknownFields); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeInt64Size(1, actualSymbol_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeInt64Size(2, expectSymbol_); - } - size += unknownFields.size(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - org.jetbrains.kotlin.protobuf.ByteString data) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - org.jetbrains.kotlin.protobuf.ByteString data, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(byte[] data) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - byte[] data, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - java.io.InputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseDelimitedFrom( - java.io.InputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.Actual prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - /** - * Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Actual} - */ - public static final class Builder extends - org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder< - org.jetbrains.kotlin.backend.common.serialization.proto.Actual, Builder> - implements - // @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Actual) - org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder { - // Construct using org.jetbrains.kotlin.backend.common.serialization.proto.Actual.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - actualSymbol_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - expectSymbol_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getDefaultInstanceForType() { - return org.jetbrains.kotlin.backend.common.serialization.proto.Actual.getDefaultInstance(); - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.Actual build() { - org.jetbrains.kotlin.backend.common.serialization.proto.Actual result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.Actual buildPartial() { - org.jetbrains.kotlin.backend.common.serialization.proto.Actual result = new org.jetbrains.kotlin.backend.common.serialization.proto.Actual(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.actualSymbol_ = actualSymbol_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.expectSymbol_ = expectSymbol_; - result.bitField0_ = to_bitField0_; - return result; - } - - public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.Actual other) { - if (other == org.jetbrains.kotlin.backend.common.serialization.proto.Actual.getDefaultInstance()) return this; - if (other.hasActualSymbol()) { - setActualSymbol(other.getActualSymbol()); - } - if (other.hasExpectSymbol()) { - setExpectSymbol(other.getExpectSymbol()); - } - setUnknownFields( - getUnknownFields().concat(other.unknownFields)); - return this; - } - - public final boolean isInitialized() { - if (!hasActualSymbol()) { - - return false; - } - if (!hasExpectSymbol()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.jetbrains.kotlin.backend.common.serialization.proto.Actual parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.Actual) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long actualSymbol_ ; - /** - * required int64 actual_symbol = 1; - */ - public boolean hasActualSymbol() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required int64 actual_symbol = 1; - */ - public long getActualSymbol() { - return actualSymbol_; - } - /** - * required int64 actual_symbol = 1; - */ - public Builder setActualSymbol(long value) { - bitField0_ |= 0x00000001; - actualSymbol_ = value; - - return this; - } - /** - * required int64 actual_symbol = 1; - */ - public Builder clearActualSymbol() { - bitField0_ = (bitField0_ & ~0x00000001); - actualSymbol_ = 0L; - - return this; - } - - private long expectSymbol_ ; - /** - * required int64 expect_symbol = 2; - */ - public boolean hasExpectSymbol() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * required int64 expect_symbol = 2; - */ - public long getExpectSymbol() { - return expectSymbol_; - } - /** - * required int64 expect_symbol = 2; - */ - public Builder setExpectSymbol(long value) { - bitField0_ |= 0x00000002; - expectSymbol_ = value; - - return this; - } - /** - * required int64 expect_symbol = 2; - */ - public Builder clearExpectSymbol() { - bitField0_ = (bitField0_ & ~0x00000002); - expectSymbol_ = 0L; - - return this; - } - - // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Actual) - } - - static { - defaultInstance = new Actual(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Actual) -} diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/ActualOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/ActualOrBuilder.java deleted file mode 100644 index 40bf4ee497d..00000000000 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/ActualOrBuilder.java +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: compiler/ir/serialization.common/src/KotlinIr.proto - -package org.jetbrains.kotlin.backend.common.serialization.proto; - -public interface ActualOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.Actual) - org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder { - - /** - * required int64 actual_symbol = 1; - */ - boolean hasActualSymbol(); - /** - * required int64 actual_symbol = 1; - */ - long getActualSymbol(); - - /** - * required int64 expect_symbol = 2; - */ - boolean hasExpectSymbol(); - /** - * required int64 expect_symbol = 2; - */ - long getExpectSymbol(); -} \ No newline at end of file diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java index 96ee12c5981..f074b7755e5 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java @@ -137,14 +137,6 @@ public final class IrFile extends input.popLimit(limit); break; } - case 50: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - actual_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; - } - actual_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Actual.PARSER, extensionRegistry)); - break; - } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -165,9 +157,6 @@ public final class IrFile extends if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { explicitlyExportedToCompiler_ = java.util.Collections.unmodifiableList(explicitlyExportedToCompiler_); } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - actual_ = java.util.Collections.unmodifiableList(actual_); - } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -313,48 +302,12 @@ public final class IrFile extends } private int explicitlyExportedToCompilerMemoizedSerializedSize = -1; - public static final int ACTUAL_FIELD_NUMBER = 6; - private java.util.List actual_; - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public java.util.List getActualList() { - return actual_; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public java.util.List - getActualOrBuilderList() { - return actual_; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public int getActualCount() { - return actual_.size(); - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index) { - return actual_.get(index); - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder getActualOrBuilder( - int index) { - return actual_.get(index); - } - private void initFields() { declarationId_ = java.util.Collections.emptyList(); fileEntry_ = org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry.getDefaultInstance(); fqName_ = java.util.Collections.emptyList(); annotation_ = java.util.Collections.emptyList(); explicitlyExportedToCompiler_ = java.util.Collections.emptyList(); - actual_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -376,12 +329,6 @@ public final class IrFile extends return false; } } - for (int i = 0; i < getActualCount(); i++) { - if (!getActual(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } memoizedIsInitialized = 1; return true; } @@ -416,9 +363,6 @@ public final class IrFile extends for (int i = 0; i < explicitlyExportedToCompiler_.size(); i++) { output.writeInt64NoTag(explicitlyExportedToCompiler_.get(i)); } - for (int i = 0; i < actual_.size(); i++) { - output.writeMessage(6, actual_.get(i)); - } output.writeRawBytes(unknownFields); } @@ -478,10 +422,6 @@ public final class IrFile extends } explicitlyExportedToCompilerMemoizedSerializedSize = dataSize; } - for (int i = 0; i < actual_.size(); i++) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeMessageSize(6, actual_.get(i)); - } size += unknownFields.size(); memoizedSerializedSize = size; return size; @@ -586,8 +526,6 @@ public final class IrFile extends bitField0_ = (bitField0_ & ~0x00000008); explicitlyExportedToCompiler_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); - actual_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -635,11 +573,6 @@ public final class IrFile extends bitField0_ = (bitField0_ & ~0x00000010); } result.explicitlyExportedToCompiler_ = explicitlyExportedToCompiler_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { - actual_ = java.util.Collections.unmodifiableList(actual_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.actual_ = actual_; result.bitField0_ = to_bitField0_; return result; } @@ -688,16 +621,6 @@ public final class IrFile extends explicitlyExportedToCompiler_.addAll(other.explicitlyExportedToCompiler_); } - } - if (!other.actual_.isEmpty()) { - if (actual_.isEmpty()) { - actual_ = other.actual_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureActualIsMutable(); - actual_.addAll(other.actual_); - } - } setUnknownFields( getUnknownFields().concat(other.unknownFields)); @@ -719,12 +642,6 @@ public final class IrFile extends return false; } } - for (int i = 0; i < getActualCount(); i++) { - if (!getActual(i).isInitialized()) { - - return false; - } - } return true; } @@ -1130,131 +1047,6 @@ public final class IrFile extends return this; } - private java.util.List actual_ = - java.util.Collections.emptyList(); - private void ensureActualIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - actual_ = new java.util.ArrayList(actual_); - bitField0_ |= 0x00000020; - } - } - - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public java.util.List getActualList() { - return java.util.Collections.unmodifiableList(actual_); - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public int getActualCount() { - return actual_.size(); - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index) { - return actual_.get(index); - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder setActual( - int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) { - if (value == null) { - throw new NullPointerException(); - } - ensureActualIsMutable(); - actual_.set(index, value); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder setActual( - int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) { - ensureActualIsMutable(); - actual_.set(index, builderForValue.build()); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder addActual(org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) { - if (value == null) { - throw new NullPointerException(); - } - ensureActualIsMutable(); - actual_.add(value); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder addActual( - int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) { - if (value == null) { - throw new NullPointerException(); - } - ensureActualIsMutable(); - actual_.add(index, value); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder addActual( - org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) { - ensureActualIsMutable(); - actual_.add(builderForValue.build()); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder addActual( - int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) { - ensureActualIsMutable(); - actual_.add(index, builderForValue.build()); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder addAllActual( - java.lang.Iterable values) { - ensureActualIsMutable(); - org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, actual_); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder clearActual() { - actual_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - - return this; - } - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - public Builder removeActual(int index) { - ensureActualIsMutable(); - actual_.remove(index); - - return this; - } - // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrFile) } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java index 2a590b8f935..23f2bb9049d 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java @@ -68,18 +68,4 @@ public interface IrFileOrBuilder extends * repeated int64 explicitly_exported_to_compiler = 5 [packed = true]; */ long getExplicitlyExportedToCompiler(int index); - - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - java.util.List - getActualList(); - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index); - /** - * repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6; - */ - int getActualCount(); } \ No newline at end of file diff --git a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt index 3a9f633faeb..726f7761c59 100644 --- a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt +++ b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/deserializeLazyDeclarations.kt @@ -65,7 +65,6 @@ fun deserializeFromByteArray( irLibraryFile, fileSymbol = dummyIrFile.symbol, fileSignature = dummyFileSignature, - /* TODO */ actuals = emptyList(), enqueueLocalTopLevelDeclaration = {}, // just link to it in symbolTable handleExpectActualMapping = { _, symbol -> symbol }, // no expect declarations internationService = internationService