Fix compilation after rebase: add debugInfo to JvmIr.proto

This commit is contained in:
Georgy Bronnikov
2021-07-05 23:20:57 +03:00
committed by TeamCityServer
parent f4d358069c
commit da946e464f
6 changed files with 162 additions and 9 deletions
@@ -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)
}
@@ -149,7 +149,7 @@ open class IrFileSerializer(
protected val protoBodyArray = mutableListOf<XStatementOrExpression>()
private val protoDebugInfoArray = arrayListOf<String>()
protected val protoDebugInfoArray = arrayListOf<String>()
sealed class XStatementOrExpression {
abstract fun toByteArray(): ByteArray
@@ -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 {
@@ -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()
}
}
@@ -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<ByteString>,
val signatures: List<ByteString>,
val strings: List<ByteString>,
val bodies: List<ByteString>,
private val types: List<ByteString>,
private val signatures: List<ByteString>,
private val strings: List<ByteString>,
private val bodies: List<ByteString>,
private val debugInfo: List<ByteString>
) : 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(
@@ -660,6 +660,19 @@ public final class JvmIr {
* <code>repeated bytes body = 4;</code>
*/
org.jetbrains.kotlin.protobuf.ByteString getBody(int index);
/**
* <code>repeated bytes debug_info = 5;</code>
*/
java.util.List<org.jetbrains.kotlin.protobuf.ByteString> getDebugInfoList();
/**
* <code>repeated bytes debug_info = 5;</code>
*/
int getDebugInfoCount();
/**
* <code>repeated bytes debug_info = 5;</code>
*/
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<org.jetbrains.kotlin.protobuf.ByteString>();
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<org.jetbrains.kotlin.protobuf.ByteString> debugInfo_;
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public java.util.List<org.jetbrains.kotlin.protobuf.ByteString>
getDebugInfoList() {
return debugInfo_;
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public int getDebugInfoCount() {
return debugInfo_.size();
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
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<org.jetbrains.kotlin.protobuf.ByteString> debugInfo_ = java.util.Collections.emptyList();
private void ensureDebugInfoIsMutable() {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
debugInfo_ = new java.util.ArrayList<org.jetbrains.kotlin.protobuf.ByteString>(debugInfo_);
bitField0_ |= 0x00000010;
}
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public java.util.List<org.jetbrains.kotlin.protobuf.ByteString>
getDebugInfoList() {
return java.util.Collections.unmodifiableList(debugInfo_);
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public int getDebugInfoCount() {
return debugInfo_.size();
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public org.jetbrains.kotlin.protobuf.ByteString getDebugInfo(int index) {
return debugInfo_.get(index);
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public Builder setDebugInfo(
int index, org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureDebugInfoIsMutable();
debugInfo_.set(index, value);
return this;
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public Builder addDebugInfo(org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureDebugInfoIsMutable();
debugInfo_.add(value);
return this;
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
public Builder addAllDebugInfo(
java.lang.Iterable<? extends org.jetbrains.kotlin.protobuf.ByteString> values) {
ensureDebugInfoIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, debugInfo_);
return this;
}
/**
* <code>repeated bytes debug_info = 5;</code>
*/
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)
}