JS PIR: move PIR proto messages to a separate file
This commit is contained in:
committed by
TeamCityServer
parent
8fe8419ad4
commit
923303c2c1
+1
-1
@@ -20,7 +20,7 @@ fun main() {
|
|||||||
generateTypeParameter()
|
generateTypeParameter()
|
||||||
generateValueParameter()
|
generateValueParameter()
|
||||||
|
|
||||||
updateKotlinIrProto()
|
generateKotlinPirCarriersProto()
|
||||||
generateCarrierDeserializer()
|
generateCarrierDeserializer()
|
||||||
generateCarrierSerializer()
|
generateCarrierSerializer()
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -661,27 +661,27 @@ internal object PersistentIrGenerator {
|
|||||||
File(prefix + path).writeText(content)
|
File(prefix + path).writeText(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateKotlinIrProto() {
|
fun generateKotlinPirCarriersProto() {
|
||||||
val file = File("compiler/ir/serialization.common/src/KotlinIr.proto")
|
val file = File("compiler/ir/serialization.common/src/KotlinPirCarriers.proto")
|
||||||
|
|
||||||
if (!file.exists()) throw IllegalStateException("KotlinIr.proto file not found!")
|
val sb = StringBuilder("""
|
||||||
|
syntax = "proto2";
|
||||||
|
package org.jetbrains.kotlin.backend.common.serialization.proto;
|
||||||
|
|
||||||
val lines = file.readText().lines()
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "KotlinIr";
|
||||||
|
option optimize_for = LITE_RUNTIME;
|
||||||
|
|
||||||
val start = lines.indexOf("// PIR GENERATOR START")
|
import "compiler/ir/serialization.common/src/KotlinIr.proto";
|
||||||
if (start < 0) throw IllegalStateException("Couldn't find the '// PIR GENERATOR START' line. Don't know where to write generated messages.")
|
|
||||||
|
// Auto-generated by compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
|
||||||
val end = lines.indexOf("// PIR GENERATOR END")
|
|
||||||
if (end < 0) throw IllegalStateException("Couldn't find the '// PIR GENERATOR END' line. Don't know where to write generated messages.")
|
""".trimIndent())
|
||||||
|
|
||||||
val sb = StringBuilder(lines.subList(0, start + 1).joinToString(separator = "\n"))
|
|
||||||
|
|
||||||
for (m in protoMessages) {
|
for (m in protoMessages) {
|
||||||
sb.append("\n").append(m)
|
sb.append("\n").append(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\n").append(lines.subList(end, lines.size).joinToString(separator = "\n"))
|
|
||||||
|
|
||||||
file.writeText(sb.toString())
|
file.writeText(sb.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -590,134 +590,6 @@ message IrStatement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------- Persistent IR Carriers --------------------------------------------- */
|
|
||||||
// Auto-generated by compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
|
|
||||||
// PIR GENERATOR START
|
|
||||||
message PirAnonymousInitializerCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
optional int32 body = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirClassCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
optional int64 thisReceiver = 5;
|
|
||||||
repeated int64 typeParameters = 6;
|
|
||||||
repeated int32 superTypes = 7;
|
|
||||||
optional int64 flags = 8 [default = 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirConstructorCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
required int32 returnTypeField = 5;
|
|
||||||
optional int64 dispatchReceiverParameter = 6;
|
|
||||||
optional int64 extensionReceiverParameter = 7;
|
|
||||||
optional int32 body = 8;
|
|
||||||
repeated int64 typeParameters = 9;
|
|
||||||
repeated int64 valueParameters = 10;
|
|
||||||
optional int64 flags = 11 [default = 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirEnumEntryCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
optional int64 correspondingClass = 5;
|
|
||||||
optional int32 initializerExpression = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirErrorDeclarationCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirFieldCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
required int32 type = 5;
|
|
||||||
optional int32 initializer = 6;
|
|
||||||
optional int64 correspondingPropertySymbol = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirFunctionCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
required int32 returnTypeField = 5;
|
|
||||||
optional int64 dispatchReceiverParameter = 6;
|
|
||||||
optional int64 extensionReceiverParameter = 7;
|
|
||||||
optional int32 body = 8;
|
|
||||||
repeated int64 typeParameters = 9;
|
|
||||||
repeated int64 valueParameters = 10;
|
|
||||||
optional int64 correspondingPropertySymbol = 11;
|
|
||||||
repeated int64 overriddenSymbols = 12;
|
|
||||||
optional int64 flags = 13 [default = 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirLocalDelegatedPropertyCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
required int32 type = 5;
|
|
||||||
optional IrVariable delegate = 6;
|
|
||||||
optional int64 getter = 7;
|
|
||||||
optional int64 setter = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirPropertyCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
optional int64 backingField = 5;
|
|
||||||
optional int64 getter = 6;
|
|
||||||
optional int64 setter = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirTypeAliasCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
repeated int64 typeParameters = 5;
|
|
||||||
required int32 expandedType = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirTypeParameterCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
repeated int32 superTypes = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PirValueParameterCarrier {
|
|
||||||
required int32 lastModified = 1;
|
|
||||||
optional int64 parentSymbol = 2;
|
|
||||||
optional int32 origin = 3;
|
|
||||||
repeated IrConstructorCall annotation = 4;
|
|
||||||
optional int32 defaultValue = 5;
|
|
||||||
required int32 type = 6;
|
|
||||||
optional int32 varargElementType = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PIR GENERATOR END
|
|
||||||
|
|
||||||
message PirBodyCarrier {
|
message PirBodyCarrier {
|
||||||
required int32 lastModified = 1;
|
required int32 lastModified = 1;
|
||||||
optional int64 containerFieldSymbol = 2;
|
optional int64 containerFieldSymbol = 2;
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
package org.jetbrains.kotlin.backend.common.serialization.proto;
|
||||||
|
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "KotlinIr";
|
||||||
|
option optimize_for = LITE_RUNTIME;
|
||||||
|
|
||||||
|
import "compiler/ir/serialization.common/src/KotlinIr.proto";
|
||||||
|
|
||||||
|
// Auto-generated by compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
|
||||||
|
|
||||||
|
message PirAnonymousInitializerCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
optional int32 body = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirClassCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
optional int64 thisReceiver = 5;
|
||||||
|
repeated int64 typeParameters = 6;
|
||||||
|
repeated int32 superTypes = 7;
|
||||||
|
optional int64 flags = 8 [default = 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirConstructorCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
required int32 returnTypeField = 5;
|
||||||
|
optional int64 dispatchReceiverParameter = 6;
|
||||||
|
optional int64 extensionReceiverParameter = 7;
|
||||||
|
optional int32 body = 8;
|
||||||
|
repeated int64 typeParameters = 9;
|
||||||
|
repeated int64 valueParameters = 10;
|
||||||
|
optional int64 flags = 11 [default = 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirEnumEntryCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
optional int64 correspondingClass = 5;
|
||||||
|
optional int32 initializerExpression = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirErrorDeclarationCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirFieldCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
required int32 type = 5;
|
||||||
|
optional int32 initializer = 6;
|
||||||
|
optional int64 correspondingPropertySymbol = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirFunctionCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
required int32 returnTypeField = 5;
|
||||||
|
optional int64 dispatchReceiverParameter = 6;
|
||||||
|
optional int64 extensionReceiverParameter = 7;
|
||||||
|
optional int32 body = 8;
|
||||||
|
repeated int64 typeParameters = 9;
|
||||||
|
repeated int64 valueParameters = 10;
|
||||||
|
optional int64 correspondingPropertySymbol = 11;
|
||||||
|
repeated int64 overriddenSymbols = 12;
|
||||||
|
optional int64 flags = 13 [default = 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirLocalDelegatedPropertyCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
required int32 type = 5;
|
||||||
|
optional IrVariable delegate = 6;
|
||||||
|
optional int64 getter = 7;
|
||||||
|
optional int64 setter = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirPropertyCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
optional int64 backingField = 5;
|
||||||
|
optional int64 getter = 6;
|
||||||
|
optional int64 setter = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirTypeAliasCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
repeated int64 typeParameters = 5;
|
||||||
|
required int32 expandedType = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirTypeParameterCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
repeated int32 superTypes = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PirValueParameterCarrier {
|
||||||
|
required int32 lastModified = 1;
|
||||||
|
optional int64 parentSymbol = 2;
|
||||||
|
optional int32 origin = 3;
|
||||||
|
repeated IrConstructorCall annotation = 4;
|
||||||
|
optional int32 defaultValue = 5;
|
||||||
|
required int32 type = 6;
|
||||||
|
optional int32 varargElementType = 7;
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@ val PROTO_PATHS: List<ProtoPath> = listOf(
|
|||||||
ProtoPath("build-common/src/java_descriptors.proto"),
|
ProtoPath("build-common/src/java_descriptors.proto"),
|
||||||
ProtoPath("compiler/util-klib-metadata/src/KlibMetadataProtoBuf.proto"),
|
ProtoPath("compiler/util-klib-metadata/src/KlibMetadataProtoBuf.proto"),
|
||||||
ProtoPath("compiler/ir/serialization.common/src/KotlinIr.proto", false),
|
ProtoPath("compiler/ir/serialization.common/src/KotlinIr.proto", false),
|
||||||
|
ProtoPath("compiler/ir/serialization.common/src/KotlinPirCarriers.proto", false),
|
||||||
ProtoPath("plugins/kotlin-serialization/kotlin-serialization-compiler/src/class_extensions.proto", generateDebug = false)
|
ProtoPath("plugins/kotlin-serialization/kotlin-serialization-compiler/src/class_extensions.proto", generateDebug = false)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user