[IR] Drop IR expect/actual table

^KT-61136
This commit is contained in:
Dmitriy Dolovov
2023-08-08 22:50:31 +02:00
committed by Space Team
parent e8b4550173
commit 6e648ac374
11 changed files with 6 additions and 852 deletions
@@ -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]
@@ -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 =
@@ -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<DeclarationDescriptor, IrSymbol>) {
val table = mutableMapOf<DeclarationDescriptor, IrSymbol>()
private fun IrElement.recordActuals(rightHandSide: Map<DeclarationDescriptor, IrSymbol>, 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<DeclarationDescriptor, IrSymbol> {
val rightHandSide = hashMapOf<DeclarationDescriptor, IrSymbol>()
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<MemberDescriptor> = 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)
}
}
}
@@ -70,7 +70,6 @@ class FileDeserializationState(
val symbolDeserializer =
IrSymbolDeserializer(
linker.symbolTable, fileReader, file.symbol,
fileProto.actualList,
::addIdSignature,
linker::handleExpectActualMapping,
symbolProcessor = linker.symbolProcessor,
@@ -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<DeclarationDescriptor, IrSymbol>,
@Suppress("UNUSED_PARAMETER") expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol> = 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<String>
) {
private val loopIndex = hashMapOf<IrLoop, Int>()
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<IrTypeKey, Int>()
@@ -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()
)
}
}
}
@@ -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<Actual>,
val enqueueLocalTopLevelDeclaration: (IdSignature) -> Unit,
val handleExpectActualMapping: (IdSignature, IrSymbol) -> IrSymbol,
internationService: IrInterningService,
@@ -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<Actual> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<Actual>() {
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<Actual> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int ACTUAL_SYMBOL_FIELD_NUMBER = 1;
private long actualSymbol_;
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public long getActualSymbol() {
return actualSymbol_;
}
public static final int EXPECT_SYMBOL_FIELD_NUMBER = 2;
private long expectSymbol_;
/**
* <code>required int64 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int64 expect_symbol = 2;</code>
*/
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_ ;
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public long getActualSymbol() {
return actualSymbol_;
}
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public Builder setActualSymbol(long value) {
bitField0_ |= 0x00000001;
actualSymbol_ = value;
return this;
}
/**
* <code>required int64 actual_symbol = 1;</code>
*/
public Builder clearActualSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
actualSymbol_ = 0L;
return this;
}
private long expectSymbol_ ;
/**
* <code>required int64 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int64 expect_symbol = 2;</code>
*/
public long getExpectSymbol() {
return expectSymbol_;
}
/**
* <code>required int64 expect_symbol = 2;</code>
*/
public Builder setExpectSymbol(long value) {
bitField0_ |= 0x00000002;
expectSymbol_ = value;
return this;
}
/**
* <code>required int64 expect_symbol = 2;</code>
*/
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)
}
@@ -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 {
/**
* <code>required int64 actual_symbol = 1;</code>
*/
boolean hasActualSymbol();
/**
* <code>required int64 actual_symbol = 1;</code>
*/
long getActualSymbol();
/**
* <code>required int64 expect_symbol = 2;</code>
*/
boolean hasExpectSymbol();
/**
* <code>required int64 expect_symbol = 2;</code>
*/
long getExpectSymbol();
}
@@ -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<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>();
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<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> actual_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> getActualList() {
return actual_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder>
getActualOrBuilderList() {
return actual_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public int getActualCount() {
return actual_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index) {
return actual_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
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<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> actual_ =
java.util.Collections.emptyList();
private void ensureActualIsMutable() {
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
actual_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>(actual_);
bitField0_ |= 0x00000020;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> getActualList() {
return java.util.Collections.unmodifiableList(actual_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public int getActualCount() {
return actual_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index) {
return actual_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
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;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder setActual(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualIsMutable();
actual_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder addActual(org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) {
if (value == null) {
throw new NullPointerException();
}
ensureActualIsMutable();
actual_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
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;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder addActual(
org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualIsMutable();
actual_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder addActual(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualIsMutable();
actual_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder addAllActual(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.Actual> values) {
ensureActualIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, actual_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder clearActual() {
actual_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
public Builder removeActual(int index) {
ensureActualIsMutable();
actual_.remove(index);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrFile)
}
@@ -68,18 +68,4 @@ public interface IrFileOrBuilder extends
* <code>repeated int64 explicitly_exported_to_compiler = 5 [packed = true];</code>
*/
long getExplicitlyExportedToCompiler(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>
getActualList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActual(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actual = 6;</code>
*/
int getActualCount();
}
@@ -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