[IR SERIALIZATION] Get rid of UniqId proto message

- encode locality flag in major bit of uniqid (1 - global, 0 - local)
This commit is contained in:
Roman Artemev
2019-09-12 15:18:30 +03:00
committed by romanart
parent fcae5873d0
commit d5176cbf5d
19 changed files with 274 additions and 857 deletions
@@ -76,7 +76,7 @@ message FileEntry {
}
message IrFile {
repeated UniqId declaration_id = 1;
repeated int64 declaration_id = 1;
required FileEntry file_entry = 2;
repeated int32 fq_name = 3;
repeated IrConstructorCall annotation = 4;
@@ -105,14 +105,12 @@ enum IrSymbolKind {
message IrSymbolData {
required IrSymbolKind kind = 1;
required UniqId uniq_id = 2;
required UniqId top_level_uniq_id = 3;
repeated int32 fq_name = 4;
optional DescriptorReference descriptor_reference = 5;
}
message IrSymbolTable {
repeated IrSymbolData symbols = 1;
required int64 uniq_id_index = 4;
required int64 top_level_uniq_id_index = 5;
repeated int32 fq_name = 6;
optional DescriptorReference descriptor_reference = 7;
}
/* ------ IrTypes --------------------------------------------- */
@@ -37,8 +37,10 @@ abstract class GlobalDeclarationTable(private val mangler: KotlinMangler, privat
protected open fun loadKnownBuiltins(builtIns: IrBuiltIns, startIndex: Long): Long {
var index = startIndex
val mask = 1L shl 63
builtIns.knownBuiltins.forEach {
table[it.owner] = UniqId(index++, false).also { id -> clashTracker.commit(it.owner, id) }
table[it.owner] = UniqId(index or mask).also { id -> clashTracker.commit(it.owner, id) }
index++
}
return index
}
@@ -46,7 +48,7 @@ abstract class GlobalDeclarationTable(private val mangler: KotlinMangler, privat
open fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
return table.getOrPut(declaration) {
with(mangler) {
UniqId(declaration.hashedMangle, false).also { clashTracker.commit(declaration, it) }
UniqId(declaration.hashedMangle).also { clashTracker.commit(declaration, it) }
}
}
}
@@ -71,7 +73,7 @@ class DeclarationTable(
private fun computeUniqIdByDeclaration(declaration: IrDeclaration): UniqId {
return if (declaration.isLocalDeclaration()) {
table.getOrPut(declaration) { UniqId(localIndex++, true) }
table.getOrPut(declaration) { UniqId(localIndex++) }
} else globalDeclarationTable.computeUniqIdByDeclaration(declaration)
}
@@ -256,11 +256,12 @@ open class IrFileSerializer(
val uniqId =
declarationTable.uniqIdByDeclaration(declaration)
proto.setUniqId(protoUniqId(uniqId))
proto.uniqIdIndex = uniqId.index
val topLevelUniqId =
declarationTable.uniqIdByDeclaration((declaration).findTopLevelDeclaration())
proto.setTopLevelUniqId(protoUniqId(topLevelUniqId))
proto.topLevelUniqIdIndex = topLevelUniqId.index
descriptorReferenceSerializer.serializeDescriptorReference(declaration)?.let {
proto.setDescriptorReference(it)
@@ -289,8 +289,8 @@ abstract class KotlinIrLinker(
}
private fun deserializeIrSymbolData(proto: ProtoSymbolData): IrSymbol {
val key = proto.uniqId.uniqId()
val topLevelKey = proto.topLevelUniqId.uniqId()
val key = UniqId(proto.uniqIdIndex)
val topLevelKey = UniqId(proto.topLevelUniqIdIndex)
val topLevelDeserializationState = getStateForID(topLevelKey)
@@ -409,22 +409,23 @@ abstract class KotlinIrLinker(
fileToDeserializerMap[file] = fileDeserializer
fileProto.declarationIdList.forEach {
val uniqId = it.uniqId()
assert(uniqId.isPublic)
val uniqId = UniqId(it)
moduleReversedFileIndex.getOrPut(uniqId) { fileDeserializer }
}
val forceLoadedIds = deserializationStrategy.run {
when {
theWholeWorld -> fileProto.declarationIdList
theWholeWorld -> fileProto.declarationIdList.map { UniqId(it) }
explicitlyExported -> fileProto.explicitlyExportedToCompilerList.map {
fileDeserializer.loadSymbolData(it).topLevelUniqId
fileDeserializer.loadSymbolData(it).run {
UniqId(topLevelUniqIdIndex)
}
}
else -> emptyList()
}
}
forceLoadedIds.forEach { moduleDeserializationState.addUniqID(it.uniqId().also { i -> assert(i.isPublic) }) }
forceLoadedIds.forEach { moduleDeserializationState.addUniqID(it.also { i -> assert(i.isPublic) }) }
return file
}
@@ -464,9 +465,10 @@ abstract class KotlinIrLinker(
private fun loadKnownBuiltinSymbols(): Long {
var currentIndex = firstKnownBuiltinsIndex
val mask = 1L shl 63
val globalDeserializedSymbols = globalDeserializationState.deserializedSymbols
builtIns.knownBuiltins.forEach {
globalDeserializedSymbols[UniqId(currentIndex, isLocal = false)] = it
globalDeserializedSymbols[UniqId(currentIndex or mask)] = it
assert(symbolTable.referenceSimpleFunction(it.descriptor) == it)
currentIndex++
}
@@ -519,7 +521,7 @@ abstract class KotlinIrLinker(
val descriptorUniqId = topLevelDescriptor.getUniqId()
?: error("Could not get descriptor uniq id for $topLevelDescriptor")
val topLevelKey = UniqId(descriptorUniqId, isLocal = false)
val topLevelKey = UniqId(descriptorUniqId)
val moduleOfOrigin = topLevelDescriptor.module
@@ -28,8 +28,11 @@ interface KotlinMangler {
}
}
private const val PUBLIC_MANGLE_FLAG = 1L shl 63
abstract class KotlinManglerImpl : KotlinMangler {
override val String.hashMangle get() = this.cityHash64()
override val String.hashMangle get() = (this.cityHash64() % PUBLIC_MANGLE_FLAG) or PUBLIC_MANGLE_FLAG
private fun hashedMangleImpl(declaration: IrDeclaration): Long {
return declaration.uniqSymbolName().hashMangle
@@ -6,30 +6,19 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
import org.jetbrains.kotlin.protobuf.GeneratedMessageLite
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
import org.jetbrains.kotlin.backend.common.serialization.proto.UniqId as ProtoUniqId
// This is an abstract uniqIdIndex any serialized IR declarations gets.
// It is either isLocal and then just gets and ordinary number within its module.
// Or is visible across modules and then gets a hash of mangled name as its index.
data class UniqId(
val index: Long,
val isLocal: Boolean
) {
val isPublic: Boolean get() = !isLocal
inline class UniqId(val index: Long) {
val isPublic: Boolean get() = (index and (1L shl 63)) != 0L
val isLocal: Boolean get() = (index and (1L shl 63)) == 0L
}
fun protoUniqId(uniqId: UniqId): ProtoUniqId =
ProtoUniqId.newBuilder()
.setIndex(uniqId.index)
.setIsLocal(uniqId.isLocal)
.build()
fun ProtoUniqId.uniqId(): UniqId = UniqId(this.index, this.isLocal)
fun <T, M : GeneratedMessageLite.ExtendableMessage<M>> M.tryGetExtension(extension: GeneratedMessageLite.GeneratedExtension<M, T>) =
if (this.hasExtension(extension)) this.getExtension<T>(extension) else null
@@ -184,37 +184,36 @@ public final class IrFile extends
private int bitField0_;
public static final int DECLARATION_ID_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId> declarationId_;
private java.util.List<java.lang.Long> declarationId_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId> getDeclarationIdList() {
public java.util.List<java.lang.Long>
getDeclarationIdList() {
return declarationId_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.UniqIdOrBuilder>
getDeclarationIdOrBuilderList() {
return declarationId_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public int getDeclarationIdCount() {
return declarationId_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getDeclarationId(int index) {
return declarationId_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqIdOrBuilder getDeclarationIdOrBuilder(
int index) {
public long getDeclarationId(int index) {
return declarationId_.get(index);
}
@@ -647,128 +646,97 @@ public final class IrFile extends
}
private int bitField0_;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId> declarationId_ =
java.util.Collections.emptyList();
private java.util.List<java.lang.Long> declarationId_ = java.util.Collections.emptyList();
private void ensureDeclarationIdIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
declarationId_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId>(declarationId_);
declarationId_ = new java.util.ArrayList<java.lang.Long>(declarationId_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId> getDeclarationIdList() {
public java.util.List<java.lang.Long>
getDeclarationIdList() {
return java.util.Collections.unmodifiableList(declarationId_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public int getDeclarationIdCount() {
return declarationId_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getDeclarationId(int index) {
public long getDeclarationId(int index) {
return declarationId_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public Builder setDeclarationId(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (value == null) {
throw new NullPointerException();
}
int index, long value) {
ensureDeclarationIdIsMutable();
declarationId_.set(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public Builder setDeclarationId(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
ensureDeclarationIdIsMutable();
declarationId_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public Builder addDeclarationId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (value == null) {
throw new NullPointerException();
}
public Builder addDeclarationId(long value) {
ensureDeclarationIdIsMutable();
declarationId_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public Builder addDeclarationId(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (value == null) {
throw new NullPointerException();
}
ensureDeclarationIdIsMutable();
declarationId_.add(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public Builder addDeclarationId(
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
ensureDeclarationIdIsMutable();
declarationId_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public Builder addDeclarationId(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
ensureDeclarationIdIsMutable();
declarationId_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public Builder addAllDeclarationId(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.UniqId> values) {
java.lang.Iterable<? extends java.lang.Long> values) {
ensureDeclarationIdIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, declarationId_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
public Builder clearDeclarationId() {
declarationId_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
public Builder removeDeclarationId(int index) {
ensureDeclarationIdIsMutable();
declarationId_.remove(index);
return this;
}
@@ -8,18 +8,29 @@ public interface IrFileOrBuilder extends
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.UniqId>
getDeclarationIdList();
java.util.List<java.lang.Long> getDeclarationIdList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getDeclarationId(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId declaration_id = 1;</code>
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
int getDeclarationIdCount();
/**
* <code>repeated int64 declaration_id = 1;</code>
*
* <pre>
* repeated UniqId declaration_id = 1;
* </pre>
*/
long getDeclarationId(int index);
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry file_entry = 2;</code>
@@ -65,33 +65,17 @@ public final class IrSymbolData extends
}
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = uniqId_.toBuilder();
}
uniqId_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uniqId_);
uniqId_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002;
break;
}
case 26: {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder subBuilder = null;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
subBuilder = topLevelUniqId_.toBuilder();
}
topLevelUniqId_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(topLevelUniqId_);
topLevelUniqId_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000004;
break;
}
case 32: {
bitField0_ |= 0x00000002;
uniqIdIndex_ = input.readInt64();
break;
}
case 40: {
bitField0_ |= 0x00000004;
topLevelUniqIdIndex_ = input.readInt64();
break;
}
case 48: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
fqName_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000008;
@@ -99,7 +83,7 @@ public final class IrSymbolData extends
fqName_.add(input.readInt32());
break;
}
case 34: {
case 50: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) {
@@ -112,7 +96,7 @@ public final class IrSymbolData extends
input.popLimit(limit);
break;
}
case 42: {
case 58: {
org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = descriptorReference_.toBuilder();
@@ -177,76 +161,76 @@ public final class IrSymbolData extends
return kind_;
}
public static final int UNIQ_ID_FIELD_NUMBER = 2;
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniqId_;
public static final int UNIQ_ID_INDEX_FIELD_NUMBER = 4;
private long uniqIdIndex_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public boolean hasUniqId() {
public boolean hasUniqIdIndex() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId() {
return uniqId_;
public long getUniqIdIndex() {
return uniqIdIndex_;
}
public static final int TOP_LEVEL_UNIQ_ID_FIELD_NUMBER = 3;
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId topLevelUniqId_;
public static final int TOP_LEVEL_UNIQ_ID_INDEX_FIELD_NUMBER = 5;
private long topLevelUniqIdIndex_;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public boolean hasTopLevelUniqId() {
public boolean hasTopLevelUniqIdIndex() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getTopLevelUniqId() {
return topLevelUniqId_;
public long getTopLevelUniqIdIndex() {
return topLevelUniqIdIndex_;
}
public static final int FQ_NAME_FIELD_NUMBER = 4;
public static final int FQ_NAME_FIELD_NUMBER = 6;
private java.util.List<java.lang.Integer> fqName_;
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public java.util.List<java.lang.Integer>
getFqNameList() {
return fqName_;
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public int getFqNameCount() {
return fqName_.size();
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public int getFqName(int index) {
return fqName_.get(index);
}
public static final int DESCRIPTOR_REFERENCE_FIELD_NUMBER = 5;
public static final int DESCRIPTOR_REFERENCE_FIELD_NUMBER = 7;
private org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptorReference_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public boolean hasDescriptorReference() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference() {
return descriptorReference_;
@@ -254,8 +238,8 @@ public final class IrSymbolData extends
private void initFields() {
kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind.FUNCTION_SYMBOL;
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
uniqIdIndex_ = 0L;
topLevelUniqIdIndex_ = 0L;
fqName_ = java.util.Collections.emptyList();
descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance();
}
@@ -269,19 +253,11 @@ public final class IrSymbolData extends
memoizedIsInitialized = 0;
return false;
}
if (!hasUniqId()) {
if (!hasUniqIdIndex()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasTopLevelUniqId()) {
memoizedIsInitialized = 0;
return false;
}
if (!getUniqId().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
if (!getTopLevelUniqId().isInitialized()) {
if (!hasTopLevelUniqIdIndex()) {
memoizedIsInitialized = 0;
return false;
}
@@ -302,16 +278,16 @@ public final class IrSymbolData extends
output.writeEnum(1, kind_.getNumber());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, uniqId_);
output.writeInt64(4, uniqIdIndex_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, topLevelUniqId_);
output.writeInt64(5, topLevelUniqIdIndex_);
}
for (int i = 0; i < fqName_.size(); i++) {
output.writeInt32(4, fqName_.get(i));
output.writeInt32(6, fqName_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(5, descriptorReference_);
output.writeMessage(7, descriptorReference_);
}
output.writeRawBytes(unknownFields);
}
@@ -328,11 +304,11 @@ public final class IrSymbolData extends
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, uniqId_);
.computeInt64Size(4, uniqIdIndex_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, topLevelUniqId_);
.computeInt64Size(5, topLevelUniqIdIndex_);
}
{
int dataSize = 0;
@@ -345,7 +321,7 @@ public final class IrSymbolData extends
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, descriptorReference_);
.computeMessageSize(7, descriptorReference_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -443,9 +419,9 @@ public final class IrSymbolData extends
super.clear();
kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind.FUNCTION_SYMBOL;
bitField0_ = (bitField0_ & ~0x00000001);
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
uniqIdIndex_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
topLevelUniqIdIndex_ = 0L;
bitField0_ = (bitField0_ & ~0x00000004);
fqName_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
@@ -481,11 +457,11 @@ public final class IrSymbolData extends
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.uniqId_ = uniqId_;
result.uniqIdIndex_ = uniqIdIndex_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.topLevelUniqId_ = topLevelUniqId_;
result.topLevelUniqIdIndex_ = topLevelUniqIdIndex_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
fqName_ = java.util.Collections.unmodifiableList(fqName_);
bitField0_ = (bitField0_ & ~0x00000008);
@@ -504,11 +480,11 @@ public final class IrSymbolData extends
if (other.hasKind()) {
setKind(other.getKind());
}
if (other.hasUniqId()) {
mergeUniqId(other.getUniqId());
if (other.hasUniqIdIndex()) {
setUniqIdIndex(other.getUniqIdIndex());
}
if (other.hasTopLevelUniqId()) {
mergeTopLevelUniqId(other.getTopLevelUniqId());
if (other.hasTopLevelUniqIdIndex()) {
setTopLevelUniqIdIndex(other.getTopLevelUniqIdIndex());
}
if (!other.fqName_.isEmpty()) {
if (fqName_.isEmpty()) {
@@ -533,19 +509,11 @@ public final class IrSymbolData extends
return false;
}
if (!hasUniqId()) {
if (!hasUniqIdIndex()) {
return false;
}
if (!hasTopLevelUniqId()) {
return false;
}
if (!getUniqId().isInitialized()) {
return false;
}
if (!getTopLevelUniqId().isInitialized()) {
if (!hasTopLevelUniqIdIndex()) {
return false;
}
@@ -612,123 +580,83 @@ public final class IrSymbolData extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
private long uniqIdIndex_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public boolean hasUniqId() {
public boolean hasUniqIdIndex() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId() {
return uniqId_;
public long getUniqIdIndex() {
return uniqIdIndex_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public Builder setUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (value == null) {
throw new NullPointerException();
}
uniqId_ = value;
public Builder setUniqIdIndex(long value) {
bitField0_ |= 0x00000002;
uniqIdIndex_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
public Builder setUniqId(
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
uniqId_ = builderForValue.build();
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
*/
public Builder mergeUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
uniqId_ != org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance()) {
uniqId_ =
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.newBuilder(uniqId_).mergeFrom(value).buildPartial();
} else {
uniqId_ = value;
}
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
*/
public Builder clearUniqId() {
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
public Builder clearUniqIdIndex() {
bitField0_ = (bitField0_ & ~0x00000002);
uniqIdIndex_ = 0L;
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
private long topLevelUniqIdIndex_ ;
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public boolean hasTopLevelUniqId() {
public boolean hasTopLevelUniqIdIndex() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getTopLevelUniqId() {
return topLevelUniqId_;
public long getTopLevelUniqIdIndex() {
return topLevelUniqIdIndex_;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public Builder setTopLevelUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (value == null) {
throw new NullPointerException();
}
topLevelUniqId_ = value;
public Builder setTopLevelUniqIdIndex(long value) {
bitField0_ |= 0x00000004;
topLevelUniqIdIndex_ = value;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
public Builder setTopLevelUniqId(
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
topLevelUniqId_ = builderForValue.build();
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
*/
public Builder mergeTopLevelUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (((bitField0_ & 0x00000004) == 0x00000004) &&
topLevelUniqId_ != org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance()) {
topLevelUniqId_ =
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.newBuilder(topLevelUniqId_).mergeFrom(value).buildPartial();
} else {
topLevelUniqId_ = value;
}
bitField0_ |= 0x00000004;
return this;
}
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
*/
public Builder clearTopLevelUniqId() {
topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
public Builder clearTopLevelUniqIdIndex() {
bitField0_ = (bitField0_ & ~0x00000004);
topLevelUniqIdIndex_ = 0L;
return this;
}
@@ -740,26 +668,26 @@ public final class IrSymbolData extends
}
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public java.util.List<java.lang.Integer>
getFqNameList() {
return java.util.Collections.unmodifiableList(fqName_);
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public int getFqNameCount() {
return fqName_.size();
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public int getFqName(int index) {
return fqName_.get(index);
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public Builder setFqName(
int index, int value) {
@@ -769,7 +697,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public Builder addFqName(int value) {
ensureFqNameIsMutable();
@@ -778,7 +706,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public Builder addAllFqName(
java.lang.Iterable<? extends java.lang.Integer> values) {
@@ -789,7 +717,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
public Builder clearFqName() {
fqName_ = java.util.Collections.emptyList();
@@ -800,31 +728,19 @@ public final class IrSymbolData extends
private org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public boolean hasDescriptorReference() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference() {
return descriptorReference_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public Builder setDescriptorReference(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference value) {
if (value == null) {
@@ -836,11 +752,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public Builder setDescriptorReference(
org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.Builder builderForValue) {
@@ -850,11 +762,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public Builder mergeDescriptorReference(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference value) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
@@ -869,11 +777,7 @@ public final class IrSymbolData extends
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
public Builder clearDescriptorReference() {
descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance();
@@ -17,50 +17,50 @@ public interface IrSymbolDataOrBuilder extends
org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind getKind();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
boolean hasUniqId();
boolean hasUniqIdIndex();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 2;</code>
* <code>required int64 uniq_id_index = 4;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId();
long getUniqIdIndex();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
boolean hasTopLevelUniqId();
boolean hasTopLevelUniqIdIndex();
/**
* <code>required .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId top_level_uniq_id = 3;</code>
* <code>required int64 top_level_uniq_id_index = 5;</code>
*
* <pre>
* required bool uniq_id_locality = 5;
* </pre>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getTopLevelUniqId();
long getTopLevelUniqIdIndex();
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
java.util.List<java.lang.Integer> getFqNameList();
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
int getFqNameCount();
/**
* <code>repeated int32 fq_name = 4;</code>
* <code>repeated int32 fq_name = 6;</code>
*/
int getFqName(int index);
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
boolean hasDescriptorReference();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5;</code>
*
* <pre>
* optional FqName fqname = 4;
* </pre>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 7;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference();
}
@@ -476,4 +476,4 @@ public final class IrSymbolTable extends
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolTable)
}
}
@@ -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.UniqId}
*/
public final class UniqId extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.UniqId)
UniqIdOrBuilder {
// Use UniqId.newBuilder() to construct.
private UniqId(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private UniqId(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final UniqId defaultInstance;
public static UniqId getDefaultInstance() {
return defaultInstance;
}
public UniqId getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private UniqId(
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);
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;
index_ = input.readUInt64();
break;
}
case 16: {
bitField0_ |= 0x00000002;
isLocal_ = input.readBool();
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<UniqId> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<UniqId>() {
public UniqId parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new UniqId(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<UniqId> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int INDEX_FIELD_NUMBER = 1;
private long index_;
/**
* <code>required uint64 index = 1;</code>
*/
public boolean hasIndex() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required uint64 index = 1;</code>
*/
public long getIndex() {
return index_;
}
public static final int ISLOCAL_FIELD_NUMBER = 2;
private boolean isLocal_;
/**
* <code>required bool isLocal = 2;</code>
*/
public boolean hasIsLocal() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool isLocal = 2;</code>
*/
public boolean getIsLocal() {
return isLocal_;
}
private void initFields() {
index_ = 0L;
isLocal_ = false;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasIndex()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasIsLocal()) {
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.writeUInt64(1, index_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBool(2, isLocal_);
}
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
.computeUInt64Size(1, index_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(2, isLocal_);
}
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.UniqId 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.UniqId 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.UniqId parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.UniqId 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.UniqId parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.UniqId 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.UniqId parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.UniqId 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.UniqId parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.UniqId 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.UniqId prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.UniqId}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.UniqId)
org.jetbrains.kotlin.backend.common.serialization.proto.UniqIdOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
index_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
isLocal_ = false;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId build() {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId result = new org.jetbrains.kotlin.backend.common.serialization.proto.UniqId(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.index_ = index_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.isLocal_ = isLocal_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance()) return this;
if (other.hasIndex()) {
setIndex(other.getIndex());
}
if (other.hasIsLocal()) {
setIsLocal(other.getIsLocal());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasIndex()) {
return false;
}
if (!hasIsLocal()) {
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.UniqId parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.UniqId) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private long index_ ;
/**
* <code>required uint64 index = 1;</code>
*/
public boolean hasIndex() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required uint64 index = 1;</code>
*/
public long getIndex() {
return index_;
}
/**
* <code>required uint64 index = 1;</code>
*/
public Builder setIndex(long value) {
bitField0_ |= 0x00000001;
index_ = value;
return this;
}
/**
* <code>required uint64 index = 1;</code>
*/
public Builder clearIndex() {
bitField0_ = (bitField0_ & ~0x00000001);
index_ = 0L;
return this;
}
private boolean isLocal_ ;
/**
* <code>required bool isLocal = 2;</code>
*/
public boolean hasIsLocal() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required bool isLocal = 2;</code>
*/
public boolean getIsLocal() {
return isLocal_;
}
/**
* <code>required bool isLocal = 2;</code>
*/
public Builder setIsLocal(boolean value) {
bitField0_ |= 0x00000002;
isLocal_ = value;
return this;
}
/**
* <code>required bool isLocal = 2;</code>
*/
public Builder clearIsLocal() {
bitField0_ = (bitField0_ & ~0x00000002);
isLocal_ = false;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.UniqId)
}
static {
defaultInstance = new UniqId(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.UniqId)
}
@@ -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 UniqIdOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.UniqId)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required uint64 index = 1;</code>
*/
boolean hasIndex();
/**
* <code>required uint64 index = 1;</code>
*/
long getIndex();
/**
* <code>required bool isLocal = 2;</code>
*/
boolean hasIsLocal();
/**
* <code>required bool isLocal = 2;</code>
*/
boolean getIsLocal();
}
@@ -29,7 +29,7 @@ class JsIrLinker(
JsDescriptorReferenceDeserializer(currentModule, mangler, builtIns)
override fun reader(moduleDescriptor: ModuleDescriptor, fileIndex: Int, uniqId: UniqId) =
moduleDescriptor.kotlinLibrary.irDeclaration(uniqId.index, uniqId.isLocal, fileIndex)
moduleDescriptor.kotlinLibrary.irDeclaration(uniqId.index, fileIndex)
override fun readSymbol(moduleDescriptor: ModuleDescriptor, fileIndex: Int, symbolIndex: Int) =
moduleDescriptor.kotlinLibrary.symbol(symbolIndex, fileIndex)
@@ -11,10 +11,6 @@ import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.isInlined
object JsMangler : KotlinManglerImpl() {
private const val MOD_VALUE = PUBLIC_LOCAL_UNIQ_ID_EDGE
override val String.hashMangle: Long get() = cityHash64() % MOD_VALUE
override val IrType.isInlined: Boolean
get() = this.isInlined()
}
@@ -35,7 +35,7 @@ interface MetadataLibrary {
interface IrLibrary {
val dataFlowGraph: ByteArray?
fun irDeclaration(index: Long, isLocal: Boolean, fileIndex: Int): ByteArray
fun irDeclaration(index: Long, fileIndex: Int): ByteArray
fun symbol(index: Int, fileIndex: Int): ByteArray
fun type(index: Int, fileIndex: Int): ByteArray
fun string(index: Int, fileIndex: Int): ByteArray
@@ -169,7 +169,7 @@ abstract class IrTableReader<K>(file: File, keyReader: ByteBuffer.() -> K) {
class IndexIrTableReader(file: File) : IrTableReader<Long>(file, { long })
data class DeclarationId(val id: Long, val isLocal: Boolean)
data class DeclarationId(val id: Long)
class DeclarationIrTableReader(file: File) : IrTableReader<DeclarationId>(file, { DeclarationId(long, int != 0) })
class DeclarationIrMultiTableReader(file: File) : IrMultiTableReader<DeclarationId>(file, { DeclarationId(long, int != 0) })
class DeclarationIrTableReader(file: File) : IrTableReader<DeclarationId>(file, { DeclarationId(long) })
class DeclarationIrMultiTableReader(file: File) : IrMultiTableReader<DeclarationId>(file, { DeclarationId(long) })
@@ -76,7 +76,7 @@ class IrTableWriter(private val data: List<Pair<Long, ByteArray>>) : IrFileWrite
override fun writeData(dataOutput: DataOutput) {
dataOutput.writeInt(data.size)
var dataOffset = 4 + data.size * (8 + 4 + 4)
var dataOffset = Int.SIZE_BYTES + data.size * (Long.SIZE_BYTES + 2 * Int.SIZE_BYTES)
data.forEach {
dataOutput.writeLong(it.first)
@@ -91,8 +91,8 @@ class IrTableWriter(private val data: List<Pair<Long, ByteArray>>) : IrFileWrite
class IrDeclarationWriter(private val declarations: List<SerializedDeclaration>) : IrFileWriter() {
private val SINGLE_INDEX_RECORD_SIZE = 20 // sizeof(Long) + 3 * sizeof(Int).
private val INDEX_HEADER_SIZE = 4 // sizeof(Int).
private val SINGLE_INDEX_RECORD_SIZE = Long.SIZE_BYTES + 2 * Int.SIZE_BYTES
private val INDEX_HEADER_SIZE = Int.SIZE_BYTES
override fun writeData(dataOutput: DataOutput) {
dataOutput.writeInt(declarations.size)
@@ -101,7 +101,6 @@ class IrDeclarationWriter(private val declarations: List<SerializedDeclaration>)
for (d in declarations) {
dataOutput.writeLong(d.id)
dataOutput.writeInt(d.local)
dataOutput.writeInt(dataOffset)
dataOutput.writeInt(d.size)
dataOffset += d.size
@@ -116,8 +115,8 @@ class IrDeclarationWriter(private val declarations: List<SerializedDeclaration>)
class IrMemoryDeclarationWriter(private val declarations: List<SerializedDeclaration>) : IrMemoryWriter() {
private val SINGLE_INDEX_RECORD_SIZE = 20 // sizeof(Long) + 3 * sizeof(Int).
private val INDEX_HEADER_SIZE = 4 // sizeof(Int).
private val SINGLE_INDEX_RECORD_SIZE = Long.SIZE_BYTES + 2 * Int.SIZE_BYTES
private val INDEX_HEADER_SIZE = Int.SIZE_BYTES
override fun writeData(dataOutput: DataOutput) {
dataOutput.writeInt(declarations.size)
@@ -126,7 +125,6 @@ class IrMemoryDeclarationWriter(private val declarations: List<SerializedDeclara
for (d in declarations) {
dataOutput.writeLong(d.id)
dataOutput.writeInt(d.local)
dataOutput.writeInt(dataOffset)
dataOutput.writeInt(d.size)
dataOffset += d.size
@@ -84,7 +84,7 @@ abstract class IrLibraryImpl(
class IrMonoliticLibraryImpl(_access: IrLibraryAccess<IrKotlinLibraryLayout>) : IrLibraryImpl(_access) {
override fun fileCount(): Int = files.entryCount()
override fun irDeclaration(index: Long, isLocal: Boolean, fileIndex: Int) = loadIrDeclaration(index, isLocal, fileIndex)
override fun irDeclaration(index: Long, fileIndex: Int) = loadIrDeclaration(index, fileIndex)
override fun symbol(index: Int, fileIndex: Int) = symbols.tableItemBytes(fileIndex, index)
@@ -96,8 +96,8 @@ class IrMonoliticLibraryImpl(_access: IrLibraryAccess<IrKotlinLibraryLayout>) :
override fun file(index: Int) = files.tableItemBytes(index)
private fun loadIrDeclaration(index: Long, isLocal: Boolean, fileIndex: Int) =
combinedDeclarations.tableItemBytes(fileIndex, DeclarationId(index, isLocal))
private fun loadIrDeclaration(index: Long, fileIndex: Int) =
combinedDeclarations.tableItemBytes(fileIndex, DeclarationId(index))
private val combinedDeclarations: DeclarationIrMultiTableReader by lazy {
DeclarationIrMultiTableReader(access.realFiles {
@@ -145,14 +145,14 @@ class IrPerFileLibraryImpl(_access: IrLibraryAccess<IrKotlinLibraryLayout>) : Ir
}
private val fileToDeclarationMap = mutableMapOf<Int, DeclarationIrTableReader>()
override fun irDeclaration(index: Long, isLocal: Boolean, fileIndex: Int): ByteArray {
override fun irDeclaration(index: Long, fileIndex: Int): ByteArray {
val dataReader = fileToDeclarationMap.getOrPut(fileIndex) {
val fileDirectory = directories[fileIndex]
DeclarationIrTableReader(access.realFiles {
it.irDeclarations(fileDirectory)
})
}
return dataReader.tableItemBytes(DeclarationId(index, isLocal))
return dataReader.tableItemBytes(DeclarationId(index))
}
private val fileToSymbolMap = mutableMapOf<Int, IrArrayReader>()