summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--tests/pb/test_decoder.cc492
-rw-r--r--tests/pb/test_decoder_schema.proto64
-rw-r--r--tests/test_cpp.cc3
-rw-r--r--tests/test_vs_proto2.cc20
-rw-r--r--tools/dump_cinit.lua13
-rw-r--r--upb/bindings/googlepb/bridge.cc7
-rw-r--r--upb/bindings/googlepb/proto2.cc230
-rw-r--r--upb/bindings/lua/upb.c19
-rw-r--r--upb/def.c26
-rw-r--r--upb/def.h35
-rw-r--r--upb/descriptor/descriptor.proto111
-rwxr-xr-xupb/descriptor/descriptor.upb.c538
-rwxr-xr-xupb/descriptor/descriptor.upb.h121
-rw-r--r--upb/descriptor/reader.c9
-rw-r--r--upb/handlers.c72
-rw-r--r--upb/pb/compile_decoder.c418
-rw-r--r--upb/pb/compile_decoder_x64.c2
-rw-r--r--upb/pb/compile_decoder_x64.dasc78
-rw-r--r--upb/pb/decoder.c225
-rw-r--r--upb/pb/decoder.h97
-rw-r--r--upb/pb/decoder.int.h31
-rw-r--r--upb/pb/glue.c4
23 files changed, 1705 insertions, 917 deletions
diff --git a/Makefile b/Makefile
index 440d4f2..26a526e 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ endif
CC=gcc
CXX=g++
CFLAGS=-std=gnu99
-CXXFLAGS=-Ibindings/cpp
+CXXFLAGS=-std=c++11
INCLUDE=-Itests -I.
CPPFLAGS=$(INCLUDE) -Wall -Wextra -Wno-sign-compare $(USER_CFLAGS)
LDLIBS=-lpthread upb/libupb.a
@@ -220,10 +220,7 @@ SIMPLE_TESTS= \
SIMPLE_CXX_TESTS= \
tests/test_cpp \
-
- # The build process for this test is complicated and hasn't been
- # ported to the open-source Makefile yet.
- # tests/test_decoder \
+ tests/pb/test_decoder
VARIADIC_TESTS= \
tests/t.test_vs_proto2.googlemessage1 \
diff --git a/tests/pb/test_decoder.cc b/tests/pb/test_decoder.cc
index eb95580..1660436 100644
--- a/tests/pb/test_decoder.cc
+++ b/tests/pb/test_decoder.cc
@@ -37,22 +37,25 @@
#include <string.h>
#include "tests/upb_test.h"
-#include "third_party/upb/tests/pb/test_decoder_schema.upb.h"
#include "upb/handlers.h"
#include "upb/pb/decoder.h"
#include "upb/pb/varint.int.h"
#include "upb/upb.h"
#undef PRINT_FAILURE
-#define PRINT_FAILURE(expr) \
- fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, "expr: %s\n", #expr); \
- if (testhash) { \
- fprintf(stderr, "assertion failed running test %x. " \
- "Run with the arg %x to run only this test.\n", \
- testhash, testhash); \
- fprintf(stderr, "Failed at %02.2f%% through tests.\n", \
- (float)completed * 100 / total); \
+#define PRINT_FAILURE(expr) \
+ fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \
+ fprintf(stderr, "expr: %s\n", #expr); \
+ if (testhash) { \
+ fprintf(stderr, "assertion failed running test %x.\n", testhash); \
+ if (!filter_hash) { \
+ fprintf(stderr, \
+ "Run with the arg %x to run only this test. " \
+ "(This will also turn on extra debugging output)\n", \
+ testhash); \
+ } \
+ fprintf(stderr, "Failed at %02.2f%% through tests.\n", \
+ (float)completed * 100 / total); \
}
uint32_t filter_hash = 0;
@@ -90,106 +93,101 @@ static const upb_decoder_typeinfo upb_decoder_types[] = {
{UPB_WIRE_TYPE_VARINT, true}, // SINT64
};
+#ifndef USE_GOOGLE
+using std::string;
+#endif
-class buffer {
- public:
- buffer(const void *data, size_t len) : len_(0) { append(data, len); }
- explicit buffer(const char *data) : len_(0) { append(data); }
- explicit buffer(size_t len) : len_(len) { memset(buf_, 0, len); }
- buffer(const buffer& buf) : len_(0) { append(buf); }
- buffer() : len_(0) {}
-
- void append(const void *data, size_t len) {
- ASSERT_NOCOUNT(len + len_ < sizeof(buf_));
- memcpy(buf_ + len_, data, len);
- len_ += len;
- buf_[len_] = NULL;
- }
-
- void append(const buffer& buf) {
- append(buf.buf_, buf.len_);
- }
-
- void append(const char *str) {
- append(str, strlen(str));
- }
-
- void vappendf(const char *fmt, va_list args) {
- size_t avail = sizeof(buf_) - len_;
- size_t size = vsnprintf(buf_ + len_, avail, fmt, args);
- ASSERT_NOCOUNT(avail > size);
- len_ += size;
- }
+void vappendf(string* str, const char *format, va_list args) {
+ va_list copy;
+ va_copy(copy, args);
- void appendf(const char *fmt, ...) {
- va_list args;
- va_start(args, fmt);
- vappendf(fmt, args);
- va_end(args);
+ int count = vsnprintf(NULL, 0, format, args);
+ if (count >= 0)
+ {
+ assert(count < 32768);
+ char *buffer = new char[count + 1];
+ assert(buffer);
+ count = vsnprintf(buffer, count + 1, format, copy);
+ assert(count >= 0);
+ str->append(buffer, count);
+ delete [] buffer;
}
+ va_end(copy);
+}
- void assign(const buffer& buf) {
- clear();
- append(buf);
- }
+void appendf(string* str, const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ vappendf(str, fmt, args);
+ va_end(args);
+}
- bool eql(const buffer& other) const {
- return len_ == other.len_ && memcmp(buf_, other.buf_, len_) == 0;
+void PrintBinary(const string& str) {
+ for (size_t i = 0; i < str.size(); i++) {
+ if (isprint(str[i])) {
+ fprintf(stderr, "%c", str[i]);
+ } else {
+ fprintf(stderr, "\\x%02x", str[i]);
+ }
}
-
- void clear() { len_ = 0; }
- size_t len() const { return len_; }
- const char *buf() const { return buf_; }
-
- private:
- // Has to be big enough for the largest string used in the test.
- char buf_[32768];
- size_t len_;
-};
-
+}
/* Routines for building arbitrary protos *************************************/
-const buffer empty;
-
-buffer cat(const buffer& a, const buffer& b,
- const buffer& c = empty,
- const buffer& d = empty,
- const buffer& e = empty,
- const buffer& f = empty) {
- buffer ret;
+const string empty;
+
+string cat(const string& a, const string& b,
+ const string& c = empty,
+ const string& d = empty,
+ const string& e = empty,
+ const string& f = empty,
+ const string& g = empty,
+ const string& h = empty,
+ const string& i = empty,
+ const string& j = empty,
+ const string& k = empty,
+ const string& l = empty) {
+ string ret;
+ ret.reserve(a.size() + b.size() + c.size() + d.size() + e.size() + f.size() +
+ g.size() + h.size() + i.size() + j.size() + k.size() + l.size());
ret.append(a);
ret.append(b);
ret.append(c);
ret.append(d);
ret.append(e);
ret.append(f);
+ ret.append(g);
+ ret.append(h);
+ ret.append(i);
+ ret.append(j);
+ ret.append(k);
+ ret.append(l);
return ret;
}
-buffer varint(uint64_t x) {
+string varint(uint64_t x) {
char buf[UPB_PB_VARINT_MAX_LEN];
size_t len = upb_vencode64(x, buf);
- return buffer(buf, len);
+ return string(buf, len);
}
// TODO: proper byte-swapping for big-endian machines.
-buffer fixed32(void *data) { return buffer(data, 4); }
-buffer fixed64(void *data) { return buffer(data, 8); }
-
-buffer delim(const buffer& buf) { return cat(varint(buf.len()), buf); }
-buffer uint32(uint32_t u32) { return fixed32(&u32); }
-buffer uint64(uint64_t u64) { return fixed64(&u64); }
-buffer flt(float f) { return fixed32(&f); }
-buffer dbl(double d) { return fixed64(&d); }
-buffer zz32(int32_t x) { return varint(upb_zzenc_32(x)); }
-buffer zz64(int64_t x) { return varint(upb_zzenc_64(x)); }
-
-buffer tag(uint32_t fieldnum, char wire_type) {
+string fixed32(void *data) { return string(static_cast<char*>(data), 4); }
+string fixed64(void *data) { return string(static_cast<char*>(data), 8); }
+
+string delim(const string& buf) { return cat(varint(buf.size()), buf); }
+string uint32(uint32_t u32) { return fixed32(&u32); }
+string uint64(uint64_t u64) { return fixed64(&u64); }
+string flt(float f) { return fixed32(&f); }
+string dbl(double d) { return fixed64(&d); }
+string zz32(int32_t x) { return varint(upb_zzenc_32(x)); }
+string zz64(int64_t x) { return varint(upb_zzenc_64(x)); }
+
+string tag(uint32_t fieldnum, char wire_type) {
return varint((fieldnum << 3) | wire_type);
}
-buffer submsg(uint32_t fn, const buffer& buf) {
+string submsg(uint32_t fn, const string& buf) {
return cat( tag(fn, UPB_WIRE_TYPE_DELIMITED), delim(buf) );
}
@@ -203,18 +201,17 @@ buffer submsg(uint32_t fn, const buffer& buf) {
// handled.
int closures[UPB_DECODER_MAX_NESTING];
-buffer output;
+string output;
-void indentbuf(buffer *buf, int depth) {
- for (int i = 0; i < depth; i++)
- buf->append(" ", 2);
+void indentbuf(string *buf, int depth) {
+ buf->append(2 * depth, ' ');
}
-#define NUMERIC_VALUE_HANDLER(member, ctype, fmt) \
- bool value_ ## member(int* depth, const uint32_t* num, ctype val) { \
- indentbuf(&output, *depth); \
- output.appendf("%" PRIu32 ":%" fmt "\n", *num, val); \
- return true; \
+#define NUMERIC_VALUE_HANDLER(member, ctype, fmt) \
+ bool value_##member(int* depth, const uint32_t* num, ctype val) { \
+ indentbuf(&output, *depth); \
+ appendf(&output, "%" PRIu32 ":%" fmt "\n", *num, val); \
+ return true; \
}
NUMERIC_VALUE_HANDLER(uint32, uint32_t, PRIu32)
@@ -226,19 +223,20 @@ NUMERIC_VALUE_HANDLER(double, double, "g")
bool value_bool(int* depth, const uint32_t* num, bool val) {
indentbuf(&output, *depth);
- output.appendf("%" PRIu32 ":%s\n", *num, val ? "true" : "false");
+ appendf(&output, "%" PRIu32 ":%s\n", *num, val ? "true" : "false");
return true;
}
int* startstr(int* depth, const uint32_t* num, size_t size_hint) {
indentbuf(&output, *depth);
- output.appendf("%" PRIu32 ":(%zu)\"", *num, size_hint);
+ appendf(&output, "%" PRIu32 ":(%zu)\"", *num, size_hint);
return depth + 1;
}
size_t value_string(int* depth, const uint32_t* num, const char* buf,
size_t n, const upb::BufferHandle* handle) {
UPB_UNUSED(num);
+ UPB_UNUSED(depth);
output.append(buf, n);
ASSERT(handle == &global_handle);
return n;
@@ -253,7 +251,7 @@ bool endstr(int* depth, const uint32_t* num) {
int* startsubmsg(int* depth, const uint32_t* num) {
indentbuf(&output, *depth);
- output.appendf("%" PRIu32 ":{\n", *num);
+ appendf(&output, "%" PRIu32 ":{\n", *num);
return depth + 1;
}
@@ -266,7 +264,7 @@ bool endsubmsg(int* depth, const uint32_t* num) {
int* startseq(int* depth, const uint32_t* num) {
indentbuf(&output, *depth);
- output.appendf("%" PRIu32 ":[\n", *num);
+ appendf(&output, "%" PRIu32 ":[\n", *num);
return depth + 1;
}
@@ -284,6 +282,7 @@ bool startmsg(int* depth) {
}
bool endmsg(int* depth, upb_status* status) {
+ UPB_UNUSED(status);
indentbuf(&output, *depth);
output.append(">\n");
return true;
@@ -298,7 +297,7 @@ template<class T, bool F(int*, const uint32_t*, T)>
void doreg(upb_handlers *h, uint32_t num) {
const upb_fielddef *f = upb_msgdef_itof(upb_handlers_msgdef(h), num);
ASSERT(f);
- ASSERT(h->SetValueHandler<T>(f, UpbBindT(F, new uint32_t(num))));
+ ASSERT(h->SetValueHandler<T>(f, UpbBindT(&F, new uint32_t(num))));
if (f->IsSequence()) {
ASSERT(h->SetStartSequenceHandler(f, UpbBind(startseq, new uint32_t(num))));
ASSERT(h->SetEndSequenceHandler(f, UpbBind(endseq, new uint32_t(num))));
@@ -347,9 +346,93 @@ void reg_str(upb_handlers *h, uint32_t num) {
ASSERT(h->SetStringHandler(f, UpbBind(value_string, new uint32_t(num))));
}
+void AddField(upb_descriptortype_t descriptor_type, const std::string& name,
+ uint32_t fn, bool repeated, upb::MessageDef* md) {
+ // TODO: Fluent interface? ie.
+ // ASSERT(md->AddField(upb::BuildFieldDef()
+ // .SetName("f_message")
+ // .SetNumber(UPB_DESCRIPTOR_TYPE_MESSAGE)
+ // .SetDescriptorType(UPB_DESCRIPTOR_TYPE_MESSAGE)
+ // .SetMessageSubdef(md.get())));
+ upb::reffed_ptr<upb::FieldDef> f = upb::FieldDef::New();
+ ASSERT(f->set_name(name, NULL));
+ ASSERT(f->set_number(fn, NULL));
+ f->set_label(repeated ? UPB_LABEL_REPEATED : UPB_LABEL_OPTIONAL);
+ f->set_descriptor_type(descriptor_type);
+ ASSERT(md->AddField(f.get(), NULL));
+}
+
+void AddFieldsForType(upb_descriptortype_t descriptor_type,
+ const char* basename, upb::MessageDef* md) {
+ const upb_descriptortype_t t = descriptor_type;
+ AddField(t, std::string("f_") + basename, t, false, md);
+ AddField(t, std::string("r_") + basename, rep_fn(t), true, md);
+}
+
+upb::reffed_ptr<const upb::MessageDef> NewMessageDef() {
+ upb::reffed_ptr<upb::MessageDef> md = upb::MessageDef::New();
+
+ md->set_full_name("DecoderTest", NULL);
+
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_DOUBLE, "double", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_FLOAT, "float", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_INT64, "int64", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_UINT64, "uint64", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_INT32, "int32", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_FIXED64, "fixed64", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_FIXED32, "fixed32", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_BOOL, "bool", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_STRING, "string", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_BYTES, "bytes", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_UINT32, "uint32", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_SFIXED32, "sfixed32", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_SFIXED64, "sfixed64", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_SINT32, "sint32", md.get());
+ AddFieldsForType(UPB_DESCRIPTOR_TYPE_SINT64, "sint64", md.get());
+
+ AddField(UPB_DESCRIPTOR_TYPE_STRING, "nop_field", 40, false, md.get());
+
+ upb::reffed_ptr<upb::FieldDef> f = upb::FieldDef::New();
+ ASSERT(f->set_name("f_message", NULL));
+ ASSERT(f->set_number(UPB_DESCRIPTOR_TYPE_MESSAGE, NULL));
+ f->set_descriptor_type(UPB_DESCRIPTOR_TYPE_MESSAGE);
+ ASSERT(f->set_message_subdef(md.get(), NULL));
+ ASSERT(md->AddField(f.get(), NULL));
+
+ f = upb::FieldDef::New();
+ ASSERT(f->set_name("r_message", NULL));
+ ASSERT(f->set_number(rep_fn(UPB_DESCRIPTOR_TYPE_MESSAGE), NULL));
+ f->set_label(UPB_LABEL_REPEATED);
+ f->set_descriptor_type(UPB_DESCRIPTOR_TYPE_MESSAGE);
+ ASSERT(f->set_message_subdef(md.get(), NULL));
+ ASSERT(md->AddField(f.get(), NULL));
+
+ upb::reffed_ptr<upb::EnumDef> e = upb::EnumDef::New();
+ ASSERT(e->AddValue("FOO", 1, NULL));
+ ASSERT(e->Freeze(NULL));
+
+ f = upb::FieldDef::New();
+ ASSERT(f->set_name("f_enum", NULL));
+ ASSERT(f->set_number(UPB_DESCRIPTOR_TYPE_ENUM, NULL));
+ f->set_descriptor_type(UPB_DESCRIPTOR_TYPE_ENUM);
+ ASSERT(f->set_enum_subdef(e.get(), NULL));
+ ASSERT(md->AddField(f.get(), NULL));
+
+ f = upb::FieldDef::New();
+ ASSERT(f->set_name("r_enum", NULL));
+ ASSERT(f->set_number(rep_fn(UPB_DESCRIPTOR_TYPE_ENUM), NULL));
+ f->set_label(UPB_LABEL_REPEATED);
+ f->set_descriptor_type(UPB_DESCRIPTOR_TYPE_ENUM);
+ ASSERT(f->set_enum_subdef(e.get(), NULL));
+ ASSERT(md->AddField(f.get(), NULL));
+
+ ASSERT(md->Freeze(NULL));
+
+ return md;
+}
+
upb::reffed_ptr<const upb::Handlers> NewHandlers() {
- upb::reffed_ptr<upb::Handlers> h(
- upb::Handlers::New(UPB_TEST_DECODER_DECODERTEST));
+ upb::reffed_ptr<upb::Handlers> h(upb::Handlers::New(NewMessageDef().get()));
h->SetStartMessageHandler(UpbMakeHandler(startmsg));
h->SetEndMessageHandler(UpbMakeHandler(endmsg));
@@ -395,11 +478,11 @@ upb::reffed_ptr<const upb::Handlers> NewHandlers() {
const upb::Handlers *global_handlers;
const upb::pb::DecoderMethod *global_method;
-uint32_t Hash(const buffer& proto, const buffer* expected_output, size_t seam1,
+uint32_t Hash(const string& proto, const string* expected_output, size_t seam1,
size_t seam2) {
- uint32_t hash = MurmurHash2(proto.buf(), proto.len(), 0);
+ uint32_t hash = MurmurHash2(proto.c_str(), proto.size(), 0);
if (expected_output)
- hash = MurmurHash2(expected_output->buf(), expected_output->len(), hash);
+ hash = MurmurHash2(expected_output->c_str(), expected_output->size(), hash);
hash = MurmurHash2(&seam1, sizeof(seam1), hash);
hash = MurmurHash2(&seam2, sizeof(seam2), hash);
return hash;
@@ -410,8 +493,38 @@ bool parse(upb::BytesSink* s, void* subc, const char* buf, size_t start,
start = UPB_MAX(start, *ofs);
if (start <= end) {
size_t len = end - start;
+ if (filter_hash) {
+ fprintf(stderr, "Calling parse(%zu) for bytes %zu-%zu of the input\n",
+ len, start, end);
+ }
size_t parsed = s->PutBuffer(subc, buf + start, len, &global_handle);
+ if (filter_hash) {
+ if (parsed == len) {
+ fprintf(stderr,
+ "parse(%zu) = %zu, complete byte count indicates success\n",
+ len, len);
+ } else if (parsed > len) {
+ fprintf(stderr,
+ "parse(%zu) = %zu, long byte count indicates success and skip"
+ "of the next %zu bytes\n",
+ len, parsed, parsed - len);
+ } else {
+ fprintf(stderr,
+ "parse(%zu) = %zu, short byte count indicates failure; "
+ "last %zu bytes were not consumed\n",
+ len, parsed, len - parsed);
+ }
+ }
if (status->ok() != (parsed >= len)) {
+ if (status->ok()) {
+ fprintf(stderr,
+ "Error: decode function returned short byte count but set no "
+ "error status\n");
+ } else {
+ fprintf(stderr,
+ "Error: decode function returned complete byte count but set "
+ "error status\n");
+ }
fprintf(stderr, "Status: %s, parsed=%zu, len=%zu\n",
status->error_message(), parsed, len);
ASSERT(false);
@@ -424,13 +537,13 @@ bool parse(upb::BytesSink* s, void* subc, const char* buf, size_t start,
}
#define LINE(x) x "\n"
-void run_decoder(const buffer& proto, const buffer* expected_output) {
+void run_decoder(const string& proto, const string* expected_output) {
upb::Status status;
upb::pb::Decoder decoder(global_method, &status);
upb::Sink sink(global_handlers, &closures[0]);
decoder.ResetOutput(&sink);
- for (size_t i = 0; i < proto.len(); i++) {
- for (size_t j = i; j < UPB_MIN(proto.len(), i + 5); j++) {
+ for (size_t i = 0; i < proto.size(); i++) {
+ for (size_t j = i; j < UPB_MIN(proto.size(), i + 5); j++) {
testhash = Hash(proto, expected_output, i, j);
if (filter_hash && testhash != filter_hash) continue;
if (!count_only) {
@@ -440,27 +553,50 @@ void run_decoder(const buffer& proto, const buffer* expected_output) {
size_t ofs = 0;
upb::BytesSink* input = decoder.input();
void *sub;
+
+ if (filter_hash) {
+ fprintf(stderr, "RUNNING TEST CASE, hash=%x\n", testhash);
+ fprintf(stderr, "JIT on: %s\n",
+ global_method->is_native() ? "true" : "false");
+ fprintf(stderr, "Input (len=%zu): ", proto.size());
+ PrintBinary(proto);
+ fprintf(stderr, "\n");
+ if (expected_output) {
+ fprintf(stderr, "Expected output: %s\n", expected_output->c_str());
+ } else {
+ fprintf(stderr, "Expected to FAIL\n");
+ }
+ fprintf(stderr, "Calling start()\n");
+ }
+
bool ok =
- input->Start(proto.len(), &sub) &&
- parse(input, sub, proto.buf(), 0, i, &ofs, &status) &&
- parse(input, sub, proto.buf(), i, j, &ofs, &status) &&
- parse(input, sub, proto.buf(), j, proto.len(), &ofs, &status) &&
- ofs == proto.len() &&
- input->End();
+ input->Start(proto.size(), &sub) &&
+ parse(input, sub, proto.c_str(), 0, i, &ofs, &status) &&
+ parse(input, sub, proto.c_str(), i, j, &ofs, &status) &&
+ parse(input, sub, proto.c_str(), j, proto.size(), &ofs, &status) &&
+ ofs == proto.size();
+
+ if (ok) {
+ if (filter_hash) {
+ fprintf(stderr, "calling end()\n");
+ }
+ ok = input->End();
+ }
+
if (expected_output) {
- if (!output.eql(*expected_output)) {
+ if (output != *expected_output) {
fprintf(stderr, "Text mismatch: '%s' vs '%s'\n",
- output.buf(), expected_output->buf());
+ output.c_str(), expected_output->c_str());
}
if (!ok) {
fprintf(stderr, "Failed: %s\n", status.error_message());
}
ASSERT(ok);
- ASSERT(output.eql(*expected_output));
+ ASSERT(output == *expected_output);
} else {
if (ok) {
fprintf(stderr, "Didn't expect ok result, but got output: '%s'\n",
- output.buf());
+ output.c_str());
}
ASSERT(!ok);
}
@@ -471,15 +607,15 @@ void run_decoder(const buffer& proto, const buffer* expected_output) {
testhash = 0;
}
-const static buffer thirty_byte_nop = buffer(cat(
- tag(NOP_FIELD, UPB_WIRE_TYPE_DELIMITED), delim(buffer(30)) ));
+const static string thirty_byte_nop = cat(
+ tag(NOP_FIELD, UPB_WIRE_TYPE_DELIMITED), delim(string(30, 'X')) );
-void assert_successful_parse(const buffer& proto,
+void assert_successful_parse(const string& proto,
const char *expected_fmt, ...) {
- buffer expected_text;
+ string expected_text;
va_list args;
va_start(args, expected_fmt);
- expected_text.vappendf(expected_fmt, args);
+ vappendf(&expected_text, expected_fmt, args);
va_end(args);
// To test both middle-of-buffer and end-of-buffer code paths,
// repeat once with no-op padding data at the end of buffer.
@@ -487,11 +623,11 @@ void assert_successful_parse(const buffer& proto,
run_decoder(cat( proto, thirty_byte_nop ), &expected_text);
}
-void assert_does_not_parse_at_eof(const buffer& proto) {
+void assert_does_not_parse_at_eof(const string& proto) {
run_decoder(proto, NULL);
}
-void assert_does_not_parse(const buffer& proto) {
+void assert_does_not_parse(const string& proto) {
// Test that the error is caught both at end-of-buffer and middle-of-buffer.
assert_does_not_parse_at_eof(proto);
assert_does_not_parse_at_eof(cat( proto, thirty_byte_nop ));
@@ -502,19 +638,19 @@ void assert_does_not_parse(const buffer& proto) {
void test_premature_eof_for_type(upb_descriptortype_t type) {
// Incomplete values for each wire type.
- static const buffer incompletes[6] = {
- buffer("\x80"), // UPB_WIRE_TYPE_VARINT
- buffer("abcdefg"), // UPB_WIRE_TYPE_64BIT
- buffer("\x80"), // UPB_WIRE_TYPE_DELIMITED (partial length)
- buffer(), // UPB_WIRE_TYPE_START_GROUP (no value required)
- buffer(), // UPB_WIRE_TYPE_END_GROUP (no value required)
- buffer("abc") // UPB_WIRE_TYPE_32BIT
+ static const string incompletes[6] = {
+ string("\x80"), // UPB_WIRE_TYPE_VARINT
+ string("abcdefg"), // UPB_WIRE_TYPE_64BIT
+ string("\x80"), // UPB_WIRE_TYPE_DELIMITED (partial length)
+ string(), // UPB_WIRE_TYPE_START_GROUP (no value required)
+ string(), // UPB_WIRE_TYPE_END_GROUP (no value required)
+ string("abc") // UPB_WIRE_TYPE_32BIT
};
uint32_t fieldnum = type;
uint32_t rep_fieldnum = rep_fn(type);
int wire_type = upb_decoder_types[type].native_wire_type;
- const buffer& incomplete = incompletes[wire_type];
+ const string& incomplete = incompletes[wire_type];
// EOF before a known non-repeated value.
assert_does_not_parse_at_eof(tag(fieldnum, wire_type));
@@ -552,19 +688,19 @@ void test_premature_eof_for_type(upb_descriptortype_t type) {
if (type == UPB_DESCRIPTOR_TYPE_MESSAGE) {
// Submessage ends in the middle of a value.
- buffer incomplete_submsg =
+ string incomplete_submsg =
cat ( tag(UPB_DESCRIPTOR_TYPE_INT32, UPB_WIRE_TYPE_VARINT),
incompletes[UPB_WIRE_TYPE_VARINT] );
assert_does_not_parse(
cat( tag(fieldnum, UPB_WIRE_TYPE_DELIMITED),
- varint(incomplete_submsg.len()),
+ varint(incomplete_submsg.size()),
incomplete_submsg ));
}
} else {
// Packed region ends in the middle of a value.
assert_does_not_parse(
cat( tag(rep_fieldnum, UPB_WIRE_TYPE_DELIMITED),
- varint(incomplete.len()),
+ varint(incomplete.size()),
incomplete ));
// EOF in the middle of packed region.
@@ -576,7 +712,7 @@ void test_premature_eof_for_type(upb_descriptortype_t type) {
// "33" and "66" are just two random values that all numeric types can
// represent.
void test_valid_data_for_type(upb_descriptortype_t type,
- const buffer& enc33, const buffer& enc66) {
+ const string& enc33, const string& enc66) {
uint32_t fieldnum = type;
uint32_t rep_fieldnum = rep_fn(type);
int wire_type = upb_decoder_types[type].native_wire_type;
@@ -614,7 +750,7 @@ void test_valid_data_for_type(upb_descriptortype_t type,
}
void test_valid_data_for_signed_type(upb_descriptortype_t type,
- const buffer& enc33, const buffer& enc66) {
+ const string& enc33, const string& enc66) {
uint32_t fieldnum = type;
uint32_t rep_fieldnum = rep_fn(type);
int wire_type = upb_decoder_types[type].native_wire_type;
@@ -672,15 +808,14 @@ void test_invalid() {
test_premature_eof_for_type(UPB_DESCRIPTOR_TYPE_SINT64);
// EOF inside a tag's varint.
- assert_does_not_parse_at_eof( buffer("\x80") );
+ assert_does_not_parse_at_eof( string("\x80") );
// EOF inside a known group.
// TODO(haberman): add group to decoder test schema.
//assert_does_not_parse_at_eof( tag(4, UPB_WIRE_TYPE_START_GROUP) );
// EOF inside an unknown group.
- // TODO(haberman): unknown groups not supported yet.
- //assert_does_not_parse_at_eof( tag(UNKNOWN_FIELD, UPB_WIRE_TYPE_START_GROUP) );
+ assert_does_not_parse_at_eof( tag(UNKNOWN_FIELD, UPB_WIRE_TYPE_START_GROUP) );
// End group that we are not currently in.
assert_does_not_parse( tag(4, UPB_WIRE_TYPE_END_GROUP) );
@@ -701,7 +836,7 @@ void test_invalid() {
tag(UPB_DESCRIPTOR_TYPE_GROUP, UPB_WIRE_TYPE_END_GROUP)));
// Test exceeding the resource limit of stack depth.
- buffer buf;
+ string buf;
for (int i = 0; i <= UPB_DECODER_MAX_NESTING; i++) {
buf.assign(submsg(UPB_DESCRIPTOR_TYPE_MESSAGE, buf));
}
@@ -710,11 +845,16 @@ void test_invalid() {
void test_valid() {
// Empty protobuf.
- assert_successful_parse(buffer(""), "<\n>\n");
+ assert_successful_parse(string(""), "<\n>\n");
// Empty protobuf where we never call PutString between
// StartString/EndString.
- {
+
+ // Randomly generated hash for this test, hope it doesn't conflict with others
+ // by chance.
+ const uint32_t emptyhash = 0x5709be8e;
+ if (!filter_hash || filter_hash == testhash) {
+ testhash = emptyhash;
upb::Status status;
upb::pb::Decoder decoder(global_method, &status);
upb::Sink sink(global_handlers, &closures[0]);
@@ -723,7 +863,7 @@ void test_valid() {
bool ok = upb::BufferSource::PutBuffer("", 0, decoder.input());
ASSERT(ok);
ASSERT(status.ok());
- ASSERT(output.eql(buffer("<\n>\n")));
+ ASSERT(output == string("<\n>\n"));
}
test_valid_data_for_signed_type(UPB_DESCRIPTOR_TYPE_DOUBLE,
@@ -770,7 +910,7 @@ void test_valid() {
cat( tag(12345, UPB_WIRE_TYPE_64BIT), uint64(2345678) ),
"<\n>\n");
assert_successful_parse(
- submsg(12345, buffer(" ")),
+ submsg(12345, string(" ")),
"<\n>\n");
assert_successful_parse(
@@ -818,7 +958,7 @@ void test_valid() {
// Submessage tests.
uint32_t msg_fn = UPB_DESCRIPTOR_TYPE_MESSAGE;
assert_successful_parse(
- submsg(msg_fn, submsg(msg_fn, submsg(msg_fn, buffer()))),
+ submsg(msg_fn, submsg(msg_fn, submsg(msg_fn, string()))),
LINE("<")
LINE("%u:{")
LINE(" <")
@@ -836,7 +976,7 @@ void test_valid() {
uint32_t repm_fn = rep_fn(UPB_DESCRIPTOR_TYPE_MESSAGE);
assert_successful_parse(
- submsg(repm_fn, submsg(repm_fn, buffer())),
+ submsg(repm_fn, submsg(repm_fn, string())),
LINE("<")
LINE("%u:[")
LINE(" %u:{")
@@ -852,16 +992,59 @@ void test_valid() {
LINE("]")
LINE(">"), repm_fn, repm_fn, repm_fn, repm_fn);
+ // Test unknown group.
+ uint32_t unknown_group_fn = 12321;
+ assert_successful_parse(
+ cat( tag(unknown_group_fn, UPB_WIRE_TYPE_START_GROUP),
+ tag(unknown_group_fn, UPB_WIRE_TYPE_END_GROUP) ),
+ LINE("<")
+ LINE(">")
+ );
+
+ // Test some unknown fields inside an unknown group.
+ const string unknown_group_with_data =
+ cat(
+ tag(unknown_group_fn, UPB_WIRE_TYPE_START_GROUP),
+ tag(12345, UPB_WIRE_TYPE_VARINT), varint(2345678),
+ tag(123456789, UPB_WIRE_TYPE_32BIT), uint32(2345678),
+ tag(123477, UPB_WIRE_TYPE_64BIT), uint64(2345678),
+ tag(123, UPB_WIRE_TYPE_DELIMITED), varint(0),
+ tag(unknown_group_fn, UPB_WIRE_TYPE_END_GROUP)
+ );
+
+ // Nested unknown group with data.
+ assert_successful_parse(
+ cat(
+ tag(unknown_group_fn, UPB_WIRE_TYPE_START_GROUP),
+ unknown_group_with_data,
+ tag(unknown_group_fn, UPB_WIRE_TYPE_END_GROUP),
+ tag(UPB_DESCRIPTOR_TYPE_INT32, UPB_WIRE_TYPE_VARINT), varint(1)
+ ),
+ LINE("<")
+ LINE("%u:1")
+ LINE(">"),
+ UPB_DESCRIPTOR_TYPE_INT32
+ );
+
+ assert_successful_parse(
+ cat( tag(unknown_group_fn, UPB_WIRE_TYPE_START_GROUP),
+ tag(unknown_group_fn + 1, UPB_WIRE_TYPE_START_GROUP),
+ tag(unknown_group_fn + 1, UPB_WIRE_TYPE_END_GROUP),
+ tag(unknown_group_fn, UPB_WIRE_TYPE_END_GROUP) ),
+ LINE("<")
+ LINE(">")
+ );
+
// Staying within the stack limit should work properly.
- buffer buf;
- buffer textbuf;
+ string buf;
+ string textbuf;
int total = UPB_DECODER_MAX_NESTING - 1;
for (int i = 0; i < total; i++) {
buf.assign(submsg(UPB_DESCRIPTOR_TYPE_MESSAGE, buf));
indentbuf(&textbuf, i);
textbuf.append("<\n");
indentbuf(&textbuf, i);
- textbuf.appendf("%u:{\n", UPB_DESCRIPTOR_TYPE_MESSAGE);
+ appendf(&textbuf, "%u:{\n", UPB_DESCRIPTOR_TYPE_MESSAGE);
}
indentbuf(&textbuf, total);
textbuf.append("<\n");
@@ -873,7 +1056,7 @@ void test_valid() {
indentbuf(&textbuf, total - i - 1);
textbuf.append(">\n");
}
- assert_successful_parse(buf, "%s", textbuf.buf());
+ assert_successful_parse(buf, "%s", textbuf.c_str());
}
void run_tests() {
@@ -885,14 +1068,17 @@ upb::reffed_ptr<const upb::pb::DecoderMethod> NewMethod(
const upb::Handlers* dest_handlers, bool allow_jit) {
upb::pb::CodeCache cache;
cache.set_allow_jit(allow_jit);
- return cache.GetDecoderMethodForDestHandlers(dest_handlers);
+ return cache.GetDecoderMethod(upb::pb::DecoderMethodOptions(dest_handlers));
}
void test_emptyhandlers(bool allowjit) {
// Create an empty handlers to make sure that the decoder can handle empty
// messages.
- upb::reffed_ptr<upb::Handlers> h(
- upb::Handlers::New(UPB_TEST_DECODER_EMPTYMESSAGE));
+ upb::reffed_ptr<upb::MessageDef> md = upb::MessageDef::New();
+ ASSERT(md->set_full_name("Empty", NULL));
+ ASSERT(md->Freeze(NULL));
+
+ upb::reffed_ptr<upb::Handlers> h(upb::Handlers::New(md.get()));
bool ok = h->Freeze(NULL);
ASSERT(ok);
NewMethod(h.get(), allowjit);
diff --git a/tests/pb/test_decoder_schema.proto b/tests/pb/test_decoder_schema.proto
deleted file mode 100644
index 50bfca9..0000000
--- a/tests/pb/test_decoder_schema.proto
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// upb - a minimalist implementation of protocol buffers.
-//
-// Copyright (c) 2012 Google Inc. See LICENSE for details.
-// Author: Josh Haberman <jhaberman@gmail.com>
-//
-// Schema used in test_decoder.cc. It contains two fields (one optional
-// and one repeated) for each type.
-
-package upb.test_decoder;
-
-message M {
- optional M m = 1;
-}
-
-enum E {
- FOO = 1;
-}
-
-message EmptyMessage {}
-
-message DecoderTest {
- optional double f_double = 1;
- optional float f_float = 2;
- optional int64 f_int64 = 3;
- optional uint64 f_uint64 = 4;
- optional int32 f_int32 = 5;
- optional fixed64 f_fixed64 = 6;
- optional fixed32 f_fixed32 = 7;
- optional bool f_bool = 8;
- optional string f_string = 9;
- optional bytes f_bytes = 12;
- optional uint32 f_uint32 = 13;
- optional sfixed32 f_sfixed32 = 15;
- optional sfixed64 f_sfixed64 = 16;
- optional sint32 f_sint32 = 17;
- optional sint64 f_sint64 = 18;
-
- optional DecoderTest f_message = 11;
- optional E f_enum = 14;
-
-
- repeated double r_double = 536869912;
- repeated float r_float = 536869913;
- repeated int64 r_int64 = 536869914;
- repeated uint64 r_uint64 = 536869915;
- repeated int32 r_int32 = 536869916;
- repeated fixed64 r_fixed64 = 536869917;
- repeated fixed32 r_fixed32 = 536869918;
- repeated bool r_bool = 536869919;
- repeated string r_string = 536869920;
- repeated bytes r_bytes = 536869923;
- repeated uint32 r_uint32 = 536869924;
- repeated sfixed32 r_sfixed32 = 536869926;
- repeated sfixed64 r_sfixed64 = 536869927;
- repeated sint32 r_sint32 = 536869928;
- repeated sint64 r_sint64 = 536869929;
-
- repeated DecoderTest r_message = 536869922;
- repeated E r_enum = 536869925;
-
- // To allow arbitrary padding.
- optional string nop_field = 40;
-}
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index c4313e1..60d6527 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -12,10 +12,7 @@
#include <iostream>
#include <set>
-
-#ifdef UPB_CXX11
#include <type_traits>
-#endif
#include "upb/def.h"
#include "upb/descriptor/reader.h"
diff --git a/tests/test_vs_proto2.cc b/tests/test_vs_proto2.cc
index 22683c3..dd20381 100644
--- a/tests/test_vs_proto2.cc
+++ b/tests/test_vs_proto2.cc
@@ -45,6 +45,15 @@ void compare_metadata(const google::protobuf::Descriptor* d,
}
}
+void print_diff(const google::protobuf::Message& msg1,
+ const google::protobuf::Message& msg2) {
+ std::string text_str1;
+ std::string text_str2;
+ google::protobuf::TextFormat::PrintToString(msg1, &text_str1);
+ google::protobuf::TextFormat::PrintToString(msg2, &text_str2);
+ fprintf(stderr, "str1: %s, str2: %s\n", text_str1.c_str(), text_str2.c_str());
+}
+
void parse_and_compare(google::protobuf::Message *msg1,
google::protobuf::Message *msg2,
const upb::Handlers *protomsg_handlers,
@@ -55,7 +64,7 @@ void parse_and_compare(google::protobuf::Message *msg1,
upb::pb::CodeCache cache;
ASSERT(cache.set_allow_jit(allow_jit));
upb::reffed_ptr<const upb::pb::DecoderMethod> decoder_method(
- cache.GetDecoderMethodForDestHandlers(protomsg_handlers));
+ cache.GetDecoderMethod(upb::pb::DecoderMethodOptions(protomsg_handlers)));
upb::Status status;
upb::pb::Decoder decoder(decoder_method.get(), &status);
@@ -67,6 +76,7 @@ void parse_and_compare(google::protobuf::Message *msg1,
bool ok = upb::BufferSource::PutBuffer(str, len, decoder.input());
if (!ok) {
fprintf(stderr, "error parsing: %s\n", status.error_message());
+ print_diff(*msg1, *msg2);
}
ASSERT(ok);
ASSERT(status.ok());
@@ -79,14 +89,8 @@ void parse_and_compare(google::protobuf::Message *msg1,
std::string str2;
msg1->SerializeToString(&str1);
msg2->SerializeToString(&str2);
-
- std::string text_str1;
- std::string text_str2;
- google::protobuf::TextFormat::PrintToString(*msg1, &text_str1);
- google::protobuf::TextFormat::PrintToString(*msg2, &text_str2);
if (str1 != str2) {
- fprintf(stderr, "str1: %s, str2: %s\n",
- text_str1.c_str(), text_str2.c_str());
+ print_diff(*msg1, *msg2);
}
ASSERT(str1 == str2);
ASSERT(std::string(str, len) == str2);
diff --git a/tools/dump_cinit.lua b/tools/dump_cinit.lua
index e23e907..c3104ee 100644
--- a/tools/dump_cinit.lua
+++ b/tools/dump_cinit.lua
@@ -359,15 +359,16 @@ local function dump_defs_c(symtab, basename, append)
else
intfmt = "0"
end
- -- UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, name,
- -- num, msgdef, subdef, selector_base, index,
+ -- UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy,
+ -- name, num, msgdef, subdef, selector_base, index,
-- default_value)
- append(' UPB_FIELDDEF_INIT(%s, %s, %s, %s, %s, "%s", %d, %s, %s, %d, ' ..
- '%d, {0},' .. -- TODO: support default value
+ append(' UPB_FIELDDEF_INIT(%s, %s, %s, %s, %s, %s, "%s", %d, %s, %s, ' ..
+ '%d, %d, {0},' .. -- TODO: support default value
'&reftables[%d], &reftables[%d]),\n',
const(f, "label"), const(f, "type"), intfmt,
- boolstr(f:istagdelim()), boolstr(f:is_extension()), f:name(),
- f:number(), linktab:addr(f:containing_type()), subdef,
+ boolstr(f:istagdelim()), boolstr(f:is_extension()),
+ boolstr(f:lazy()), f:name(), f:number(),
+ linktab:addr(f:containing_type()), subdef,
f:_selector_base(), f:index(),
reftable, reftable + 1
)
diff --git a/upb/bindings/googlepb/bridge.cc b/upb/bindings/googlepb/bridge.cc
index a125249..c8e3474 100644
--- a/upb/bindings/googlepb/bridge.cc
+++ b/upb/bindings/googlepb/bridge.cc
@@ -109,10 +109,6 @@ const MessageDef* DefBuilder::GetMaybeUnfrozenMessageDef(
for (int i = 0; i < fields.size(); i++) {
const goog::FieldDescriptor* proto2_f = fields[i];
assert(proto2_f);
-#ifdef UPB_GOOGLE3
- // Skip lazy fields for now since we can't properly handle them.
- if (proto2_f->options().lazy()) continue;
-#endif
md->AddField(NewFieldDef(proto2_f, m), &status);
}
ASSERT_STATUS(&status);
@@ -135,6 +131,9 @@ reffed_ptr<FieldDef> DefBuilder::NewFieldDef(const goog::FieldDescriptor* f,
Status status;
upb_f->set_number(f->number(), &status);
upb_f->set_label(FieldDef::ConvertLabel(f->label()));
+#ifdef UPB_GOOGLE3
+ upb_f->set_lazy(f->options().lazy());
+#endif
if (f->is_extension()) {
upb_f->set_name(f->full_name(), &status);
diff --git a/upb/bindings/googlepb/proto2.cc b/upb/bindings/googlepb/proto2.cc
index c0b4907..04e504b 100644
--- a/upb/bindings/googlepb/proto2.cc
+++ b/upb/bindings/googlepb/proto2.cc
@@ -42,9 +42,14 @@ namespace google_opensource { class GMR_Handlers; }
#ifdef UPB_GOOGLE3
+// TODO(haberman): Add public functionality to ExtensionSet for populating
+// LazyFields.
+#define private public
+#include "net/proto2/public/extension_set.h"
+#undef private
+
#include "net/proto2/proto/descriptor.pb.h"
#include "net/proto2/public/descriptor.h"
-#include "net/proto2/public/extension_set.h"
#include "net/proto2/public/generated_message_reflection.h"
#include "net/proto2/public/lazy_field.h"
#include "net/proto2/public/message.h"
@@ -66,9 +71,12 @@ namespace me = ::upb::google_google3;
#include "google/protobuf/generated_message_reflection.h"
#undef private
+#define private public
+#include "google/protobuf/extension_set.h"
+#undef private
+
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor.pb.h"
-#include "google/protobuf/extension_set.h"
#include "google/protobuf/message.h"
namespace goog = ::google::protobuf;
@@ -176,9 +184,14 @@ case goog::FieldDescriptor::cpptype: \
}
case goog::FieldDescriptor::CPPTYPE_MESSAGE:
#ifdef UPB_GOOGLE3
- if (proto2_f->options().lazy()) {
- assert(false);
- return false; // Not yet implemented.
+ if (proto2_f->options().lazy() &&
+ // proto2 lets you set lazy=true on a repeated field, but doesn't
+ // actually support lazy repeated messages, so just ignore
+ // lazy=true for repeated messages.
+ !proto2_f->is_repeated()) {
+ // Supports lazy fields and lazy extensions.
+ SetLazyFieldHandlers(proto2_f, m, r, upb_f, h);
+ return true;
}
#endif
if (proto2_f->is_extension()) {
@@ -267,12 +280,14 @@ case goog::FieldDescriptor::cpptype: \
const goog::FieldDescriptor* proto2_f,
const goog::internal::GeneratedMessageReflection* r)
: offset_(r->extensions_offset_),
- number_(proto2_f->number()),
- type_(proto2_f->type()) {
+ field_descriptor_(proto2_f) {
}
- int number() const { return number_; }
- goog::internal::FieldType type() const { return type_; }
+ int number() const { return field_descriptor_->number(); }
+ goog::internal::FieldType type() const { return field_descriptor_->type(); }
+ const goog::FieldDescriptor* field_descriptor() const {
+ return field_descriptor_;
+ }
goog::internal::ExtensionSet* GetExtensionSet(goog::Message* m) const {
return GetPointer<goog::internal::ExtensionSet>(m, offset_);
@@ -280,8 +295,10 @@ case goog::FieldDescriptor::cpptype: \
private:
const size_t offset_;
- int number_;
- goog::internal::FieldType type_;
+ // We know it will outlive because we require that the input message used to
+ // build these handlers outlives us, and the descriptor will outlive the
+ // message.
+ const goog::FieldDescriptor* field_descriptor_;
};
// StartSequence /////////////////////////////////////////////////////////////
@@ -693,10 +710,27 @@ case goog::FieldDescriptor::cpptype: \
#ifdef UPB_GOOGLE3
// Handlers for types/features only included in internal proto2 release:
// Cord, StringPiece, LazyField, and MessageSet.
- // TODO(haberman): LazyField, MessageSet.
+ // TODO(haberman): MessageSet.
// Cord //////////////////////////////////////////////////////////////////////
+ static void AppendBufToCord(const char* buf, size_t n,
+ const upb::BufferHandle* handle, Cord* c) {
+ const Cord* source_cord = handle->GetAttachedObject<Cord>();
+ if (source_cord) {
+ // This TODO is copied from CordReader::CopyToCord():
+ // "We could speed this up by using CordReader internals."
+ Cord piece(*source_cord);
+ piece.RemovePrefix(handle->object_offset() + (buf - handle->buffer()));
+ assert(piece.size() >= n);
+ piece.RemoveSuffix(piece.size() - n);
+
+ c->Append(piece);
+ } else {
+ c->Append(StringPiece(buf, n));
+ }
+ }
+
static void SetCordHandlers(
const proto2::FieldDescriptor* proto2_f,
const proto2::internal::GeneratedMessageReflection* r,
@@ -723,19 +757,7 @@ case goog::FieldDescriptor::cpptype: \
static void OnCordBuf(Cord* c, const char* buf, size_t n,
const upb::BufferHandle* handle) {
- const Cord* source_cord = handle->GetAttachedObject<Cord>();
- if (source_cord) {
- // This TODO is copied from CordReader::CopyToCord():
- // "We could speed this up by using CordReader internals."
- Cord piece(*source_cord);
- piece.RemovePrefix(handle->object_offset() + (buf - handle->buffer()));
- assert(piece.size() >= n);
- piece.RemoveSuffix(piece.size() - n);
-
- c->Append(piece);
- } else {
- c->Append(StringPiece(buf, n));
- }
+ AppendBufToCord(buf, n, handle, c);
}
static Cord* StartRepeatedCord(proto2::RepeatedField<Cord>* r,
@@ -795,6 +817,164 @@ case goog::FieldDescriptor::cpptype: \
return field;
}
+ // LazyField /////////////////////////////////////////////////////////////////
+
+ // For lazy fields we set both lazy and eager handlers. The user can
+ // configure the data source to call either, though lazy handlers may only be
+ // used when the source data is binary protobuf.
+ static void SetLazyFieldHandlers(
+ const proto2::FieldDescriptor* proto2_f,
+ const proto2::Message& m,
+ const proto2::internal::GeneratedMessageReflection* r,
+ const upb::FieldDef* f, upb::Handlers* h) {
+ assert(!proto2_f->is_repeated());
+ const goog::Message* field_prototype = GetFieldPrototype(m, proto2_f);
+ CHKRET(h->SetStringHandler(f, UpbMakeHandler(OnLazyFieldBuf)));
+ if (proto2_f->is_extension()) {
+ CHKRET(h->SetStartStringHandler(
+ f, UpbBind(StartLazyExtension, new ExtensionFieldData(proto2_f, r))));
+ CHKRET(h->SetStartSubMessageHandler(
+ f, UpbBind(StartSubMessageExtension,
+ new SubMessageExtensionHandlerData(proto2_f, r,
+ field_prototype))));
+ } else {
+ CHKRET(h->SetStartStringHandler(
+ f, UpbBind(StartLazyField, new FieldOffset(proto2_f, r))));
+ CHKRET(h->SetStartSubMessageHandler(
+ f, UpbBind(StartLazyFieldEager,
+ new SubMessageHandlerData(proto2_f, r, field_prototype))));
+ }
+ }
+
+ static proto2::internal::LazyField* StartLazyField(proto2::Message* m,
+ const FieldOffset* offset,
+ size_t size_hint) {
+ UPB_UNUSED(size_hint);
+ offset->SetHasbit(m);
+ proto2::internal::LazyField* field =
+ offset->GetFieldPointer<proto2::internal::LazyField>(m);
+ field->Clear();
+ return field;
+ }
+
+ // For when the field has a lazy representation but we parse it eagerly anyway
+ // (either because we want to or because we're parsing from a format other
+ // than binary protobuf).
+ static proto2::Message* StartLazyFieldEager(
+ proto2::Message* m, const SubMessageHandlerData* data) {
+ data->SetHasbit(m);
+ proto2::internal::LazyField* field =
+ data->GetFieldPointer<proto2::internal::LazyField>(m);
+ return field->MutableByPrototype(*data->prototype());
+ }
+
+ class LazyMessageExtensionImpl
+ : public proto2::internal::ExtensionSet::LazyMessageExtension {
+ public:
+ LazyMessageExtensionImpl() {}
+ virtual ~LazyMessageExtensionImpl() {}
+
+ virtual LazyMessageExtension* New() const {
+ return new LazyMessageExtensionImpl();
+ }
+
+ virtual const proto2::MessageLite& GetMessage(
+ const proto2::MessageLite& prototype) const {
+ return lazy_field_.GetByPrototype(
+ static_cast<const proto2::Message&>(prototype));
+ }
+
+ virtual proto2::MessageLite* MutableMessage(
+ const proto2::MessageLite& prototype) {
+ return lazy_field_.MutableByPrototype(
+ static_cast<const proto2::Message&>(prototype));
+ }
+
+ virtual void SetAllocatedMessage(proto2::MessageLite* message) {
+ return lazy_field_.SetAllocated(static_cast<proto2::Message*>(message));
+ }
+
+ virtual proto2::MessageLite* ReleaseMessage(
+ const proto2::MessageLite& prototype) {
+ return lazy_field_.ReleaseByPrototype(
+ static_cast<const proto2::Message&>(prototype));
+ }
+
+ virtual bool IsInitialized() const { return true; }
+
+ virtual int ByteSize() const { return lazy_field_.MessageByteSize(); }
+
+ int SpaceUsed() const {
+ return sizeof(*this) + lazy_field_.SpaceUsedExcludingSelf();
+ }
+
+ virtual void MergeFrom(const LazyMessageExtension& other) {
+ MergeFrom(*static_cast<const LazyMessageExtensionImpl*>(&other));
+ }
+
+ virtual void MergeFrom(const LazyMessageExtensionImpl& other) {
+ lazy_field_.MergeFrom(other.lazy_field_);
+ }
+
+ virtual void Clear() { lazy_field_.Clear(); }
+
+ virtual bool ReadMessage(const proto2::MessageLite& prototype,
+ proto2::io::CodedInputStream* input) {
+ return lazy_field_.Read(input);
+ }
+
+ virtual void WriteMessage(int number,
+ proto2::io::CodedOutputStream* output) const {
+ lazy_field_.Write(number, output);
+ }
+
+ virtual uint8* WriteMessageToArray(int number, uint8* target) const {
+ return lazy_field_.WriteToArray(number, target);
+ }
+
+ proto2::internal::LazyField& lazy_field() { return lazy_field_; }
+
+ private:
+ proto2::internal::LazyField lazy_field_;
+ DISALLOW_COPY_AND_ASSIGN(LazyMessageExtensionImpl);
+ };
+
+ static proto2::internal::LazyField* StartLazyExtension(
+ proto2::Message* m, const ExtensionFieldData* data, size_t size_hint) {
+ proto2::internal::ExtensionSet* set = data->GetExtensionSet(m);
+
+ // We have to break encapsulation here since no public accessors expose the
+ // LazyField.
+ //
+ // TODO(haberman): add a function to ExtensionSet that allows us to set the
+ // lazy field directly.
+ proto2::internal::ExtensionSet::Extension* item;
+ LazyMessageExtensionImpl* lazy_extension;
+ if (set->MaybeNewExtension(data->number(), data->field_descriptor(),
+ &item)) {
+ lazy_extension = new LazyMessageExtensionImpl();
+ item->type = UPB_DESCRIPTOR_TYPE_MESSAGE;
+ item->is_repeated = false;
+ item->is_lazy = true;
+ item->lazymessage_value = lazy_extension;
+ } else {
+ lazy_extension =
+ CheckDownCast<LazyMessageExtensionImpl*>(item->lazymessage_value);
+ }
+
+ item->is_cleared = false;
+
+ return &lazy_extension->lazy_field();
+ }
+
+ static void OnLazyFieldBuf(proto2::internal::LazyField* field,
+ const char* buf, size_t len,
+ const upb::BufferHandle* handle) {
+ Cord encoded(field->GetEncoded());
+ AppendBufToCord(buf, len, handle, &encoded);
+ field->SetEncoded(encoded);
+ }
+
#endif // UPB_GOOGLE3
};
diff --git a/upb/bindings/lua/upb.c b/upb/bindings/lua/upb.c
index 1e7540a..022d689 100644
--- a/upb/bindings/lua/upb.c
+++ b/upb/bindings/lua/upb.c
@@ -326,6 +326,10 @@ static void lupb_fielddef_dosetlabel(lua_State *L, upb_fielddef *f, int narg) {
upb_fielddef_setlabel(f, label);
}
+static void lupb_fielddef_dosetlazy(lua_State *L, upb_fielddef *f, int narg) {
+ upb_fielddef_setlazy(f, chkbool(L, narg, "lazy"));
+}
+
static void lupb_fielddef_dosetname(lua_State *L, upb_fielddef *f, int narg) {
CHK(upb_fielddef_setname(f, chkname(L, narg), &status));
}
@@ -402,6 +406,12 @@ static int lupb_fielddef_setlabel(lua_State *L) {
return 0;
}
+static int lupb_fielddef_setlazy(lua_State *L) {
+ upb_fielddef *f = lupb_fielddef_checkmutable(L, 1);
+ lupb_fielddef_dosetlazy(L, f, 2);
+ return 0;
+}
+
static int lupb_fielddef_setname(lua_State *L) {
upb_fielddef *f = lupb_fielddef_checkmutable(L, 1);
lupb_fielddef_dosetname(L, f, 2);
@@ -466,6 +476,7 @@ static int lupb_fielddef_new(lua_State *L) {
else if (streql(key, "number")) lupb_fielddef_dosetnumber(L, f, v);
else if (streql(key, "type")) lupb_fielddef_dosettype(L, f, v);
else if (streql(key, "label")) lupb_fielddef_dosetlabel(L, f, v);
+ else if (streql(key, "lazy")) lupb_fielddef_dosetlazy(L, f, v);
else if (streql(key, "is_extension"))
lupb_fielddef_dosetisextension(L, f, v);
else if (streql(key, "containing_type_name"))
@@ -541,6 +552,12 @@ static int lupb_fielddef_label(lua_State *L) {
return 1;
}
+static int lupb_fielddef_lazy(lua_State *L) {
+ const upb_fielddef *f = lupb_fielddef_check(L, 1);
+ lua_pushboolean(L, upb_fielddef_lazy(f));
+ return 1;
+}
+
static int lupb_fielddef_name(lua_State *L) {
const upb_fielddef *f = lupb_fielddef_check(L, 1);
lua_pushstring(L, upb_fielddef_name(f));
@@ -653,6 +670,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = {
{"is_extension", lupb_fielddef_isextension},
{"istagdelim", lupb_fielddef_istagdelim},
{"label", lupb_fielddef_label},
+ {"lazy", lupb_fielddef_lazy},
{"name", lupb_fielddef_name},
{"number", lupb_fielddef_number},
{"subdef", lupb_fielddef_subdef},
@@ -663,6 +681,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = {
{"set_default", lupb_fielddef_setdefault},
{"set_is_extension", lupb_fielddef_setisextension},
{"set_label", lupb_fielddef_setlabel},
+ {"set_lazy", lupb_fielddef_setlazy},
{"set_name", lupb_fielddef_setname},
{"set_number", lupb_fielddef_setnumber},
{"set_subdef", lupb_fielddef_setsubdef},
diff --git a/upb/def.c b/upb/def.c
index 805f143..14715c8 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -145,6 +145,12 @@ static bool upb_validate_field(upb_fielddef *f, upb_status *s) {
upb_status_seterrmsg(s, "fielddef type was not initialized");
return false;
}
+ if (upb_fielddef_lazy(f) &&
+ upb_fielddef_descriptortype(f) != UPB_DESCRIPTOR_TYPE_MESSAGE) {
+ upb_status_seterrmsg(s,
+ "only length-delimited submessage fields may be lazy");
+ return false;
+ }
if (upb_fielddef_hassubdef(f)) {
if (f->subdef_is_symbolic) {
upb_status_seterrf(s,
@@ -463,6 +469,7 @@ upb_fielddef *upb_fielddef_new(const void *owner) {
f->type_is_set_ = false;
f->tagdelim = false;
f->is_extension_ = false;
+ f->lazy_ = false;
// For the moment we default this to UPB_INTFMT_VARIABLE, since it will work
// with all integer types and is in some since more "default" since the most
@@ -565,6 +572,10 @@ bool upb_fielddef_isextension(const upb_fielddef *f) {
return f->is_extension_;
}
+bool upb_fielddef_lazy(const upb_fielddef *f) {
+ return f->lazy_;
+}
+
const char *upb_fielddef_name(const upb_fielddef *f) {
return upb_def_fullname(UPB_UPCAST(f));
}
@@ -824,10 +835,14 @@ upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f) {
return 0;
}
-bool upb_fielddef_setisextension(upb_fielddef *f, bool is_extension) {
+void upb_fielddef_setisextension(upb_fielddef *f, bool is_extension) {
assert(!upb_fielddef_isfrozen(f));
f->is_extension_ = is_extension;
- return true;
+}
+
+void upb_fielddef_setlazy(upb_fielddef *f, bool lazy) {
+ assert(!upb_fielddef_isfrozen(f));
+ f->lazy_ = lazy;
}
void upb_fielddef_setlabel(upb_fielddef *f, upb_label_t label) {
@@ -836,17 +851,16 @@ void upb_fielddef_setlabel(upb_fielddef *f, upb_label_t label) {
f->label_ = label;
}
-bool upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt) {
+void upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt) {
assert(!upb_fielddef_isfrozen(f));
assert(upb_fielddef_checkintfmt(fmt));
f->intfmt = fmt;
- return true;
}
-bool upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim) {
+void upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim) {
assert(!upb_fielddef_isfrozen(f));
f->tagdelim = tag_delim;
- return true;
+ f->tagdelim = tag_delim;
}
static bool checksetdefault(upb_fielddef *f, upb_fieldtype_t type) {
diff --git a/upb/def.h b/upb/def.h
index 8951353..a7240bf 100644
--- a/upb/def.h
+++ b/upb/def.h
@@ -274,6 +274,20 @@ class upb::FieldDef /* : public upb::Def */ {
uint32_t number() const; // Returns 0 if uninitialized.
bool is_extension() const;
+ // For UPB_TYPE_MESSAGE fields only where is_tag_delimited() == false,
+ // indicates whether this field should have lazy parsing handlers that yield
+ // the unparsed string for the submessage.
+ //
+ // When we freeze, we ensure that this can only be true for length-delimited
+ // message fields. Prior to freezing this can be true or false with no
+ // restrictions.
+ //
+ // TODO(haberman): I think we want to move this into a FieldOptions container
+ // when we add support for custom options (the FieldOptions struct will
+ // contain both regular FieldOptions like "lazy" *and* custom options).
+ bool lazy() const;
+ void set_lazy(bool lazy);
+
// An integer that can be used as an index into an array of fields for
// whatever message this field belongs to. Guaranteed to be less than
// f->containing_type()->field_count(). May only be accessed once the def has
@@ -450,6 +464,7 @@ struct upb_fielddef {
bool default_is_string;
bool type_is_set_; // False until type is explicitly set.
bool is_extension_;
+ bool lazy_;
upb_intfmt_t intfmt;
bool tagdelim;
upb_fieldtype_t type_;
@@ -459,14 +474,14 @@ struct upb_fielddef {
uint32_t index_;
};
-#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, name, \
- num, msgdef, subdef, selector_base, index, \
+#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \
+ name, num, msgdef, subdef, selector_base, index, \
defaultval, refs, ref2s) \
{ \
UPB_DEF_INIT(name, UPB_DEF_FIELD, refs, ref2s), defaultval, {msgdef}, \
{subdef}, false, false, \
type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \
- intfmt, tagdelim, type, label, num, selector_base, index \
+ lazy, intfmt, tagdelim, type, label, num, selector_base, index \
}
// Native C API.
@@ -496,6 +511,7 @@ upb_label_t upb_fielddef_label(const upb_fielddef *f);
uint32_t upb_fielddef_number(const upb_fielddef *f);
const char *upb_fielddef_name(const upb_fielddef *f);
bool upb_fielddef_isextension(const upb_fielddef *f);
+bool upb_fielddef_lazy(const upb_fielddef *f);
const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f);
upb_msgdef *upb_fielddef_containingtype_mutable(upb_fielddef *f);
const char *upb_fielddef_containingtypename(upb_fielddef *f);
@@ -528,9 +544,10 @@ bool upb_fielddef_setnumber(upb_fielddef *f, uint32_t number, upb_status *s);
bool upb_fielddef_setname(upb_fielddef *f, const char *name, upb_status *s);
bool upb_fielddef_setcontainingtypename(upb_fielddef *f, const char *name,
upb_status *s);
-bool upb_fielddef_setisextension(upb_fielddef *f, bool is_extension);
-bool upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt);
-bool upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim);
+void upb_fielddef_setisextension(upb_fielddef *f, bool is_extension);
+void upb_fielddef_setlazy(upb_fielddef *f, bool lazy);
+void upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt);
+void upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim);
void upb_fielddef_setdefaultint64(upb_fielddef *f, int64_t val);
void upb_fielddef_setdefaultint32(upb_fielddef *f, int32_t val);
void upb_fielddef_setdefaultuint64(upb_fielddef *f, uint64_t val);
@@ -1071,6 +1088,12 @@ inline const char* FieldDef::name() const { return upb_fielddef_name(this); }
inline bool FieldDef::is_extension() const {
return upb_fielddef_isextension(this);
}
+inline bool FieldDef::lazy() const {
+ return upb_fielddef_lazy(this);
+}
+inline void FieldDef::set_lazy(bool lazy) {
+ upb_fielddef_setlazy(this, lazy);
+}
inline const MessageDef* FieldDef::containing_type() const {
return upb_fielddef_containingtype(this);
}
diff --git a/upb/descriptor/descriptor.proto b/upb/descriptor/descriptor.proto
index 233f879..a785f79 100644
--- a/upb/descriptor/descriptor.proto
+++ b/upb/descriptor/descriptor.proto
@@ -59,6 +59,11 @@ message FileDescriptorProto {
// Names of files imported by this file.
repeated string dependency = 3;
+ // Indexes of the public imported files in the dependency list above.
+ repeated int32 public_dependency = 10;
+ // Indexes of the weak imported files in the dependency list.
+ // For Google-internal migration only. Do not use.
+ repeated int32 weak_dependency = 11;
// All top-level definitions in this file.
repeated DescriptorProto message_type = 4;
@@ -101,13 +106,13 @@ message FieldDescriptorProto {
// Order is weird for historical reasons.
TYPE_DOUBLE = 1;
TYPE_FLOAT = 2;
- TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers
- // take 10 bytes. Use TYPE_SINT64 if negative
- // values are likely.
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
+ // negative values are likely.
+ TYPE_INT64 = 3;
TYPE_UINT64 = 4;
- TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers
- // take 10 bytes. Use TYPE_SINT32 if negative
- // values are likely.
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
+ // negative values are likely.
+ TYPE_INT32 = 5;
TYPE_FIXED64 = 6;
TYPE_FIXED32 = 7;
TYPE_BOOL = 8;
@@ -199,6 +204,7 @@ message MethodDescriptorProto {
optional MethodOptions options = 4;
}
+
// ===================================================================
// Options
@@ -220,10 +226,15 @@ message MethodDescriptorProto {
// through 99999. It is up to you to ensure that you do not use the
// same number for multiple options.
// * For options which will be published and used publicly by multiple
-// independent entities, e-mail kenton@google.com to reserve extension
-// numbers. Simply tell me how many you need and I'll send you back a
-// set of numbers to use -- there's no need to explain how you intend to
-// use them. If this turns out to be popular, a web service will be set up
+// independent entities, e-mail protobuf-global-extension-registry@google.com
+// to reserve extension numbers. Simply provide your project name (e.g.
+// Object-C plugin) and your porject website (if available) -- there's no need
+// to explain how you intend to use them. Usually you only need one extension
+// number. You can declare multiple options with only one extension number by
+// putting them in a sub-message. See the Custom Options section of the docs
+// for examples:
+// http://code.google.com/apis/protocolbuffers/docs/proto.html#options
+// If this turns out to be popular, a web service will be set up
// to automatically assign option numbers.
@@ -266,6 +277,9 @@ message FileOptions {
}
optional OptimizeMode optimize_for = 9 [default=SPEED];
+ // Sets the Go package where structs generated from this .proto will be
+ // placed. There is no default.
+ optional string go_package = 11;
@@ -344,6 +358,37 @@ message FieldOptions {
optional bool packed = 2;
+
+ // Should this field be parsed lazily? Lazy applies only to message-type
+ // fields. It means that when the outer message is initially parsed, the
+ // inner message's contents will not be parsed but instead stored in encoded
+ // form. The inner message will actually be parsed when it is first accessed.
+ //
+ // This is only a hint. Implementations are free to choose whether to use
+ // eager or lazy parsing regardless of the value of this option. However,
+ // setting this option true suggests that the protocol author believes that
+ // using lazy parsing on this field is worth the additional bookkeeping
+ // overhead typically needed to implement it.
+ //
+ // This option does not affect the public interface of any generated code;
+ // all method signatures remain the same. Furthermore, thread-safety of the
+ // interface is not affected by this option; const methods remain safe to
+ // call from multiple threads concurrently, while non-const methods continue
+ // to require exclusive access.
+ //
+ //
+ // Note that implementations may choose not to check required fields within
+ // a lazy sub-message. That is, calling IsInitialized() on the outher message
+ // may return true even if the inner message has missing required fields.
+ // This is necessary because otherwise the inner message would have to be
+ // parsed in order to perform the check, defeating the purpose of lazy
+ // parsing. An implementation which chooses not to check required fields
+ // must be consistent about it. That is, for any particular sub-message, the
+ // implementation must either *always* check its required fields, or *never*
+ // check its required fields, regardless of whether or not the message has
+ // been parsed.
+ optional bool lazy = 5 [default=false];
+
// Is this field deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for accessors, or it will be completely ignored; in the very least, this
@@ -364,6 +409,9 @@ message FieldOptions {
// TODO: Fully-implement this, then remove the "experimental_" prefix.
optional string experimental_map_key = 9;
+ // For Google-internal migration only. Do not use.
+ optional bool weak = 10 [default=false];
+
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
@@ -373,6 +421,10 @@ message FieldOptions {
message EnumOptions {
+ // Set this option to false to disallow mapping different tag names to a same
+ // value.
+ optional bool allow_alias = 2 [default=true];
+
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
@@ -416,6 +468,7 @@ message MethodOptions {
extensions 1000 to max;
}
+
// A message representing a option the parser does not recognize. This only
// appears in options protos created by the compiler::Parser class.
// DescriptorPool resolves these when building Descriptor objects. Therefore,
@@ -527,7 +580,41 @@ message SourceCodeInfo {
// 1 to each before displaying to a user.
repeated int32 span = 2 [packed=true];
- // TODO(kenton): Record comments appearing before and after the
- // declaration.
+ // If this SourceCodeInfo represents a complete declaration, these are any
+ // comments appearing before and after the declaration which appear to be
+ // attached to the declaration.
+ //
+ // A series of line comments appearing on consecutive lines, with no other
+ // tokens appearing on those lines, will be treated as a single comment.
+ //
+ // Only the comment content is provided; comment markers (e.g. //) are
+ // stripped out. For block comments, leading whitespace and an asterisk
+ // will be stripped from the beginning of each line other than the first.
+ // Newlines are included in the output.
+ //
+ // Examples:
+ //
+ // optional int32 foo = 1; // Comment attached to foo.
+ // // Comment attached to bar.
+ // optional int32 bar = 2;
+ //
+ // optional string baz = 3;
+ // // Comment attached to baz.
+ // // Another line attached to baz.
+ //
+ // // Comment attached to qux.
+ // //
+ // // Another line attached to qux.
+ // optional double qux = 4;
+ //
+ // optional string corge = 5;
+ // /* Block comment attached
+ // * to corge. Leading asterisks
+ // * will be removed. */
+ // /* Block comment attached to
+ // * grault. */
+ // optional int32 grault = 6;
+ optional string leading_comments = 3;
+ optional string trailing_comments = 4;
}
}
diff --git a/upb/descriptor/descriptor.upb.c b/upb/descriptor/descriptor.upb.c
index 8046bcd..fa2f447 100755
--- a/upb/descriptor/descriptor.upb.c
+++ b/upb/descriptor/descriptor.upb.c
@@ -5,272 +5,292 @@
#include "upb/def.h"
const upb_msgdef google_protobuf_msgs[20];
-const upb_fielddef google_protobuf_fields[73];
+const upb_fielddef google_protobuf_fields[81];
const upb_enumdef google_protobuf_enums[4];
-const upb_tabent google_protobuf_strentries[192];
+const upb_tabent google_protobuf_strentries[204];
const upb_tabent google_protobuf_intentries[14];
-const _upb_value google_protobuf_arrays[224];
+const _upb_value google_protobuf_arrays[232];
#ifdef UPB_DEBUG_REFS
-static upb_inttable reftables[194];
+static upb_inttable reftables[210];
#endif
const upb_msgdef google_protobuf_msgs[20] = {
UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 27, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[0], 8, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[0]),&reftables[0], &reftables[1]),
UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[8], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[16]),&reftables[2], &reftables[3]),
UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[11], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[20]),&reftables[4], &reftables[5]),
- UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[0], &google_protobuf_arrays[15], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[24]),&reftables[6], &reftables[7]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[19], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[28]),&reftables[8], &reftables[9]),
- UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[2], &google_protobuf_arrays[23], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[32]),&reftables[10], &reftables[11]),
- UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[27], 9, 8), UPB_STRTABLE_INIT(8, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[36]),&reftables[12], &reftables[13]),
- UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[4], &google_protobuf_arrays[36], 32, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[52]),&reftables[14], &reftables[15]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 33, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[68], 10, 9), UPB_STRTABLE_INIT(9, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[60]),&reftables[16], &reftables[17]),
- UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[78], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[76]),&reftables[18], &reftables[19]),
- UPB_MSGDEF_INIT("google.protobuf.FileOptions", 18, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[6], &google_protobuf_arrays[80], 64, 8), UPB_STRTABLE_INIT(9, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[80]),&reftables[20], &reftables[21]),
- UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[8], &google_protobuf_arrays[144], 16, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[96]),&reftables[22], &reftables[23]),
- UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 13, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[160], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[100]),&reftables[24], &reftables[25]),
- UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[10], &google_protobuf_arrays[165], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[108]),&reftables[26], &reftables[27]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[169], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[112]),&reftables[28], &reftables[29]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[12], &google_protobuf_arrays[173], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[116]),&reftables[30], &reftables[31]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[177], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[120]),&reftables[32], &reftables[33]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 8, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[179], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[124]),&reftables[34], &reftables[35]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[182], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[128]),&reftables[36], &reftables[37]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[191], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[144]),&reftables[38], &reftables[39]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 7, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[0], &google_protobuf_arrays[15], 8, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[24]),&reftables[6], &reftables[7]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[23], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[28]),&reftables[8], &reftables[9]),
+ UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[2], &google_protobuf_arrays[27], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[32]),&reftables[10], &reftables[11]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[31], 9, 8), UPB_STRTABLE_INIT(8, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[36]),&reftables[12], &reftables[13]),
+ UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 14, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[4], &google_protobuf_arrays[40], 32, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[52]),&reftables[14], &reftables[15]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 39, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[72], 12, 11), UPB_STRTABLE_INIT(11, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[68]),&reftables[16], &reftables[17]),
+ UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[84], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[84]),&reftables[18], &reftables[19]),
+ UPB_MSGDEF_INIT("google.protobuf.FileOptions", 21, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[6], &google_protobuf_arrays[86], 64, 9), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[88]),&reftables[20], &reftables[21]),
+ UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[8], &google_protobuf_arrays[150], 16, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[104]),&reftables[22], &reftables[23]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 13, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[166], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[108]),&reftables[24], &reftables[25]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[10], &google_protobuf_arrays[171], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[116]),&reftables[26], &reftables[27]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[175], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[120]),&reftables[28], &reftables[29]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[12], &google_protobuf_arrays[179], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[124]),&reftables[30], &reftables[31]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[183], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[128]),&reftables[32], &reftables[33]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 14, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[185], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[132]),&reftables[34], &reftables[35]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[190], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[140]),&reftables[36], &reftables[37]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[199], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[156]),&reftables[38], &reftables[39]),
};
-const upb_fielddef google_protobuf_fields[73] = {
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "aggregate_value", 8, &google_protobuf_msgs[18], NULL, 15, 6, {0},&reftables[40], &reftables[41]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "cc_generic_services", 16, &google_protobuf_msgs[10], NULL, 14, 5, {0},&reftables[42], &reftables[43]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "ctype", 1, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_enums[2]), 6, 1, {0},&reftables[44], &reftables[45]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "default_value", 7, &google_protobuf_msgs[6], NULL, 16, 7, {0},&reftables[46], &reftables[47]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, "dependency", 3, &google_protobuf_msgs[8], NULL, 30, 8, {0},&reftables[48], &reftables[49]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "deprecated", 3, &google_protobuf_msgs[7], NULL, 8, 3, {0},&reftables[50], &reftables[51]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, "double_value", 6, &google_protobuf_msgs[18], NULL, 11, 4, {0},&reftables[52], &reftables[53]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "end", 2, &google_protobuf_msgs[1], NULL, 3, 1, {0},&reftables[54], &reftables[55]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "enum_type", 4, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[2]), 16, 2, {0},&reftables[56], &reftables[57]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "enum_type", 5, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[2]), 13, 1, {0},&reftables[58], &reftables[59]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "experimental_map_key", 9, &google_protobuf_msgs[7], NULL, 9, 4, {0},&reftables[60], &reftables[61]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "extendee", 2, &google_protobuf_msgs[6], NULL, 7, 2, {0},&reftables[62], &reftables[63]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension", 7, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[6]), 19, 3, {0},&reftables[64], &reftables[65]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension", 6, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 22, 4, {0},&reftables[66], &reftables[67]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension_range", 5, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[1]), 19, 3, {0},&reftables[68], &reftables[69]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "field", 2, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 10, 0, {0},&reftables[70], &reftables[71]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "file", 1, &google_protobuf_msgs[9], UPB_UPCAST(&google_protobuf_msgs[8]), 5, 0, {0},&reftables[72], &reftables[73]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "identifier_value", 3, &google_protobuf_msgs[18], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "input_type", 2, &google_protobuf_msgs[12], NULL, 7, 2, {0},&reftables[76], &reftables[77]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, "is_extension", 2, &google_protobuf_msgs[19], NULL, 5, 1, {0},&reftables[78], &reftables[79]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_generate_equals_and_hash", 20, &google_protobuf_msgs[10], NULL, 17, 8, {0},&reftables[80], &reftables[81]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_generic_services", 17, &google_protobuf_msgs[10], NULL, 15, 6, {0},&reftables[82], &reftables[83]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_multiple_files", 10, &google_protobuf_msgs[10], NULL, 13, 4, {0},&reftables[84], &reftables[85]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "java_outer_classname", 8, &google_protobuf_msgs[10], NULL, 9, 2, {0},&reftables[86], &reftables[87]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "java_package", 1, &google_protobuf_msgs[10], NULL, 6, 1, {0},&reftables[88], &reftables[89]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "label", 4, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[0]), 11, 4, {0},&reftables[90], &reftables[91]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "location", 1, &google_protobuf_msgs[16], UPB_UPCAST(&google_protobuf_msgs[17]), 5, 0, {0},&reftables[92], &reftables[93]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "message_set_wire_format", 1, &google_protobuf_msgs[11], NULL, 6, 1, {0},&reftables[94], &reftables[95]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "message_type", 4, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[0]), 10, 0, {0},&reftables[96], &reftables[97]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "method", 2, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[12]), 6, 0, {0},&reftables[98], &reftables[99]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "name", 2, &google_protobuf_msgs[18], UPB_UPCAST(&google_protobuf_msgs[19]), 5, 0, {0},&reftables[100], &reftables[101]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[8], NULL, 22, 6, {0},&reftables[102], &reftables[103]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[14], NULL, 8, 2, {0},&reftables[104], &reftables[105]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[12], NULL, 4, 1, {0},&reftables[106], &reftables[107]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[6], NULL, 4, 1, {0},&reftables[108], &reftables[109]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[4], NULL, 4, 1, {0},&reftables[110], &reftables[111]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[2], NULL, 8, 2, {0},&reftables[112], &reftables[113]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[0], NULL, 24, 6, {0},&reftables[114], &reftables[115]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, "name_part", 1, &google_protobuf_msgs[19], NULL, 2, 0, {0},&reftables[116], &reftables[117]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, "negative_int_value", 5, &google_protobuf_msgs[18], NULL, 10, 3, {0},&reftables[118], &reftables[119]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "nested_type", 3, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[0]), 13, 1, {0},&reftables[120], &reftables[121]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "no_standard_descriptor_accessor", 2, &google_protobuf_msgs[11], NULL, 7, 2, {0},&reftables[122], &reftables[123]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "number", 2, &google_protobuf_msgs[4], NULL, 7, 2, {0},&reftables[124], &reftables[125]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "number", 3, &google_protobuf_msgs[6], NULL, 10, 3, {0},&reftables[126], &reftables[127]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "optimize_for", 9, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_enums[3]), 12, 3, {0},&reftables[128], &reftables[129]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[3]), 7, 1, {0},&reftables[130], &reftables[131]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 8, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[10]), 20, 4, {0},&reftables[132], &reftables[133]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[15]), 7, 1, {0},&reftables[134], &reftables[135]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 7, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[11]), 23, 5, {0},&reftables[136], &reftables[137]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 4, &google_protobuf_msgs[12], UPB_UPCAST(&google_protobuf_msgs[13]), 3, 0, {0},&reftables[138], &reftables[139]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[4], UPB_UPCAST(&google_protobuf_msgs[5]), 3, 0, {0},&reftables[140], &reftables[141]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 8, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_msgs[7]), 3, 0, {0},&reftables[142], &reftables[143]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "output_type", 3, &google_protobuf_msgs[12], NULL, 10, 3, {0},&reftables[144], &reftables[145]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "package", 2, &google_protobuf_msgs[8], NULL, 25, 7, {0},&reftables[146], &reftables[147]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "packed", 2, &google_protobuf_msgs[7], NULL, 7, 2, {0},&reftables[148], &reftables[149]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "path", 1, &google_protobuf_msgs[17], NULL, 4, 0, {0},&reftables[150], &reftables[151]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, "positive_int_value", 4, &google_protobuf_msgs[18], NULL, 9, 2, {0},&reftables[152], &reftables[153]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "py_generic_services", 18, &google_protobuf_msgs[10], NULL, 16, 7, {0},&reftables[154], &reftables[155]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "service", 6, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[14]), 16, 2, {0},&reftables[156], &reftables[157]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "source_code_info", 9, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[16]), 21, 5, {0},&reftables[158], &reftables[159]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "span", 2, &google_protobuf_msgs[17], NULL, 7, 1, {0},&reftables[160], &reftables[161]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "start", 1, &google_protobuf_msgs[1], NULL, 2, 0, {0},&reftables[162], &reftables[163]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, "string_value", 7, &google_protobuf_msgs[18], NULL, 12, 5, {0},&reftables[164], &reftables[165]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "type", 5, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[1]), 12, 5, {0},&reftables[166], &reftables[167]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "type_name", 6, &google_protobuf_msgs[6], NULL, 13, 6, {0},&reftables[168], &reftables[169]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[3], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[170], &reftables[171]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[15], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[172], &reftables[173]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[11], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[174], &reftables[175]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[176], &reftables[177]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[178], &reftables[179]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[13], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[180], &reftables[181]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[5], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[182], &reftables[183]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "value", 2, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[4]), 6, 0, {0},&reftables[184], &reftables[185]),
+const upb_fielddef google_protobuf_fields[81] = {
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "aggregate_value", 8, &google_protobuf_msgs[18], NULL, 15, 6, {0},&reftables[40], &reftables[41]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "allow_alias", 2, &google_protobuf_msgs[3], NULL, 6, 1, {0},&reftables[42], &reftables[43]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "cc_generic_services", 16, &google_protobuf_msgs[10], NULL, 17, 6, {0},&reftables[44], &reftables[45]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "ctype", 1, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_enums[2]), 6, 1, {0},&reftables[46], &reftables[47]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "default_value", 7, &google_protobuf_msgs[6], NULL, 16, 7, {0},&reftables[48], &reftables[49]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, "dependency", 3, &google_protobuf_msgs[8], NULL, 30, 8, {0},&reftables[50], &reftables[51]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "deprecated", 3, &google_protobuf_msgs[7], NULL, 8, 3, {0},&reftables[52], &reftables[53]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, "double_value", 6, &google_protobuf_msgs[18], NULL, 11, 4, {0},&reftables[54], &reftables[55]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "end", 2, &google_protobuf_msgs[1], NULL, 3, 1, {0},&reftables[56], &reftables[57]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "enum_type", 5, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[2]), 13, 1, {0},&reftables[58], &reftables[59]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "enum_type", 4, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[2]), 16, 2, {0},&reftables[60], &reftables[61]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "experimental_map_key", 9, &google_protobuf_msgs[7], NULL, 10, 5, {0},&reftables[62], &reftables[63]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "extendee", 2, &google_protobuf_msgs[6], NULL, 7, 2, {0},&reftables[64], &reftables[65]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension", 7, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[6]), 19, 3, {0},&reftables[66], &reftables[67]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension", 6, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 22, 4, {0},&reftables[68], &reftables[69]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension_range", 5, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[1]), 19, 3, {0},&reftables[70], &reftables[71]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "field", 2, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 10, 0, {0},&reftables[72], &reftables[73]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "file", 1, &google_protobuf_msgs[9], UPB_UPCAST(&google_protobuf_msgs[8]), 5, 0, {0},&reftables[74], &reftables[75]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "go_package", 11, &google_protobuf_msgs[10], NULL, 14, 5, {0},&reftables[76], &reftables[77]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "identifier_value", 3, &google_protobuf_msgs[18], NULL, 6, 1, {0},&reftables[78], &reftables[79]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "input_type", 2, &google_protobuf_msgs[12], NULL, 7, 2, {0},&reftables[80], &reftables[81]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, "is_extension", 2, &google_protobuf_msgs[19], NULL, 5, 1, {0},&reftables[82], &reftables[83]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_generate_equals_and_hash", 20, &google_protobuf_msgs[10], NULL, 20, 9, {0},&reftables[84], &reftables[85]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_generic_services", 17, &google_protobuf_msgs[10], NULL, 18, 7, {0},&reftables[86], &reftables[87]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_multiple_files", 10, &google_protobuf_msgs[10], NULL, 13, 4, {0},&reftables[88], &reftables[89]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "java_outer_classname", 8, &google_protobuf_msgs[10], NULL, 9, 2, {0},&reftables[90], &reftables[91]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "java_package", 1, &google_protobuf_msgs[10], NULL, 6, 1, {0},&reftables[92], &reftables[93]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "label", 4, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[0]), 11, 4, {0},&reftables[94], &reftables[95]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "lazy", 5, &google_protobuf_msgs[7], NULL, 9, 4, {0},&reftables[96], &reftables[97]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "leading_comments", 3, &google_protobuf_msgs[17], NULL, 8, 2, {0},&reftables[98], &reftables[99]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "location", 1, &google_protobuf_msgs[16], UPB_UPCAST(&google_protobuf_msgs[17]), 5, 0, {0},&reftables[100], &reftables[101]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "message_set_wire_format", 1, &google_protobuf_msgs[11], NULL, 6, 1, {0},&reftables[102], &reftables[103]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "message_type", 4, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[0]), 10, 0, {0},&reftables[104], &reftables[105]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "method", 2, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[12]), 6, 0, {0},&reftables[106], &reftables[107]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[6], NULL, 4, 1, {0},&reftables[108], &reftables[109]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[14], NULL, 8, 2, {0},&reftables[110], &reftables[111]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[2], NULL, 8, 2, {0},&reftables[112], &reftables[113]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[4], NULL, 4, 1, {0},&reftables[114], &reftables[115]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[8], NULL, 22, 6, {0},&reftables[116], &reftables[117]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[0], NULL, 24, 6, {0},&reftables[118], &reftables[119]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[12], NULL, 4, 1, {0},&reftables[120], &reftables[121]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "name", 2, &google_protobuf_msgs[18], UPB_UPCAST(&google_protobuf_msgs[19]), 5, 0, {0},&reftables[122], &reftables[123]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, "name_part", 1, &google_protobuf_msgs[19], NULL, 2, 0, {0},&reftables[124], &reftables[125]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, "negative_int_value", 5, &google_protobuf_msgs[18], NULL, 10, 3, {0},&reftables[126], &reftables[127]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "nested_type", 3, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[0]), 13, 1, {0},&reftables[128], &reftables[129]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "no_standard_descriptor_accessor", 2, &google_protobuf_msgs[11], NULL, 7, 2, {0},&reftables[130], &reftables[131]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "number", 3, &google_protobuf_msgs[6], NULL, 10, 3, {0},&reftables[132], &reftables[133]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "number", 2, &google_protobuf_msgs[4], NULL, 7, 2, {0},&reftables[134], &reftables[135]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "optimize_for", 9, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_enums[3]), 12, 3, {0},&reftables[136], &reftables[137]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 4, &google_protobuf_msgs[12], UPB_UPCAST(&google_protobuf_msgs[13]), 3, 0, {0},&reftables[138], &reftables[139]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[15]), 7, 1, {0},&reftables[140], &reftables[141]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[3]), 7, 1, {0},&reftables[142], &reftables[143]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 8, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[10]), 20, 4, {0},&reftables[144], &reftables[145]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 8, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_msgs[7]), 3, 0, {0},&reftables[146], &reftables[147]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[4], UPB_UPCAST(&google_protobuf_msgs[5]), 3, 0, {0},&reftables[148], &reftables[149]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 7, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[11]), 23, 5, {0},&reftables[150], &reftables[151]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "output_type", 3, &google_protobuf_msgs[12], NULL, 10, 3, {0},&reftables[152], &reftables[153]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "package", 2, &google_protobuf_msgs[8], NULL, 25, 7, {0},&reftables[154], &reftables[155]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "packed", 2, &google_protobuf_msgs[7], NULL, 7, 2, {0},&reftables[156], &reftables[157]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "path", 1, &google_protobuf_msgs[17], NULL, 4, 0, {0},&reftables[158], &reftables[159]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, "positive_int_value", 4, &google_protobuf_msgs[18], NULL, 9, 2, {0},&reftables[160], &reftables[161]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "public_dependency", 10, &google_protobuf_msgs[8], NULL, 35, 9, {0},&reftables[162], &reftables[163]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "py_generic_services", 18, &google_protobuf_msgs[10], NULL, 19, 8, {0},&reftables[164], &reftables[165]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "service", 6, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[14]), 16, 2, {0},&reftables[166], &reftables[167]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "source_code_info", 9, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[16]), 21, 5, {0},&reftables[168], &reftables[169]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "span", 2, &google_protobuf_msgs[17], NULL, 7, 1, {0},&reftables[170], &reftables[171]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "start", 1, &google_protobuf_msgs[1], NULL, 2, 0, {0},&reftables[172], &reftables[173]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, "string_value", 7, &google_protobuf_msgs[18], NULL, 12, 5, {0},&reftables[174], &reftables[175]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "trailing_comments", 4, &google_protobuf_msgs[17], NULL, 11, 3, {0},&reftables[176], &reftables[177]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "type", 5, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[1]), 12, 5, {0},&reftables[178], &reftables[179]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "type_name", 6, &google_protobuf_msgs[6], NULL, 13, 6, {0},&reftables[180], &reftables[181]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[15], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[182], &reftables[183]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[11], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[184], &reftables[185]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[13], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[186], &reftables[187]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[188], &reftables[189]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[3], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[190], &reftables[191]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[5], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[192], &reftables[193]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[194], &reftables[195]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "value", 2, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[4]), 6, 0, {0},&reftables[196], &reftables[197]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "weak", 10, &google_protobuf_msgs[7], NULL, 13, 6, {0},&reftables[198], &reftables[199]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "weak_dependency", 11, &google_protobuf_msgs[8], NULL, 38, 10, {0},&reftables[200], &reftables[201]),
};
const upb_enumdef google_protobuf_enums[4] = {
- UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[148]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[194], 4, 3), 0, &reftables[186], &reftables[187]),
- UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &google_protobuf_strentries[152]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[198], 19, 18), 0, &reftables[188], &reftables[189]),
- UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[184]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[217], 3, 3), 0, &reftables[190], &reftables[191]),
- UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[220], 4, 3), 0, &reftables[192], &reftables[193]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[160]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[202], 4, 3), 0, &reftables[202], &reftables[203]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &google_protobuf_strentries[164]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[206], 19, 18), 0, &reftables[204], &reftables[205]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[196]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[225], 3, 3), 0, &reftables[206], &reftables[207]),
+ UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[200]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[228], 4, 3), 0, &reftables[208], &reftables[209]),
};
-const upb_tabent google_protobuf_strentries[192] = {
- {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), NULL},
+const upb_tabent google_protobuf_strentries[204] = {
+ {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("field"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]), NULL},
- {UPB_TABKEY_STR("extension_range"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]), NULL},
+ {UPB_TABKEY_STR("field"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), NULL},
+ {UPB_TABKEY_STR("extension_range"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("nested_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), NULL},
+ {UPB_TABKEY_STR("nested_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), NULL},
- {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), &google_protobuf_strentries[14]},
- {UPB_TABKEY_STR("start"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), NULL},
- {UPB_TABKEY_STR("end"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), NULL},
+ {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), &google_protobuf_strentries[14]},
+ {UPB_TABKEY_STR("start"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL},
+ {UPB_TABKEY_STR("end"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), NULL},
+ {UPB_TABKEY_STR("value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[78]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), NULL},
{UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[36]), &google_protobuf_strentries[22]},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), NULL},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[75]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("allow_alias"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), &google_protobuf_strentries[30]},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[76]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), &google_protobuf_strentries[30]},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("label"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), NULL},
+ {UPB_TABKEY_STR("label"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), &google_protobuf_strentries[49]},
+ {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), &google_protobuf_strentries[49]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("type_name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), NULL},
- {UPB_TABKEY_STR("extendee"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), NULL},
- {UPB_TABKEY_STR("type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), &google_protobuf_strentries[48]},
- {UPB_TABKEY_STR("default_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), NULL},
- {UPB_TABKEY_STR("experimental_map_key"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), &google_protobuf_strentries[58]},
+ {UPB_TABKEY_STR("type_name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL},
+ {UPB_TABKEY_STR("extendee"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), NULL},
+ {UPB_TABKEY_STR("type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), &google_protobuf_strentries[48]},
+ {UPB_TABKEY_STR("default_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), NULL},
+ {UPB_TABKEY_STR("experimental_map_key"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), &google_protobuf_strentries[67]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("ctype"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), NULL},
+ {UPB_TABKEY_STR("weak"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[79]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("deprecated"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), NULL},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), NULL},
- {UPB_TABKEY_STR("packed"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), NULL},
- {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), NULL},
- {UPB_TABKEY_STR("service"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), NULL},
+ {UPB_TABKEY_STR("packed"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), NULL},
+ {UPB_TABKEY_STR("lazy"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("source_code_info"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), NULL},
+ {UPB_TABKEY_STR("ctype"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("deprecated"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), NULL},
- {UPB_TABKEY_STR("message_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), NULL},
- {UPB_TABKEY_STR("package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), NULL},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[74]), NULL},
+ {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), NULL},
+ {UPB_TABKEY_STR("weak_dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[80]), NULL},
+ {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), NULL},
+ {UPB_TABKEY_STR("service"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), NULL},
+ {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("source_code_info"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), NULL},
- {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), &google_protobuf_strentries[74]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("file"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), NULL},
+ {UPB_TABKEY_STR("message_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), NULL},
+ {UPB_TABKEY_STR("package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), &google_protobuf_strentries[82]},
+ {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), NULL},
+ {UPB_TABKEY_STR("public_dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), &google_protobuf_strentries[81]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL},
+ {UPB_TABKEY_STR("file"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("cc_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("java_multiple_files"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), NULL},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[77]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("java_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), &google_protobuf_strentries[94]},
- {UPB_TABKEY_STR("java_generate_equals_and_hash"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), NULL},
+ {UPB_TABKEY_STR("cc_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("java_multiple_files"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("java_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), &google_protobuf_strentries[102]},
+ {UPB_TABKEY_STR("java_generate_equals_and_hash"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("java_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), NULL},
- {UPB_TABKEY_STR("optimize_for"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), NULL},
- {UPB_TABKEY_STR("py_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), NULL},
- {UPB_TABKEY_STR("java_outer_classname"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), NULL},
- {UPB_TABKEY_STR("message_set_wire_format"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), &google_protobuf_strentries[98]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), NULL},
- {UPB_TABKEY_STR("no_standard_descriptor_accessor"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), NULL},
+ {UPB_TABKEY_STR("go_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), NULL},
+ {UPB_TABKEY_STR("java_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), NULL},
+ {UPB_TABKEY_STR("optimize_for"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), NULL},
+ {UPB_TABKEY_STR("py_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), NULL},
+ {UPB_TABKEY_STR("java_outer_classname"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), NULL},
+ {UPB_TABKEY_STR("message_set_wire_format"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), &google_protobuf_strentries[106]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL},
+ {UPB_TABKEY_STR("no_standard_descriptor_accessor"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), NULL},
- {UPB_TABKEY_STR("input_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("output_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), NULL},
+ {UPB_TABKEY_STR("input_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), NULL},
+ {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("output_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), NULL},
{UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[49]), NULL},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[73]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), &google_protobuf_strentries[114]},
- {UPB_TABKEY_STR("method"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), &google_protobuf_strentries[113]},
- {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL},
+ {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), &google_protobuf_strentries[122]},
+ {UPB_TABKEY_STR("method"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), &google_protobuf_strentries[121]},
+ {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("location"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), NULL},
+ {UPB_TABKEY_STR("location"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("span"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), NULL},
- {UPB_TABKEY_STR("path"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), &google_protobuf_strentries[126]},
- {UPB_TABKEY_STR("double_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("span"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), &google_protobuf_strentries[139]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), NULL},
+ {UPB_TABKEY_STR("trailing_comments"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL},
+ {UPB_TABKEY_STR("leading_comments"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), &google_protobuf_strentries[137]},
+ {UPB_TABKEY_STR("path"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), NULL},
+ {UPB_TABKEY_STR("double_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("negative_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), NULL},
+ {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
+ {UPB_TABKEY_STR("negative_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), NULL},
{UPB_TABKEY_STR("aggregate_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[0]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("positive_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), NULL},
- {UPB_TABKEY_STR("identifier_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), NULL},
- {UPB_TABKEY_STR("string_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), &google_protobuf_strentries[142]},
+ {UPB_TABKEY_STR("positive_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), NULL},
+ {UPB_TABKEY_STR("identifier_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), NULL},
+ {UPB_TABKEY_STR("string_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), &google_protobuf_strentries[154]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("is_extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), NULL},
- {UPB_TABKEY_STR("name_part"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), NULL},
- {UPB_TABKEY_STR("LABEL_REQUIRED"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[150]},
+ {UPB_TABKEY_STR("is_extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), NULL},
+ {UPB_TABKEY_STR("name_part"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), NULL},
+ {UPB_TABKEY_STR("LABEL_REQUIRED"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[162]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("LABEL_REPEATED"), UPB_VALUE_INIT_INT32(3), NULL},
{UPB_TABKEY_STR("LABEL_OPTIONAL"), UPB_VALUE_INIT_INT32(1), NULL},
@@ -280,17 +300,17 @@ const upb_tabent google_protobuf_strentries[192] = {
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("TYPE_STRING"), UPB_VALUE_INIT_INT32(9), NULL},
- {UPB_TABKEY_STR("TYPE_FLOAT"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[181]},
+ {UPB_TABKEY_STR("TYPE_FLOAT"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[193]},
{UPB_TABKEY_STR("TYPE_DOUBLE"), UPB_VALUE_INIT_INT32(1), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("TYPE_INT32"), UPB_VALUE_INIT_INT32(5), NULL},
{UPB_TABKEY_STR("TYPE_SFIXED32"), UPB_VALUE_INIT_INT32(15), NULL},
{UPB_TABKEY_STR("TYPE_FIXED32"), UPB_VALUE_INIT_INT32(7), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("TYPE_MESSAGE"), UPB_VALUE_INIT_INT32(11), &google_protobuf_strentries[182]},
+ {UPB_TABKEY_STR("TYPE_MESSAGE"), UPB_VALUE_INIT_INT32(11), &google_protobuf_strentries[194]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("TYPE_INT64"), UPB_VALUE_INIT_INT32(3), &google_protobuf_strentries[179]},
+ {UPB_TABKEY_STR("TYPE_INT64"), UPB_VALUE_INIT_INT32(3), &google_protobuf_strentries[191]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
@@ -298,7 +318,7 @@ const upb_tabent google_protobuf_strentries[192] = {
{UPB_TABKEY_STR("TYPE_ENUM"), UPB_VALUE_INIT_INT32(14), NULL},
{UPB_TABKEY_STR("TYPE_UINT32"), UPB_VALUE_INIT_INT32(13), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_STR("TYPE_UINT64"), UPB_VALUE_INIT_INT32(4), &google_protobuf_strentries[178]},
+ {UPB_TABKEY_STR("TYPE_UINT64"), UPB_VALUE_INIT_INT32(4), &google_protobuf_strentries[190]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("TYPE_SFIXED64"), UPB_VALUE_INIT_INT32(16), NULL},
{UPB_TABKEY_STR("TYPE_BYTES"), UPB_VALUE_INIT_INT32(12), NULL},
@@ -308,80 +328,83 @@ const upb_tabent google_protobuf_strentries[192] = {
{UPB_TABKEY_STR("TYPE_SINT32"), UPB_VALUE_INIT_INT32(17), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("CORD"), UPB_VALUE_INIT_INT32(1), NULL},
- {UPB_TABKEY_STR("STRING"), UPB_VALUE_INIT_INT32(0), &google_protobuf_strentries[185]},
+ {UPB_TABKEY_STR("STRING"), UPB_VALUE_INIT_INT32(0), &google_protobuf_strentries[197]},
{UPB_TABKEY_STR("STRING_PIECE"), UPB_VALUE_INIT_INT32(2), NULL},
{UPB_TABKEY_STR("CODE_SIZE"), UPB_VALUE_INIT_INT32(2), NULL},
- {UPB_TABKEY_STR("SPEED"), UPB_VALUE_INIT_INT32(1), &google_protobuf_strentries[191]},
+ {UPB_TABKEY_STR("SPEED"), UPB_VALUE_INIT_INT32(1), &google_protobuf_strentries[203]},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
{UPB_TABKEY_STR("LITE_RUNTIME"), UPB_VALUE_INIT_INT32(3), NULL},
};
const upb_tabent google_protobuf_intentries[14] = {
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[75]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[76]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[74]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[77]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[73]), NULL},
{UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL},
- {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL},
};
-const _upb_value google_protobuf_arrays[224] = {
+const _upb_value google_protobuf_arrays[232] = {
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]),
UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]),
UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]),
UPB_ARRAY_EMPTYENT,
UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[36]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[78]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]),
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]),
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[79]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
@@ -403,38 +426,41 @@ const _upb_value google_protobuf_arrays[224] = {
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[80]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]),
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]),
UPB_ARRAY_EMPTYENT,
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
@@ -479,8 +505,8 @@ const _upb_value google_protobuf_arrays[224] = {
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
@@ -495,39 +521,41 @@ const _upb_value google_protobuf_arrays[224] = {
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]),
UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[49]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]),
UPB_ARRAY_EMPTYENT,
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]),
UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[0]),
UPB_ARRAY_EMPTYENT,
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]),
- UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]),
+ UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]),
UPB_ARRAY_EMPTYENT,
UPB_VALUE_INIT_CONSTPTR("LABEL_OPTIONAL"),
UPB_VALUE_INIT_CONSTPTR("LABEL_REQUIRED"),
@@ -561,7 +589,23 @@ const _upb_value google_protobuf_arrays[224] = {
};
#ifdef UPB_DEBUG_REFS
-static upb_inttable reftables[194] = {
+static upb_inttable reftables[210] = {
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
diff --git a/upb/descriptor/descriptor.upb.h b/upb/descriptor/descriptor.upb.h
index 9f0bee0..72256e7 100755
--- a/upb/descriptor/descriptor.upb.h
+++ b/upb/descriptor/descriptor.upb.h
@@ -55,7 +55,7 @@ typedef enum {
// Do not refer to these forward declarations; use the constants
// below.
extern const upb_msgdef google_protobuf_msgs[20];
-extern const upb_fielddef google_protobuf_fields[73];
+extern const upb_fielddef google_protobuf_fields[81];
extern const upb_enumdef google_protobuf_enums[4];
// Constants for references to defs.
@@ -85,55 +85,89 @@ extern const upb_enumdef google_protobuf_enums[4];
// Selector definitions.
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 15
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSTR 18
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 16
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 14
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSTR 17
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 4
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STRING 19
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_END_INT32 3
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_START_INT32 2
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSEQ 21
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSTR 24
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSUBMSG 22
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSEQ 18
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSTR 21
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSUBMSG 19
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSEQ 17
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSTR 20
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSUBMSG 5
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STRING 22
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSEQ 20
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSTR 23
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSUBMSG 6
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STRING 25
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSEQ 9
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSTR 12
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSUBMSG 10
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSEQ 8
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSTR 11
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STRING 13
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_ENDSTR 26
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STARTSTR 25
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STRING 24
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSEQ 12
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSTR 15
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSUBMSG 13
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSEQ 11
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSTR 14
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSUBMSG 3
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STRING 16
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_ENDSTR 25
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_ENDSUBMSG 23
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STARTSTR 24
#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STARTSUBMSG 7
+#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STRING 26
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_ENDSTR 10
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STARTSTR 9
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STRING 8
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_ENDSTR 9
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STARTSTR 8
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STRING 10
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSEQ 5
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSTR 8
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSUBMSG 6
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSEQ 4
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSTR 7
#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STRING 9
+#define GOOGLE_PROTOBUF_ENUMOPTIONS_ALLOW_ALIAS_BOOL 6
#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_ENDSTR 6
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STARTSTR 5
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STRING 4
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NUMBER_INT32 7
+#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_ENDSTR 5
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
+#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STARTSTR 4
#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STRING 6
#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_ENDSTR 18
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STARTSTR 17
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STRING 16
@@ -145,60 +179,98 @@ extern const upb_enumdef google_protobuf_enums[4];
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STARTSTR 5
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STRING 4
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NUMBER_INT32 10
+#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_ENDSTR 5
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
+#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STARTSTR 4
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STRING 6
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32 12
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_ENDSTR 15
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STARTSTR 14
#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STRING 13
#define GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_INT32 6
#define GOOGLE_PROTOBUF_FIELDOPTIONS_DEPRECATED_BOOL 8
-#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_ENDSTR 11
-#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STARTSTR 10
-#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STRING 9
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_ENDSTR 12
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STARTSTR 11
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STRING 10
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_LAZY_BOOL 9
#define GOOGLE_PROTOBUF_FIELDOPTIONS_PACKED_BOOL 7
#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STRING 8
+#define GOOGLE_PROTOBUF_FIELDOPTIONS_WEAK_BOOL 13
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSEQ 29
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSTR 32
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSEQ 28
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSTR 31
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STRING 30
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 12
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSTR 15
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 13
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 11
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSTR 14
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 3
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STRING 16
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSEQ 18
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSTR 21
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSUBMSG 19
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSEQ 17
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSTR 20
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSUBMSG 5
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STRING 22
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSEQ 9
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSTR 12
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSUBMSG 10
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSEQ 8
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSTR 11
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STRING 13
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_ENDSTR 24
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STARTSTR 23
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STRING 22
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_ENDSTR 22
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 20
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STARTSTR 21
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 6
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STRING 23
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_ENDSTR 27
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STARTSTR 26
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STRING 25
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_ENDSEQ 34
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_INT32 35
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_STARTSEQ 33
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSEQ 15
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSTR 18
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSUBMSG 16
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSEQ 14
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSTR 17
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSUBMSG 4
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STRING 19
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_ENDSTR 23
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_ENDSUBMSG 21
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STARTSTR 22
#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STARTSUBMSG 7
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STRING 24
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_ENDSEQ 37
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_INT32 38
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_STARTSEQ 36
#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSEQ 4
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSTR 7
#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSEQ 3
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSTR 6
#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSUBMSG 2
-#define GOOGLE_PROTOBUF_FILEOPTIONS_CC_GENERIC_SERVICES_BOOL 14
-#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERATE_EQUALS_AND_HASH_BOOL 17
-#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERIC_SERVICES_BOOL 15
+#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STRING 8
+#define GOOGLE_PROTOBUF_FILEOPTIONS_CC_GENERIC_SERVICES_BOOL 17
+#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_ENDSTR 16
+#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STARTSTR 15
+#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STRING 14
+#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERATE_EQUALS_AND_HASH_BOOL 20
+#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERIC_SERVICES_BOOL 18
#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_MULTIPLE_FILES_BOOL 13
#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_ENDSTR 11
#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_STARTSTR 10
@@ -207,47 +279,72 @@ extern const upb_enumdef google_protobuf_enums[4];
#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STARTSTR 7
#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STRING 6
#define GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZE_FOR_INT32 12
-#define GOOGLE_PROTOBUF_FILEOPTIONS_PY_GENERIC_SERVICES_BOOL 16
+#define GOOGLE_PROTOBUF_FILEOPTIONS_PY_GENERIC_SERVICES_BOOL 19
#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_MESSAGE_SET_WIRE_FORMAT_BOOL 6
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_NO_STANDARD_DESCRIPTOR_ACCESSOR_BOOL 7
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_ENDSTR 9
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STARTSTR 8
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STRING 7
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_ENDSTR 6
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STARTSTR 5
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STRING 4
+#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_ENDSTR 5
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3
+#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STARTSTR 4
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STRING 6
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_ENDSTR 12
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STARTSTR 11
#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STRING 10
#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSEQ 5
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSTR 8
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSUBMSG 6
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSEQ 4
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSTR 7
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STRING 9
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_ENDSTR 10
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STARTSTR 9
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STRING 8
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_ENDSTR 9
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STARTSTR 8
#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3
+#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STRING 10
#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7
#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6
#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STRING 8
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSEQ 4
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSTR 7
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSUBMSG 5
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_ENDSTR 10
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STARTSTR 9
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STRING 8
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_ENDSEQ 3
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_INT32 4
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_STARTSEQ 2
@@ -255,7 +352,12 @@ extern const upb_enumdef google_protobuf_enums[4];
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_INT32 7
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_STARTSEQ 5
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSEQ 3
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSTR 6
#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STRING 8
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_ENDSTR 13
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STARTSTR 12
+#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STRING 11
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_ENDSTR 17
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STARTSTR 16
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STRING 15
@@ -268,9 +370,12 @@ extern const upb_enumdef google_protobuf_enums[4];
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STARTSTR 3
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STRING 2
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSEQ 4
+#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSTR 7
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSUBMSG 5
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSEQ 3
+#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSTR 6
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSUBMSG 2
+#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STRING 8
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NEGATIVE_INT_VALUE_INT64 10
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_POSITIVE_INT_VALUE_UINT64 9
#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_STRING_VALUE_ENDSTR 14
diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c
index eea6ce7..9baca1d 100644
--- a/upb/descriptor/reader.c
+++ b/upb/descriptor/reader.c
@@ -376,6 +376,13 @@ static bool field_endmsg(void *closure, const void *hd, upb_status *status) {
return true;
}
+static bool field_onlazy(void *closure, const void *hd, bool val) {
+ UPB_UNUSED(hd);
+ upb_descreader *r = closure;
+ upb_fielddef_setlazy(r->f, val);
+ return true;
+}
+
static bool field_ontype(void *closure, const void *hd, int32_t val) {
UPB_UNUSED(hd);
upb_descreader *r = closure;
@@ -540,6 +547,8 @@ static void reghandlers(void *closure, upb_handlers *h) {
upb_handlers_setstring(h, f(h, "type_name"), &field_ontypename, NULL);
upb_handlers_setstring(h, f(h, "extendee"), &field_onextendee, NULL);
upb_handlers_setstring(h, f(h, "default_value"), &field_ondefaultval, NULL);
+ } else if (m == GOOGLE_PROTOBUF_FIELDOPTIONS) {
+ upb_handlers_setbool(h, f(h, "lazy"), &field_onlazy, NULL);
}
}
diff --git a/upb/handlers.c b/upb/handlers.c
index 006ff83..be035ba 100644
--- a/upb/handlers.c
+++ b/upb/handlers.c
@@ -52,6 +52,9 @@ typedef struct {
void *closure;
} dfs_state;
+// TODO(haberman): discard upb_handlers* objects that do not actually have any
+// handlers set and cannot reach any upb_handlers* object that does. This is
+// slightly tricky to do correctly.
static upb_handlers *newformsg(const upb_msgdef *m, const void *owner,
dfs_state *s) {
upb_handlers *h = upb_handlers_new(m, owner);
@@ -425,6 +428,39 @@ bool upb_handlers_freeze(upb_handlers *const*handlers, int n, upb_status *s) {
}
if (upb_fielddef_issubmsg(f)) {
+ bool hashandler = false;
+ if (upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_STARTSUBMSG)) ||
+ upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_ENDSUBMSG))) {
+ hashandler = true;
+ }
+
+ if (upb_fielddef_isseq(f) &&
+ (upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_STARTSEQ)) ||
+ upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_ENDSEQ)))) {
+ hashandler = true;
+ }
+
+ if (hashandler && !upb_handlers_getsubhandlers(h, f)) {
+ // For now we add an empty subhandlers in this case. It makes the
+ // decoder code generator simpler, because it only has to handle two
+ // cases (submessage has handlers or not) as opposed to three
+ // (submessage has handlers in enclosing message but no subhandlers).
+ //
+ // This makes parsing less efficient in the case that we want to
+ // notice a submessage but skip its contents (like if we're testing
+ // for submessage presence or counting the number of repeated
+ // submessages). In this case we will end up parsing the submessage
+ // field by field and throwing away the results for each, instead of
+ // skipping the whole delimited thing at once. If this is an issue we
+ // can revisit it, but do remember that this only arises when you have
+ // handlers (startseq/startsubmsg/endsubmsg/endseq) set for the
+ // submessage but no subhandlers. The uses cases for this are
+ // limited.
+ upb_handlers *sub = upb_handlers_new(upb_fielddef_msgsubdef(f), &sub);
+ upb_handlers_setsubhandlers(h, f, sub);
+ upb_handlers_unref(sub, &sub);
+ }
+
// TODO(haberman): check type of submessage.
// This is slightly tricky; also consider whether we should check that
// they match at setsubhandlers time.
@@ -470,16 +506,27 @@ bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type,
*s = f->selector_base;
break;
case UPB_HANDLER_STRING:
- if (!upb_fielddef_isstring(f)) return false;
- *s = f->selector_base;
+ if (upb_fielddef_isstring(f)) {
+ *s = f->selector_base;
+ } else if (upb_fielddef_issubmsg(f)) {
+ *s = f->selector_base + 3;
+ } else {
+ return false;
+ }
break;
case UPB_HANDLER_STARTSTR:
- if (!upb_fielddef_isstring(f)) return false;
- *s = f->selector_base + 1;
+ if (upb_fielddef_isstring(f) || upb_fielddef_issubmsg(f)) {
+ *s = f->selector_base + 1;
+ } else {
+ return false;
+ }
break;
case UPB_HANDLER_ENDSTR:
- if (!upb_fielddef_isstring(f)) return false;
- *s = f->selector_base + 2;
+ if (upb_fielddef_isstring(f) || upb_fielddef_issubmsg(f)) {
+ *s = f->selector_base + 2;
+ } else {
+ return false;
+ }
break;
case UPB_HANDLER_STARTSEQ:
if (!upb_fielddef_isseq(f)) return false;
@@ -501,7 +548,6 @@ bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type,
if (!upb_fielddef_issubmsg(f)) return false;
*s = f->selector_base;
break;
- // Subhandler slot is selector_base + 2.
}
assert(*s < upb_fielddef_containingtype(f)->selector_count);
return true;
@@ -514,9 +560,15 @@ uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f) {
uint32_t upb_handlers_selectorcount(const upb_fielddef *f) {
uint32_t ret = 1;
if (upb_fielddef_isseq(f)) ret += 2; // STARTSEQ/ENDSEQ
- if (upb_fielddef_isstring(f)) ret += 2; // [STARTSTR]/STRING/ENDSTR
- // ENDSUBMSG (STARTSUBMSG is at table beginning)
- if (upb_fielddef_issubmsg(f)) ret += 0;
+ if (upb_fielddef_isstring(f)) ret += 2; // [STRING]/STARTSTR/ENDSTR
+ if (upb_fielddef_issubmsg(f)) {
+ // ENDSUBMSG (STARTSUBMSG is at table beginning)
+ ret += 0;
+ if (upb_fielddef_lazy(f)) {
+ // STARTSTR/ENDSTR/STRING (for lazy)
+ ret += 3;
+ }
+ }
return ret;
}
diff --git a/upb/pb/compile_decoder.c b/upb/pb/compile_decoder.c
index f96f07a..400d6fa 100644
--- a/upb/pb/compile_decoder.c
+++ b/upb/pb/compile_decoder.c
@@ -19,13 +19,6 @@
#define MAXLABEL 5
#define EMPTYLABEL -1
-static const void *methodkey(const upb_msgdef *md, const upb_handlers *h) {
- const void *ret = h ? (const void*)h : (const void*)md;
- assert(ret);
- return ret;
-}
-
-
/* mgroup *********************************************************************/
static void freegroup(upb_refcounted *r) {
@@ -80,10 +73,8 @@ static void visitmethod(const upb_refcounted *r, upb_refcounted_visit *visit,
visit(r, m->group, closure);
}
-static upb_pbdecodermethod *newmethod(const upb_msgdef *msg,
- const upb_handlers *dest_handlers,
- mgroup *group,
- const void *key) {
+static upb_pbdecodermethod *newmethod(const upb_handlers *dest_handlers,
+ mgroup *group) {
static const struct upb_refcounted_vtbl vtbl = {visitmethod, freemethod};
upb_pbdecodermethod *ret = malloc(sizeof(*ret));
upb_refcounted_init(UPB_UPCAST(ret), &vtbl, &ret);
@@ -92,11 +83,10 @@ static upb_pbdecodermethod *newmethod(const upb_msgdef *msg,
// The method references the group and vice-versa, in a circular reference.
upb_ref2(ret, group);
upb_ref2(group, ret);
- upb_inttable_insertptr(&group->methods, key, upb_value_ptr(ret)); // Owns ref
+ upb_inttable_insertptr(&group->methods, dest_handlers, upb_value_ptr(ret));
upb_refcounted_unref(UPB_UPCAST(ret), &ret);
ret->group = UPB_UPCAST(group);
- ret->schema_ = msg;
ret->dest_handlers_ = dest_handlers;
ret->is_native_ = false; // If we JIT, it will update this later.
upb_inttable_init(&ret->dispatch, UPB_CTYPE_UINT64);
@@ -126,10 +116,6 @@ void upb_pbdecodermethod_checkref(const upb_pbdecodermethod *m,
upb_refcounted_checkref(UPB_UPCAST(m), owner);
}
-const upb_msgdef *upb_pbdecodermethod_schema(const upb_pbdecodermethod *m) {
- return m->schema_;
-}
-
const upb_handlers *upb_pbdecodermethod_desthandlers(
const upb_pbdecodermethod *m) {
return m->dest_handlers_;
@@ -144,12 +130,12 @@ bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m) {
return m->is_native_;
}
-const upb_pbdecodermethod *upb_pbdecodermethod_newfordesthandlers(
- const upb_handlers *dest, const void *owner) {
+const upb_pbdecodermethod *upb_pbdecodermethod_new(
+ const upb_pbdecodermethodopts *opts, const void *owner) {
upb_pbcodecache cache;
upb_pbcodecache_init(&cache);
const upb_pbdecodermethod *ret =
- upb_pbcodecache_getdecodermethodfordesthandlers(&cache, dest);
+ upb_pbcodecache_getdecodermethod(&cache, opts);
upb_pbdecodermethod_ref(ret, owner);
upb_pbcodecache_uninit(&cache);
return ret;
@@ -165,11 +151,15 @@ typedef struct {
uint32_t *pc;
int fwd_labels[MAXLABEL];
int back_labels[MAXLABEL];
+
+ // For fields marked "lazy", parse them lazily or eagerly?
+ bool lazy;
} compiler;
-static compiler *newcompiler(mgroup *group) {
+static compiler *newcompiler(mgroup *group, bool lazy) {
compiler *ret = malloc(sizeof(*ret));
ret->group = group;
+ ret->lazy = lazy;
for (int i = 0; i < MAXLABEL; i++) {
ret->fwd_labels[i] = EMPTYLABEL;
ret->back_labels[i] = EMPTYLABEL;
@@ -300,11 +290,11 @@ static void putop(compiler *c, opcode op, ...) {
}
case OP_STARTMSG:
case OP_ENDMSG:
- case OP_PUSHTAGDELIM:
case OP_PUSHLENDELIM:
case OP_POP:
case OP_SETDELIM:
case OP_HALT:
+ case OP_RET:
put32(c, op);
break;
case OP_PARSE_DOUBLE:
@@ -321,13 +311,13 @@ static void putop(compiler *c, opcode op, ...) {
case OP_PARSE_SINT32:
case OP_PARSE_SINT64:
case OP_STARTSEQ:
- case OP_SETGROUPNUM:
case OP_ENDSEQ:
case OP_STARTSUBMSG:
case OP_ENDSUBMSG:
case OP_STARTSTR:
case OP_STRING:
case OP_ENDSTR:
+ case OP_PUSHTAGDELIM:
put32(c, op | va_arg(ap, upb_selector_t) << 8);
break;
case OP_SETBIGGROUPNUM:
@@ -382,10 +372,10 @@ const char *upb_pbdecoder_getopname(unsigned int op) {
T(DOUBLE), T(FLOAT), T(INT64), T(UINT64), T(INT32), T(FIXED64), T(FIXED32),
T(BOOL), T(UINT32), T(SFIXED32), T(SFIXED64), T(SINT32), T(SINT64),
OP(STARTMSG), OP(ENDMSG), OP(STARTSEQ), OP(ENDSEQ), OP(STARTSUBMSG),
- OP(ENDSUBMSG), OP(STARTSTR), OP(STRING), OP(ENDSTR), OP(CALL),
+ OP(ENDSUBMSG), OP(STARTSTR), OP(STRING), OP(ENDSTR), OP(CALL), OP(RET),
OP(PUSHLENDELIM), OP(PUSHTAGDELIM), OP(SETDELIM), OP(CHECKDELIM),
OP(BRANCH), OP(TAG1), OP(TAG2), OP(TAGN), OP(SETDISPATCH), OP(POP),
- OP(SETGROUPNUM), OP(SETBIGGROUPNUM), OP(HALT),
+ OP(SETBIGGROUPNUM), OP(HALT),
};
return op > OP_HALT ? names[0] : names[op];
#undef OP
@@ -413,16 +403,17 @@ static void dumpbc(uint32_t *p, uint32_t *end, FILE *f) {
const upb_pbdecodermethod *method =
(void *)((char *)dispatch -
offsetof(upb_pbdecodermethod, dispatch));
- fprintf(f, " %s", upb_msgdef_fullname(method->schema_));
+ fprintf(f, " %s", upb_msgdef_fullname(
+ upb_handlers_msgdef(method->dest_handlers_)));
break;
}
case OP_STARTMSG:
case OP_ENDMSG:
case OP_PUSHLENDELIM:
- case OP_PUSHTAGDELIM:
case OP_POP:
case OP_SETDELIM:
case OP_HALT:
+ case OP_RET:
break;
case OP_PARSE_DOUBLE:
case OP_PARSE_FLOAT:
@@ -444,7 +435,7 @@ static void dumpbc(uint32_t *p, uint32_t *end, FILE *f) {
case OP_STARTSTR:
case OP_STRING:
case OP_ENDSTR:
- case OP_SETGROUPNUM:
+ case OP_PUSHTAGDELIM:
fprintf(f, " %d", instr >> 8);
break;
case OP_SETBIGGROUPNUM:
@@ -537,11 +528,11 @@ static void putpush(compiler *c, const upb_fielddef *f) {
putop(c, OP_PUSHLENDELIM);
} else {
uint32_t fn = upb_fielddef_number(f);
- putop(c, OP_PUSHTAGDELIM);
if (fn >= 1 << 24) {
+ putop(c, OP_PUSHTAGDELIM, 0);
putop(c, OP_SETBIGGROUPNUM, fn);
} else {
- putop(c, OP_SETGROUPNUM, fn);
+ putop(c, OP_PUSHTAGDELIM, fn);
}
}
}
@@ -549,13 +540,35 @@ static void putpush(compiler *c, const upb_fielddef *f) {
static upb_pbdecodermethod *find_submethod(const compiler *c,
const upb_pbdecodermethod *method,
const upb_fielddef *f) {
- const upb_handlers *sub = method->dest_handlers_ ?
- upb_handlers_getsubhandlers(method->dest_handlers_, f) : NULL;
- const void *key = methodkey(upb_downcast_msgdef(upb_fielddef_subdef(f)), sub);
+ const upb_handlers *sub =
+ upb_handlers_getsubhandlers(method->dest_handlers_, f);
upb_value v;
- bool ok = upb_inttable_lookupptr(&c->group->methods, key, &v);
- UPB_ASSERT_VAR(ok, ok);
- return upb_value_getptr(v);
+ return upb_inttable_lookupptr(&c->group->methods, sub, &v)
+ ? upb_value_getptr(v)
+ : NULL;
+}
+
+static void putsel(compiler *c, opcode op, upb_selector_t sel,
+ const upb_handlers *h) {
+ if (upb_handlers_gethandler(h, sel)) {
+ putop(c, op, sel);
+ }
+}
+
+// Puts an opcode to call a callback, but only if a callback actually exists for
+// this field and handler type.
+static void putcb(compiler *c, opcode op, const upb_handlers *h,
+ const upb_fielddef *f, upb_handlertype_t type) {
+ putsel(c, op, getsel(f, type), h);
+}
+
+static bool haslazyhandlers(const upb_handlers *h, const upb_fielddef *f) {
+ if (!upb_fielddef_lazy(f))
+ return false;
+
+ return upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STARTSTR)) ||
+ upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STRING)) ||
+ upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_ENDSTR));
}
// Adds bytecode for parsing the given message to the given decoderplan,
@@ -596,177 +609,178 @@ static void compile_method(compiler *c, upb_pbdecodermethod *method) {
upb_inttable_uninit(&method->dispatch);
upb_inttable_init(&method->dispatch, UPB_CTYPE_UINT64);
+ const upb_handlers *h = upb_pbdecodermethod_desthandlers(method);
+ const upb_msgdef *md = upb_handlers_msgdef(h);
+
method->code_base.ofs = pcofs(c);
putop(c, OP_SETDISPATCH, &method->dispatch);
- putop(c, OP_STARTMSG);
+ putsel(c, OP_STARTMSG, UPB_STARTMSG_SELECTOR, h);
label(c, LABEL_FIELD);
upb_msg_iter i;
- for(upb_msg_begin(&i, method->schema_); !upb_msg_done(&i); upb_msg_next(&i)) {
+ for(upb_msg_begin(&i, md); !upb_msg_done(&i); upb_msg_next(&i)) {
const upb_fielddef *f = upb_msg_iter_field(&i);
- upb_descriptortype_t type = upb_fielddef_descriptortype(f);
+ upb_descriptortype_t descriptor_type = upb_fielddef_descriptortype(f);
+ upb_fieldtype_t type = upb_fielddef_type(f);
// From a decoding perspective, ENUM is the same as INT32.
- if (type == UPB_DESCRIPTOR_TYPE_ENUM)
- type = UPB_DESCRIPTOR_TYPE_INT32;
-
- label(c, LABEL_FIELD);
-
- switch (upb_fielddef_type(f)) {
- case UPB_TYPE_MESSAGE: {
- const upb_pbdecodermethod *sub_m = find_submethod(c, method, f);
- int wire_type = (type == UPB_DESCRIPTOR_TYPE_MESSAGE) ?
- UPB_WIRE_TYPE_DELIMITED : UPB_WIRE_TYPE_START_GROUP;
- if (upb_fielddef_isseq(f)) {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, wire_type, LABEL_DISPATCH);
- dispatchtarget(c, method, f, wire_type);
- putop(c, OP_PUSHTAGDELIM);
- putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
- label(c, LABEL_LOOPSTART);
- putpush(c, f);
- putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
- putop(c, OP_CALL, sub_m);
- putop(c, OP_POP);
- putop(c, OP_ENDSUBMSG, getsel(f, UPB_HANDLER_ENDSUBMSG));
- if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
- putop(c, OP_SETDELIM);
- }
- putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
- putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
- putop(c, OP_BRANCH, -LABEL_LOOPSTART);
- label(c, LABEL_LOOPBREAK);
- putop(c, OP_POP);
- putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ));
- } else {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, wire_type, LABEL_DISPATCH);
- dispatchtarget(c, method, f, wire_type);
- putpush(c, f);
- putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
- putop(c, OP_CALL, sub_m);
- putop(c, OP_POP);
- putop(c, OP_ENDSUBMSG, getsel(f, UPB_HANDLER_ENDSUBMSG));
- if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
- putop(c, OP_SETDELIM);
- }
- }
- break;
+ if (descriptor_type == UPB_DESCRIPTOR_TYPE_ENUM)
+ descriptor_type = UPB_DESCRIPTOR_TYPE_INT32;
+
+ if (type == UPB_TYPE_MESSAGE && !(haslazyhandlers(h, f) && c->lazy)) {
+ const upb_pbdecodermethod *sub_m = find_submethod(c, method, f);
+ if (!sub_m) {
+ // Don't emit any code for this field at all; it will be parsed as an
+ // unknown field.
+ continue;
}
- case UPB_TYPE_STRING:
- case UPB_TYPE_BYTES:
- if (upb_fielddef_isseq(f)) {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
- dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
- putop(c, OP_PUSHTAGDELIM);
- putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
- label(c, LABEL_LOOPSTART);
- putop(c, OP_PUSHLENDELIM);
- putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
- putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
- putop(c, OP_POP);
- putop(c, OP_ENDSTR, getsel(f, UPB_HANDLER_ENDSTR));
- putop(c, OP_SETDELIM);
- putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
- putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_LOOPBREAK);
- putop(c, OP_BRANCH, -LABEL_LOOPSTART);
- label(c, LABEL_LOOPBREAK);
- putop(c, OP_POP);
- putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ));
- } else {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
- dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
- putop(c, OP_PUSHLENDELIM);
- putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
- putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
- putop(c, OP_POP);
- putop(c, OP_ENDSTR, getsel(f, UPB_HANDLER_ENDSTR));
+
+ label(c, LABEL_FIELD);
+
+ int wire_type = (descriptor_type == UPB_DESCRIPTOR_TYPE_MESSAGE)
+ ? UPB_WIRE_TYPE_DELIMITED
+ : UPB_WIRE_TYPE_START_GROUP;
+ if (upb_fielddef_isseq(f)) {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, wire_type, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, wire_type);
+ putop(c, OP_PUSHTAGDELIM, 0);
+ putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
+ label(c, LABEL_LOOPSTART);
+ putpush(c, f);
+ putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
+ putop(c, OP_CALL, sub_m);
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG);
+ if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
putop(c, OP_SETDELIM);
}
- break;
- default: {
- opcode parse_type = (opcode)type;
- assert((int)parse_type >= 0 && parse_type <= OP_MAX);
- upb_selector_t sel = getsel(f, upb_handlers_getprimitivehandlertype(f));
- int wire_type = native_wire_types[upb_fielddef_descriptortype(f)];
- if (upb_fielddef_isseq(f)) {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
- dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
- putop(c, OP_PUSHLENDELIM);
- putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Packed
- label(c, LABEL_LOOPSTART);
- putop(c, parse_type, sel);
- putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
- putop(c, OP_BRANCH, -LABEL_LOOPSTART);
- dispatchtarget(c, method, f, wire_type);
- putop(c, OP_PUSHTAGDELIM);
- putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Non-packed
- label(c, LABEL_LOOPSTART);
- putop(c, parse_type, sel);
- putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
- putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
- putop(c, OP_BRANCH, -LABEL_LOOPSTART);
- label(c, LABEL_LOOPBREAK);
- putop(c, OP_POP); // Packed and non-packed join.
- putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ));
- putop(c, OP_SETDELIM); // Could remove for non-packed by dup ENDSEQ.
- } else {
- putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
- putchecktag(c, f, wire_type, LABEL_DISPATCH);
- dispatchtarget(c, method, f, wire_type);
- putop(c, parse_type, sel);
+ putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+ putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
+ putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+ label(c, LABEL_LOOPBREAK);
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+ } else {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, wire_type, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, wire_type);
+ putpush(c, f);
+ putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG));
+ putop(c, OP_CALL, sub_m);
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG);
+ if (wire_type == UPB_WIRE_TYPE_DELIMITED) {
+ putop(c, OP_SETDELIM);
}
}
+ } else if (type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES ||
+ type == UPB_TYPE_MESSAGE) {
+ label(c, LABEL_FIELD);
+ if (upb_fielddef_isseq(f)) {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+ putop(c, OP_PUSHTAGDELIM, 0);
+ putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ));
+ label(c, LABEL_LOOPSTART);
+ putop(c, OP_PUSHLENDELIM);
+ putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
+ // Need to emit even if no handler to skip past the string.
+ putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR);
+ putop(c, OP_SETDELIM);
+ putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+ putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_LOOPBREAK);
+ putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+ label(c, LABEL_LOOPBREAK);
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+ } else {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+ putop(c, OP_PUSHLENDELIM);
+ putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR));
+ putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING));
+ putop(c, OP_POP);
+ putcb(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR);
+ putop(c, OP_SETDELIM);
+ }
+ } else {
+ label(c, LABEL_FIELD);
+ opcode parse_type = (opcode)descriptor_type;
+ assert((int)parse_type >= 0 && parse_type <= OP_MAX);
+ upb_selector_t sel = getsel(f, upb_handlers_getprimitivehandlertype(f));
+ int wire_type = native_wire_types[upb_fielddef_descriptortype(f)];
+ if (upb_fielddef_isseq(f)) {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED);
+ putop(c, OP_PUSHLENDELIM);
+ putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Packed
+ label(c, LABEL_LOOPSTART);
+ putop(c, parse_type, sel);
+ putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+ putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+ dispatchtarget(c, method, f, wire_type);
+ putop(c, OP_PUSHTAGDELIM, 0);
+ putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Non-packed
+ label(c, LABEL_LOOPSTART);
+ putop(c, parse_type, sel);
+ putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK);
+ putchecktag(c, f, wire_type, LABEL_LOOPBREAK);
+ putop(c, OP_BRANCH, -LABEL_LOOPSTART);
+ label(c, LABEL_LOOPBREAK);
+ putop(c, OP_POP); // Packed and non-packed join.
+ putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ);
+ putop(c, OP_SETDELIM); // Could remove for non-packed by dup ENDSEQ.
+ } else {
+ putop(c, OP_CHECKDELIM, LABEL_ENDMSG);
+ putchecktag(c, f, wire_type, LABEL_DISPATCH);
+ dispatchtarget(c, method, f, wire_type);
+ putop(c, parse_type, sel);
+ }
}
}
+
// For now we just loop back to the last field of the message (or if none,
// the DISPATCH opcode for the message.
putop(c, OP_BRANCH, -LABEL_FIELD);
+
+ // Insert both a label and a dispatch table entry for this end-of-msg.
label(c, LABEL_ENDMSG);
- putop(c, OP_ENDMSG);
+ upb_value val = upb_value_uint64(pcofs(c) - method->code_base.ofs);
+ upb_inttable_insert(&method->dispatch, DISPATCH_ENDMSG, val);
+
+ putsel(c, OP_ENDMSG, UPB_ENDMSG_SELECTOR, h);
+ putop(c, OP_RET);
upb_inttable_compact(&method->dispatch);
}
-// Populate "methods" with new upb_pbdecodermethod objects reachable from "md".
-// "h" can be NULL, in which case the methods will not be statically bound to
-// destination handlers.
-//
-// Returns the method for this msgdef/handlers.
+// Populate "methods" with new upb_pbdecodermethod objects reachable from "h".
+// Returns the method for these handlers.
//
-// Note that there is a deep difference between keying the method table on
-// upb_msgdef and keying it on upb_handlers. Since upb_msgdef : upb_handlers
-// can be 1:many, binding a handlers statically can result in *more* methods
-// being generated than if the methods are dynamically-bound.
-//
-// On the other hand, if/when the optimization mentioned below is implemented,
-// binding to a upb_handlers can result in *fewer* methods being generated if
-// many of the submessages have no handlers bound to them.
-static void find_methods(compiler *c, const upb_msgdef *md,
- const upb_handlers *h) {
- const void *key = methodkey(md, h);
+// Generates a new method for every destination handlers reachable from "h".
+static void find_methods(compiler *c, const upb_handlers *h) {
upb_value v;
- if (upb_inttable_lookupptr(&c->group->methods, key, &v))
+ if (upb_inttable_lookupptr(&c->group->methods, h, &v))
return;
- newmethod(md, h, c->group, key);
+ newmethod(h, c->group);
// Find submethods.
upb_msg_iter i;
+ const upb_msgdef *md = upb_handlers_msgdef(h);
for(upb_msg_begin(&i, md); !upb_msg_done(&i); upb_msg_next(&i)) {
const upb_fielddef *f = upb_msg_iter_field(&i);
- if (upb_fielddef_type(f) != UPB_TYPE_MESSAGE)
- continue;
- const upb_handlers *sub_h = h ? upb_handlers_getsubhandlers(h, f) : NULL;
-
- if (h && !sub_h &&
- upb_fielddef_descriptortype(f) == UPB_DESCRIPTOR_TYPE_MESSAGE) {
- // OPT: We could optimize away the sub-method, but would have to make sure
- // this field is compiled as a string instead of a submessage.
+ const upb_handlers *sub_h;
+ if (upb_fielddef_type(f) == UPB_TYPE_MESSAGE &&
+ (sub_h = upb_handlers_getsubhandlers(h, f)) != NULL) {
+ // We only generate a decoder method for submessages with handlers.
+ // Others will be parsed as unknown fields.
+ find_methods(c, sub_h);
}
-
- find_methods(c, upb_downcast_msgdef(upb_fielddef_subdef(f)), sub_h);
}
}
@@ -814,12 +828,6 @@ static void sethandlers(mgroup *g, bool allowjit) {
}
}
-static bool bind_dynamic(bool allowjit) {
- // For the moment, JIT handlers always bind statically, but bytecode handlers
- // never do.
- return !allowjit;
-}
-
#else // UPB_USE_JIT_X64
static void sethandlers(mgroup *g, bool allowjit) {
@@ -828,33 +836,19 @@ static void sethandlers(mgroup *g, bool allowjit) {
set_bytecode_handlers(g);
}
-static bool bind_dynamic(bool allowjit) {
- // Bytecode handlers never bind statically.
- UPB_UNUSED(allowjit);
- return true;
-}
-
#endif // UPB_USE_JIT_X64
// TODO(haberman): allow this to be constructed for an arbitrary set of dest
// handlers and other mgroups (but verify we have a transitive closure).
-const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit,
+const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy,
const void *owner) {
UPB_UNUSED(allowjit);
assert(upb_handlers_isfrozen(dest));
- const upb_msgdef *md = upb_handlers_msgdef(dest);
mgroup *g = newgroup(owner);
- compiler *c = newcompiler(g);
-
- if (bind_dynamic(allowjit)) {
- // If binding dynamically, remove the reference against destination
- // handlers.
- dest = NULL;
- }
-
- find_methods(c, md, dest);
+ compiler *c = newcompiler(g, lazy);
+ find_methods(c, dest);
// We compile in two passes:
// 1. all messages are assigned relative offsets from the beginning of the
@@ -909,20 +903,28 @@ bool upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow) {
return true;
}
-const upb_pbdecodermethod *upb_pbcodecache_getdecodermethodfordesthandlers(
- upb_pbcodecache *c, const upb_handlers *handlers) {
+const upb_pbdecodermethod *upb_pbcodecache_getdecodermethod(
+ upb_pbcodecache *c, const upb_pbdecodermethodopts *opts) {
// Right now we build a new DecoderMethod every time.
// TODO(haberman): properly cache methods by their true key.
- const mgroup *g = mgroup_new(handlers, c->allow_jit_, c);
+ const mgroup *g = mgroup_new(opts->handlers, c->allow_jit_, opts->lazy, c);
upb_inttable_push(&c->groups, upb_value_constptr(g));
- const upb_msgdef *md = upb_handlers_msgdef(handlers);
- if (bind_dynamic(c->allow_jit_)) {
- handlers = NULL;
- }
-
upb_value v;
- bool ok = upb_inttable_lookupptr(&g->methods, methodkey(md, handlers), &v);
+ bool ok = upb_inttable_lookupptr(&g->methods, opts->handlers, &v);
UPB_ASSERT_VAR(ok, ok);
return upb_value_getptr(v);
}
+
+
+/* upb_pbdecodermethodopts ****************************************************/
+
+void upb_pbdecodermethodopts_init(upb_pbdecodermethodopts *opts,
+ const upb_handlers *h) {
+ opts->handlers = h;
+ opts->lazy = false;
+}
+
+void upb_pbdecodermethodopts_setlazy(upb_pbdecodermethodopts *opts, bool lazy) {
+ opts->lazy = lazy;
+}
diff --git a/upb/pb/compile_decoder_x64.c b/upb/pb/compile_decoder_x64.c
index 44331b8..913a748 100644
--- a/upb/pb/compile_decoder_x64.c
+++ b/upb/pb/compile_decoder_x64.c
@@ -194,6 +194,8 @@ static void patchdispatch(jitcompiler *jc) {
}
// Define for JIT debugging.
+//#define UPB_JIT_LOAD_SO
+
#ifdef UPB_JIT_LOAD_SO
static void load_so(jitcompiler *jc) {
// Dump to a .so file in /tmp and load that, so all the tooling works right
diff --git a/upb/pb/compile_decoder_x64.dasc b/upb/pb/compile_decoder_x64.dasc
index 571aa9b..97fb5ce 100644
--- a/upb/pb/compile_decoder_x64.dasc
+++ b/upb/pb/compile_decoder_x64.dasc
@@ -42,6 +42,9 @@
| mov DECODER->top, FRAME
| mov DECODER->ptr, PTR
| mov DECODER->data_end, DATAEND
+| // We don't guarantee that delim_end is NULL when out of range like the
+| // interpreter does.
+| mov DECODER->delim_end, DELIMEND
| sub DELIMEND, DECODER->buf
| add DELIMEND, DECODER->bufstart_ofs
| mov FRAME->end_ofs, DELIMEND
@@ -205,6 +208,8 @@ static void emit_static_asm(jitcompiler *jc) {
|
| mov DECODER, rdi
| callp upb_pbdecoder_resume // Same args as us; reuse regs.
+ | test eax, eax
+ | jns >1
| mov DECODER->saved_rsp, rsp
| mov rax, rbx
| load_regs
@@ -212,12 +217,13 @@ static void emit_static_asm(jitcompiler *jc) {
| // Test whether we have a saved stack to resume.
| mov ARG3_64, DECODER->call_len
| test ARG3_64, ARG3_64
- | jnz >1
+ | jnz >2
|
| call rax
|
| mov rax, DECODER->size_param
| mov qword DECODER->call_len, 0
+ |1:
| add rsp, 8 // Counter previous alignment.
| pop rbx
| pop r12
@@ -227,7 +233,7 @@ static void emit_static_asm(jitcompiler *jc) {
| pop rbp
| ret
|
- |1:
+ |2:
| // Resume decoder.
| lea ARG2_64, DECODER->callstack
| sub rsp, ARG3_64
@@ -293,6 +299,7 @@ static void emit_static_asm(jitcompiler *jc) {
| add DELIMEND, rdx
| cmp FRAME, DECODER->limit
| je >3 // Stack overflow
+ | mov dword FRAME->groupnum, 0
| test rcx, rcx
| jz >2
| mov DATAEND, DECODER->end
@@ -850,24 +857,7 @@ static void jittag(jitcompiler *jc, uint64_t tag, int n, int ofs,
|5:
}
-// Emit message-specific assembly. Overall code layout is:
-// +---------------------------------------------------------------------------+
-// | Message A |
-// | 1. function prologue (startmsg), jmps to OP_CHECKDELIM_RET before first |
-// | OP_TAG* in 4. |
-// | 2. function epilogue (endmsg), returns from function. |
-// | 3. dispatch function (returns fptr to 4) |
-// | - loops internally to skip unknown fields |
-// | - after each unknown field does OP_CHECKDELIM_RET (returns 2) |
-// | - also returns 2 for END_GROUP.
-// | 4. code for each op: |
-// | - OP_TAG* on mismatch calls 3 to get addr, then jumps to 4 (or 2 on EOM).|
-// | - OP_CHECKDELIM_RET jumps to 2 |
-// +---------------------------------------------------------------------------+
-// | Message B |
-// | 1. ... |
-// | ... |
-// +---------------------------------------------------------------------------+
+// Compile the bytecode to x64.
static void jitbytecode(jitcompiler *jc) {
upb_pbdecodermethod *method = NULL;
const upb_handlers *h = NULL;
@@ -877,20 +867,21 @@ static void jitbytecode(jitcompiler *jc) {
uint32_t arg = instr >> 8;
int32_t longofs = arg;
- if (op != OP_STARTMSG && op != OP_SETDISPATCH) {
+ if (op != OP_SETDISPATCH) {
+ // Skipped for SETDISPATCH because it defines its own asmlabel for the
+ // dispatch code it emits.
asmlabel(jc, "0x%lx.%s", pcofs(jc), upb_pbdecoder_getopname(op));
+
+ // Skipped for SETDISPATCH because it should point at the function
+ // prologue, not the dispatch function that is emitted first.
+ // TODO: optimize this to only define pclabels that are actually used.
+ |=>define_pclabel(jc, jc->pc):
}
- // TODO: optimize this to only define pclabels that are actually used.
- |=>define_pclabel(jc, jc->pc):
+
jc->pc++;
switch (op) {
case OP_STARTMSG: {
- // This opcode serves as a function prolouge also.
- const char *msgname = upb_msgdef_fullname(method->schema_);
- asmlabel(jc, "0x%lx.parse.%s", pcofs(jc), msgname);
- |=>define_pclabel(jc, method):
- | sub rsp, 8
upb_func *startmsg = gethandler(h, UPB_STARTMSG_SELECTOR);
if (startmsg) {
// bool startmsg(void *closure, const void *hd)
@@ -905,11 +896,12 @@ static void jitbytecode(jitcompiler *jc) {
| jmp <1
|2:
}
+ } else {
+ | nop
}
break;
}
case OP_ENDMSG: {
- // This opcode serves as a function epiloue also.
upb_func *endmsg = gethandler(h, UPB_ENDMSG_SELECTOR);
|9:
if (endmsg) {
@@ -919,11 +911,12 @@ static void jitbytecode(jitcompiler *jc) {
| mov ARG3_64, DECODER->status
| callp endmsg
}
- | add rsp, 8
- | ret
break;
}
case OP_SETDISPATCH: {
+ uint32_t *op_pc = jc->pc - 1;
+
+ // Load info for new method.
upb_inttable *dispatch;
memcpy(&dispatch, jc->pc, sizeof(void*));
jc->pc += sizeof(void*) / sizeof(uint32_t);
@@ -936,9 +929,18 @@ static void jitbytecode(jitcompiler *jc) {
// case instead of parsing it field by field. We should also do the skip
// in the containing message's code.
h = method->dest_handlers_;
- const char *msgname = upb_msgdef_fullname(method->schema_);
+ const char *msgname = upb_msgdef_fullname(upb_handlers_msgdef(h));
+
+ // Emit dispatch code for new method.
asmlabel(jc, "0x%lx.dispatch.%s", pcofs(jc), msgname);
jitdispatch(jc, method);
+
+ // Emit function prologue for new method.
+ asmlabel(jc, "0x%lx.parse.%s", pcofs(jc), msgname);
+ |=>define_pclabel(jc, op_pc):
+ |=>define_pclabel(jc, method):
+ | sub rsp, 8
+
break;
}
case OP_PARSE_DOUBLE:
@@ -1056,6 +1058,7 @@ static void jitbytecode(jitcompiler *jc) {
| add FRAME, sizeof(upb_pbdecoder_frame)
| cmp FRAME, DECODER->limit
| je ->err
+ | mov dword FRAME->groupnum, arg
break;
case OP_PUSHLENDELIM:
| call ->pushlendelim
@@ -1075,9 +1078,6 @@ static void jitbytecode(jitcompiler *jc) {
| mov DATAEND, DELIMEND
|1:
break;
- case OP_SETGROUPNUM:
- | mov dword FRAME->groupnum, arg
- break;
case OP_SETBIGGROUPNUM:
| mov dword FRAME->groupnum, *jc->pc++
break;
@@ -1086,11 +1086,16 @@ static void jitbytecode(jitcompiler *jc) {
| je =>pclabel(jc, jc->pc + longofs)
break;
case OP_CALL:
- | call =>pclabel(jc, jc->pc + longofs + 3)
+ | call =>pclabel(jc, jc->pc + longofs)
break;
case OP_BRANCH:
| jmp =>pclabel(jc, jc->pc + longofs);
break;
+ case OP_RET:
+ |9:
+ | add rsp, 8
+ | ret
+ break;
case OP_TAG1:
jittag(jc, (arg >> 8) & 0xff, 1, (int8_t)arg, method);
break;
@@ -1107,6 +1112,7 @@ static void jitbytecode(jitcompiler *jc) {
assert(false);
}
}
+
asmlabel(jc, "eof");
| nop
}
diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c
index c5fae0e..9c54b8a 100644
--- a/upb/pb/decoder.c
+++ b/upb/pb/decoder.c
@@ -18,7 +18,6 @@
#endif
#define CHECK_SUSPEND(x) if (!(x)) return upb_pbdecoder_suspend(d);
-#define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; }
// Error messages that are shared between the bytecode and JIT decoders.
const char *kPbDecoderStackOverflow = "Nesting too deep.";
@@ -45,10 +44,10 @@ static bool consumes_input(opcode op) {
case OP_PUSHTAGDELIM:
case OP_POP:
case OP_SETDELIM:
- case OP_SETGROUPNUM:
case OP_SETBIGGROUPNUM:
case OP_CHECKDELIM:
case OP_CALL:
+ case OP_RET:
case OP_BRANCH:
return false;
default:
@@ -147,13 +146,12 @@ static void checkpoint(upb_pbdecoder *d) {
}
// Resumes the decoder from an initial state or from a previous suspend.
-void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
- size_t size, const upb_bufhandle *handle) {
+int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
+ size_t size, const upb_bufhandle *handle) {
UPB_UNUSED(p); // Useless; just for the benefit of the JIT.
d->buf_param = buf;
d->size_param = size;
d->handle = handle;
- d->skip = 0;
if (d->residual_end > d->residual) {
// We have residual bytes from the last buffer.
assert(ptr(d) == d->residual);
@@ -161,7 +159,11 @@ void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
switchtobuf(d, buf, buf + size);
}
d->checkpoint = ptr(d);
- return d; // For the JIT.
+ if (d->top->groupnum < 0) {
+ CHECK_RETURN(upb_pbdecoder_skipunknown(d, -1, 0));
+ d->checkpoint = ptr(d);
+ }
+ return DECODE_OK;
}
// Suspends the decoder at the last checkpoint, without saving any residual
@@ -176,10 +178,10 @@ size_t upb_pbdecoder_suspend(upb_pbdecoder *d) {
assert(!in_residual_buf(d, d->checkpoint));
assert(d->buf == d->buf_param);
size_t consumed = d->checkpoint - d->buf;
- d->bufstart_ofs += consumed + d->skip;
+ d->bufstart_ofs += consumed;
d->residual_end = d->residual;
switchtobuf(d, d->residual, d->residual_end);
- return consumed + d->skip;
+ return consumed;
}
}
@@ -209,11 +211,11 @@ static size_t suspend_save(upb_pbdecoder *d) {
assert(save <= sizeof(d->residual));
memcpy(d->residual, ptr(d), save);
d->residual_end = d->residual + save;
- d->bufstart_ofs = offset(d) + d->skip;
+ d->bufstart_ofs = offset(d);
}
switchtobuf(d, d->residual, d->residual_end);
- return d->size_param + d->skip;
+ return d->size_param;
}
static int32_t skip(upb_pbdecoder *d, size_t bytes) {
@@ -221,12 +223,16 @@ static int32_t skip(upb_pbdecoder *d, size_t bytes) {
if (curbufleft(d) >= bytes) {
// Skipped data is all in current buffer.
advance(d, bytes);
+ return DECODE_OK;
} else {
// Skipped data extends beyond currently available buffers.
- d->skip = bytes - curbufleft(d);
- advance(d, curbufleft(d));
+ d->pc = d->last;
+ size_t skip = bytes - curbufleft(d);
+ d->bufstart_ofs += (d->end - d->buf) + skip;
+ d->residual_end = d->residual;
+ switchtobuf(d, d->residual, d->residual_end);
+ return d->size_param + skip;
}
- return DECODE_OK;
}
FORCEINLINE void consumebytes(upb_pbdecoder *d, void *buf, size_t bytes) {
@@ -247,8 +253,8 @@ static NOINLINE int32_t getbytes_slow(upb_pbdecoder *d, void *buf,
if (curbufleft(d) >= bytes) {
consumebytes(d, buf + avail, bytes);
return DECODE_OK;
- } else if (d->data_end - d->buf == d->top->end_ofs - d->bufstart_ofs) {
- seterr(d, "Submessage ended in the middle of a value");
+ } else if (d->data_end == d->delim_end) {
+ seterr(d, "Submessage ended in the middle of a value or group");
return upb_pbdecoder_suspend(d);
} else {
return suspend_save(d);
@@ -378,11 +384,24 @@ static bool push(upb_pbdecoder *d, uint64_t end) {
fr++;
fr->end_ofs = end;
fr->dispatch = NULL;
- fr->groupnum = -1;
+ fr->groupnum = 0;
d->top = fr;
return true;
}
+static bool pushtagdelim(upb_pbdecoder *d, uint32_t arg) {
+ // While we expect to see an "end" tag (either ENDGROUP or a non-sequence
+ // field number) prior to hitting any enclosing submessage end, pushing our
+ // existing delim end prevents us from continuing to parse values from a
+ // corrupt proto that doesn't give us an END tag in time.
+ if (!push(d, d->top->end_ofs))
+ return false;
+ d->top->groupnum = arg;
+ return true;
+}
+
+static void pop(upb_pbdecoder *d) { d->top--; }
+
NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d,
uint64_t expected) {
uint64_t data = 0;
@@ -400,46 +419,103 @@ NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d,
}
}
-int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, uint32_t fieldnum,
+int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum,
uint8_t wire_type) {
- if (fieldnum == 0 || fieldnum > UPB_MAX_FIELDNUMBER) {
- seterr(d, "Invalid field number");
- return upb_pbdecoder_suspend(d);
- }
-
- if (wire_type == UPB_WIRE_TYPE_END_GROUP) {
- if (fieldnum != d->top->groupnum) {
- seterr(d, "Unmatched ENDGROUP tag.");
+ if (fieldnum >= 0)
+ goto have_tag;
+
+ while (true) {
+ uint32_t tag;
+ CHECK_RETURN(decode_v32(d, &tag));
+ wire_type = tag & 0x7;
+ fieldnum = tag >> 3;
+
+have_tag:
+ if (fieldnum == 0) {
+ seterr(d, "Saw invalid field number (0)");
return upb_pbdecoder_suspend(d);
}
- return DECODE_ENDGROUP;
- }
- // TODO: deliver to unknown field callback.
- switch (wire_type) {
- case UPB_WIRE_TYPE_VARINT: {
- uint64_t u64;
- return decode_varint(d, &u64);
+ // TODO: deliver to unknown field callback.
+ switch (wire_type) {
+ case UPB_WIRE_TYPE_32BIT:
+ CHECK_RETURN(skip(d, 4));
+ break;
+ case UPB_WIRE_TYPE_64BIT:
+ CHECK_RETURN(skip(d, 8));
+ break;
+ case UPB_WIRE_TYPE_VARINT: {
+ uint64_t u64;
+ CHECK_RETURN(decode_varint(d, &u64));
+ break;
+ }
+ case UPB_WIRE_TYPE_DELIMITED: {
+ uint32_t len;
+ CHECK_RETURN(decode_v32(d, &len));
+ CHECK_RETURN(skip(d, len));
+ break;
+ }
+ case UPB_WIRE_TYPE_START_GROUP:
+ CHECK_SUSPEND(pushtagdelim(d, -fieldnum));
+ break;
+ case UPB_WIRE_TYPE_END_GROUP:
+ if (fieldnum == -d->top->groupnum) {
+ pop(d);
+ } else if (fieldnum == d->top->groupnum) {
+ return DECODE_ENDGROUP;
+ } else {
+ seterr(d, "Unmatched ENDGROUP tag.");
+ return upb_pbdecoder_suspend(d);
+ }
+ break;
+ default:
+ seterr(d, "Invalid wire type");
+ return upb_pbdecoder_suspend(d);
}
- case UPB_WIRE_TYPE_32BIT:
- return skip(d, 4);
- case UPB_WIRE_TYPE_64BIT:
- return skip(d, 8);
- case UPB_WIRE_TYPE_DELIMITED: {
- uint32_t len;
- CHECK_RETURN(decode_v32(d, &len));
- return skip(d, len);
+
+ if (d->top->groupnum >= 0) {
+ return DECODE_OK;
}
- case UPB_WIRE_TYPE_START_GROUP:
- seterr(d, "Can't handle unknown groups yet");
- return upb_pbdecoder_suspend(d);
- case UPB_WIRE_TYPE_END_GROUP:
- default:
- seterr(d, "Invalid wire type");
+
+ if (ptr(d) == d->delim_end) {
+ seterr(d, "Enclosing submessage ended in the middle of value or group");
+ // Unlike most errors we notice during parsing, right now we have consumed
+ // all of the user's input.
+ //
+ // There are three different options for how to handle this case:
+ //
+ // 1. decode() = short count, error = set
+ // 2. decode() = full count, error = set
+ // 3. decode() = full count, error NOT set, short count and error will
+ // be reported on next call to decode() (or end())
+ //
+ // (1) and (3) have the advantage that they preserve the invariant that an
+ // error occurs iff decode() returns a short count.
+ //
+ // (2) and (3) have the advantage of reflecting the fact that all of the
+ // bytes were in fact parsed (and possibly delivered to the unknown field
+ // handler, in the future when that is supported).
+ //
+ // (3) requires extra state in the decode (a place to store the "permanent
+ // error" that we should return for all subsequent attempts to decode).
+ // But we likely want this anyway.
+ //
+ // Right now we do (1), thanks to the fact that we checkpoint *after* this
+ // check. (3) may be a better choice long term; unclear at the moment.
return upb_pbdecoder_suspend(d);
+ }
+
+ checkpoint(d);
}
}
+static void goto_endmsg(upb_pbdecoder *d) {
+ upb_value v;
+ bool found = upb_inttable_lookup32(d->top->dispatch, DISPATCH_ENDMSG, &v);
+ UPB_ASSERT_VAR(found, found);
+ d->pc = d->top->base + upb_value_getuint64(v);
+}
+
static int32_t dispatch(upb_pbdecoder *d) {
upb_inttable *dispatch = d->top->dispatch;
@@ -470,7 +546,7 @@ static int32_t dispatch(upb_pbdecoder *d) {
int32_t ret = upb_pbdecoder_skipunknown(d, fieldnum, wire_type);
if (ret == DECODE_ENDGROUP) {
- d->pc = d->top->base - 1; // Back to OP_ENDMSG.
+ goto_endmsg(d);
return DECODE_OK;
} else {
d->pc = d->last - 1; // Rewind to CHECKDELIM.
@@ -493,7 +569,11 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
upb_pbdecoder *d = closure;
const mgroup *group = hd;
assert(buf);
- upb_pbdecoder_resume(d, NULL, buf, size, handle);
+ int32_t result = upb_pbdecoder_resume(d, NULL, buf, size, handle);
+ if (result == DECODE_ENDGROUP) {
+ goto_endmsg(d);
+ }
+ CHECK_RETURN(result);
UPB_UNUSED(group);
#define VMCASE(op, code) \
@@ -552,8 +632,6 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
)
VMCASE(OP_ENDMSG,
CHECK_SUSPEND(upb_sink_endmsg(&d->top->sink, d->status));
- assert(d->call_len > 0);
- d->pc = d->callstack[--d->call_len];
)
VMCASE(OP_STARTSEQ,
upb_pbdecoder_frame *outer = outer_frame(d);
@@ -579,25 +657,39 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
)
VMCASE(OP_STRING,
uint32_t len = curbufleft(d);
- CHECK_SUSPEND(
- upb_sink_putstring(&d->top->sink, arg, ptr(d), len, handle));
- advance(d, len);
- if (d->delim_end == NULL) { // String extends beyond this buf?
- d->pc--;
- d->bufstart_ofs += size;
- d->residual_end = d->residual;
- return size;
+ size_t n = upb_sink_putstring(&d->top->sink, arg, ptr(d), len, handle);
+ if (n > len) {
+ if (n > d->top->end_ofs - offset(d)) {
+ seterr(d, "Tried to skip past end of string.");
+ return upb_pbdecoder_suspend(d);
+ } else {
+ return skip(d, n);
+ }
+ } else if (n < len) {
+ advance(d, n);
+ return upb_pbdecoder_suspend(d);
+ } else {
+ advance(d, n);
+ if (d->delim_end == NULL) { // String extends beyond this buf?
+ d->pc--; // Do OP_STRING again when we resume.
+ d->bufstart_ofs += size;
+ d->residual_end = d->residual;
+ return size;
+ }
}
)
VMCASE(OP_ENDSTR,
CHECK_SUSPEND(upb_sink_endstr(&d->top->sink, arg));
)
VMCASE(OP_PUSHTAGDELIM,
- CHECK_SUSPEND(push(d, d->top->end_ofs));
+ CHECK_SUSPEND(pushtagdelim(d, arg));
+ )
+ VMCASE(OP_SETBIGGROUPNUM,
+ d->top->groupnum = *d->pc++;
)
VMCASE(OP_POP,
assert(d->top > d->stack);
- d->top--;
+ pop(d);
)
VMCASE(OP_PUSHLENDELIM,
uint32_t len;
@@ -608,13 +700,9 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
VMCASE(OP_SETDELIM,
set_delim_end(d);
)
- VMCASE(OP_SETGROUPNUM,
- d->top->groupnum = arg;
- )
- VMCASE(OP_SETBIGGROUPNUM,
- d->top->groupnum = *d->pc++;
- )
VMCASE(OP_CHECKDELIM,
+ // We are guaranteed of this assert because we never allow ourselves to
+ // consume bytes beyond data_end, which covers delim_end when non-NULL.
assert(!(d->delim_end && ptr(d) > d->delim_end));
if (ptr(d) == d->delim_end)
d->pc += longofs;
@@ -623,6 +711,10 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
d->callstack[d->call_len++] = d->pc;
d->pc += longofs;
)
+ VMCASE(OP_RET,
+ assert(d->call_len > 0);
+ d->pc = d->callstack[--d->call_len];
+ )
VMCASE(OP_BRANCH,
d->pc += longofs;
)
@@ -755,6 +847,7 @@ void upb_pbdecoder_init(upb_pbdecoder *d, const upb_pbdecodermethod *m,
void upb_pbdecoder_reset(upb_pbdecoder *d) {
d->top = d->stack;
d->top->end_ofs = UINT64_MAX;
+ d->top->groupnum = 0;
d->bufstart_ofs = 0;
d->ptr = d->residual;
d->buf = d->residual;
diff --git a/upb/pb/decoder.h b/upb/pb/decoder.h
index 4313bb3..586d2d5 100644
--- a/upb/pb/decoder.h
+++ b/upb/pb/decoder.h
@@ -20,19 +20,23 @@ namespace pb {
class CodeCache;
class Decoder;
class DecoderMethod;
+class DecoderMethodOptions;
} // namespace pb
} // namespace upb
typedef upb::pb::CodeCache upb_pbcodecache;
typedef upb::pb::Decoder upb_pbdecoder;
typedef upb::pb::DecoderMethod upb_pbdecodermethod;
+typedef upb::pb::DecoderMethodOptions upb_pbdecodermethodopts;
#else
struct upb_pbdecoder;
struct upb_pbdecodermethod;
+struct upb_pbdecodermethodopts;
struct upb_pbcodecache;
typedef struct upb_pbdecoder upb_pbdecoder;
typedef struct upb_pbdecodermethod upb_pbdecodermethod;
+typedef struct upb_pbdecodermethodopts upb_pbdecodermethodopts;
typedef struct upb_pbcodecache upb_pbcodecache;
#endif
@@ -72,14 +76,40 @@ typedef struct {
// that calls from the JIT into C work correctly.
uint64_t end_ofs;
const uint32_t *base;
- uint32_t groupnum;
+
+ // 0 indicates a length-delimited field.
+ // A positive number indicates a known group.
+ // A negative number indicates an unknown group.
+ int32_t groupnum;
upb_inttable *dispatch; // Not used by the JIT.
} upb_pbdecoder_frame;
#ifdef __cplusplus
-// Represents the code to parse a protobuf according to a specific schema,
-// optionally bound to a set of destination handlers.
+// The parameters one uses to construct a DecoderMethod.
+// TODO(haberman): move allowjit here? Seems more convenient for users.
+class upb::pb::DecoderMethodOptions {
+ public:
+ // Parameter represents the destination handlers that this method will push
+ // to.
+ explicit DecoderMethodOptions(const Handlers* dest_handlers);
+
+ // Should the decoder push submessages to lazy handlers for fields that have
+ // them? The caller should set this iff the lazy handlers expect data that is
+ // in protobuf binary format and the caller wishes to lazy parse it.
+ void set_lazy(bool lazy);
+
+ private:
+#else
+struct upb_pbdecodermethodopts {
+#endif
+ const upb_handlers *handlers;
+ bool lazy;
+};
+
+#ifdef __cplusplus
+
+// Represents the code to parse a protobuf according to a destination Handlers.
class upb::pb::DecoderMethod /* : public upb::RefCounted */ {
public:
// From upb::ReferenceCounted.
@@ -88,14 +118,9 @@ class upb::pb::DecoderMethod /* : public upb::RefCounted */ {
void DonateRef(const void* from, const void* to) const;
void CheckRef(const void* owner) const;
- // The schema that this method parses. Never NULL.
- const MessageDef* schema() const;
-
// The destination handlers that are statically bound to this method.
// This method is only capable of outputting to a sink that uses these
// handlers.
- //
- // Will be NULL if this method is not statically bound.
const Handlers* dest_handlers() const;
// The input handlers for this decoder method.
@@ -106,8 +131,7 @@ class upb::pb::DecoderMethod /* : public upb::RefCounted */ {
// Convenience method for generating a DecoderMethod without explicitly
// creating a CodeCache.
- static reffed_ptr<const DecoderMethod> NewForDestHandlers(
- const upb::Handlers *dest);
+ static reffed_ptr<const DecoderMethod> New(const DecoderMethodOptions& opts);
private:
UPB_DISALLOW_POD_OPS(DecoderMethod, upb::pb::DecoderMethod);
@@ -138,13 +162,7 @@ struct upb_pbdecodermethod {
// The handler one calls to invoke this method.
upb_byteshandler input_handler_;
- // The message type that this method is parsing.
- const upb_msgdef *schema_;
-
- // The destination handlers this method is bound to, or NULL if this method
- // can be bound to a destination handlers instance at runtime.
- //
- // If non-NULL, we own a ref.
+ // The destination handlers this method is bound to. We own a ref.
const upb_handlers *dest_handlers_;
// The dispatch table layout is:
@@ -183,8 +201,7 @@ class upb::pb::Decoder {
void Reset();
// Resets the output sink of the Decoder.
- // The given sink must match method()->schema() as well as
- // method()->dest_handlers() if the latter is non-NULL.
+ // The given sink must match method()->dest_handlers().
//
// This must be called at least once before the decoder can be used. It may
// only be called with the decoder is in a state where it was just created or
@@ -221,9 +238,6 @@ struct upb_pbdecoder {
// Overall stream offset of "buf."
uint64_t bufstart_ofs;
- // How many bytes past the end of the user buffer we want to skip.
- size_t skip;
-
// Buffer for residual bytes not parsed from the previous buffer.
// The maximum number of residual bytes we require is 12; a five-byte
// unknown tag plus an eight-byte value, less one because the value
@@ -290,8 +304,7 @@ class upb::pb::CodeCache {
// more efficient decoding. However the returned method may or may not
// actually be statically bound. But in all cases, the returned method can
// push data to the given handlers.
- const DecoderMethod *GetDecoderMethodForDestHandlers(
- const upb::Handlers *handlers);
+ const DecoderMethod *GetDecoderMethod(const DecoderMethodOptions& opts);
// If/when someone needs to explicitly create a dynamically-bound
// DecoderMethod*, we can add a method to get it here.
@@ -320,27 +333,30 @@ const upb_pbdecodermethod *upb_pbdecoder_method(const upb_pbdecoder *d);
bool upb_pbdecoder_resetoutput(upb_pbdecoder *d, upb_sink *sink);
upb_bytessink *upb_pbdecoder_input(upb_pbdecoder *d);
+void upb_pbdecodermethodopts_init(upb_pbdecodermethodopts *opts,
+ const upb_handlers *h);
+void upb_pbdecodermethodopts_setlazy(upb_pbdecodermethodopts *opts, bool lazy);
+
void upb_pbdecodermethod_ref(const upb_pbdecodermethod *m, const void *owner);
void upb_pbdecodermethod_unref(const upb_pbdecodermethod *m, const void *owner);
void upb_pbdecodermethod_donateref(const upb_pbdecodermethod *m,
const void *from, const void *to);
void upb_pbdecodermethod_checkref(const upb_pbdecodermethod *m,
const void *owner);
-const upb_msgdef *upb_pbdecodermethod_schema(const upb_pbdecodermethod *m);
const upb_handlers *upb_pbdecodermethod_desthandlers(
const upb_pbdecodermethod *m);
const upb_byteshandler *upb_pbdecodermethod_inputhandler(
const upb_pbdecodermethod *m);
bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m);
-const upb_pbdecodermethod *upb_pbdecodermethod_newfordesthandlers(
- const upb_handlers *dest, const void *owner);
+const upb_pbdecodermethod *upb_pbdecodermethod_new(
+ const upb_pbdecodermethodopts *opts, const void *owner);
void upb_pbcodecache_init(upb_pbcodecache *c);
void upb_pbcodecache_uninit(upb_pbcodecache *c);
bool upb_pbcodecache_allowjit(const upb_pbcodecache *c);
bool upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow);
-const upb_pbdecodermethod *upb_pbcodecache_getdecodermethodfordesthandlers(
- upb_pbcodecache *c, const upb_handlers *handlers);
+const upb_pbdecodermethod *upb_pbcodecache_getdecodermethod(
+ upb_pbcodecache *c, const upb_pbdecodermethodopts *opts);
#ifdef __cplusplus
} /* extern "C" */
@@ -391,6 +407,13 @@ inline BytesSink* Decoder::input() {
return upb_pbdecoder_input(this);
}
+inline DecoderMethodOptions::DecoderMethodOptions(const Handlers* h) {
+ upb_pbdecodermethodopts_init(this, h);
+}
+inline void DecoderMethodOptions::set_lazy(bool lazy) {
+ upb_pbdecodermethodopts_setlazy(this, lazy);
+}
+
inline void DecoderMethod::Ref(const void *owner) const {
upb_pbdecodermethod_ref(this, owner);
}
@@ -403,9 +426,6 @@ inline void DecoderMethod::DonateRef(const void *from, const void *to) const {
inline void DecoderMethod::CheckRef(const void *owner) const {
upb_pbdecodermethod_checkref(this, owner);
}
-inline const MessageDef* DecoderMethod::schema() const {
- return upb_pbdecodermethod_schema(this);
-}
inline const Handlers* DecoderMethod::dest_handlers() const {
return upb_pbdecodermethod_desthandlers(this);
}
@@ -416,10 +436,9 @@ inline bool DecoderMethod::is_native() const {
return upb_pbdecodermethod_isnative(this);
}
// static
-inline reffed_ptr<const DecoderMethod> DecoderMethod::NewForDestHandlers(
- const Handlers *dest) {
- const upb_pbdecodermethod *m =
- upb_pbdecodermethod_newfordesthandlers(dest, &m);
+inline reffed_ptr<const DecoderMethod> DecoderMethod::New(
+ const DecoderMethodOptions &opts) {
+ const upb_pbdecodermethod *m = upb_pbdecodermethod_new(&opts, &m);
return reffed_ptr<const DecoderMethod>(m, &m);
}
@@ -435,9 +454,9 @@ inline bool CodeCache::allow_jit() const {
inline bool CodeCache::set_allow_jit(bool allow) {
return upb_pbcodecache_setallowjit(this, allow);
}
-inline const DecoderMethod* CodeCache::GetDecoderMethodForDestHandlers(
- const upb::Handlers* handlers) {
- return upb_pbcodecache_getdecodermethodfordesthandlers(this, handlers);
+inline const DecoderMethod *CodeCache::GetDecoderMethod(
+ const DecoderMethodOptions& opts) {
+ return upb_pbcodecache_getdecodermethod(this, &opts);
}
} // namespace pb
diff --git a/upb/pb/decoder.int.h b/upb/pb/decoder.int.h
index 20afa68..11aa133 100644
--- a/upb/pb/decoder.int.h
+++ b/upb/pb/decoder.int.h
@@ -40,12 +40,10 @@ typedef enum {
OP_PUSHLENDELIM = 24, // No arg.
OP_POP = 25, // No arg.
OP_SETDELIM = 26, // No arg.
- OP_SETGROUPNUM = 27,
- OP_SETBIGGROUPNUM = 28, // two words: | unused (24) | opc || groupnum (32) |
-
- // The arg for these opcodes is a local label reference.
- OP_CHECKDELIM = 29,
- OP_CALL = 30,
+ OP_SETBIGGROUPNUM = 27, // two words: | unused (24) | opc || groupnum (32) |
+ OP_CHECKDELIM = 28,
+ OP_CALL = 29,
+ OP_RET = 30,
OP_BRANCH = 31,
// Different opcodes depending on how many bytes expected.
@@ -112,10 +110,10 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
bool upb_pbdecoder_end(void *closure, const void *handler_data);
// Decoder-internal functions that the JIT calls to handle fallback paths.
-void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
- size_t size, const upb_bufhandle *handle);
+int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf,
+ size_t size, const upb_bufhandle *handle);
size_t upb_pbdecoder_suspend(upb_pbdecoder *d);
-int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, uint32_t fieldnum,
+int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum,
uint8_t wire_type);
int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, uint64_t expected);
int32_t upb_pbdecoder_decode_varint_slow(upb_pbdecoder *d, uint64_t *u64);
@@ -137,8 +135,21 @@ void upb_pbdecoder_freejit(mgroup *group);
// wherever that takes you."
#define LABEL_DISPATCH 0
+// A special slot in the dispatch table that stores the epilogue (ENDMSG and/or
+// RET) for branching to when we find an appropriate ENDGROUP tag.
+#define DISPATCH_ENDMSG 0
+
+// All of the functions in decoder.c that return int32_t return values according
+// to the following scheme:
+// 1. negative values indicate a return code from the following list.
+// 2. positive values indicate that error or end of buffer was hit, and
+// that the decode function should immediately return the given value
+// (the decoder state has already been suspended and is ready to be
+// resumed).
#define DECODE_OK -1
#define DECODE_MISMATCH -2 // Used only from checktag_slow().
-#define DECODE_ENDGROUP -2 // Used only from checkunknown().
+#define DECODE_ENDGROUP -3 // Used only from checkunknown().
+
+#define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; }
#endif // UPB_DECODER_INT_H_
diff --git a/upb/pb/glue.c b/upb/pb/glue.c
index 73ef145..fde2dd1 100644
--- a/upb/pb/glue.c
+++ b/upb/pb/glue.c
@@ -17,8 +17,10 @@ upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n,
void *owner, upb_status *status) {
// Create handlers.
const upb_handlers *reader_h = upb_descreader_newhandlers(&reader_h);
+ upb_pbdecodermethodopts opts;
+ upb_pbdecodermethodopts_init(&opts, reader_h);
const upb_pbdecodermethod *decoder_m =
- upb_pbdecodermethod_newfordesthandlers(reader_h, &decoder_m);
+ upb_pbdecodermethod_new(&opts, &decoder_m);
upb_pbdecoder decoder;
upb_descreader reader;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback