Skip to content

Commit

Permalink
Merge pull request #426 from haberman/defs
Browse files Browse the repository at this point in the history
Filling out the functionality of defs.
  • Loading branch information
haberman authored Oct 6, 2021
2 parents 0e0de7d + 6f7634f commit e5c1583
Show file tree
Hide file tree
Showing 11 changed files with 1,224 additions and 392 deletions.
1 change: 0 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ http_archive(
build_file = "//benchmarks:BUILD.googleapis",
strip_prefix = "googleapis-master",
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
sha256 = "a3353ef2cea09074eac8a99b6ad8e1c802c9bfac6a6192401287de8d6991b6bc",
)

system_python(
Expand Down
6 changes: 3 additions & 3 deletions bazel/workspace_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ def upb_deps():
maybe(
http_archive,
name = "com_google_absl",
url = "https://github.com/abseil/abseil-cpp/archive/refs/heads/master.zip",
strip_prefix = "abseil-cpp-master",
sha256 = "9da85425cda33e13c619c35473c9653944d0dd9aab1a69ee9b3543cdaed277e5",
url = "https://github.com/abseil/abseil-cpp/archive/b9b925341f9e90f5e7aa0cf23f036c29c7e454eb.zip",
strip_prefix = "abseil-cpp-b9b925341f9e90f5e7aa0cf23f036c29c7e454eb",
sha256 = "bb2a0b57c92b6666e8acb00f4cbbfce6ddb87e83625fb851b0e78db581340617",
)

maybe(
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def Benchmark(outbase, bench_cpu=True, runs=12, fasttable=False):
Run("cp -f bazel-bin/tests/conformance_upb {}.bin".format(outbase))


baseline = "bm-interleave"
baseline = "master"
bench_cpu = True
fasttable = False

Expand Down
4 changes: 4 additions & 0 deletions cmake/google/protobuf/descriptor.upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,10 @@ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_prot

extern const upb_msglayout_file google_protobuf_descriptor_proto_upb_file_layout;

/* Max size 32 is google.protobuf.FileOptions */
/* Max size 64 is google.protobuf.FileOptions */
#define _UPB_MAXOPT_SIZE UPB_SIZE(104, 192)

#ifdef __cplusplus
} /* extern "C" */
#endif
Expand Down
18 changes: 5 additions & 13 deletions upb/bindings/lua/def.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,6 @@ 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));
Expand Down Expand Up @@ -229,7 +223,6 @@ static const struct luaL_Reg lupb_fielddef_m[] = {
{"index", lupb_fielddef_index},
{"is_extension", lupb_fielddef_isextension},
{"label", lupb_fielddef_label},
{"lazy", lupb_fielddef_lazy},
{"name", lupb_fielddef_name},
{"number", lupb_fielddef_number},
{"packed", lupb_fielddef_packed},
Expand Down Expand Up @@ -689,28 +682,28 @@ static int lupb_filedef_depcount(lua_State *L) {
static int lupb_filedef_enum(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
int index = luaL_checkint(L, 2);
const upb_enumdef *e = upb_filedef_enum(f, index);
const upb_enumdef *e = upb_filedef_toplvlenum(f, index);
lupb_wrapper_pushwrapper(L, 1, e, LUPB_ENUMDEF);
return 1;
}

static int lupb_filedef_enumcount(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
lua_pushnumber(L, upb_filedef_enumcount(f));
lua_pushnumber(L, upb_filedef_toplvlenumcount(f));
return 1;
}

static int lupb_filedef_msg(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
int index = luaL_checkint(L, 2);
const upb_msgdef *m = upb_filedef_msg(f, index);
const upb_msgdef *m = upb_filedef_toplvlmsg(f, index);
lupb_wrapper_pushwrapper(L, 1, m, LUPB_MSGDEF);
return 1;
}

static int lupb_filedef_msgcount(lua_State *L) {
const upb_filedef *f = lupb_filedef_check(L, 1);
lua_pushnumber(L, upb_filedef_msgcount(f));
lua_pushnumber(L, upb_filedef_toplvlmsgcount(f));
return 1;
}

Expand Down Expand Up @@ -916,8 +909,7 @@ static int lupb_symtab_lookupenumval(lua_State *L) {

static int lupb_symtab_tostring(lua_State *L) {
const upb_symtab *s = lupb_symtab_check(L, 1);
lua_pushfstring(L, "<upb.SymbolTable file_count=%d>",
(int)upb_symtab_filecount(s));
lua_pushfstring(L, "<upb.SymbolTable>");
return 1;
}

Expand Down
Loading

0 comments on commit e5c1583

Please sign in to comment.