proto, runtime/protoiface: add support for fast-path marshaling

Allow message implementations to provide optimized versions of standard
operations. Generated messages now include a ProtoReflectMethods method,
returning a protoiface.Methods struct containing pointers to assorted
optional functions.

The Methods struct also includes a Flags field indicating support for
optional features such as deterministic marshaling.

Implementation of the fast paths (and tests) will come in later CLs.

Change-Id: Idd1beed0ecf43ec5e5e7b8da2ee1e08d3ce32213
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170340
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/testprotos/pb3/test.pb.go b/encoding/testprotos/pb3/test.pb.go
index b879929..383db64 100644
--- a/encoding/testprotos/pb3/test.pb.go
+++ b/encoding/testprotos/pb3/test.pb.go
@@ -6,6 +6,7 @@
 import (
 	protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
 	protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry"
+	protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
 	protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
 	sync "sync"
 )
@@ -132,6 +133,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[0].MessageOf(x)
 }
 
+func (m *Scalars) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[0].Methods()
+}
+
 // Deprecated: Use Scalars.ProtoReflect.Type instead.
 func (*Scalars) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{0}
@@ -265,6 +270,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[1].MessageOf(x)
 }
 
+func (m *Enums) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[1].Methods()
+}
+
 // Deprecated: Use Enums.ProtoReflect.Type instead.
 func (*Enums) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{1}
@@ -306,6 +315,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[2].MessageOf(x)
 }
 
+func (m *Nests) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[2].Methods()
+}
+
 // Deprecated: Use Nests.ProtoReflect.Type instead.
 func (*Nests) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{2}
@@ -341,6 +354,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[3].MessageOf(x)
 }
 
+func (m *Nested) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[3].Methods()
+}
+
 // Deprecated: Use Nested.ProtoReflect.Type instead.
 func (*Nested) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{3}
@@ -386,6 +403,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[4].MessageOf(x)
 }
 
+func (m *Oneofs) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[4].Methods()
+}
+
 // Deprecated: Use Oneofs.ProtoReflect.Type instead.
 func (*Oneofs) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{4}
@@ -476,6 +497,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[5].MessageOf(x)
 }
 
+func (m *Maps) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[5].Methods()
+}
+
 // Deprecated: Use Maps.ProtoReflect.Type instead.
 func (*Maps) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{5}
@@ -538,6 +563,10 @@
 	return xxx_File_pb3_test_proto_messageTypes[6].MessageOf(x)
 }
 
+func (m *JSONNames) XXX_Methods() *protoiface.Methods {
+	return xxx_File_pb3_test_proto_messageTypes[6].Methods()
+}
+
 // Deprecated: Use JSONNames.ProtoReflect.Type instead.
 func (*JSONNames) Descriptor() ([]byte, []int) {
 	return xxx_File_pb3_test_proto_rawDescGZIP(), []int{6}