diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt index 090c544750f..e87a379923d 100644 --- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt +++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmGeneratorExtensionsImpl.kt @@ -217,7 +217,7 @@ open class JvmGeneratorExtensionsImpl( override fun registerDeclarations(symbolTable: SymbolTable) { val signatureComputer = PublicIdSignatureComputer(JvmIrMangler) specialAnnotationConstructors.forEach { constructor -> - symbolTable.declareConstructorWithSignature(signatureComputer.composePublicIdSignature(constructor), constructor.symbol) + symbolTable.declareConstructorWithSignature(signatureComputer.composePublicIdSignature(constructor, false), constructor.symbol) } super.registerDeclarations(symbolTable) } 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 79dd000cfd6..fee1ec40022 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 @@ -149,7 +149,7 @@ open class IrFileSerializer( protected val protoBodyArray = mutableListOf() - private val protoDebugInfoArray = arrayListOf() + protected val protoDebugInfoArray = arrayListOf() sealed class XStatementOrExpression { abstract fun toByteArray(): ByteArray diff --git a/compiler/ir/serialization.jvm/src/JvmIr.proto b/compiler/ir/serialization.jvm/src/JvmIr.proto index 4c8a39a696e..49adcb4d012 100644 --- a/compiler/ir/serialization.jvm/src/JvmIr.proto +++ b/compiler/ir/serialization.jvm/src/JvmIr.proto @@ -20,6 +20,7 @@ message AuxTables { repeated bytes signature = 2; repeated bytes string = 3; repeated bytes body = 4; + repeated bytes debug_info = 5; } message JvmIrFile { diff --git a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/JvmIrSerializerSession.kt b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/JvmIrSerializerSession.kt index 1e562c059fd..f9b6d3d9c3f 100644 --- a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/JvmIrSerializerSession.kt +++ b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/JvmIrSerializerSession.kt @@ -54,6 +54,7 @@ class JvmIrSerializerSession( protoIdSignatureArray.forEach { proto.addSignature(it.toByteString()) } protoStringArray.forEach { proto.addString(ByteString.copyFromUtf8(it)) } protoBodyArray.forEach { proto.addBody(ByteString.copyFrom(it.toByteArray())) } + protoDebugInfoArray.forEach { proto.addDebugInfo(ByteString.copyFromUtf8(it)) } return proto.build() } } \ 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 ad3663096c0..bacf3e20abc 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 @@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmIrMangler import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl import org.jetbrains.kotlin.ir.declarations.lazy.LazyIrFactory -import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.impl.IrFileSymbolImpl import org.jetbrains.kotlin.ir.types.IrTypeSystemContext @@ -42,7 +41,8 @@ fun deserializeClassFromByteArray( irProto.auxTables.typeList, irProto.auxTables.signatureList, irProto.auxTables.stringList, - irProto.auxTables.bodyList + irProto.auxTables.bodyList, + irProto.auxTables.debugInfoList ) val descriptorFinder = DescriptorByIdSignatureFinder( @@ -99,7 +99,8 @@ fun deserializeIrFileFromByteArray( irProto.auxTables.typeList, irProto.auxTables.signatureList, irProto.auxTables.stringList, - irProto.auxTables.bodyList + irProto.auxTables.bodyList, + irProto.auxTables.debugInfoList ) val descriptorFinder = DescriptorByIdSignatureFinder( @@ -146,10 +147,11 @@ fun deserializeIrFileFromByteArray( } private class IrLibraryFileFromAnnotation( - val types: List, - val signatures: List, - val strings: List, - val bodies: List, + private val types: List, + private val signatures: List, + private val strings: List, + private val bodies: List, + private val debugInfo: List ) : IrLibraryFile() { override fun irDeclaration(index: Int): ByteArray { error("This method is never supposed to be called") @@ -159,6 +161,7 @@ private class IrLibraryFileFromAnnotation( override fun signature(index: Int): ByteArray = signatures[index].toByteArray() override fun string(index: Int): ByteArray = strings[index].toByteArray() override fun body(index: Int): ByteArray = bodies[index].toByteArray() + override fun debugInfo(index: Int): ByteArray = debugInfo[index].toByteArray() } private fun referencePublicSymbol( diff --git a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/proto/JvmIr.java b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/proto/JvmIr.java index ae76d97d36b..290a6954fb3 100644 --- a/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/proto/JvmIr.java +++ b/compiler/ir/serialization.jvm/src/org/jetbrains/kotlin/backend/jvm/serialization/proto/JvmIr.java @@ -660,6 +660,19 @@ public final class JvmIr { * repeated bytes body = 4; */ org.jetbrains.kotlin.protobuf.ByteString getBody(int index); + + /** + * repeated bytes debug_info = 5; + */ + java.util.List getDebugInfoList(); + /** + * repeated bytes debug_info = 5; + */ + int getDebugInfoCount(); + /** + * repeated bytes debug_info = 5; + */ + org.jetbrains.kotlin.protobuf.ByteString getDebugInfo(int index); } /** * Protobuf type {@code org.jetbrains.kotlin.backend.jvm.serialization.proto.AuxTables} @@ -743,6 +756,14 @@ public final class JvmIr { body_.add(input.readBytes()); break; } + case 42: { + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + debugInfo_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000010; + } + debugInfo_.add(input.readBytes()); + break; + } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -763,6 +784,9 @@ public final class JvmIr { if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { body_ = java.util.Collections.unmodifiableList(body_); } + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + debugInfo_ = java.util.Collections.unmodifiableList(debugInfo_); + } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -888,11 +912,34 @@ public final class JvmIr { return body_.get(index); } + public static final int DEBUG_INFO_FIELD_NUMBER = 5; + private java.util.List debugInfo_; + /** + * repeated bytes debug_info = 5; + */ + public java.util.List + getDebugInfoList() { + return debugInfo_; + } + /** + * repeated bytes debug_info = 5; + */ + public int getDebugInfoCount() { + return debugInfo_.size(); + } + /** + * repeated bytes debug_info = 5; + */ + public org.jetbrains.kotlin.protobuf.ByteString getDebugInfo(int index) { + return debugInfo_.get(index); + } + private void initFields() { type_ = java.util.Collections.emptyList(); signature_ = java.util.Collections.emptyList(); string_ = java.util.Collections.emptyList(); body_ = java.util.Collections.emptyList(); + debugInfo_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -919,6 +966,9 @@ public final class JvmIr { for (int i = 0; i < body_.size(); i++) { output.writeBytes(4, body_.get(i)); } + for (int i = 0; i < debugInfo_.size(); i++) { + output.writeBytes(5, debugInfo_.get(i)); + } output.writeRawBytes(unknownFields); } @@ -964,6 +1014,15 @@ public final class JvmIr { size += dataSize; size += 1 * getBodyList().size(); } + { + int dataSize = 0; + for (int i = 0; i < debugInfo_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeBytesSizeNoTag(debugInfo_.get(i)); + } + size += dataSize; + size += 1 * getDebugInfoList().size(); + } size += unknownFields.size(); memoizedSerializedSize = size; return size; @@ -1066,6 +1125,8 @@ public final class JvmIr { bitField0_ = (bitField0_ & ~0x00000004); body_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); + debugInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -1108,6 +1169,11 @@ public final class JvmIr { bitField0_ = (bitField0_ & ~0x00000008); } result.body_ = body_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + debugInfo_ = java.util.Collections.unmodifiableList(debugInfo_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.debugInfo_ = debugInfo_; return result; } @@ -1152,6 +1218,16 @@ public final class JvmIr { body_.addAll(other.body_); } + } + if (!other.debugInfo_.isEmpty()) { + if (debugInfo_.isEmpty()) { + debugInfo_ = other.debugInfo_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureDebugInfoIsMutable(); + debugInfo_.addAll(other.debugInfo_); + } + } setUnknownFields( getUnknownFields().concat(other.unknownFields)); @@ -1497,6 +1573,78 @@ public final class JvmIr { return this; } + private java.util.List debugInfo_ = java.util.Collections.emptyList(); + private void ensureDebugInfoIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + debugInfo_ = new java.util.ArrayList(debugInfo_); + bitField0_ |= 0x00000010; + } + } + /** + * repeated bytes debug_info = 5; + */ + public java.util.List + getDebugInfoList() { + return java.util.Collections.unmodifiableList(debugInfo_); + } + /** + * repeated bytes debug_info = 5; + */ + public int getDebugInfoCount() { + return debugInfo_.size(); + } + /** + * repeated bytes debug_info = 5; + */ + public org.jetbrains.kotlin.protobuf.ByteString getDebugInfo(int index) { + return debugInfo_.get(index); + } + /** + * repeated bytes debug_info = 5; + */ + public Builder setDebugInfo( + int index, org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDebugInfoIsMutable(); + debugInfo_.set(index, value); + + return this; + } + /** + * repeated bytes debug_info = 5; + */ + public Builder addDebugInfo(org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDebugInfoIsMutable(); + debugInfo_.add(value); + + return this; + } + /** + * repeated bytes debug_info = 5; + */ + public Builder addAllDebugInfo( + java.lang.Iterable values) { + ensureDebugInfoIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, debugInfo_); + + return this; + } + /** + * repeated bytes debug_info = 5; + */ + public Builder clearDebugInfo() { + debugInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.jvm.serialization.proto.AuxTables) }