Write new flags to proto messages for callables

This is needed to get rid of two unused bits: Flags.RESERVED_1 and
Flags.RESERVED_2. The old flags are still there temporarily because of the
bootstrap dependency on built-ins. Soon the old flags will be dropped and the
current flags will be transformed to the new format
This commit is contained in:
Alexander Udalov
2016-01-11 22:11:14 +03:00
parent 86bbc9f15b
commit 693a9c9453
5 changed files with 781 additions and 428 deletions
@@ -252,6 +252,10 @@ public class DescriptorSerializer {
if (flags != builder.getFlags()) {
builder.setFlags(flags);
}
int newFlags = (flags & 0x3f) + ((flags >> 2) & ~0x3f);
if (newFlags != builder.getNewFlags()) {
builder.setNewFlags(newFlags);
}
builder.setName(getSimpleNameIndex(descriptor.getName()));
@@ -295,6 +299,10 @@ public class DescriptorSerializer {
if (flags != builder.getFlags()) {
builder.setFlags(flags);
}
int newFlags = (flags & 0x3f) + ((flags >> 2) & ~0x3f);
if (newFlags != builder.getNewFlags()) {
builder.setNewFlags(newFlags);
}
builder.setName(getSimpleNameIndex(descriptor.getName()));
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -222,7 +222,7 @@ message Constructor {
Visibility
isSecondary
*/
optional int32 flags = 1 [default = 6];
optional int32 flags = 1 [default = 6 /* public constructor, no annotations */];
repeated ValueParameter value_parameter = 2;
@@ -242,6 +242,7 @@ message Function {
isExternal
*/
optional int32 flags = 1 [default = 6];
optional int32 new_flags = 9 [default = 6 /* public final function, no annotations */];
required int32 name = 2 [(name_id_in_table) = true];
@@ -273,7 +274,8 @@ message Property {
lateinit
hasConstant
*/
optional int32 flags = 1 [default = 262 /* public (6) final property with getter (256) */];
optional int32 flags = 1 [default = 262];
optional int32 new_flags = 11 [default = 518 /* public (6) final property with getter (512) */];
required int32 name = 2 [(name_id_in_table) = true];
File diff suppressed because it is too large Load Diff
@@ -198,6 +198,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.flags != new.flags) return false
}
if (old.hasNewFlags() != new.hasNewFlags()) return false
if (old.hasNewFlags()) {
if (old.newFlags != new.newFlags) return false
}
if (!checkStringEquals(old.name, new.name)) return false
if (old.hasReturnType() != new.hasReturnType()) return false
@@ -243,6 +248,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.flags != new.flags) return false
}
if (old.hasNewFlags() != new.hasNewFlags()) return false
if (old.hasNewFlags()) {
if (old.newFlags != new.newFlags) return false
}
if (!checkStringEquals(old.name, new.name)) return false
if (old.hasReturnType() != new.hasReturnType()) return false
@@ -900,6 +910,10 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + flags
}
if (hasNewFlags()) {
hashCode = 31 * hashCode + newFlags
}
hashCode = 31 * hashCode + stringIndexes(name)
if (hasReturnType()) {
@@ -944,6 +958,10 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + flags
}
if (hasNewFlags()) {
hashCode = 31 * hashCode + newFlags
}
hashCode = 31 * hashCode + stringIndexes(name)
if (hasReturnType()) {