Skip to content

Create a bytecode interpreter to compactly represent text/JSON name maps. #1789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public struct ImportsAPublicly: Sendable {

extension ImportsAPublicly: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "ImportsAPublicly"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
11: .same(proto: "a"),
12: .same(proto: "e"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{2}\u{b}a\0\u{1}e\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)

public var isInitialized: Bool {
if let v = self._a, !v.isInitialized {return false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ public struct ImportsImportsAPublicly: Sendable {

extension ImportsImportsAPublicly: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "ImportsImportsAPublicly"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
21: .same(proto: "a"),
22: .same(proto: "e"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{2}\u{15}a\0\u{1}e\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)

public var isInitialized: Bool {
if let v = self._a, !v.isInitialized {return false}
Expand Down
12 changes: 4 additions & 8 deletions CompileTests/MultiModule/Sources/ModuleA/a.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,14 @@ public let Extensions_ext_str = SwiftProtobuf.MessageExtension<SwiftProtobuf.Opt
// MARK: - Code below here is support for the SwiftProtobuf runtime.

extension E: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "E_UNSET"),
1: .same(proto: "E_A"),
2: .same(proto: "E_B"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{2}\0E_UNSET\0\u{1}E_A\0\u{1}E_B\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)
}

extension A: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "A"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "e"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{1}e\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)

public var isInitialized: Bool {
if !_protobuf_extensionFieldValues.isInitialized {return false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public struct UsesATransitively: Sendable {

extension UsesATransitively: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "UsesATransitively"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
101: .same(proto: "a"),
102: .same(proto: "e"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{2}e\u{1}a\0\u{1}e\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)

public var isInitialized: Bool {
if let v = self._a, !v.isInitialized {return false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public struct UsesATransitively2: Sendable {

extension UsesATransitively2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = "UsesATransitively2"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
111: .same(proto: "a"),
122: .same(proto: "e"),
]
private static let _protobuf_nameMap_bytecode: Swift.StaticString = "\0\u{2}o\u{1}a\0\u{2}\u{b}e\0"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: _protobuf_nameMap_bytecode)

public var isInitialized: Bool {
if let v = self._a, !v.isInitialized {return false}
Expand Down
325 changes: 18 additions & 307 deletions FuzzTesting/Sources/FuzzCommon/fuzz_testing.pb.swift

Large diffs are not rendered by default.

Loading