Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

incompatible_override_toolchain_transition: Migrate rules to use the toolchain transition #11584

Closed
katre opened this issue Jun 11, 2020 · 4 comments
Assignees
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: feature request

Comments

@katre
Copy link
Member

katre commented Jun 11, 2020

This flag unconditionally makes all rule uses the new toolchain transition. This means that any rule that uses toolchain resolution to fetch tools will need to migrate so that tools are in the correct configuration.

Flag: --incompatible_override_toolchain_transition

Migration:

First, wait for the new feature to be released (presumably in the release after 3.3.0).

See toolchain transition migration for details, but the process is fairly simple:

  1. For rules that create toolchains (i.e., cc_toolchain, go_toolchain, java_toolchain), add the proper cfg attribute.
    1. If the attribute is a tool used in builds (a compiler, a linker, anything that is executed), add cfg = 'exec' so that it will be built for the correct execution platform.
    2. If the attribute is intended to be part of the final target (a library, included source, anything else), add cfg = 'target', so that it will be built in the correct target configuration.
    3. At this point, there will be no change, because toolchains still use the host transition, and that overrides anything set on the toolchain rule itself.
  2. For each rule that uses a toolchain (i.e., cc_library, go_binary, java_test), add the incompatible_use_toolchain_transition = True parameter to the rule definition in Starlark.
    1. This enables the toolchain transition, instead of the host transition, when this rule type depends on a toolchain.
    2. Every toolchain type this rule uses should have been migrated in step 1 above.
  3. Once every rule has been migrated, wait for Bazel to flip the value of the --incompatible_override_toolchain_transition flag. This will take several releases for all rules to finish steps 1. and 2.
  4. Once the flag has flipped, remove the incompatible_use_toolchain_transition parameter from the rule declaration.
  5. Bazel will eventually deprecate the flag and rule parameter and remove them.
@katre katre added P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions incompatible-change Incompatible/breaking change labels Jun 11, 2020
@katre katre self-assigned this Jun 11, 2020
bazel-io pushed a commit that referenced this issue Jun 11, 2020
…ition

Adds a test for the new toolchain transition functionality.

Adds the --incompatible_use_toolchain_transition flag to force all rules to depend on toolchains via the toolchain transition.
Adds the incompatible_use_toolchain_transition rule attribute to force a
specific rule to depend on toolchains via the toolchain transition.

RELNOTES: Rule authors should use the
incompatible_use_toolchain_transition rule attribute to migrate to using
the toolchain transition. jcater to udpate notes further.

Closes #10523.

Incompatible flag issue is #11584.

Closes #11583.

PiperOrigin-RevId: 315959878
@katre katre changed the title incompatible_use_toolchain_transition: Migrate rules to use the toolchain transition incompatible_override_toolchain_transition: Migrate rules to use the toolchain transition Jun 12, 2020
katre added a commit to katre/bazel that referenced this issue Jun 18, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316090981
Change-Id: I8e5afacf59389899587e75d8f7d82d5e5f99fd9f
@konste
Copy link

konste commented Aug 17, 2020

@katre I have a question: we use custom C++ and Python toolchains, but to implement those toolchains we use native cc_toolchain rule and toolchain rule, like that:

py_runtime_pair(
    name = "tab_python_runtime_pair",
    py3_runtime = "@tab_toolchains//thirdparty/python:tab_python_runtime",
)

toolchain(
    name = "tab_python_toolchain",
    toolchain = ":tab_python_runtime_pair",
    toolchain_type = "@bazel_tools//tools/python:toolchain_type",
)

As far as I understand toolchain transition migration is to be done by the maintainers of the cc_toolchain rule and toolchain rule, right? The changes needed are in the implementation of those native rules, not at the place where they are used. Correct?

Specific reason I need to clarify that is because recently bazel cquery started to give us warnings like this:

WARNING: Targets were missing from graph: [ConfiguredTargetKey{label=@tab_msvc_toolchain_repo_64//:tab_msvc_cc_toolchain_64, config=BuildConfigurationValue.Key[5abb50d874a0ab83869e8c0d685014657df6f34d02bb0ebbb59b2108192fcfff]}]
WARNING: Targets were missing from graph: [ConfiguredTargetKey{label=@tab_toolchains//bazel/toolchains/python:tab_python_runtime_pair, config=BuildConfigurationValue.Key[5abb50d874a0ab83869e8c0d685014657df6f34d02bb0ebbb59b2108192fcfff]}]

I cannot make sense of those warnings, but both of them point to the rule directly related to the C++ and Python toolchain. This made me think it may be relevant to toolchain transition migration.
Any advice?

@katre
Copy link
Member Author

katre commented Aug 17, 2020

Both python rules and CC rules need to be migrated, this will be separate efforts. I'm not sure where you are using the cc toolchain: in your example, the py_runtime_pair target creates a specific python toolchain and the toolchain target allows Bazel to know it exists. I don't see an example of a cc_toolchain here. Note that toolchain and cc_toolchain are very different: cc_toolchain creates a specific type of toolchain that CC rules can use to build C and C++ files, whereas toolchain is a core configuration rule used to tell Bazel about specific toolchains that can be used.

I'm not sure what's happening with cquery: you will need to file a separate issue about that so we can route it to the appropriate experts.

@konste
Copy link

konste commented Aug 17, 2020

I see. I was just making sure that there is nothing for us to do if we only use cc_toolchain, but not implement it.

@katre
Copy link
Member Author

katre commented Aug 17, 2020

There is nothing needed for users of rules.

katre added a commit to katre/bazel that referenced this issue Sep 2, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.
katre added a commit to katre/bazel that referenced this issue Sep 2, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.
katre added a commit to katre/bazel that referenced this issue Sep 11, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.
katre added a commit to katre/bazel that referenced this issue Sep 11, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.
katre added a commit to katre/bazel that referenced this issue Sep 11, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316094950
Change-Id: I01002a9c012209434928ac8afb58a52c836e727e
katre added a commit to katre/bazel that referenced this issue Sep 14, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316090981
Change-Id: I8e5afacf59389899587e75d8f7d82d5e5f99fd9f
katre added a commit to katre/bazel that referenced this issue Sep 14, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316094950
Change-Id: I01002a9c012209434928ac8afb58a52c836e727e
katre added a commit to katre/bazel that referenced this issue Sep 14, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316090981
Change-Id: I8e5afacf59389899587e75d8f7d82d5e5f99fd9f
katre added a commit to katre/bazel that referenced this issue Sep 14, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316094950
Change-Id: I01002a9c012209434928ac8afb58a52c836e727e
katre added a commit to katre/bazel that referenced this issue Sep 15, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316090981
Change-Id: I8e5afacf59389899587e75d8f7d82d5e5f99fd9f
katre added a commit to katre/bazel that referenced this issue Sep 15, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316094950
Change-Id: I01002a9c012209434928ac8afb58a52c836e727e
bazel-io pushed a commit that referenced this issue Sep 18, 2020
This is phase 1 of of the switch to toolchain transitions. See #11584 for details.

PiperOrigin-RevId: 332429608
bazel-io pushed a commit that referenced this issue Sep 18, 2020
This is phase 1 of of the switch to toolchain transitions. See #11584 for details.

Closes #12038.

PiperOrigin-RevId: 332439975
bazel-io pushed a commit that referenced this issue Sep 18, 2020
This is phase 2 of of the switch to toolchain transitions. See #11584 for details.

Closes #12039.

PiperOrigin-RevId: 332441640
katre added a commit to katre/bazel that referenced this issue Sep 21, 2020
This is phase 1 of of the switch to toolchain transitions. See bazelbuild#11584 for details.

PiperOrigin-RevId: 316090981
Change-Id: I8e5afacf59389899587e75d8f7d82d5e5f99fd9f
bazel-io pushed a commit that referenced this issue Oct 21, 2020
This is phase 2 of of the switch to toolchain transitions. See #11584 for details.

Downstream Bazel tests: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1692

PiperOrigin-RevId: 338302806
lidizheng added a commit to lidizheng/grpc that referenced this issue Dec 15, 2020
31b3528424 Merge pull request #350 from haberman/encode-depthlimit
e9551022c1 Added depth limit checking to upb_encode().
f389384c5a Merge pull request #349 from lidizheng/json-public
f72c26cbc4 Make :json publically visible
5797d95172 Merge pull request #348 from haberman/json-emit-defaults
7a17493269 Removed print debugging.
695b7f4617 Added code to test UPB_JSONENC_EMITDEFAULTS.
6b357607bd Fixed bugs in JSON encoding with UPB_JSONENC_EMITDEFAULTS.
1b08391979 Merge pull request #347 from haberman/filedef-symtab
ee49a8d7df Added an accessor to get the symtab from a filedef.
a81b47025a Merge pull request #345 from haberman/encode-skipunknown
6535cbe380 Merge pull request #346 from timgates42/bugfix_typo_position
7225108720 docs: fix simple typo, posisiton -> position
871ff96252 Test SKIPUNKNOWN on regular fields.
0569c22a1e Removed debug print.
76764643ac Added option to binary encoder to skip unknown fields.
794ce6d061 Merge pull request #344 from haberman/deterministic-serialize
a04627abc8 Added map sorting to binary and text encoders.
3e071ea91a Merge pull request #343 from haberman/msvc
e70e488e09 MSVC apparently doesn't support the standard C/C++ defines.
963e501aa6 Merge pull request #342 from haberman/fuzz
8d670d8aea Renamed decode_varint32() to decode_tag().
9abf8e043f Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
50a543de7f Merge pull request #341 from haberman/code-size
9c87f1168f Added size benchmark for CODE_SIZE.
6f82028236 Merge pull request #340 from haberman/darwin-setjmp
358fa14d0e Fixed headers and updated benchmark script.
bc200451ce Use a macro instead of an inline function for setjmp/longjmp.
ca279f8afa Merge branch 'master' into darwin-setjmp
fbc0639b07 Use _setjmp on mac to avoid saving/restoring the signal mask.
10f0a38450 Merge pull request #337 from haberman/size-benchmarks
4be07a2dce Increase build timeout until we can parallelize the build.
378a27b640 Force "size" to run locally.
da48e01f05 More google3 fixes.
d2446fd2db Moved cc_api_version attribute to proto_library().
4a84390c89 Added cc_proto_library() tweaks for google3.
4dd4212a34 Merge branch 'master' into size-benchmarks
ffecfef161 Merge branch 'master' into size-benchmarks
86f671d5fd Fix for Darwin (output is different, but it won't error out).
165e01ec6f Fix for old Python versions.
40fdff5e43 Merge pull request #339 from haberman/benchmark-alias
5f8bb5de1d Updated generated code.
65d166a6ba Added API for copy vs. alias and added benchmarks to test both.
27b9c999a7 Merge pull request #338 from haberman/arena-initial
9df96874e9 Start arena block doubling at initial block size.
881ddac7fe Also use .format() for gen_synthetic_protos.py.
8b7dabe1a2 Use format() instead of string interpolation, for old Python versions.
8e08282c3b Removed unused small.proto.
0f79d47215 Added missing lite binaries to size_data.txt.
555fbbc0bc Size benchmarks are working pretty well.
85cbc41a89 Merge branch 'master' into size-benchmarks
e5bdfba92c Removed accidentally-added .orig file.
07851fac58 Merge pull request #336 from haberman/fuzz
982b634bc5 Fixed a few minor bugs found by fuzzing.
c9d2e58480 Merge pull request #310 from haberman/fast-table
a01f3e23a4 Fixes for google3 build, and exclude even more tests from macOS to avoid timeout.
a83d55ee4b Exclude Clang tests from MacOS to avoid Kokoro timeouts.
73fcfe9ed0 Tried to slim down the tests a bit more.
baab25b7aa Removed excess/redundant tests from Kokoro script.
1eb7bd39e7 Some formatting fixes.
9d87055ce4 Updated Kokoro build script.
4bd34da105 WIP.
a7993615bf Merge branch 'master' into fast-table
3a3efe69a2 Added incompatible_use_toolchain_transition = True per https://github.com/bazelbuild/bazel/issues/11584
7b4e376f79 Switch unordered_set -> absl::flat_hash_set.
fe62fc83e1 Removed obsolete includes in benchmark.
5ed089dc42 Merge pull request #335 from haberman/wyhash-rule
e9b79542ad Added a BUILD file for wyhash.
7b8ae7ec4e Merge branch 'master' into size-benchmarks
a5b5445da6 Merge pull request #334 from haberman/rm-port-c
6c16cba83f Removed obsolete port.c file.
484d8f746a Updated comment in wyhash.h to correct spelling mistake.
6a9d0f45b8 Merge pull request #333 from haberman/32bitfixes
5b1f0d86a1 For Kokoro, only build/test -m32 on Linux.
0497f8deed Fixed a critical bug on 32-bit builds, and added much more Kokoro testing.
7543f851f1 Merge pull request #332 from haberman/php-amalgamation
64abb5eb11 Amalgamation no longer bundles wyhash, but #includes it.
a2a40792b5 Merge pull request #331 from haberman/json-oneof-fix
dd0994d377 Bugfix for JSON decoding: only check real oneofs for duplicates.
496f638025 Merge pull request #330 from haberman/symtab-longjmp
c9f9668234 symtab: use longjmp() for errors and avoid intermediate table.
4d9a8cd67b Merge branch 'master' into symtab-longjmp
6322d1d72d Merge pull request #329 from haberman/benchmark-ads-descriptor
5ec1d39224 Avoid building .pb.cc for ads protos, as C++ takes forever to compile.
43c207ea7e Added CMake dummy rule.
c3b5637646 Added benchmark for loading ads descriptor.
acd72c6d3f WIP.
6ae3b66cd2 Merge pull request #328 from haberman/optdefload
8113ebd6c7 Added explanatory comment about integer constants.
f2d826b9f3 Got rid of floating-point division in table init.
723cd8ffc1 Added wyhash code and LICENSE, and removed temporary benchmark.
15e20636c3 Merge branch 'master' into optdefload
154f2c25f4 Added UTF-8 validation for proto3 string fields.
e8f9eac68c Added #defines UPB_ENABLE_FASTTABLE and UPB_TRY_ENABLE_FASTTABLE.
994cf07cf3 Merge pull request #327 from benjaminp/modern-linking
b5bd5807a7 Migrate to modern Starlark linking api.
dc64613607 Merge branch 'fastest-table' into fast-table
e86541ac1d Fixed the build after the merge.
1cd0cb17d3 Merge branch 'master' into fastest-table
901744a97e Merge pull request #326 from haberman/c99
a0d16e7073 Added a few missing copts, and made some functions proper prototypes.
558315a1c3 Added COPTS to :port.
7e5bd65098 Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
8f3ee80d46 Drop C89/C90 support and MSVC prior to Visual Studio 2015.
a274ad786a Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
2c8bb6dd9d Specify C99 explicitly until/unless we stop using bool.
efd576b698 Added -std=gnu99 for fastdecode and ran Buildifier.
b928696942 A few more fixes, and test fastdecode under Kokoro.
55f3569cd2 A few minor fixes and more assertions.
8b38e8f214 Merge branch 'fastest-table' into fast-table
46eb82467a Added comment to decode_fast.h.
bd9f8f580d Fixed a few bugs with the fast decoder.
3eba47914b Allocate hasbits and table slots in "hotness" order.
021db6fcd5 Allow larger tags into the table if they are unique mod 31.
86d9908c55 Fastdecode support for packed fields.
e3e797b680 Added fasttable support for oneofs.
7ffa9c181a Fixed some small bugs and performance problems in string copying.
e2c709e047 Repeated string and primitive support.
e9103eda9e Merge branch 'master' into fastest-table
0756999ab6 Merge pull request #325 from haberman/inlined-arena
25db40bc30 Fixed upb::InlinedArena, which was compeltely broken.
d81ba58215 Optimized short string copying.
f3a2a79349 More optimization, back up to 2.56GB/s.
199c914295 Simplify push/pop when msg fits in the current buffer.
d5f5db2729 Put string-copying field parser into a separate function.
883f20d4dc Merge branch 'master' into fastest-table
1bd62e8218 Merge pull request #324 from haberman/simplemomi
f4adbe0698 Optimized varint decoding from Gerben.
48689df72e Eliminated bounds checks inside parsing a field.
a345af9883 Added a codegen parameter for whether fasttables are generated or not.
8a3470c543 WIP.
8e8dbb5258 Merge branch 'fastest-table' into fast-table
7d17a0e8c5 Merge branch 'master' into fastest-table
a7e2e8338d Fixed benchmark script.
72de7b7002 Merge branch 'fastest-table' into fast-table
cb234e652c Merge branch 'master' into fastest-table
b86cf2d789 Merge pull request #323 from haberman/build-files
4ea81ab107 Fixed pedantic warning.
6399b31f4b Removed ULL constants in json_decode.c.
c8ae197e64 Removed "U" suffixes, they are not necessary.
bc1e0b314f Fixed some strict C89 errors.
2c1664906a Removed license comments and upb_amalgamation for google3.
b7dc77415a Added licenses() to all BUILD files.
de22764b33 Updated Kokoro to test ... instead of :all.
e3f41de6c7 Split monolithic BUILD file into many build files.
fbe2bcafbc Merge pull request #4 from gerben-s/gerbens-fast-table
9e68ec033f Add repeated varints and fixed parsers
d0e4b688c6 Shorten name of kAliasString, so benchmark results don't wrap.
c0c9b5a168 Regenerated generated code.
eb8e6de8b7 Regenerated source files.
7f0d535826 Merge branch 'fastest-table' into fast-table
bf8e08074c Added a few more comments.
6e3c22e6ee Merge branch 'fastest-table' into fast-table
3238821315 Gave fast table entry a nicer name.
2a574d3d01 Added a bunch of comments for readability.
0deca8b8fb Merge branch 'master' into fast-table
bfadc99709 Merge branch 'master' into fastest-table
84e0f6127d Merge branch 'master' into fastest-table
61c51a607b Merge branch 'master' into fast-table
4f066765a9 Merge pull request #320 from haberman/string-view-benchmark
bf393bf086 Cleaned up benchmark names.
9eb8414b31 Added descriptor_sv.proto.
ee7da95367 Bzl formatting fix per buildifier.
de1b6b0718 Refactored proto2 benchmarks and added StringView benchmark.
c2901eeee1 Added missing #includes (caught by Blaze).
52721eadc7 Order LargeInitialBlock after non-initial-block test.
44a7130845 Used the correct copy of the protos in the benchmark.
3a242e7a48 Merge branch 'master' into fast-table
d01b712dbb Merge branch 'master' into fastest-table
d225dfc2ed Buildifier formatting fixes.
b0994a6501 Added missing dep from benchmark.
de80054018 Make required fields optional for benchmarking.
745661bf1f Merge branch 'master' into fastest-table
11585095b7 Merge pull request #319 from haberman/copy-descriptor
fd5a35d49d Minor comment changes.
bdd1a516e8 Fixed other tests.
27262adf93 Snapshot descriptor.proto into our own copy for benchmarking purposes.
d6b40fd5e2 Added missing dependency on reflection.
b9f1b67d07 Use quoted include.
1c8c16b9b1 Use quoted include.
4f901b6430 Passes all tests.
de84e20788 Merge branch 'master' into optdefload
d5c64476fd Merge pull request #318 from haberman/descriptor-load-benchmark
42d2f6cef9 Add MB/s measures in the benchmarks.
1ce98b86ec Added LoadDescriptor benchmark for proto2.
4890735ce2 Added benchmark for descriptor loading.
6f59f1256e Optimizations to descriptor loading.
6874d61704 Merge pull request #317 from haberman/gencode-compat
c81113e60f Added fallback code for when no enum matches.
c10b24ffb2 Simplified switch().
ded2e657a7 Added compatibility with old generated code.
5b0c5c7d4a Dispatch inline.
75edd3e59c Changed to use table pairs, seems to ever-so-slightly regress.
69d99a247e Merge pull request #3 from haberman/shifted-table
bca7edac8c Cleaned up table compression a bit.
b95f217996 A little speed boost, now hitting 2.51GB/s.
8ed6b2fe85 Stored mask in the table pointer.
a6dc88556d Tables are compressed, but perf goes down to 2.44GB/s.
91eb09b1bc Add a few comments.
7a1835d7c3 Merge branch 'master' into fast-table
8bd5c0088e Merge pull request #316 from haberman/submsg-array
a4966fd230 Added a few extra sanity checks.
99acbe0da8 Fixed bug where submsg array could have excess elements.
2a0425ecf5 Merge pull request #315 from haberman/conformance-fixes
7ccf5650c7 If we encounter "null" for a non-NullValue enum, throw an error.
0a3a94a12f Updated to a new version of protobuf and fixed a few conformance tests.
ddd5f28c4f Merge branch 'is_bazel'
10fa3a0c77 Merge pull request #314 from haberman/addunknown
504e105420 undef UPB_ASAN.
ab96d1ec41 Removed extraneous C++-style comment.
d5096f9ee8 Fixed bug in addunknown and added ASAN poisoning.
6fe84526be Mark _is_bazel to be replace in google3.
f01efe8b64 Removed another C99-ism.
1749082bbb Removed C99-ism.
147e363f56 Merge branch 'master' into fast-table
f2ddc15d76 Bugfix: initialize fastlimit and fastend.
65e49b694b Merge branch 'gerben-fast-table' into fast-table
1abf7d418d Added generated files.
3f719fa6b2 Bugfix: offsetting hasbits with 16 introduced a bug in calculating hasmasks. Removing extra <<16 shift in hasmask calculating and masking out the first 16 bits. This makes messages without hasbits work as well.
aec762e405 Merge branch 'master' into fast-table
4f77aaafd8 Merge pull request #2 from gerben-s/fast-table
4053805759 Bugfixes
d1cd80385b Merge pull request #313 from haberman/inline-arena
ad21083623 Merge pull request #313 from haberman/inline-arena
2339fc779c Updated obsolete comment.
b393849bbd Updated obsolete comment.
ebe53f8590 Fixed compile error.
b37f82b58b Fixed compile error.
71749b7caf Implemented inline array allocation, and moved type->lg2 map to reflection.
9557b97acc Implemented inline array allocation, and moved type->lg2 map to reflection.
b58d2a0ee6 Shrink overhead of message representation.
0bf063a2ca Shrink overhead of message representation.
d87ceeacab Shave off one more store.
ddc52ab9d6 Shave off one more store.
c25d895adf Shrunk the arena state that needs to be synced.
7f67f68c1c Shrunk the arena state that needs to be synced.
ff40dd6ea9 Added new internal header.
85a43e5461 Added new internal header.
36662b3735 Refactor some code. I extracted some common code from all message field parsers, to a tail recursive function. Removed the varint jmp table for a simple varint parse loop, that removes the stack frames. Also careful with not losing information in repeated message tag check. When written mindful the checks and loads that happen can be reused for tag dispatch if not the expected tag.
cbcd635917 Fixed memory leak.
bcbcdadbd2 Fixed memory leak.
e5264bd794 Merge pull request #312 from haberman/defiter
52957fa984 Merge pull request #312 from haberman/defiter
746f64692c Moved arena inline for decoder.
7363b91ac3 Moved arena inline for decoder.
b8ef1dcc57 Removed C++-style comments.
575acd85bd Re-added const for all of the pointer wrapper types.
5aa5b77b41 Added simple offset-based accessors for defs, and deprecated old iterators.
33384301e2 Merge pull request #311 from haberman/proto2-benchmark2
578e7c1f4c Merge pull request #311 from haberman/proto2-benchmark2
bc301e7da4 Use merge/partial variants to give proto2 benchmark the fairest hearing.
30f01afa83 Added LargeInitialBlock test for proto2.
5d23fd99af Used shorter protobuf:: namespace alias.
9938cf8f27 Put submsg_index directly in table data. Drop oneof support for now to focus.
d87179501d Another build fix.
89bd8b87e1 Fixed a few more C89 compat issues.
64d293894a Fixed bug introduced by last optimization.
ff957b996c Fixed C89 compat issues.
537b6f42c2 A few updates to the benchamrk and minor implementation changes.
0dcc5641eb Replicated dispatch and implemeted array resizing logic. Up to 2.67GB/s.
526e430794 I think this may have reached the optimization limit.
4c65b25daf Handle long varints, now 2GB/s!
e39ec95ca2 Hoisted updates to limits and depth out of the loop.
52a0ed3891 Fixed a bug with tag number 15.
388b6f64eb A small optimization: don't increment array length every iteration.
9e5c5ce089 Optimized memset() with cutoff and fixed group & unknown message bugs.
8dd7b5a2ca A bunch more optimization.
e46e94ec7f Added benchmarks for proto2.
405e7934b1 Handle 2-byte submessage lengths.
88b1ec7784 Table-driven supports repeated sub-messages.
f173642db4 Handle non-repeated submessages.
e219a2d91d Merge branch 'decode-arena' into fast-table
7ec2c52346 Donate/steal from arena to accelerate decoding.
d43ccfa079 Revert test changes.
fac992db83 Cleanup for showing.
3937874a85 We have a properly structured algorithm, but perf regresses by 20%.
438ecaeb5a Give all field parsers a generic table entry.
383ae5293e WIP.
26abaa2345 WIP.
34b98bc030 Avoid passing too many params to fallback.
763a3f6293 WIP.
02ff6fb996 Merge pull request #309 from haberman/decoder-forceinline
a202ce9629 Add UPB_FORCEINLINE for varint32 decoding.
d0f2c4c8a2 Merge pull request #308 from haberman/encoder
5741eb9ad7 Expanded benchmarking script and added one size opt to the encoder.
0135399e60 Fixed bug introduced in refactoring.
df3438222b Notated impossible branch as unreachable.
9b31e8fe12 Merged common encode tag paths.
5d7dc718cc Minor formatting fix.
80441e4eb4 Optimized binary encoder.
ada28896b9 Changed encoder to use longjmp() for error recovery.
6e140c267c Added benchmark for encoding.
7338facddb Merge pull request #307 from veblush/port-backport
4d2251c3e4 Add UPB_NORETURN for MSC
382d5afc60 Merge pull request #306 from haberman/bigendian
efefbffc80 Fixed binary encoding and decoding for big-endian machines.
5d3083013c Merge pull request #304 from haberman/upb-assume
55dd9d3e41 Fixed UPB_ASSUME() for non-GCC, non-MSVC platforms.
e4c8afd0d4 Merge pull request #303 from haberman/packed-def
8284321780 Fixed upb_fielddef_packed() to have the correct default.
ed86d98f53 Merge pull request #302 from haberman/verify-utf8
8e26a33bcb Added a test for UTF-8 parse checking and added missing error reporting.
2c666bc8f6 Use C-style comment instead of C++.
a77ea639d5 Verify UTF-8 when parsing proto3 string fields.
7f19072206 Merge pull request #301 from haberman/rm-pop
bfdfe5a914 Removed unused push/pop functions.
1479f2d7ca Merge pull request #299 from haberman/google3-fixes
8f11ec57d2 Applied changes from google3.
7172b981dd Merge pull request #297 from haberman/bugfixes
ffe40c9f94 Only run Valgrind if it is present.
922c126b8b Fixed unit test errors that were causing Valgrind failures.
086a68d191 Fixed memory leak that could occur after upb_arena_fuse().
35abcc248b Added test that should trigger a memory leak.
7d726c8da6 JSON parser: Bugfix for float/double in quotes.
74c60c757b Merge pull request #296 from haberman/php-fixes
efe11c6c50 Removed excess logging statement.
92e63da733 Merge pull request #295 from haberman/mac-compile-fix
e179dda212 Added initialization of all members to satisfy compiler warnings.
81c2aa753e Fixes for the PHP C Extension.
f7fcc0df37 Fix divide by zero vs2019 compilation error #293 (#294)
7d38c201fa Enabled conformance tests to run under ASAN. This apears to work now. (#292)
0dc2394da5 Changes to support import into google3 (#291)
363e39c171 Fix for extra compiler warnings. (#290)
b717575cef Added -Wextra and -Wshorten-64-to-32 and fixed resulting errors. (#289)
2e335ab9d2 Merge pull request #288 from haberman/ubsan
408d34797d Disable UBSan, Clang is not available in upb's Kokoro image atm.
6b808a4072 Fixed all UBSan issues and added UBSan CI checks.
7f5b8d73b0 Merge pull request #287 from haberman/php-amalgamation
634d37515c Bugfix for oneofs and added line/col info to JSON.
543a0ce8f2 Fixes for PHP. (#286)
93e2a40881 MSVC 2019 Fixes (#285)
a1c2caeb25 More arena tests. (#279)
16facab490 Created an amalgamation without handlers, and fixed some bugs. (#283)
22182e6e54 Simplified epoch day algorithm. (#282)
55f5bcd62c Add upb_symtab_lookupfile2 (#281)
c26e8db53d Ignore Unknown Enum Value (#280)
6c4acba610 Implemented upb_arena_fuse() (#278)
2b1e7dc1cc Arena refactor: moves cleanup list into regular blocks (#277)
a0ae30bd16 Remove bytes allocated measurement functions. (#276)
025cc2ec3d New arena benchmarks that actually hit the heap. (#275)
cef720e9b0 Parser bugfix and updated generated file. (#273)
262bcbcada Updated generated files. (#274)
0842f88211 Support for proto3 optional. (#270)
d638d74d1b Add load statements for @rules_proto (#271)
2559e78aa3 Separated C++ wrappers into separate files in a backward-compatible way. (#265)
9bd23dab42 Changed upb status to suit GCC10's warning about strncpy(). (#268)
38a1045975 Added a has_foo() generated method for proto3 submessage fields. (#266)
ef25ea5281 Added Kokoro verification of the ASAN build. (#220)
378cbbc3cc Updated to new protobuf version, and added support for packed=false. (#264)
08b6d2d6fd Rewrite of the decoder (#263)
4e2505edaa Merge pull request #259 from haberman/rmsubmodule
91fd76cc9c Merge pull request #258 from haberman/bazel_version
d0d5339620 Removed .gitmodules, we don't use submodules any more.
6c5d5afc43 Remove compatibility code for old Bazel versions.
c1357afb2e Merge pull request #230 from moroten/maybe-deps
a3d693544b Merge pull request #257 from haberman/warnings2
63e673383b Fixed narrowing warnings in text_encode.c.
39bc93a527 Merge pull request #252 from haberman/jsondecode
0fdd65f223 Merge branch 'master' into jsondecode
82af3d661c Merge pull request #255 from protocolbuffers/const-array
90b3a20af0 Making sure _upb_fieldtype_to_sizelg2 is readonly
97bcd5276c Merge pull request #253 from haberman/warnings
aacdcf8b91 The compile is now clean of -Wshorten-64-to-32 warnings.
5667a7a806 Removed stray assert, causing C90 build errors.
23a5af3513 [json] fixed all remaining conformance bugs.
6ec4df82c1 Updated other parts of upb for new JSON name API.
a292261aeb Added JSON decoder to conformance tests, and fixed tons of bugs.
d49c1db6c2 New JSON decoder, string->msg using reflection.
e70853d71f Merge pull request #251 from haberman/emptyfix
b409f8cd85 Fixed code generator for upbdefs when a file has no messages.
58010a3f73 Another fix for google import.
4b8c04e521 Ran buildifier and fixed a few things for google3 import.
95fb9b2e38 Merge pull request #250 from haberman/jsonencode
d7d72f0075 Updated CMakeLists.txt.
872f4ceb8f [json encoder] passes all conformance tests.
384cf15b0f [json encoder] passes almost all conformance tests.
6e9db7dafc Fixed JSON encoder so that it compiles.
43d8673623 Merge branch 'master' into jsonencode
02c89a8b15 Renamed textencode -> text_encode for greater readability. (#249)
bb2db35464 Fixing Windows build. (#247)
60d0966a0b [jsonencoder]: wrote most of the code, haven't even compiled yet, let alone tested.
1da9cfde77 A few bugfixes.
ca84145476 [decoder] fix for buf=NULL, size=0 case. (#246)
4c6dcc3c6b [textformat]: added missing newline when a message opens. (#245)
3d955e684c Added "extern C" blocks to textencode. (#244)
ca512852f3 Fixed parsing for string->double maps. (#243)
ce1a399a19 Text format serializer for upb_msg (#242)
888f35cae6 Merge pull request #241 from haberman/conformance-fixes
46b93f8cea A bit more cleanup in the decoder.
ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug.
a202c5f84d Merge pull request #234 from haberman/parser
4c974cf72d Fixed generated files.
9a870d957f Removed upb_decframe and made ptr an explicit parameter and return.
a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled:
9e1f89ef2c Merge pull request #224 from haberman/maps
ce0496eb86 Merge branch 'master' into maps
e911aae5f6 Factored upb_map_entry into a shared place.
d8f3d6f9d4 Merge pull request #233 from annarev/add_port_dependencies
a27429f265 Add port_def.inc and port_undef.inc to generated code hdrs
3797ad2217 port should not be public
578dc32208 Set port visibility to public.
fc4941183f Add :port dependencies to libraries that include it
4c1a97ae9c Merge branch 'master' into maps
7d1abedbdd Merge pull request #232 from annarev/forward_assert_changes
1b131ca544 Merge pull request #231 from annarev/fix_build_for_sync
d2389ba261 Add correctness asserts to upb_addmsg
de1bc11663 Split port into its own target, add msg.h to :legacy_msg_reflection
f593289087 Merge branch 'master' into maybe-deps
abdf14937d Merge pull request #216 from XrXr/use-memcpy-to-do-unaligned-read
47ab661706 Merge pull request #227 from lizan/absl_workspace_name
0b63c75164 Do not strip :descriptor_upbreflection and make some headers public that are used outside of the their module
0c2046f732 Make workspace_deps.bzl overridable using maybe()
59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps
744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables.
f9efbcd5d6 Added missing append fallback.
c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object.
d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs.
059f226d41 Unit tests for maps generated code.
520ddc1f11 c89 fixes.
806c8c9c6e Removed obsolete testing files.
2a85bef825 Generated code interface for maps is complete, though not yet tested.
7f5fe52dfa Fixes for non-C89 code.
6c2d732082 Fixed upb's map parsing to overwrite existing elements.
090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer.
0fbae939d2 Removed stray fprintf().
572ba75d1c Removed comma after final enumerator.
c9135e5276 Fixed the build.
d040aa1302 Merge branch 'master' into maps
e18541a9dd Added some missing files.
2a25fd557e Merge pull request #226 from lizan/upb_bazel_version
92509cc3b2 Rename lua_test.
382f92a87f Maps encode and decode successfully!
4c57b1fefd More progress on Lua extension.
d6c3152c0b Added more Lua tests that are passing.
ae66e571d4 Fixed some bugs and added a few more tests.
bfc86d3577 Fixed many bugs, basic Lua test passes!
b518b06d75 Lua test program is loaded successfully.
6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps
cc6db9fb0b Fixed crash bug.
88d996132e Added Lua main.c test driver program.
626ec4bfcf Everything builds, test pass except test_decoder.
5239655b99 WIP.
23825332e1 WIP.
27b95c969a WIP.
8a3ae1ef3e Merge pull request #229 from veblush/zlib
34e55c1c56 Use github.com as a zlib repo
bcdfe6b1b0 bazel: use canonical repository name for absl
b973c06480 prefix bazel_version
9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}.
dc58b657ee New reflection API doesn't need types as parameters for map/array.
c486da3970 WIP.
b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps
cc8e894b63 Merge branch 'master' into maps
f32f2fdb25 Merge pull request #221 from haberman/endsubmsg
ea99941f92 Merge pull request #223 from haberman/timestamp
88b1026d26 Fixed leap year handling by reworking upb_mktime() -> upb_timegm().
715718d5a5 Changed endsubmsg handler to return the closure of the submessage.
946880c105 Merge branch 'master' into maps
56589c7276 Merge pull request #219 from haberman/asan
1ed64db8c2 Fixed compiler error "error: control reaches end of non-void function".
32bed8562a Merge pull request #217 from haberman/fix-bazel
5768e68ed7 Fixed for Bazel >= 1.0.
a73fd86c13 Use memcpy to perform unaligned reads
9effcbcb27 Merge pull request #213 from veblush/c99
905d1913f7 No // comment
e5f873198e Removed -std=c89 option
cdb3779e99 Merge pull request #210 from haberman/asanfix
4e77dc16c1 Merge pull request #209 from haberman/pbcodecache2
29c30e9cb3 Fixed cache to properly insert by msgdef key.
555b60b062 A memory safety fix, found by ASAN.
ca4605b3af Properly cache decoder methods, instead of regenerating every time.
2c86919770 Merge pull request #208 from haberman/bool_bugfix
509f1e474f Bugfix for boolean defaults.
1461da5056 WIP.
d3762e96cb Accpet string for numeric wrappers (#202)
931bbecbd3 Merge pull request #205 from veblush/murmur
59f43cd6e3 Merge pull request #204 from veblush/msvc-port
311049a67e Merge pull request #203 from veblush/clang-port
6f9a9fb2fa Rename MurmurHash2 to upb_murmur_hash2
ce4c4fd76b Clean up MSVC port for vsnprintf
bc6d9518e1 Make it use builtin functions on clang
b70f68269a Merge pull request #201 from veblush/ubsan2
3838f62aa5 Fixed ubsan error on memmove
638d114a1a Merge pull request #200 from veblush/ubsan
bc8b1a8f90 Fixed UBSAN issues
7e7cb5f831 Merge pull request #199 from veblush/upb_alloc_global
98ae7806e9 Add extern C to upb_alloc_global
94d74ce700 Merge pull request #198 from veblush/shorten
588128ccce Merge pull request #197 from veblush/likely
a8bb192fa4 Fixed -Wshorten-64-to-32
401285b2f1 Use UPB_LIKELY only when GNUC
f3514c0600 Merge pull request #196 from veblush/strict-prototypes
2c3a28e411 Add -Wstrict-prototypes option
76d75aec66 Merge pull request #195 from veblush/vsnprintf
7a1e6aa84b Support MSVC prior to 2015
f179e23e5b Support Visual Studio
423ea5ca9c Merge pull request #194 from veblush/conversion-warning
2825f867bb Remove conversion warning
1ee1e36256 Merge pull request #193 from nicolasnoble/windows-flags
a2013f0fc2 Trying to be more flexible with the version of bazel we can use here.
4d8af5e4b9 Adding (v)snprintf and va_copy for Windows.
6e85c2bf03 Fixing the separator string.
0a07f2714b Merge branch 'master' into maps
9605c7093c Revert previous fix - to_list() is too new, or...?
ce3ba4dcdc Disabling gcc flags for Windows build.
a73ae43786 Merge pull request #185 from TeBoring/int64-json-fix
41e42d12b9 Merge pull request #188 from Google-Autofuzz/master
21cef48fc3 Merge pull request #190 from haberman/style
ee87a28d2d Some minor style fixes.
14f4c9eadc change back to the original BUILD
b52178d54b modified BUILD
7d0b7c838f fix -fsanitize
5149dc5ce2 Update BUILD
3f622103c2 Merge branch 'master' of https://github.com/Google-Autofuzz/upb
8f19667786 modified fuzz config
47f4983fcc Create README
18de110b00 Merge branch 'master' into maps
2d18dfbcd2 Merge pull request #187 from haberman/fixes
493e9b2614 Build fixes from fuzz target.
a6347ec35e Change methods name to specify as number/string
8e5f03f719 Fix integer types
6ce5e722f1 Merge pull request #186 from Google-Autofuzz/master
76baf906c9 Update BUILD with OSS-FUZZ
c4a8498103 Add simple fuzz target for upb
c50e849ac2 Change int64 json encoding to be string
312c6b421a Merge pull request #183 from haberman/bazelfix
75d680d7b0 Small fix to upb_proto_library().
ef6ce94bfe Merge pull request #182 from haberman/bazelfix
57a63d4c7b Fixed upb_proto_library() logic for calculating output dir.
283857f308 WIP.
5dea3f8486 Merge branch 'master' into maps
7cd1b9362b Merge pull request #180 from haberman/rmreflective
9960d7c772 Renamed end_group field number and updated documentation.
da4e616860 Removed type from upb_array also.
56779f09eb All tests pass again.
ba0a2fb955 Compiles, doesn't work yet.
e1f84aeb10 Merge branch 'master' into rmreflective
00e739648d Merge pull request #179 from haberman/benchmark
901463e41e Added benchmark of parsing.
7485261370 WIP.
26245628a9 Merge pull request #178 from haberman/generated-only
583f24fec1 Merge branch 'master' into rmreflective
d5137134e0 Merge pull request #177 from laurentlb/master
ba29af3a6a Hid generated-code-only headers inside a separate library.
07ac6f0e8e Merge branch 'master' into maps
1a5a609b0e Update upb_proto_library.bzl for Bazel compatibility
9f49efef62 Merge pull request #173 from hlopko/migrate_for_bazel_027
6d204851d2 Update upb to be forward compatible with Bazel 0.27
1a77fbce39 Merge pull request #171 from haberman/master
7804454f68 Merge pull request #170 from haberman/upb_mktime
811ee4f442 Use a custom mktime() function to avoid platform dependencies.
8a41e6cb12 Fixed amalgamation to not exclude upb/decode.c.
960c2492bf Updated Git hash.
d16bf99ac4 Updated README.md and examples/bazel directory.
5611ff267b Moved bazel files to bazel/ directory.
f74cb51f11 Refactored workspace deps into a separate file.
240bf641de Working example dir for Bazel.
77600acc84 Merge branch 'master' into readme
a288f761c1 Small typographical tweak.
4d89a44b26 Some revisions to README.md and DESIGN.md.
ae107c7ab9 New README.md.
d5af87d06b Merge pull request #168 from haberman/bugfix
a8f719c98d Added checks for OOM conditions.
68d3810766 Merge branch 'bazel25'
17568d619e Added .bazelci/presubmit.yml for BuildKite.
184cc8ecfa Merge pull request #167 from haberman/bazel25
a126b9a046 Removed package(), Bazel doesn't support it.
44817c02fa Added package() statement.
c58541ea04 Added support for public dependencies.
ef9499cb44 Migrate std::unordered_map -> absl::flat_hash_map.
06b90f9b69 Split upb_proto_library.bzl into its own .bzl file.
d94c2d3c74 Another fix of course.
717db51700 Updated protobuf to the main branch again.
1cf4af7b2c A (final?) round of Blaze fixes.
5e5e0cf24a More Blaze fixes.
4451b790bd More Blaze fixes.
e04216eb0f More Blaze fixes.
c0a1afa16f More Blaze fixes.
9b07311c7c More Blaze fixes.
7913bc678a Removed obsolete references to runfiles scripts.
81e813d389 Made upb_proto_reflection_library() a true aspect.
301b6e2d78 Removed map_dep() in favor of rewrites.
9a66356d95 More Blaze fixes.
13eb14986b More fixes for Blaze.
a37877a326 Fixes for Blaze.
04350e1d1b Merge pull request #166 from haberman/bazel25
f060528396 Updated protobuf to point to main repo.
0fea70b4d9 Works with Bazel 0.24.1 and Bazel 0.25.2!
cbe051a09c Re-enabled conformance tests.
e294a16c08 Added name to cc_library_func() to avoid conflicts.
61034f50b3 Fixed conflict error with Ragel on Bazel 0.25.
6c1b78f095 Update Skylib and update to newer Sandwich API.
20d849a5e0 Fixes for Bazel 0.25.
b08819749e Merge pull request #162 from haberman/aspect
e1fb10002d Fixed include path.
985145ca16 Fixed amalgamation and CMake build.
d6e466e943 More refactoring/simplification.
65f97218d1 Removed some obsolete code.
9fa3e8bd62 Fix the Ubuntu build.
239d4a90db Fixed upb_proto_library() for macOS.
f9dab27de3 Merge pull request #164 from haberman/oneofcase
151ebc8a29 Fixed oneof case accessor to cast to enum for C++.
cd9e1e6817 upb_proto_library() aspect is working, even for external repos.
f3c560122a upb_proto_library() works for local project!
02e26c5004 Replaced upb_proto_library() with a truly aspect-based rule.
932753d91e WIP.
0c64c4b594 WIP.
cf35baa1ad Moved macros from upb.h to port_def.inc to avoid leaking them to users. (#160)
928ef7f2c0 Removed reflection and other extraneous things from the core library. (#158)
00f96cb947 Fixed macOS Kokoro build for new Bazel. (#159)
e999afb612 Merge pull request #150 from haberman/apitweaks
0abf6083b3 Merge branch 'master' into apitweaks
a8a0bc73b9 Allow bytes field to be longer than 16000 bytes (#157)
0ca4edd7d9 Merge pull request #156 from TeBoring/strptime-fix
f298f3078b Remove _XOPEN_SOURCE from amalgamate.py
f3d5ff02d1 Commented out missing file
3c4f0347f9 Replace strptime with custom implementation
56fefe2a50 Fix parsing repeated well known type value (#153)
fa88c6017d Merge pull request #155 from haberman/fwd-decl
e86e198690 Changed enums to be open int32_t.
9cd426495e Merge pull request #151 from linux-on-ibm-z/master
ed9faae099 Merge pull request #141 from haberman/defcleanup
71ec01e34b Fix for Windows.
f8ba0f67f2 Merge branch 'defcleanup' of github.com:haberman/upb into defcleanup
55e23d4bef Merge branch 'master' into defcleanup
51f30e064b Merge pull request #152 from TeBoring/ruby-fix
8b75e5c119 Add _XOPEN_SOURCE to amalgamate.py
da8d1392c1 Fix the issue for strptime
17db372267 Removing the 'byteswap.h' header which is not portable
f858e0160e Merge branch 'master' into defcleanup
c3e6bb5318 Merge pull request #148 from TeBoring/empty-fieldmask
ad905b08f5 Fixed amalgamation to properly include stdint.h first for UPB_SIZE().
5575a228c9 Merge branch 'master' into defcleanup
32e3f394b4 A few small API tweaks.
b0292a9eb1 Merge pull request #149 from haberman/fixmacos
eb633dbe3c Query CMake version.
e223001916 Update table.c
33cd3cfa1d Update varint.int.h
afaa22eb3d Update test_varint.c
2b62fbce67 Merge pull request #145 from haberman/arrayapi
3d93155790 Fix to deps.
b07fcde013 Fix for C++ inclusion of decoder.int.h.
22ad7121c2 Fixes for google3.
8e737d4f9a Discard extensions since current symtab can't handle them.
68d86cbc59 Ported BUILD file fixes for google3 to arrayapi branch.
c1706e0a7c Added a few more missing functions.
afdd4698ba Added missing fielddef function implementations for C++.
865876895d Fixed tests and code.
0dbbfd1f80 Added missing functions.
c4327e55ac A few more fixes.
8980f6db5c text_printer.h now successfully compiles.
c358bb42fd A few more Google fixes.
76033b3a65 Correct TextPrinterPtr.
2719bcff0d Fixes for Google-internal tests.
ca5f951137 More fixes for google3 import.
9bc7973e38 Fixes for Google import.
7f9f7222bf Changes for google3 import.
77371f050c Some rearranging and cleanup.
0517c462e6 Delete obsolete dump_cinit.lua.
f4532ab273 Properly align the arena.
315c167bed Some more fixes for PHP.
04923fc26e Some fixes for PHP.
12a5297740 Fix empty FieldMask json encoding
8cd3b9dfa9 Moved some definitions to def.h
e13e1c46ae Merge branch 'arrayapi' into defcleanup
e5ccbdcdd0 Merge branch 'master' into arrayapi
c7870e0f77 Supprot FieldMask json encoding/decoding. (#147)
01557462cc upb_symtab_add() returns upb_filedef* instead of bool.
84fb01ad0f Removed the JIT.  Nobody was actually using it, and table-driven should achieve 80-90% of the perf.
2c26f60dbb Added some comments and reversed upb_arena_cleanup() args.
9349b703a3 Fixed a few bugs surfaced by Ruby.
f30c7f4acb Take sinks by value.
9ae5a3af5b Merge branch 'arrayapi' into defcleanup
1508648f30 Build & fix the JIT.
754b9f1cfd All tests pass again!
cb26d883d1 WIP.
a9c375f8ea Partway through refactoring of Arena.
ef7c50223a All tests pass again!
48863ea0be A lot more tests are working now.
d2f9bec5c6 Removed old-style C++ handlers that relied on UB in favor of more normal ones.
0553eff64a upb_refcounted is gone! Some tests still to fix.
9ea6bb4678 Renamed upb_stringview -> upb_strview for C terseness.
aac4d03420 Standardize on package_name_Message_mutable_foo() for mutable accessors.
31e0997c1a Some bugfixes.
7a0a25af05 Updated generated code.
daa9175dd4 Merge branch 'arrayapi' into defcleanup
0ce9b81815 Fixed bugs in array accessors.
d0c8bb84f4 WIP.
45d61f4299 Merge branch 'arrayapi' into defcleanup
c3011c1548 Fixed bug: make proto2 setters set hasbit.
a3a02d6319 Merge branch 'arrayapi' into defcleanup
618981a60f Added mutable_ accessor for submessages.
16becd2bd6 Merge branch 'arrayapi' into defcleanup
bc916f1d0f Added "add" accessors for repeated fields.
08987e3dd4 Merge branch 'master' into arrayapi
810c45a224 Merge branch 'master' into defcleanup
87b59f445b Merge pull request #146 from haberman/amalgamate
4267380b67 Merge branch 'master' into defcleanup
51a646ec11 Make Bazel print output for failed tests.
b4dec6b897 Fixed amalgamation to not list header files explicitly.
8afe0b03a3 Some fixes for Ruby.
161258a2ad Merge pull request #142 from TeBoring/json-any-encoding
18563bee4c Fix comments
549a828f76 Disbled CMake tests for now.
b996854899 Added missing test_cpp.proto.
9f5dec1c05 Updated CMakeLists.txt.
9dd2446531 test_cpp is working!
5e958a8c05 test_json is working!
377871f104 Got test_decoder working!
380558922b test_encoder passes!  Other tests still need to be fixed.
2681a17513 Merge branch 'arrayapi' into defcleanup
99600b4a0e Fix generated file test
aa2d5a609b Fixed generated code for C++.
ffae78df27 Updated encoder to new API.
e2c2121f20 Use some hazzers in def.c.
101aeba0fb Merge branch 'arrayapi' into defcleanup
10e682cf2a Added hazzers.
cf0a89ed69 Updated to use the new array accessors.
b31df4c57d Merge branch 'arrayapi' into defcleanup
48bef61537 Merge branch 'master' into defcleanup
6bcdaa1352 Changed generated array accessors to be more convenient.
7ff8413a03 Ported some tests.
2c0e0054a8 Merge pull request #144 from haberman/rmupbc
32ef122e38 Deleted old Lua-based C API compiler.
aad4f403a6 Merge pull request #143 from haberman/rmtravis
43ab429c09 Use the latest Bazel version.
12195ff19f Removed Travis config and Makefile, in favor of Kokoro and Bazel/CMake.
0fed529ea1 WIP, more progress on refactoring.
375a25423e Mark unused parameter
915806ea8d Remove unused code
b39dbb9d40 Add support for encoding Any in json
336402b4d7 WIP, core library compiles now.
bfa3c015bb Merge branch 'master' into defcleanup
73ccf4a7c7 Merge pull request #140 from haberman/cmake-mac-fixes
66f90464a8 Fix for sed that also works on Linux.
0c824b6b6c Merge branch 'master' into cmake-mac-fixes
14c96a143c Merge branch 'cmake-mac-fixes' into defcleanup
13c59cb051 Implement json decoding for Any message. (#130)
35fa3df8ec Fixes for macOS build.  Also run tests in CMake test.
9e44a757ed Fix Bazel Kokoro build (#136)
fb6f7e9689 Merge pull request #137 from vishalpowar/add_visibility
7031f77666 Add visibility for use in other projects.
7c005e7807 Merge branch 'master' of github.com:google/upb
22be932863 Merge pull request #135 from vishalpowar/cast_correct
f6c33307c4 Fix tests for generated code
e2ad6bd146 Fix tests for generated code
0811b6fead Explicit cast when creating a new struct
cb113bc8cc Merge pull request #134 from haberman/upbc-cpp
9ce4a77f61 Updates to build system for upb C++ compiler.
5f575995b5 Added upb compiler written in C++ as a normal protoc plugin.
d4e78f9fdf Merge pull request #132 from haberman/bazel
23fa64f10c Added script to generate CMake build. Bazel tests it.
966d9d89e6 Added Kokoro config files.
9abff2b95f Added missing files from Bazel build.
a7ebe54eb1 Conformance tests work under Bazel.
2655ed9cf5 Bazel builds everything except conformance_upb.
01ed4ce3d4 WIP.
9bb0814c48 Added missing "upbc" file.
2d44ad4bad Some fixes to the CMake build.
e77ab811ba Merge branch 'master' into defcleanup
3c742bfdc8 Fix json ignore unknown (#128)
b258ae3235 Fix mac use local timezone for strptime by default. (#127)
706ffdbc65 Fix json encoding for wrappers, ListValue, Struct and Value. (#126)
b79fd65a83 WIP.
4271689953 Merge pull request #125 from haberman/portdef
ae4c03b93c Fixed port_def/undef so that the amalgamation is self-contained.
b2a388212a Merge pull request #124 from haberman/unknown
950d7a9530 Fixed warnings.
a105c015b1 Added support for unknown fields to upb_msg.
ea19fa4ed6 Merge pull request #123 from haberman/rmdefault
b290a5dd65 Disabled another Lua test for the time being.
a4db175929 Removed unnecessary struct definition with "int a".
4a7bc85d72 Fixed some c89 errors.
340bd01338 Removed default instance and oneof array from tables.
3d511104ac Updated protobuf submodule.
ef1246d87c Merge pull request #121 from haberman/minimize
bdbc9fbd6d Merge pull request #122 from TeBoring/json-values
3a37b91532 Fixed amalgamation.
ba03d65a8f Removed unused variable.
1d4957a9a6 Removed unused parameter.
287ab94800 A few more compile fixes.
33d1231ead Added port_def.inc and port_undef.inc.
f7713ebc39 Changed C API to use inline functions and computed offsets.
81fbb4ffa7 Initialize value
6c910330c4 Fix json parsing for Struct, ListValue and Value.
694d51f4d6 Changed C API to only define structs, a table, and a few minimal inline functions.
41379a7064 Merge pull request #120 from haberman/cmake
b6a92a93c6 More work on CMake build, and updated conformance for proto3.
6c4469e189 Fix json encoding/decoding for duration. (#118)
b7cad62b5f Got CMake build working on macOS, and updated CMake build.
62318cadce Merge pull request #119 from rohitsakala/master
4473585734 Merge branch 'master' of https://github.com/rohitsakala/upb
898f640e65 Bugfix on bigendianess by casting size_t to unint32_t
6522ae4fb3 Bugfix on bigendianess by casting size_t to unint32_t
38d674e86f Fix json parsing for timestamp (#115)
d1738d4dec Merge pull request #117 from haberman/cmake
e94ac4f757 Moved upb_msg parts that depend on def to a separate msgfactory.{c,h}.
0a95f73d0d Merge pull request #116 from haberman/rmgooglepb
6155ed8b49 Re-add amalgamation rules and remove google protobuf from Travis.
1a484d353b Re-add upb/bindings/stdc++/string.h, which is still used in tests.
c0a50de923 Removed a bunch of obsolete code.
e3eae33fb5 Merge pull request #114 from haberman/arenaonly
636b25be8d Re-add msg handlers to the .c file also.
7059be68ae Re-add message handlers to upb/handlers.*.
c8f6a27e6b Enforced that upb_msg lives in an Arena only, and other simplifying.
b0a6602fc8 Merge pull request #113 from TeBoring/json-wrapper
a8d1a5933d Use special eof char to mark end of parsing
d4caefaade Move logic away from ragel machine
f1d7570f30 Remove unused code
ac9d4468f5 Make value top level
ae2f1cdb17 Mark unused variable
cc27a5b576 Update ragel generated file
9449cf68cc Make top level wrapper value parsing work
20f1b6df41 Fix json decoding for wrapper messages
1db11440bd Merge pull request #112 from TeBoring/json-unknown
72e66e2b55 Enable ignore unknown field in json parsing
fa99d854f6 Merge pull request #110 from TeBoring/upb-revert
1080117f2b Revert "Prepare upb_value for encoding/decoding map."
d73b12ed3c Merge pull request #107 from lauraguevara97/patch-1
45a9dd20d8 Update README.md
f30dd0ff0c Prepare upb_value for encoding/decoding map.
5029aa439c Merge pull request #105 from TeBoring/php-change
86dec3021f Implement decoding repeated message field.
13f200bd77 Merge pull request #104 from TeBoring/php-change
0833cf29b3 Bytes type should return size of stringview
298c252695 Merge pull request #103 from TeBoring/php-change
e06cc3d7cc e->limit is invalidated after growing.
0693640da8 Merge pull request #101 from TeBoring/php-change
9dbe75a403 Merge pull request #102 from haberman/descriptor-in-core
cea737028f Added google/protobuf/descriptor.upb.* to core.
93aaf99347 Fix parsing sub-message field. Buffer start place needs to be adjusted before parsing sub-message.
681cf4279c Merge pull request #100 from TeBoring/php-change
dfe7d3a374 swap condition branches to remove negation
ba93474aa2 Fix oneof encoding/decoding
6edcf6a82a Merge pull request #99 from TeBoring/php-change
bc7f1eaca0 In case of circular dependency, layout has to be inserted first.
69719e0a06 Merge pull request #98 from TeBoring/php-change
719f644232 Field missing submsg and hasbit information.
10ae4951fb Merge pull request #97 from TeBoring/php-change
8c6d0e5545 Conversion from uint64 to uint32 didn't consider sign bit.
a66159a384 Merge pull request #96 from TeBoring/php-change
cafebf6bee For encoding upb needs descriptor type instead of type.
bcb62b7fbf Merge pull request #92 from TeBoring/unknown
0a9681874e Modify TODO
10c6f18d11 Turn off warining on undef private/protected
1e1c54f772 Change parameter type from enum opcode to int.
ee7b049d19 Initialize tag to make compiler happy.
0776f64830 Fixed JIT for unknown fields. (#1)
d9eca86091 Modify selector base in tests/json/test.upbdefs.cc
dd77460c65 Do not expose encode_unknown
69dee545ec Remove upb_pb_encoder_encode_unknown
6a6e192375 Remove unused declaration.
6b4e07cc18 Remove upb_addunknown_handlerfunc
5aa27d91c6 Use upb_sink_putunknown for reserve unknown
dc9d15084f Remove upb_addunknown_handlerfunc and upb_handlers_setaddunknown
0b7904e18c Reserve unknown fields in upb 1. For decoding, an unknownfields will be lazily created on message, which contains bytes of unknown fields. 2. For encoding, if the unknownfields is present on message, all bytes contained in it will be serialized.
ae30b4a816 Merge pull request #90 from haberman/gencode3
72c333eb03 Fixed amalgamated build.
058a17f6a6 Fix amalgamated build.
98f513fb8f Fixed 32-bit build and added generated files.
6b87674221 Address review comments and fix compile warnings.
806ffc1d20 Responded to PR comments.
15308afff2 Fixes for oneof conformance tests.
b697882fb2 Fixed varint length when buffer is reallocated.
be9094d91a New encode/decode: most (171 / 192) conformance tests pass.
d5167fff74 Merge pull request #88 from google/gencode2
4da95f6213 Merge branch 'gencode2' into gencode3
6eb489a30a Merge branch 'master' into gencode2
edad06a9fa WIP.
0af928564e Merge pull request #89 from google/stringview
277c4d584f Merge branch 'gencode2' into gencode3
1278ff8994 Responded to PR comments.
2e01793ded Merge branch 'stringview' into gencode3
c0a660f474 Added upb_stringview, the string representation for upb_msg.
f38e4c7cf4 Merge pull request #87 from google/gencode
051df05fb2 Merge branch 'gencode2' into gencode3
717a030083 Merge branch 'gencode' into gencode2
3e8acc3f4e Removed incorrect assert and added comments.
af43ea72b5 Removed incorrect assertion.
428deb3a53 Merge branch 'gencode' into gencode2
2826811367 Responded to PR comments.
699b51b441 Lots of encoder/decoder work (backwards encoder).
1aafd4111b A good start on upb_encode and upb_decode.
dd536fd567 Be more picky about command-line args in upbc.
9cb10577fc First version of a real C codegen for upb.
76fcdd2ee9 Removed all upb_msgdef/upb_fielddef from upb_msg.
1b9d37a00e Start migrating upb_msglayout to be suitable for generated code.
e38098cbfc Merge pull request #86 from haberman/json-numbers
cbc2d7af56 Responded to PR comments.  This also fixed a few more conformance tests.
8389aa2977 Merge pull request #84 from TeBoring/master
d04af15acb Some fixes to make JSON properly recognize numbers in quotes.
82cbdc86ac Merge pull request #85 from TeBoring/pull2
35f838e82d php_namespace should be explicitly set even if it's empty.
0a9b07ba86 Fix upb load descriptor when no messages defined in prorto.
04fcf0b112 Merge pull request #83 from TeBoring/master
f15e6764bd Add new file option php_namespace.
3f3ee548f1 Merge pull request #82 from haberman/rmvarint
c909a7aa6e Deleted some dead code related to varint decoding.
6507e1fee3 Merge pull request #81 from TeBoring/master
4169481438 Fix bugs in file_onphpprefix
e35c38fc65 Merge pull request #80 from TeBoring/master
969ba5ef86 Add new file option php_class_prefix.
5a8467842a Merge pull request #79 from TeBoring/master
0168f28daf Bug fix: When encoding, negative int32 values should be padded to int64 in order to be wire compatible
73a48a46f8 Merge pull request #78 from haberman/axerefcount
3b7dc27fb5 Fixed amalgamated build and added test.
72ae34c28f Merge pull request #77 from haberman/axerefcount
5aa01b46e4 A couple more fixes.
512130adf1 Remove another bit of obsolete code.
693b841ec6 Removed all code for adding extensions to upb_symtab.
9a9a1097a7 Merge pull request #76 from haberman/movesymtab
629b4ce621 Ripped out complicated and unused code for replacing defs in a symtab.
47da2afd52 Make upb::SymbolTable no longer reference-counted.
c850bc0a4e Moved upb_symtab to def.h/def.c.
d5d2eadee5 Merge pull request #75 from haberman/msg
6cccfe1649 Addressed PR comments.
ce1f63fde2 A few C++ fixes for BufferSink.
15c388b819 Basic serialization for upb_msg and Lua.
076a82ee7e Merge pull request #74 from haberman/msg
2b77da3da8 Update for final PR comments.
ba4e23f170 Added a few missing __gc metamethods.
949aeee3f1 Changes for PR comments.
3122535726 Fleshed out comments and removed some dead code.
62472c1161 Suppress warnings on 32-bit for this dead code for now.
e977c0af03 Fixed more bugs surfaced by Travis.
39c2414d68 Added descriptor.pb so we don't depend on protoc for tests.
ff99b3f46b Fixed some bugs surfaced by Travis.
16ca9309b3 Removed some temporary code and fixed a few tests.
4b0c4ca7fb New upb_msg code and Lua bindings around it.
9a91f7bba8 Merge pull request #73 from apstndb/fix-va-copy
1b4fc46f87 Fix glibc coupling in test
35e174bf0e Fix C++11 incompatibility
5211caac97 Make upb compatible with musl libc
77c97fd3f2 Merge pull request #70 from haberman/reffix
5a49a33605 Responded to CR comments.
af79bfb919 Some refcounting fixes.
b176b976a5 Merge pull request #69 from haberman/oneofdesc
c387d372ee Added descriptive comment about descriptor nesting.
bb872be0c0 Addressed CR comments: simplify slightly.
074a050bb1 Added support for loading oneofs from descriptors.
0787643281 Merge pull request #68 from haberman/bugfixes
dd1b8dad6d Merge pull request #67 from haberman/endstrhd
cf22c890c9 Adjust PATH in .travis.yml instead of travis.sh.
7d1de129cd Updated Travis to put protoc in a subdirectory for genfiles.
fd1e6a3805 Updated generated code.
b09c59cc05 A small bugfix to upb_table and simplified some code.
ea85066489 JSON: fix a couple cases of the wrong closure being passed to end handlers.
dfc409618f Merge pull request #66 from mortonfox/patch-1
ea9aa962ef Fix email links
8b6e2113b0 WIP.
fa338b70a6 Added UPB_ASSERT() that helps avoid unused var warnings.
e16ed470be Updated URL to Tarjan set union paper.
d0c2479920 Fixed small omission: upb_env_init2(). (#61)
ac2689cec7 Put oneofs in the same table as fields. (#60)
e6fa3f9d86 Changed schema for JSON test to be defined in a .proto file. (#54)
68bc62a7fa Split upb::Arena/upb::Allocator from upb::Environment. (#58)
04786dc2b3 Also regenerate JSON parser.
5b1804d52a Fix for JSON error reporting. (#57)
89197b9358 JSON parser: always accept both name variants, flag controls which we generate.
534b5c98ba Merge pull request #55 from haberman/jsonflag
1019f76fc5 Added migration flag for users using old JSON format.
458077ccb4 Merge pull request #53 from haberman/filedef
8823fa6069 Refactored upb_def_freeze() a bit per PR comments.
f8c26358f0 Changes for PR comments.
e9d79d2441 Added upb::FileDef, which represents the file defs are declared in.
d0b9d0a9b7 Merge pull request #52 from haberman/oneof-not-def
7f0d3bb83d Make OneofDef stop deriving from Def.
f73baf670e Merge pull request #49 from mbarbon/add-fielddef-index
15c77612d0 Add missing FieldDef::index() definition
79938f3590 Fixed const correctness of json_nice_escape().
4cae251fb3 Merge pull request #48 from jackdoe/master
5da90a3571 indent according to google-style-guide
32236c9cbc Merge pull request #46 from haberman/jsoncamel
4150640650 Added assertions for getjsonname() return.
458da2563f Addressed code review comments.
f9afc3e55b Changed JSON parser/printer to correctly camelCase names.
4d9fa86309 make it compile with gcc < 4.5.1
ff6fe32744 Merge pull request #47 from haberman/compact
ae8d257985 Added small explanatory comment.
0d18e1f7e3 Optimized upb_inttable_compact(): it shrinks inttables more now.
002f57f8c5 Merge pull request #45 from mbarbon/fix-status-init
6d2a1513b8 Merge pull request #44 from mbarbon/master
e943fc6e7a Make sure upb_pbdecoder.status is initialized
4ab60c1def Add missing upb_fielddef_fullname implementation
a1c8f7ce7c Merge pull request #43 from haberman/presenceflag
c1bc256d4e Addressed PR comments.
ba4b6f5c84 Properly populate field presence flag on messages according to syntax flag.
bc53c1bc46 Add flag to MessageDef for whether fields have presence.
77d45edfb3 Merge pull request #38 from haberman/decoderfix2
1e870951d7 Refer to a shared definition for max buffered bytes.
146a9c22ef Added lots of decoder tests and fixed lots of bugs.
782670e6a3 Merge pull request #37 from haberman/google-internal
7c6a763bd8 Fix from google3: memory leak caught by heapcheck.
d56339e6ff Merge pull request #36 from haberman/decoderfix
85440108e5 More decoder fixes, and slightly changed parse call semantics.
fe427341f2 Decoder fix: skipped data at end of submessage.
9c788b116e Merge pull request #34 from haberman/parserskip
7dcd017f4e Fixed PR for JIT-enabled builds.
abcb6428ad Changed parser semantics around skipping.
ecaf82d134 Merge pull request #33 from haberman/jsonerr
2efe6be994 Clear JSON parser status in reset.
334bab5d8d Updated JSON parser size.
5506b58943 Fixed JSON parser error reporting.
5b44720f8f Also remove license headers from Lua.
c09ec32f5c Updated license headers for Ragel source also.
49dab06e03 Brought into compliance with Google open-source policies.
6d9a9c727f Merge pull request #32 from haberman/third_party
016587ea33 Moved lunit to third_party for Google compliance.
36962f137f Merge pull request #31 from haberman/third_party
b354ead7ef Moved DynASM to third_party to comply with Google policy.
ff8b042ad3 Merge pull request #30 from haberman/encoderfix
c3e9a57a6f Fixed some bad bugs in upb_env.
d264438d15 Merge pull request #29 from haberman/symtabfix
e3a7a4cf7b Addressed code review comment and clarified comments.
b72ed3b97a Fix for stack overflow for cyclic defs.
21d32dfe3d Fix amalgamation by changing include style for structdef.int.h.
7333db596e Parameterize AR properly in the Makefile.
d9485c28ed Fix for va_copy.
19a973a85e Fixes from Google-internal.
e5bcdc2a3f Merge branch 'master' into google-internal
6f30032183 Sync from Google-internal development.
97eeb57022 Merge pull request #27 from haberman/c89
919fea438a Ported upb to C89, for greater portability.
6650b3c652 Update Travis and Coveralls URLs for repo switch.
0b64534a44 Merge pull request #21 from google/tablestrings
e6dddd6c17 Merge pull request #22 from martinmaly/upbc
c688be9e06 Generating enums and intentries only if the tables are non-empty.
2cff15d35e Updates from code review comments.
e2840a4aa1 Restructure tables for C89 port and smaller size.
0c7eb664fc JIT bugfix: align stack properly on getbytes_slow.
00c36ece20 Upload failing artifacts to S3 for debugging purposes.
e087947c84 Enabled asserts() and verbosity for most Travis builds.
93791bfe65 Merge pull request #19 from cfallin/upb-seededalloc-fix
710111cc7c Bugfix: seeded_alloc() should not realloc() user-provided memory.
37cffddc5d Decoder bugfix.
eace8e3295 Enable Travis for Clang, and enable -Werror for all Travis builds.
51cf616dab Changes to Lua module loading, and file generation.
35923b43b5 Remove test code written by contributor without a CLA.
c95bed1b6c Merge pull request #17 from martinmaly/links
ccc0fd0dbb Merge pull request #18 from haberman/google-internal
838009ba2b Fixes for the open-source build.
fa10302a50 Merge from open-source development.
3bd691a497 Google-internal development.
f519e95817 Updating Readme links
bd7ea8c6f1 Merge pull request #16 from martinmaly/warnings
508c39ee13 Resolve compilation errors if compiled with more stringent semantic checks. Adding Travis test to build with strict warnings. Fixing a warning in a test which used signed/unsigned integer comparison.
535bc2fe2f Merge pull request #13 from cfallin/json-maps
099d57346a Fixed JSON parser issue: missing NUL byte in parse_number() in some code paths. Also, fix unused-function warnings.
17be1ef0f2 Merge pull request #12 from cfallin/json-maps
fb58504569 Support maps in JSON parsing and serialization.
51513c6e7f Add -O0 for coverage run to hopefully get better data.
1988a660f4 Merge pull request #11 from cfallin/oneofs
87a18f3774 Support oneof defs in upb.
bebdc009b4 Coverage support for coveralls.io.
b55f32b278 Fix for JSON parser: don't overrun buffer parsing ints.
87fc2c516b Changes from Google-internal development.
d18475ae57 Merge pull request #10 from cfallin/master
fd1cc56625 Modified strtable to support length-delimited string keys. Allows for arbitrary binary data, e.g., to support strings from other languages as key values.
0ab8d5e1bb Merge pull request #9 from cfallin/map-fields
3bd667e95f Added msgdef flag to indicate map_entry protos.
efffb86a5c Merge pull request #8 from cfallin/master
b3f6daf83d Amalgamated distribution (upb.c/upb.h) tool.
56913be6bb Removed obsolete benchmarks/ and examples/ directories.
82be433d41 Decoder bugfix, .gitignore update, and delete obsolete files.
bf51ef86b4 Merge pull request #7 from cfallin/master
8f8113b4ff JSON test, symbolic enum names in JSON, and a few improvements.
e257bd978d Merge pull request #6 from cfallin/master
98adb44547 Sync update: haberman@'s internal changes.
f3052474d4 Update JSON parser to emit UTF8 to string fields appropriately.
3249b36a2a Synced to post-code-review JSON printer.
a350b42069 Merge pull request #5 from cfallin/master
db63db82aa JSON printer: remove dependency on YAJL, using a hand-rolled printer instead.
39c9a8bd5a Sync from Google-internal development.
177212c82f Fixed building of googlepbtests.
3d0c7c45da Sync to Google-internal development.
648afe3da6 I think I have the right 32-bit C++ libraries now.
697297433b Maybe I finally got the right C++ library for 32-bit?
4b7fad4624 32-bit builds also needs 32-bit C++ library.
562a4d80df 32-bit build needs 32-bit libraries installed.
66a74a4fd5 Added lua and core32 Travis builds, and rewrote README.md
2ccbe04559 Added compiled version of test.proto.
3461a5113e Enable more Travis configurations.
6ed916653f Rewrite of build system.
ba87fcd84b Fix in test_cpp for bad macro expansion.
f447370f80 Fixed build and added Travis CI support.
a25c50361a Added optimization note.
d869097400 Make the absence of perf-cppflags give a good default build.
cf2a959fa1 Fixed some bugs and added accessors.
8405e5e389 Beginnings of a prototype Ruby extension.
43f2455cbd Added UPB_UNTRACKED_REF and some more handler overload options.
d493500abc Sync from Google-internal development.
47b5e0968a Sync from internal Google development.
2d10fa3307 Sync from internal Google development.
7d565f1e7a Sync from Google development.
0fd2f83088 Sync to internal Google development.
ce9bba3cb5 Sync from Google-internal development.
aa8db6ab5e Build fix for Mac OS X.
ccb2f8ab87 Fixes to make the open-source build compile on Linux.
26d98ca94f Merge from Google-internal development:
61109fca1f Fix to compile on Linux.
228872a5c6 Fixes to compile on GCC 4.2, as shipped with XCode.
bada1e94f4 Merge from Google-internal development.
ee3a3191cd Updated benchmarks to new API.
c70a754296 Merge branch 'master' of github.com:haberman/upb
90bb4246c3 Synced with Google-internal development.
622481990b Updated benchmarks to new APIs.
70293f5faa Open source fixes: builds on OS X again.
cfdb9907cb Synced with 3 months of Google-internal development.
7d3e2bd2c4 Sync with 8 months of Google-internal development.
ea198bdcf9 Properly export setjmp/longjmp.
6cda8586b1 Fix broken setjmp with working one.
9a7037a2fa Got decoder & textprinter compiling in kernel mode.
cca4818eb7 Sync from internal Google development.
26ed1e9961 Got our performance back by tweaking AssignToString.
bf0308ebc5 Fix duplicate symbol on OS X.
c16c978193 Updated DynASM from upstream (Lua 5.2 support).
86bad61b76 Sync from internal Google development.
db59a5198f Fixes to un-break "make descriptorgen"
02ede91eb2 Small Makefile fix.
1b9b6bd1ad Fixed the open-source build.
1bcab1377d Sync with internal Google development.
b5f5ee867e Refinement of upb_bytesrc interface.
99ae0ed397 Changes to get upb compiling inside Google.
d29339d126 Fix GDB unwinding through JIT-compiled frames.
c0a08a6827 Fixes to get upb to compile inside Google.
56f7a345d7 x86 JIT: now works without -NDNDEBUG (also small perf increase).
64e199d18b Small bugfix for x86->x64 rename.
8899727827 Fix perf-tests.sh to skip building non-upb tests.
7d986946b7 Rename x86 -> x64, since JIT is x64-only.
7a0e63ec61 x86 JIT: avoid storing pointer for every field.
878fc9c362 Small typo fix.
7f045f9451 x86 JIT: add easy switch between replicated/common dispatch.
887abe669f Added an example, constified some more methods.
bda3269a42 Fleshed out fielddef default functionality.
7175edb10a Add failing unit test
aca8cef29b Merge pull request #2 from winksaville/fix-typo-handler.h
0606476cb6 Fix typo in handler.h
2054853964 Header tweaking.
f226554fa5 Fleshed out C++ def wrappers some.
621c0cdcb5 Const invasion: large parts of upb made const-correct.
8f2758dda2 Work on C++ wrappers, added C++ test.
4a8b9be46c Header cleanup, clarify/correct comments for interfaces.
d1d126acf4 Make "benchmark" build "benchmarks", add bug note.
8eb2b2a216 Revised upb_bytesink, refactored upb_textprinter (untested).
521ac7a89a Refined upb_status.
48fedab345 Add packed field support (untested).
c03802b0f1 Some updates to the experimental C++ wrapper.
e8796beffc Add comment clarifying that the proto2 benchmark is ugly and temporary.
9d2fcd3692 Some progress on upb_stdio.
6c6013e51e Fold gen-deps.sh into Makefile.
adb6580d97 Let the JIT emit hasbit-setting code in addition to calling a callback.
a5e6a7b029 Fix stack alignment on OS X.
8bdc6d233e Prime the decoder buf for modest perf improvement on small messages.
d5324d1d5c Some Makefile cleanup.
7935b702c5 More cleanup.
282b34529f Some source cleanup/commenting.
08e7ad94f9 Renamed lang_ext -> bindings, README updates.
3387ccaffd Avoid longjmp() in successful case.
a090a7abf6 Fix proto2 benchmark for newer proto2.
06b8181f97 Benchmark to parse into proto2 messages.
40f271b854 x86 JIT: add callback specializations for a 10% speedup when parsing to struct.
fa82e4fbf0 Benchmark JIT vs no JIT without forcing a whole-project recompile.
51d4e295a4 Python: fleshed out accessors.
fe3df2c9bc Python: basic SymbolTable support and empty accessors.
2cf930ef51 Python: fixed object cache and fleshed out MessageDef a bit.
25cdf1e6f7 Fixed overzealous assert().
336268b3d7 Fixed a few memory leaks and Makefile tweaks.
be74572455 Fixed off-by-one stack allocation error.
fc9c49860b Python: Implemented weak-ref'd object cache.
a1bb3dc448 Makefile target for running Python tests.
ce425df78c More Python upb.FieldDef functionality and tests.
487bfdfc06 Begin port of Python extension to new APIs.
6981e468a3 More work on Lua extension, and consequent core refactoring.
c2c853fa21 More work on Lua extension.
57abebaaf9 Fixed "make descriptorgen".
56984e8db8 Significant work on Lua extension.
92b4c38fa5 Added comment about how to disassemble JIT output.
daf36f0747 Get rid of upb_symtabtxn.
b6ca2718c8 Make Lua extension build again.
10265aa56b Directory restructure.
6a1f3a6693 Major refactoring: upb_string is gone in favor of upb_strref.
559e23c796 Major refactoring: abandon upb_msg, add upb_accessors.
a503b8859c Make all handlers objects refcounted.
2ccebb74c3 Add proof-of-concept C++ wrapper header.
0941664215 Add startseq/endseq handlers.
74102e836d JIT: factor out push/pop frame into macros.
d619852e06 Change dispatcher error handling model.
a5506318aa Fix JIT for new interface.
2fe68c6a5a Fix aliasing violation.
3231fd0fdd Vastly improved/simplified the upb_handlers API.
ea2a80840e More renaming.
1782f28c86 Documentation, some type renaming, nix unknown handler for now.
eb622c0531 Split upb_stream -> upb_bytestream/upb_handlers.
f74534b42a Decoder redesign in preparation for packed fields and start/endseq.
4a99abba12 Refactor varint encoding/decoding.
7cf5893dcc Revise/clarify comment about clear() implementation.
6955dfb302 Calculate and print string sizes in test messages.
4d209efd23 Merge branch 'master' …
bazel-io pushed a commit to bazelbuild/tulsi that referenced this issue Dec 15, 2020
This is phase 2 of of the switch to toolchain transitions. See bazelbuild/bazel#11584 for details.

PiperOrigin-RevId: 338462410
veblush added a commit to veblush/grpc that referenced this issue Dec 21, 2020
60607da72e Merge pull request grpc#356 from haberman/codegen-uniquefiles
7a54a5f3d6 Split the code generators for .upb and .upbdefs.
b10b02f66f Merge pull request grpc#353 from haberman/small-fixes
cd7c2d2701 Merge pull request grpc#352 from haberman/large-field-number
10b355a6e0 A couple minor fixes. These are exercised by Ruby.
6c30b5fe73 Fixed upb encoder for field numbers > 2**28.
31b3528424 Merge pull request grpc#350 from haberman/encode-depthlimit
e9551022c1 Added depth limit checking to upb_encode().
f389384c5a Merge pull request grpc#349 from lidizheng/json-public
f72c26cbc4 Make :json publically visible
5797d95172 Merge pull request grpc#348 from haberman/json-emit-defaults
7a17493269 Removed print debugging.
695b7f4617 Added code to test UPB_JSONENC_EMITDEFAULTS.
6b357607bd Fixed bugs in JSON encoding with UPB_JSONENC_EMITDEFAULTS.
1b08391979 Merge pull request grpc#347 from haberman/filedef-symtab
ee49a8d7df Added an accessor to get the symtab from a filedef.
a81b47025a Merge pull request grpc#345 from haberman/encode-skipunknown
6535cbe380 Merge pull request grpc#346 from timgates42/bugfix_typo_position
7225108720 docs: fix simple typo, posisiton -> position
871ff96252 Test SKIPUNKNOWN on regular fields.
0569c22a1e Removed debug print.
76764643ac Added option to binary encoder to skip unknown fields.
794ce6d061 Merge pull request grpc#344 from haberman/deterministic-serialize
a04627abc8 Added map sorting to binary and text encoders.
3e071ea91a Merge pull request grpc#343 from haberman/msvc
e70e488e09 MSVC apparently doesn't support the standard C/C++ defines.
963e501aa6 Merge pull request grpc#342 from haberman/fuzz
8d670d8aea Renamed decode_varint32() to decode_tag().
9abf8e043f Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
50a543de7f Merge pull request grpc#341 from haberman/code-size
9c87f1168f Added size benchmark for CODE_SIZE.
6f82028236 Merge pull request grpc#340 from haberman/darwin-setjmp
358fa14d0e Fixed headers and updated benchmark script.
bc200451ce Use a macro instead of an inline function for setjmp/longjmp.
ca279f8afa Merge branch 'master' into darwin-setjmp
fbc0639b07 Use _setjmp on mac to avoid saving/restoring the signal mask.
10f0a38450 Merge pull request grpc#337 from haberman/size-benchmarks
4be07a2dce Increase build timeout until we can parallelize the build.
378a27b640 Force "size" to run locally.
da48e01f05 More google3 fixes.
d2446fd2db Moved cc_api_version attribute to proto_library().
4a84390c89 Added cc_proto_library() tweaks for google3.
4dd4212a34 Merge branch 'master' into size-benchmarks
ffecfef161 Merge branch 'master' into size-benchmarks
86f671d5fd Fix for Darwin (output is different, but it won't error out).
165e01ec6f Fix for old Python versions.
40fdff5e43 Merge pull request grpc#339 from haberman/benchmark-alias
5f8bb5de1d Updated generated code.
65d166a6ba Added API for copy vs. alias and added benchmarks to test both.
27b9c999a7 Merge pull request grpc#338 from haberman/arena-initial
9df96874e9 Start arena block doubling at initial block size.
881ddac7fe Also use .format() for gen_synthetic_protos.py.
8b7dabe1a2 Use format() instead of string interpolation, for old Python versions.
8e08282c3b Removed unused small.proto.
0f79d47215 Added missing lite binaries to size_data.txt.
555fbbc0bc Size benchmarks are working pretty well.
85cbc41a89 Merge branch 'master' into size-benchmarks
e5bdfba92c Removed accidentally-added .orig file.
07851fac58 Merge pull request grpc#336 from haberman/fuzz
982b634bc5 Fixed a few minor bugs found by fuzzing.
c9d2e58480 Merge pull request grpc#310 from haberman/fast-table
a01f3e23a4 Fixes for google3 build, and exclude even more tests from macOS to avoid timeout.
a83d55ee4b Exclude Clang tests from MacOS to avoid Kokoro timeouts.
73fcfe9ed0 Tried to slim down the tests a bit more.
baab25b7aa Removed excess/redundant tests from Kokoro script.
1eb7bd39e7 Some formatting fixes.
9d87055ce4 Updated Kokoro build script.
4bd34da105 WIP.
a7993615bf Merge branch 'master' into fast-table
3a3efe69a2 Added incompatible_use_toolchain_transition = True per bazelbuild/bazel#11584
7b4e376f79 Switch unordered_set -> absl::flat_hash_set.
fe62fc83e1 Removed obsolete includes in benchmark.
5ed089dc42 Merge pull request grpc#335 from haberman/wyhash-rule
e9b79542ad Added a BUILD file for wyhash.
7b8ae7ec4e Merge branch 'master' into size-benchmarks
a5b5445da6 Merge pull request grpc#334 from haberman/rm-port-c
6c16cba83f Removed obsolete port.c file.
484d8f746a Updated comment in wyhash.h to correct spelling mistake.
6a9d0f45b8 Merge pull request grpc#333 from haberman/32bitfixes
5b1f0d86a1 For Kokoro, only build/test -m32 on Linux.
0497f8deed Fixed a critical bug on 32-bit builds, and added much more Kokoro testing.
7543f851f1 Merge pull request grpc#332 from haberman/php-amalgamation
64abb5eb11 Amalgamation no longer bundles wyhash, but #includes it.
a2a40792b5 Merge pull request grpc#331 from haberman/json-oneof-fix
dd0994d377 Bugfix for JSON decoding: only check real oneofs for duplicates.
496f638025 Merge pull request grpc#330 from haberman/symtab-longjmp
c9f9668234 symtab: use longjmp() for errors and avoid intermediate table.
4d9a8cd67b Merge branch 'master' into symtab-longjmp
6322d1d72d Merge pull request grpc#329 from haberman/benchmark-ads-descriptor
5ec1d39224 Avoid building .pb.cc for ads protos, as C++ takes forever to compile.
43c207ea7e Added CMake dummy rule.
c3b5637646 Added benchmark for loading ads descriptor.
acd72c6d3f WIP.
6ae3b66cd2 Merge pull request grpc#328 from haberman/optdefload
8113ebd6c7 Added explanatory comment about integer constants.
f2d826b9f3 Got rid of floating-point division in table init.
723cd8ffc1 Added wyhash code and LICENSE, and removed temporary benchmark.
15e20636c3 Merge branch 'master' into optdefload
154f2c25f4 Added UTF-8 validation for proto3 string fields.
e8f9eac68c Added #defines UPB_ENABLE_FASTTABLE and UPB_TRY_ENABLE_FASTTABLE.
994cf07cf3 Merge pull request grpc#327 from benjaminp/modern-linking
b5bd5807a7 Migrate to modern Starlark linking api.
dc64613607 Merge branch 'fastest-table' into fast-table
e86541ac1d Fixed the build after the merge.
1cd0cb17d3 Merge branch 'master' into fastest-table
901744a97e Merge pull request grpc#326 from haberman/c99
a0d16e7073 Added a few missing copts, and made some functions proper prototypes.
558315a1c3 Added COPTS to :port.
7e5bd65098 Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
8f3ee80d46 Drop C89/C90 support and MSVC prior to Visual Studio 2015.
a274ad786a Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
2c8bb6dd9d Specify C99 explicitly until/unless we stop using bool.
efd576b698 Added -std=gnu99 for fastdecode and ran Buildifier.
b928696942 A few more fixes, and test fastdecode under Kokoro.
55f3569cd2 A few minor fixes and more assertions.
8b38e8f214 Merge branch 'fastest-table' into fast-table
46eb82467a Added comment to decode_fast.h.
bd9f8f580d Fixed a few bugs with the fast decoder.
3eba47914b Allocate hasbits and table slots in "hotness" order.
021db6fcd5 Allow larger tags into the table if they are unique mod 31.
86d9908c55 Fastdecode support for packed fields.
e3e797b680 Added fasttable support for oneofs.
7ffa9c181a Fixed some small bugs and performance problems in string copying.
e2c709e047 Repeated string and primitive support.
e9103eda9e Merge branch 'master' into fastest-table
0756999ab6 Merge pull request grpc#325 from haberman/inlined-arena
25db40bc30 Fixed upb::InlinedArena, which was compeltely broken.
d81ba58215 Optimized short string copying.
f3a2a79349 More optimization, back up to 2.56GB/s.
199c914295 Simplify push/pop when msg fits in the current buffer.
d5f5db2729 Put string-copying field parser into a separate function.
883f20d4dc Merge branch 'master' into fastest-table
1bd62e8218 Merge pull request grpc#324 from haberman/simplemomi
f4adbe0698 Optimized varint decoding from Gerben.
48689df72e Eliminated bounds checks inside parsing a field.
a345af9883 Added a codegen parameter for whether fasttables are generated or not.
8a3470c543 WIP.
8e8dbb5258 Merge branch 'fastest-table' into fast-table
7d17a0e8c5 Merge branch 'master' into fastest-table
a7e2e8338d Fixed benchmark script.
72de7b7002 Merge branch 'fastest-table' into fast-table
cb234e652c Merge branch 'master' into fastest-table
b86cf2d789 Merge pull request grpc#323 from haberman/build-files
4ea81ab107 Fixed pedantic warning.
6399b31f4b Removed ULL constants in json_decode.c.
c8ae197e64 Removed "U" suffixes, they are not necessary.
bc1e0b314f Fixed some strict C89 errors.
2c1664906a Removed license comments and upb_amalgamation for google3.
b7dc77415a Added licenses() to all BUILD files.
de22764b33 Updated Kokoro to test ... instead of :all.
e3f41de6c7 Split monolithic BUILD file into many build files.
fbe2bcafbc Merge pull request #4 from gerben-s/gerbens-fast-table
9e68ec033f Add repeated varints and fixed parsers
d0e4b688c6 Shorten name of kAliasString, so benchmark results don't wrap.
c0c9b5a168 Regenerated generated code.
eb8e6de8b7 Regenerated source files.
7f0d535826 Merge branch 'fastest-table' into fast-table
bf8e08074c Added a few more comments.
6e3c22e6ee Merge branch 'fastest-table' into fast-table
3238821315 Gave fast table entry a nicer name.
2a574d3d01 Added a bunch of comments for readability.
0deca8b8fb Merge branch 'master' into fast-table
bfadc99709 Merge branch 'master' into fastest-table
84e0f6127d Merge branch 'master' into fastest-table
61c51a607b Merge branch 'master' into fast-table
4f066765a9 Merge pull request grpc#320 from haberman/string-view-benchmark
bf393bf086 Cleaned up benchmark names.
9eb8414b31 Added descriptor_sv.proto.
ee7da95367 Bzl formatting fix per buildifier.
de1b6b0718 Refactored proto2 benchmarks and added StringView benchmark.
c2901eeee1 Added missing #includes (caught by Blaze).
52721eadc7 Order LargeInitialBlock after non-initial-block test.
44a7130845 Used the correct copy of the protos in the benchmark.
3a242e7a48 Merge branch 'master' into fast-table
d01b712dbb Merge branch 'master' into fastest-table
d225dfc2ed Buildifier formatting fixes.
b0994a6501 Added missing dep from benchmark.
de80054018 Make required fields optional for benchmarking.
745661bf1f Merge branch 'master' into fastest-table
11585095b7 Merge pull request grpc#319 from haberman/copy-descriptor
fd5a35d49d Minor comment changes.
bdd1a516e8 Fixed other tests.
27262adf93 Snapshot descriptor.proto into our own copy for benchmarking purposes.
d6b40fd5e2 Added missing dependency on reflection.
b9f1b67d07 Use quoted include.
1c8c16b9b1 Use quoted include.
4f901b6430 Passes all tests.
de84e20788 Merge branch 'master' into optdefload
d5c64476fd Merge pull request grpc#318 from haberman/descriptor-load-benchmark
42d2f6cef9 Add MB/s measures in the benchmarks.
1ce98b86ec Added LoadDescriptor benchmark for proto2.
4890735ce2 Added benchmark for descriptor loading.
6f59f1256e Optimizations to descriptor loading.
6874d61704 Merge pull request grpc#317 from haberman/gencode-compat
c81113e60f Added fallback code for when no enum matches.
c10b24ffb2 Simplified switch().
ded2e657a7 Added compatibility with old generated code.
5b0c5c7d4a Dispatch inline.
75edd3e59c Changed to use table pairs, seems to ever-so-slightly regress.
69d99a247e Merge pull request #3 from haberman/shifted-table
bca7edac8c Cleaned up table compression a bit.
b95f217996 A little speed boost, now hitting 2.51GB/s.
8ed6b2fe85 Stored mask in the table pointer.
a6dc88556d Tables are compressed, but perf goes down to 2.44GB/s.
91eb09b1bc Add a few comments.
7a1835d7c3 Merge branch 'master' into fast-table
8bd5c0088e Merge pull request grpc#316 from haberman/submsg-array
a4966fd230 Added a few extra sanity checks.
99acbe0da8 Fixed bug where submsg array could have excess elements.
2a0425ecf5 Merge pull request grpc#315 from haberman/conformance-fixes
7ccf5650c7 If we encounter "null" for a non-NullValue enum, throw an error.
0a3a94a12f Updated to a new version of protobuf and fixed a few conformance tests.
ddd5f28c4f Merge branch 'is_bazel'
10fa3a0c77 Merge pull request grpc#314 from haberman/addunknown
504e105420 undef UPB_ASAN.
ab96d1ec41 Removed extraneous C++-style comment.
d5096f9ee8 Fixed bug in addunknown and added ASAN poisoning.
6fe84526be Mark _is_bazel to be replace in google3.
f01efe8b64 Removed another C99-ism.
1749082bbb Removed C99-ism.
147e363f56 Merge branch 'master' into fast-table
f2ddc15d76 Bugfix: initialize fastlimit and fastend.
65e49b694b Merge branch 'gerben-fast-table' into fast-table
1abf7d418d Added generated files.
3f719fa6b2 Bugfix: offsetting hasbits with 16 introduced a bug in calculating hasmasks. Removing extra <<16 shift in hasmask calculating and masking out the first 16 bits. This makes messages without hasbits work as well.
aec762e405 Merge branch 'master' into fast-table
4f77aaafd8 Merge pull request #2 from gerben-s/fast-table
4053805759 Bugfixes
d1cd80385b Merge pull request grpc#313 from haberman/inline-arena
ad21083623 Merge pull request grpc#313 from haberman/inline-arena
2339fc779c Updated obsolete comment.
b393849bbd Updated obsolete comment.
ebe53f8590 Fixed compile error.
b37f82b58b Fixed compile error.
71749b7caf Implemented inline array allocation, and moved type->lg2 map to reflection.
9557b97acc Implemented inline array allocation, and moved type->lg2 map to reflection.
b58d2a0ee6 Shrink overhead of message representation.
0bf063a2ca Shrink overhead of message representation.
d87ceeacab Shave off one more store.
ddc52ab9d6 Shave off one more store.
c25d895adf Shrunk the arena state that needs to be synced.
7f67f68c1c Shrunk the arena state that needs to be synced.
ff40dd6ea9 Added new internal header.
85a43e5461 Added new internal header.
36662b3735 Refactor some code. I extracted some common code from all message field parsers, to a tail recursive function. Removed the varint jmp table for a simple varint parse loop, that removes the stack frames. Also careful with not losing information in repeated message tag check. When written mindful the checks and loads that happen can be reused for tag dispatch if not the expected tag.
cbcd635917 Fixed memory leak.
bcbcdadbd2 Fixed memory leak.
e5264bd794 Merge pull request grpc#312 from haberman/defiter
52957fa984 Merge pull request grpc#312 from haberman/defiter
746f64692c Moved arena inline for decoder.
7363b91ac3 Moved arena inline for decoder.
b8ef1dcc57 Removed C++-style comments.
575acd85bd Re-added const for all of the pointer wrapper types.
5aa5b77b41 Added simple offset-based accessors for defs, and deprecated old iterators.
33384301e2 Merge pull request grpc#311 from haberman/proto2-benchmark2
578e7c1f4c Merge pull request grpc#311 from haberman/proto2-benchmark2
bc301e7da4 Use merge/partial variants to give proto2 benchmark the fairest hearing.
30f01afa83 Added LargeInitialBlock test for proto2.
5d23fd99af Used shorter protobuf:: namespace alias.
9938cf8f27 Put submsg_index directly in table data. Drop oneof support for now to focus.
d87179501d Another build fix.
89bd8b87e1 Fixed a few more C89 compat issues.
64d293894a Fixed bug introduced by last optimization.
ff957b996c Fixed C89 compat issues.
537b6f42c2 A few updates to the benchamrk and minor implementation changes.
0dcc5641eb Replicated dispatch and implemeted array resizing logic. Up to 2.67GB/s.
526e430794 I think this may have reached the optimization limit.
4c65b25daf Handle long varints, now 2GB/s!
e39ec95ca2 Hoisted updates to limits and depth out of the loop.
52a0ed3891 Fixed a bug with tag number 15.
388b6f64eb A small optimization: don't increment array length every iteration.
9e5c5ce089 Optimized memset() with cutoff and fixed group & unknown message bugs.
8dd7b5a2ca A bunch more optimization.
e46e94ec7f Added benchmarks for proto2.
405e7934b1 Handle 2-byte submessage lengths.
88b1ec7784 Table-driven supports repeated sub-messages.
f173642db4 Handle non-repeated submessages.
e219a2d91d Merge branch 'decode-arena' into fast-table
7ec2c52346 Donate/steal from arena to accelerate decoding.
d43ccfa079 Revert test changes.
fac992db83 Cleanup for showing.
3937874a85 We have a properly structured algorithm, but perf regresses by 20%.
438ecaeb5a Give all field parsers a generic table entry.
383ae5293e WIP.
26abaa2345 WIP.
34b98bc030 Avoid passing too many params to fallback.
763a3f6293 WIP.
02ff6fb996 Merge pull request grpc#309 from haberman/decoder-forceinline
a202ce9629 Add UPB_FORCEINLINE for varint32 decoding.
d0f2c4c8a2 Merge pull request grpc#308 from haberman/encoder
5741eb9ad7 Expanded benchmarking script and added one size opt to the encoder.
0135399e60 Fixed bug introduced in refactoring.
df3438222b Notated impossible branch as unreachable.
9b31e8fe12 Merged common encode tag paths.
5d7dc718cc Minor formatting fix.
80441e4eb4 Optimized binary encoder.
ada28896b9 Changed encoder to use longjmp() for error recovery.
6e140c267c Added benchmark for encoding.
7338facddb Merge pull request grpc#307 from veblush/port-backport
4d2251c3e4 Add UPB_NORETURN for MSC

git-subtree-dir: third_party/upb
git-subtree-split: 60607da72e89ba0c84c84054d2e562d8b6b61177
lidizheng added a commit to lidizheng/grpc that referenced this issue Dec 21, 2020
60607da72e Merge pull request grpc#356 from haberman/codegen-uniquefiles
7a54a5f3d6 Split the code generators for .upb and .upbdefs.
b10b02f66f Merge pull request grpc#353 from haberman/small-fixes
cd7c2d2701 Merge pull request grpc#352 from haberman/large-field-number
10b355a6e0 A couple minor fixes. These are exercised by Ruby.
6c30b5fe73 Fixed upb encoder for field numbers > 2**28.
31b3528424 Merge pull request grpc#350 from haberman/encode-depthlimit
e9551022c1 Added depth limit checking to upb_encode().
f389384c5a Merge pull request grpc#349 from lidizheng/json-public
f72c26cbc4 Make :json publically visible
5797d95172 Merge pull request grpc#348 from haberman/json-emit-defaults
7a17493269 Removed print debugging.
695b7f4617 Added code to test UPB_JSONENC_EMITDEFAULTS.
6b357607bd Fixed bugs in JSON encoding with UPB_JSONENC_EMITDEFAULTS.
1b08391979 Merge pull request grpc#347 from haberman/filedef-symtab
ee49a8d7df Added an accessor to get the symtab from a filedef.
a81b47025a Merge pull request grpc#345 from haberman/encode-skipunknown
6535cbe380 Merge pull request grpc#346 from timgates42/bugfix_typo_position
7225108720 docs: fix simple typo, posisiton -> position
871ff96252 Test SKIPUNKNOWN on regular fields.
0569c22a1e Removed debug print.
76764643ac Added option to binary encoder to skip unknown fields.
794ce6d061 Merge pull request grpc#344 from haberman/deterministic-serialize
a04627abc8 Added map sorting to binary and text encoders.
3e071ea91a Merge pull request grpc#343 from haberman/msvc
e70e488e09 MSVC apparently doesn't support the standard C/C++ defines.
963e501aa6 Merge pull request grpc#342 from haberman/fuzz
8d670d8aea Renamed decode_varint32() to decode_tag().
9abf8e043f Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
50a543de7f Merge pull request grpc#341 from haberman/code-size
9c87f1168f Added size benchmark for CODE_SIZE.
6f82028236 Merge pull request grpc#340 from haberman/darwin-setjmp
358fa14d0e Fixed headers and updated benchmark script.
bc200451ce Use a macro instead of an inline function for setjmp/longjmp.
ca279f8afa Merge branch 'master' into darwin-setjmp
fbc0639b07 Use _setjmp on mac to avoid saving/restoring the signal mask.
10f0a38450 Merge pull request grpc#337 from haberman/size-benchmarks
4be07a2dce Increase build timeout until we can parallelize the build.
378a27b640 Force "size" to run locally.
da48e01f05 More google3 fixes.
d2446fd2db Moved cc_api_version attribute to proto_library().
4a84390c89 Added cc_proto_library() tweaks for google3.
4dd4212a34 Merge branch 'master' into size-benchmarks
ffecfef161 Merge branch 'master' into size-benchmarks
86f671d5fd Fix for Darwin (output is different, but it won't error out).
165e01ec6f Fix for old Python versions.
40fdff5e43 Merge pull request grpc#339 from haberman/benchmark-alias
5f8bb5de1d Updated generated code.
65d166a6ba Added API for copy vs. alias and added benchmarks to test both.
27b9c999a7 Merge pull request grpc#338 from haberman/arena-initial
9df96874e9 Start arena block doubling at initial block size.
881ddac7fe Also use .format() for gen_synthetic_protos.py.
8b7dabe1a2 Use format() instead of string interpolation, for old Python versions.
8e08282c3b Removed unused small.proto.
0f79d47215 Added missing lite binaries to size_data.txt.
555fbbc0bc Size benchmarks are working pretty well.
85cbc41a89 Merge branch 'master' into size-benchmarks
e5bdfba92c Removed accidentally-added .orig file.
07851fac58 Merge pull request grpc#336 from haberman/fuzz
982b634bc5 Fixed a few minor bugs found by fuzzing.
c9d2e58480 Merge pull request grpc#310 from haberman/fast-table
a01f3e23a4 Fixes for google3 build, and exclude even more tests from macOS to avoid timeout.
a83d55ee4b Exclude Clang tests from MacOS to avoid Kokoro timeouts.
73fcfe9ed0 Tried to slim down the tests a bit more.
baab25b7aa Removed excess/redundant tests from Kokoro script.
1eb7bd39e7 Some formatting fixes.
9d87055ce4 Updated Kokoro build script.
4bd34da105 WIP.
a7993615bf Merge branch 'master' into fast-table
3a3efe69a2 Added incompatible_use_toolchain_transition = True per bazelbuild/bazel#11584
7b4e376f79 Switch unordered_set -> absl::flat_hash_set.
fe62fc83e1 Removed obsolete includes in benchmark.
5ed089dc42 Merge pull request grpc#335 from haberman/wyhash-rule
e9b79542ad Added a BUILD file for wyhash.
7b8ae7ec4e Merge branch 'master' into size-benchmarks
a5b5445da6 Merge pull request grpc#334 from haberman/rm-port-c
6c16cba83f Removed obsolete port.c file.
484d8f746a Updated comment in wyhash.h to correct spelling mistake.
6a9d0f45b8 Merge pull request grpc#333 from haberman/32bitfixes
5b1f0d86a1 For Kokoro, only build/test -m32 on Linux.
0497f8deed Fixed a critical bug on 32-bit builds, and added much more Kokoro testing.
7543f851f1 Merge pull request grpc#332 from haberman/php-amalgamation
64abb5eb11 Amalgamation no longer bundles wyhash, but #includes it.
a2a40792b5 Merge pull request grpc#331 from haberman/json-oneof-fix
dd0994d377 Bugfix for JSON decoding: only check real oneofs for duplicates.
496f638025 Merge pull request grpc#330 from haberman/symtab-longjmp
c9f9668234 symtab: use longjmp() for errors and avoid intermediate table.
4d9a8cd67b Merge branch 'master' into symtab-longjmp
6322d1d72d Merge pull request grpc#329 from haberman/benchmark-ads-descriptor
5ec1d39224 Avoid building .pb.cc for ads protos, as C++ takes forever to compile.
43c207ea7e Added CMake dummy rule.
c3b5637646 Added benchmark for loading ads descriptor.
acd72c6d3f WIP.
6ae3b66cd2 Merge pull request grpc#328 from haberman/optdefload
8113ebd6c7 Added explanatory comment about integer constants.
f2d826b9f3 Got rid of floating-point division in table init.
723cd8ffc1 Added wyhash code and LICENSE, and removed temporary benchmark.
15e20636c3 Merge branch 'master' into optdefload
154f2c25f4 Added UTF-8 validation for proto3 string fields.
e8f9eac68c Added #defines UPB_ENABLE_FASTTABLE and UPB_TRY_ENABLE_FASTTABLE.
994cf07cf3 Merge pull request grpc#327 from benjaminp/modern-linking
b5bd5807a7 Migrate to modern Starlark linking api.
dc64613607 Merge branch 'fastest-table' into fast-table
e86541ac1d Fixed the build after the merge.
1cd0cb17d3 Merge branch 'master' into fastest-table
901744a97e Merge pull request grpc#326 from haberman/c99
a0d16e7073 Added a few missing copts, and made some functions proper prototypes.
558315a1c3 Added COPTS to :port.
7e5bd65098 Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
8f3ee80d46 Drop C89/C90 support and MSVC prior to Visual Studio 2015.
a274ad786a Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
2c8bb6dd9d Specify C99 explicitly until/unless we stop using bool.
efd576b698 Added -std=gnu99 for fastdecode and ran Buildifier.
b928696942 A few more fixes, and test fastdecode under Kokoro.
55f3569cd2 A few minor fixes and more assertions.
8b38e8f214 Merge branch 'fastest-table' into fast-table
46eb82467a Added comment to decode_fast.h.
bd9f8f580d Fixed a few bugs with the fast decoder.
3eba47914b Allocate hasbits and table slots in "hotness" order.
021db6fcd5 Allow larger tags into the table if they are unique mod 31.
86d9908c55 Fastdecode support for packed fields.
e3e797b680 Added fasttable support for oneofs.
7ffa9c181a Fixed some small bugs and performance problems in string copying.
e2c709e047 Repeated string and primitive support.
e9103eda9e Merge branch 'master' into fastest-table
0756999ab6 Merge pull request grpc#325 from haberman/inlined-arena
25db40bc30 Fixed upb::InlinedArena, which was compeltely broken.
d81ba58215 Optimized short string copying.
f3a2a79349 More optimization, back up to 2.56GB/s.
199c914295 Simplify push/pop when msg fits in the current buffer.
d5f5db2729 Put string-copying field parser into a separate function.
883f20d4dc Merge branch 'master' into fastest-table
1bd62e8218 Merge pull request grpc#324 from haberman/simplemomi
f4adbe0698 Optimized varint decoding from Gerben.
48689df72e Eliminated bounds checks inside parsing a field.
a345af9883 Added a codegen parameter for whether fasttables are generated or not.
8a3470c543 WIP.
8e8dbb5258 Merge branch 'fastest-table' into fast-table
7d17a0e8c5 Merge branch 'master' into fastest-table
a7e2e8338d Fixed benchmark script.
72de7b7002 Merge branch 'fastest-table' into fast-table
cb234e652c Merge branch 'master' into fastest-table
b86cf2d789 Merge pull request grpc#323 from haberman/build-files
4ea81ab107 Fixed pedantic warning.
6399b31f4b Removed ULL constants in json_decode.c.
c8ae197e64 Removed "U" suffixes, they are not necessary.
bc1e0b314f Fixed some strict C89 errors.
2c1664906a Removed license comments and upb_amalgamation for google3.
b7dc77415a Added licenses() to all BUILD files.
de22764b33 Updated Kokoro to test ... instead of :all.
e3f41de6c7 Split monolithic BUILD file into many build files.
fbe2bcafbc Merge pull request #4 from gerben-s/gerbens-fast-table
9e68ec033f Add repeated varints and fixed parsers
d0e4b688c6 Shorten name of kAliasString, so benchmark results don't wrap.
c0c9b5a168 Regenerated generated code.
eb8e6de8b7 Regenerated source files.
7f0d535826 Merge branch 'fastest-table' into fast-table
bf8e08074c Added a few more comments.
6e3c22e6ee Merge branch 'fastest-table' into fast-table
3238821315 Gave fast table entry a nicer name.
2a574d3d01 Added a bunch of comments for readability.
0deca8b8fb Merge branch 'master' into fast-table
bfadc99709 Merge branch 'master' into fastest-table
84e0f6127d Merge branch 'master' into fastest-table
61c51a607b Merge branch 'master' into fast-table
4f066765a9 Merge pull request grpc#320 from haberman/string-view-benchmark
bf393bf086 Cleaned up benchmark names.
9eb8414b31 Added descriptor_sv.proto.
ee7da95367 Bzl formatting fix per buildifier.
de1b6b0718 Refactored proto2 benchmarks and added StringView benchmark.
c2901eeee1 Added missing #includes (caught by Blaze).
52721eadc7 Order LargeInitialBlock after non-initial-block test.
44a7130845 Used the correct copy of the protos in the benchmark.
3a242e7a48 Merge branch 'master' into fast-table
d01b712dbb Merge branch 'master' into fastest-table
d225dfc2ed Buildifier formatting fixes.
b0994a6501 Added missing dep from benchmark.
de80054018 Make required fields optional for benchmarking.
745661bf1f Merge branch 'master' into fastest-table
11585095b7 Merge pull request grpc#319 from haberman/copy-descriptor
fd5a35d49d Minor comment changes.
bdd1a516e8 Fixed other tests.
27262adf93 Snapshot descriptor.proto into our own copy for benchmarking purposes.
d6b40fd5e2 Added missing dependency on reflection.
b9f1b67d07 Use quoted include.
1c8c16b9b1 Use quoted include.
4f901b6430 Passes all tests.
de84e20788 Merge branch 'master' into optdefload
d5c64476fd Merge pull request grpc#318 from haberman/descriptor-load-benchmark
42d2f6cef9 Add MB/s measures in the benchmarks.
1ce98b86ec Added LoadDescriptor benchmark for proto2.
4890735ce2 Added benchmark for descriptor loading.
6f59f1256e Optimizations to descriptor loading.
6874d61704 Merge pull request grpc#317 from haberman/gencode-compat
c81113e60f Added fallback code for when no enum matches.
c10b24ffb2 Simplified switch().
ded2e657a7 Added compatibility with old generated code.
5b0c5c7d4a Dispatch inline.
75edd3e59c Changed to use table pairs, seems to ever-so-slightly regress.
69d99a247e Merge pull request #3 from haberman/shifted-table
bca7edac8c Cleaned up table compression a bit.
b95f217996 A little speed boost, now hitting 2.51GB/s.
8ed6b2fe85 Stored mask in the table pointer.
a6dc88556d Tables are compressed, but perf goes down to 2.44GB/s.
91eb09b1bc Add a few comments.
7a1835d7c3 Merge branch 'master' into fast-table
8bd5c0088e Merge pull request grpc#316 from haberman/submsg-array
a4966fd230 Added a few extra sanity checks.
99acbe0da8 Fixed bug where submsg array could have excess elements.
2a0425ecf5 Merge pull request grpc#315 from haberman/conformance-fixes
7ccf5650c7 If we encounter "null" for a non-NullValue enum, throw an error.
0a3a94a12f Updated to a new version of protobuf and fixed a few conformance tests.
ddd5f28c4f Merge branch 'is_bazel'
10fa3a0c77 Merge pull request grpc#314 from haberman/addunknown
504e105420 undef UPB_ASAN.
ab96d1ec41 Removed extraneous C++-style comment.
d5096f9ee8 Fixed bug in addunknown and added ASAN poisoning.
6fe84526be Mark _is_bazel to be replace in google3.
f01efe8b64 Removed another C99-ism.
1749082bbb Removed C99-ism.
147e363f56 Merge branch 'master' into fast-table
f2ddc15d76 Bugfix: initialize fastlimit and fastend.
65e49b694b Merge branch 'gerben-fast-table' into fast-table
1abf7d418d Added generated files.
3f719fa6b2 Bugfix: offsetting hasbits with 16 introduced a bug in calculating hasmasks. Removing extra <<16 shift in hasmask calculating and masking out the first 16 bits. This makes messages without hasbits work as well.
aec762e405 Merge branch 'master' into fast-table
4f77aaafd8 Merge pull request #2 from gerben-s/fast-table
4053805759 Bugfixes
d1cd80385b Merge pull request grpc#313 from haberman/inline-arena
ad21083623 Merge pull request grpc#313 from haberman/inline-arena
2339fc779c Updated obsolete comment.
b393849bbd Updated obsolete comment.
ebe53f8590 Fixed compile error.
b37f82b58b Fixed compile error.
71749b7caf Implemented inline array allocation, and moved type->lg2 map to reflection.
9557b97acc Implemented inline array allocation, and moved type->lg2 map to reflection.
b58d2a0ee6 Shrink overhead of message representation.
0bf063a2ca Shrink overhead of message representation.
d87ceeacab Shave off one more store.
ddc52ab9d6 Shave off one more store.
c25d895adf Shrunk the arena state that needs to be synced.
7f67f68c1c Shrunk the arena state that needs to be synced.
ff40dd6ea9 Added new internal header.
85a43e5461 Added new internal header.
36662b3735 Refactor some code. I extracted some common code from all message field parsers, to a tail recursive function. Removed the varint jmp table for a simple varint parse loop, that removes the stack frames. Also careful with not losing information in repeated message tag check. When written mindful the checks and loads that happen can be reused for tag dispatch if not the expected tag.
cbcd635917 Fixed memory leak.
bcbcdadbd2 Fixed memory leak.
e5264bd794 Merge pull request grpc#312 from haberman/defiter
52957fa984 Merge pull request grpc#312 from haberman/defiter
746f64692c Moved arena inline for decoder.
7363b91ac3 Moved arena inline for decoder.
b8ef1dcc57 Removed C++-style comments.
575acd85bd Re-added const for all of the pointer wrapper types.
5aa5b77b41 Added simple offset-based accessors for defs, and deprecated old iterators.
33384301e2 Merge pull request grpc#311 from haberman/proto2-benchmark2
578e7c1f4c Merge pull request grpc#311 from haberman/proto2-benchmark2
bc301e7da4 Use merge/partial variants to give proto2 benchmark the fairest hearing.
30f01afa83 Added LargeInitialBlock test for proto2.
5d23fd99af Used shorter protobuf:: namespace alias.
9938cf8f27 Put submsg_index directly in table data. Drop oneof support for now to focus.
d87179501d Another build fix.
89bd8b87e1 Fixed a few more C89 compat issues.
64d293894a Fixed bug introduced by last optimization.
ff957b996c Fixed C89 compat issues.
537b6f42c2 A few updates to the benchamrk and minor implementation changes.
0dcc5641eb Replicated dispatch and implemeted array resizing logic. Up to 2.67GB/s.
526e430794 I think this may have reached the optimization limit.
4c65b25daf Handle long varints, now 2GB/s!
e39ec95ca2 Hoisted updates to limits and depth out of the loop.
52a0ed3891 Fixed a bug with tag number 15.
388b6f64eb A small optimization: don't increment array length every iteration.
9e5c5ce089 Optimized memset() with cutoff and fixed group & unknown message bugs.
8dd7b5a2ca A bunch more optimization.
e46e94ec7f Added benchmarks for proto2.
405e7934b1 Handle 2-byte submessage lengths.
88b1ec7784 Table-driven supports repeated sub-messages.
f173642db4 Handle non-repeated submessages.
e219a2d91d Merge branch 'decode-arena' into fast-table
7ec2c52346 Donate/steal from arena to accelerate decoding.
d43ccfa079 Revert test changes.
fac992db83 Cleanup for showing.
3937874a85 We have a properly structured algorithm, but perf regresses by 20%.
438ecaeb5a Give all field parsers a generic table entry.
383ae5293e WIP.
26abaa2345 WIP.
34b98bc030 Avoid passing too many params to fallback.
763a3f6293 WIP.
02ff6fb996 Merge pull request grpc#309 from haberman/decoder-forceinline
a202ce9629 Add UPB_FORCEINLINE for varint32 decoding.
d0f2c4c8a2 Merge pull request grpc#308 from haberman/encoder
5741eb9ad7 Expanded benchmarking script and added one size opt to the encoder.
0135399e60 Fixed bug introduced in refactoring.
df3438222b Notated impossible branch as unreachable.
9b31e8fe12 Merged common encode tag paths.
5d7dc718cc Minor formatting fix.
80441e4eb4 Optimized binary encoder.
ada28896b9 Changed encoder to use longjmp() for error recovery.
6e140c267c Added benchmark for encoding.
7338facddb Merge pull request grpc#307 from veblush/port-backport
4d2251c3e4 Add UPB_NORETURN for MSC

git-subtree-dir: third_party/upb
git-subtree-split: 60607da72e89ba0c84c84054d2e562d8b6b61177
keith pushed a commit to bazelbuild/tulsi that referenced this issue Jan 7, 2021
This is phase 2 of of the switch to toolchain transitions. See bazelbuild/bazel#11584 for details.

PiperOrigin-RevId: 338462410
(cherry picked from commit 06d3ebf)
keith pushed a commit to bazelbuild/tulsi that referenced this issue Jan 7, 2021
This is phase 2 of of the switch to toolchain transitions. See bazelbuild/bazel#11584 for details.

PiperOrigin-RevId: 338462410
(cherry picked from commit 06d3ebf)
jsharpe added a commit to jsharpe/rules_foreign_cc that referenced this issue Apr 19, 2021
jsharpe added a commit to jsharpe/rules_foreign_cc that referenced this issue Apr 19, 2021
UebelAndre pushed a commit to bazel-contrib/rules_foreign_cc that referenced this issue Apr 19, 2021
severnt added a commit to Enflick/rules_swift that referenced this issue Sep 21, 2021
* Add .clang-format (bazelbuild#467)

Fixes bazelbuild#305

* Add error for no Linux swiftc path (bazelbuild#466)

Fixes bazelbuild#16

* Update dump_toolchains to support home dir (bazelbuild#471)

Before:

```
swift-DEVELOPMENT-SNAPSHOT-2020-01-29-a.xctoolchain -> org.swift.50202001291a
swift-TEST-SNAPSHOT-2020-01-23-a.xctoolchain -> org.swift.50202001231a
swift-latest.xctoolchain -> org.swift.50202001291a
```

After:

```
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-01-29-a.xctoolchain -> org.swift.50202001291a
/Library/Developer/Toolchains/swift-TEST-SNAPSHOT-2020-01-23-a.xctoolchain -> org.swift.50202001231a
/Library/Developer/Toolchains/swift-latest.xctoolchain -> org.swift.50202001291a
/Users/ksmiley/Library/Developer/Toolchains/swift-5.2-DEVELOPMENT-SNAPSHOT-2020-04-28-a.xctoolchain -> org.swift.52202004281a
/Users/ksmiley/Library/Developer/Toolchains/swift-latest.xctoolchain -> org.swift.52202004281a
```

* Run clang-format on everything (bazelbuild#470)

* Update README instructions (bazelbuild#472)

* Ensure that `swift_module_alias` propagates instrumented file info from its dependencies, otherwise coverage data might get dropped.

PiperOrigin-RevId: 325306099

* Allow generated headers with path separators (bazelbuild#439)

Co-authored-by: Michael Eisel <meisel@spotify.com>
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>

* Delete CONTRIBUTORS (bazelbuild#475)

This is outdated, best to look at the github insights tab

* Various changes related to explicit module compilation: (bazelbuild#477)

*   Add a feature to support compiling system modules with reduced
    diagnostic output.
*   Support system modules passed as path names (strings) instead of
    `File` artifacts.
*   Add the necessary tool config to support compiling explicit
    modules with Xcode 12 and higher (when the features are also
    enabled).
*   When compiling explicit modules, generate module maps for
    `objc_library` targets in the Swift rules instead of using
    the one propagated by `ObjcProvider` to ensure that `use`
    declarations for dependencies unknown to the native Bazel
    module map generation code are present.

PiperOrigin-RevId: 327813526

Co-authored-by: Tony Allevato <allevato@google.com>

* Use a parameter file when linking Swift libraries when the host machine is macOS (bazelbuild#473)

This is to prevent the linking failures if a `swift_library` target has
too many files that can cause its linking args to become longer than the
system's command length limits. This does not change the behavior when
building on Linux yet, since `ar` does not support passing arguments
using a parameter file.

* Read the `custom_malloc` configuration field in `swift_{binary,test}` to use an allocator provided by the `--custom_malloc` flag, if any. (bazelbuild#478)

PiperOrigin-RevId: 329317960

Co-authored-by: Tony Allevato <allevato@google.com>

* No need to check if we're on macOS for non-Darwin Swift toolchain (bazelbuild#479)

* Update protobuf deps (bazelbuild#480)

* Run //test/... on Linux CI (bazelbuild#463)

* Ensure that intermediate outputs created for Swift source files (such as object files) do not have spaces in their names.

This was already handled for basenames, but not for directory names between the target's package and the file; for example, if one had `swift_library(name = "ArgumentParser", ...)` in a `BUILD` file that also contained `Sources/ArgumentParser/Parsable Types/ParsableCommand.swift`.

PiperOrigin-RevId: 329799243

* Update bzl_library targets (bazelbuild#482)

* Pin rules_proto to a rev that contains bzl_library definitions

* Update bzl_library targets

Mostly so depending on them from a stardoc rule works now we load rules_proto

Mostly autogenerated & then tweaked based on the gazelle in bazelbuild/bazel-skylib#271

* Revert removal of for_bazel_tests filegroup target

* Update internal bzl_libraries to only be visible to //swift:__subpackages__

* Also limit visibility of //test/fixtures:common

* Add a feature flag to enable generation from raw proto sources.

The DescriptorSets ProtoInfo exposes don't have source info, so the generated
source don't have the comment. bazelbuild/bazel#9337
is open to attempt to get that, but this provides a way to opt into forcing it.

This does come with a minor risk for cross repository and/or generated proto
files where the protoc command line might not be crafted correctly, so it
remains opt in.

RELNOTES: None
PiperOrigin-RevId: 330538313

* Honor the feature flag to enable generation from raw proto sources.

The DescriptorSets ProtoInfo exposes don't have source info, so the generated
source don't have the comment. bazelbuild/bazel#9337
is open to attempt to get that, but this provides a way to opt into forcing it.

This does come with a minor risk for cross repository and/or generated proto
files where the protoc command line might not be crafted correctly, so it
remains opt in.

This is followup to the previous change that did this for swift_proto_library.

NOTE: The current version of swift grpc depended on doesn't include comments,
but the NIO version appears to support it for methods, so landing the work
in advance of things updating to that version.

RELNOTES: None
PiperOrigin-RevId: 330729710

* Remove unused value.

RELNOTES: None
PiperOrigin-RevId: 330801521

* Don't propagate an empty module map for `{cc,objc}_library` targets that don't have any headers (and that don't specify an explicit module map using the `module_map` attribute).

This is typically the case for libraries that group other libraries via their `deps`. Users mistakenly import these thinking they're required to use the underlying declarations, but they do nothing (except make more work for the compiler).

PiperOrigin-RevId: 332246632
(cherry picked from commit 639ecfa)

* Added helper macro for declaring transitive dependencies

* Update README shas

* Fix buildifier warning

* Update rules_swift to use the toolchain transition.

This is phase 2 of of the switch to toolchain transitions. See bazelbuild/bazel#11584 for details.

This shouldn't be merged into rules_swift's master branch until https://cs.opensource.google/bazel/bazel/+/58fdf63d81cc71f0315918b111fc56f4c039f1a5 is in a Bazel release (which should be 3.7, bazelbuild/bazel#12188).

PiperOrigin-RevId: 334610489

* Update apple_support

* Implement -coverage-prefix-map feature (bazelbuild#489)

* Update worker docstring with example (bazelbuild#505)

This comment made it sound like this shouldn't ever happen, but if you
pass `-rpath @loader_path/something` you will always hit this case.

* Introduce feature to register a separate action to generate swift derived files (bazelbuild#504)

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>

* Fix index while building with derived files (bazelbuild#506)

The swiftmodule generation should not attempt to perform indexing.

* Fix derive files with bitcode (bazelbuild#509)

* Output command lines of failed action command line tests (bazelbuild#508)

This is helpful when debugging what does or doesn't exist

* Add swift.remap_xcode_path feature (bazelbuild#511)

* Only read output_file_map if it's going to be written

The output_file_map is only written to disk in a transformed state if an incremental build is happening. This change causes the output_file_map to only be read and processed in that case as well, leading to less work in the WMO case.

* Create a build setting to allow forcing a Swift target to Apple with bazel transitions. (bazelbuild#515)

PiperOrigin-RevId: 339779917
(cherry picked from commit e4ad1cc)

Co-authored-by: Googler <noreply@google.com>

* Update apple_support (bazelbuild#517)

* Update README with new URLs (bazelbuild#518)

* Migrate to the modern Starlark linker input API. (bazelbuild#512)

See bazelbuild/bazel#10860.

* Update README with new URLs (bazelbuild#520)

* Update protobuf (bazelbuild#524)

* Clean up some old TODOs.

- Remove some deprecated fields.
- Assert that atleast one module is provided.

RELNOTES: None
PiperOrigin-RevId: 344261262
(cherry picked from commit eefede5)

* Remove the `swift.implicit_modules` feature.

This feature permitted an odd three-state situation around the way the implicit module cache is handled:

1. The so-called "global module cache", which is placed in `bazel-out`
2. The ephemeral module cache, which is created and destroyed around each compile action
3. A state where no flags related to the implicit module cache are passed to the compiler, meaning "do whatever the compiler does by default".

This third state is the one we want to get rid of, since the default is to place the module cache in a temp location outside the sandbox.

PiperOrigin-RevId: 344942165
(cherry picked from commit 575b819)

* Stop computing transitive_generated_headers.

RELNOTES: None
PiperOrigin-RevId: 344857866
(cherry picked from commit 5167ae9)

* Standardize on FIXTURE_TAGS, ensure all targets tagged.

RELNOTES: None
PiperOrigin-RevId: 345024048
(cherry picked from commit d5fa2f5)

* Deduplicate module map flags in Swift compilation

Module map files being propagated through different providers seem to
ended up being treated like different modules, even though they point to
the same .modulemap files. Swift compilation in targets with a lot of
objc_library dependencies were getting a lot of duplicate flags. This
fixes that by deduplicate the module map list before passing them to the
compiler.

* Revert "Migrate to the modern Starlark linker input API. (bazelbuild#512)"

This reverts commit aff1754.

* Migrate Swift build rules to the new C++ `LinkerInput` APIs.

Based partially on bazelbuild#512 by @benjaminp.

PiperOrigin-RevId: 341831304
(cherry picked from commit bf9560d)

* Fix tests

* Make the `srcs` attribute of `swift_library` mandatory and non-empty.

PiperOrigin-RevId: 345120894
(cherry picked from commit c210804)

* Update README with new URLs

* Migration off SwiftInfo.module_name.

- Make module alias use the direct modules instead with legacy fall back for the
  existing support.
- Validate during creation of SwiftInfo that any provided module_name matches the
  first module (if any modules are provided).

RELNOTES: None
PiperOrigin-RevId: 345237478
(cherry picked from commit 46613b2)

* Add the SDK's `Developer/Library/Frameworks` directory to the compiler and linker search paths on platforms that have it.

Added in Xcode 12, `StoreKitTest.framework` is in a new Developer directory hierarchy under the SDK root (not to be confused with the one under the `.platform` root), except on macOS where it *does* live in the `.platform`'s Developer directory.

A small cleanup here means we also no longer pass a non-existent developer frameworks path when targeting watchOS.

PiperOrigin-RevId: 346784495
(cherry picked from commit 0ec7a57)

* Require `name` to be a named argument.

RELNOTES: None
PiperOrigin-RevId: 347033042
(cherry picked from commit 3355e61)

* Retire `module_name` from create_swift_info.

RELNOTES: None
PiperOrigin-RevId: 347035229
(cherry picked from commit 6e4e3ca)

* Allow `optional_implicit_deps` and `required_implicit_deps` to be set on an `xcode_swift_toolchain` target.

PiperOrigin-RevId: 347841955
(cherry picked from commit 875de9f)

* Fix XCTest -I for derived files

In 768bfe3 this was moved and this
wasn't added (since it isn't used inside Google)

* Remove SwiftInfo.module_name, it was deprecated a while ago.

RELNOTES: None
PiperOrigin-RevId: 348027802
(cherry picked from commit 789b20b)

* Ignore a feature when a `SwiftToolchainInfo` says it does not support it instead of making it a build failure. This is closer to the C++ crosstool behavior.

This change also cleans up the internal representation of the feature configuration, by no longer tracking unsupported features (which were never used elsewhere) and by preceding the `struct` fields with underscores to indicate that they should not be read by clients (the value should only be queried by passing it to other `swift_common` functions).

PiperOrigin-RevId: 348055621
(cherry picked from commit 3c85e63)

* Uniquify `-fmodule-map-file=` flags passed to `swiftc`.

In some cases (e.g., if a module map defines multiple modules and both or more were present in the dependency graph), the `depset` won't deduplicate the module structures because their values are distinct (they contain different module names). That's the behavior we want, but it also resulted in the `-fmodule-map-file=` for that module map appearing multiple times on the command line.

PiperOrigin-RevId: 348139990
(cherry picked from commit df1198b)

* Work around bazelbuild/stardoc#78.

Markdown bullet lists work fine in the general descriptions block of macros/rules/providers, but for rule attributes and provider fields the the markdown is a table, and `*` has no means (and stardoc transforms the content to remove newlines). The above issue is to support catch these and marking html bullet lists out of them, but until that is done, adding a blank line between each bullet gets slightly more readable generated/render documents.

PiperOrigin-RevId: 348682502
(cherry picked from commit 5383052)

* Update README with new URLs

* Allow modules propagated by `SwiftInfo` to indicate whether they are system modules.

System modules differ from non-system modules in that we don't pass the module map to the compiler via `-fmodule-map-file` for system modules in implicit module builds, only in explicit module builds. This is because module maps passed via `-fmodule-map-file` are always treated as non-system modules, which affects how diagnostics are emitted when their headers are parsed, and some Swift modules like `SwiftOverlayShims` don't declare themselves as `[system]` in their module map file but contain small nullability issues. Such headers *must* be found through a standard header search via a system path like `-isystem` so that they don't cause builds to fail if they treat warnings more severely.

PiperOrigin-RevId: 351896080
(cherry picked from commit 2140619)

* Stop computing/tracking defines.

They are already exposed in the modules, so use them directly from there instead.

This also means they union doesn't have to keep being computed going up the
build graph, which will save some cycles.

RELNOTES: None
PiperOrigin-RevId: 351588940
(cherry picked from commit 52b9ffa)

* Remove swift_version.

It was deprecated a while ago, and it avoids the collection in swift_library now.

RELNOTES: None
PiperOrigin-RevId: 351595739
(cherry picked from commit 5b1aabd)

* Add a `swift_explicit_module` output group to the `swift_clang_module_aspect` to provide a way to invoke the aspect from the command line and retrieve the `.pcm` file.

This provides an easier way to manually verify that a `{cc,objc}_library` builds correctly as an explicit module.

PiperOrigin-RevId: 353103538
(cherry picked from commit 1b63232)

* Lessen restrictions on when implicit modules can be used:

- Allow Swift compiles to use implicit modules even if `swift.use_c_modules` is enabled (a necessary fallback if some dependencies don't emit explicit modules).
- Continue to disallow usage of implicit modules when compiling explicit C/Objective-C modules because those implicit module paths would become embedded in the `.pcm` files, making them immovable.

PiperOrigin-RevId: 353665654
(cherry picked from commit 2711a2b)

* Fix header selection when falling back to implicit modules.

If we're compiling a `swift_library` with explicit modules enabled but some dependency subtree doesn't propagate explicit modules, we weren't collecting the right headers; we need the full transitive set for that subtree, not just the direct headers.

Also cleaned up the comments and control flow in this function, which had gotten out-of-date and confusing, which no doubt contributed to the problem.

PiperOrigin-RevId: 354142943
(cherry picked from commit 0ad70ff)

* Simplify the paths to module maps generated by the Swift build rules.

Since we pass these module maps directly to the compiler with `-fmodule-map-file`, we don't need them to be named exactly `module.modulemap`, so the extra subdirectory is also unnecessary.

PiperOrigin-RevId: 354151400
(cherry picked from commit 71998c8)

* Automated rollback of commit 71998c8.

PiperOrigin-RevId: 354172938
(cherry picked from commit 6dc76fe)

* Simplify the paths to module maps generated by the Swift build rules.

Since we pass these module maps directly to the compiler with `-fmodule-map-file`, we don't need them to be named exactly `module.modulemap`, so the extra subdirectory is also unnecessary.

This change also migrates generation of the modulemap file content for the generated header's module to the same code (`module_maps.bzl`) already used by `swift_clang_module_aspect`, instead of having its own separate code path.

PiperOrigin-RevId: 354324121
(cherry picked from commit 5f51ca9)

* Use released protoc binaries where possible (bazelbuild#555)

This updates `rules_proto`, which has been configured to use released
protoc binaries where it can.

This can be a breaking change if users have a call to `protobuf_deps()`
_before_ `swift_rules_extra_dependencies()` in their WORKSPACE. To
fix, remove `load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")`
and `protobuf_deps()` from the WORKSPACE file, and use the following
instead:

```
load(
    "@build_bazel_rules_swift//swift:extras.bzl",
    "swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()
```

* Add disable system index feature (bazelbuild#563)

* Don't re-export the modules imported by a Swift generated header.

This was an unintentional change in behavior from bazelbuild@5f51ca9; this puts us back to the original behavior, but leaves an API in place for finer-grained control over re-exporting modules in the future. (But the BUILD rules today don't really have the flexibility to support it yet.)

PiperOrigin-RevId: 356338982
(cherry picked from commit f45eea8)

* Explicitly set --macos_minimum_os=10.15 to make `swift_{binary,test}` runnable on macOS Catalina (which is the macOS version used by Bazel CI) when building with Xcode 12 or above (bazelbuild#566)

Since there's no way to set the deployment version for
`*_{binary,test}`, this makes rules_swift on CI green again without
having to go back to using Xcode 11.7.

* Move toolchain- and command-line-provided compiler flags into action configurators.

This change removes of the `SwiftToolchainInfo.command_line_copts` field, no longer treating those command line flags as an odd special case. It also ensures that flags from the toolchain are passed in a unified manner regardless of which rule registers the action.

For example, Bazel-legacy Objective-C flags determined by compilation mode, like `-fstack-protector`, affect the compatibility of Clang modules and need to be passed both when compiling an explicit module and when compiling the Swift code that consumes those modules.

This required a bit more shuffling around of the way we need to handle differing outptus for WMO, since the `--swiftcopt` flags would no longer be able to be scanned directly after the toolchain configuration.

PiperOrigin-RevId: 355451642
(cherry picked from commit 1bea35e)

* Fix incorrect param name

* Fix non-threaded mode WMO

The non-threaded mode WMO, which produces a single object file for the
entire compilation unit (.o), is determined by the non-presence of the
`-num-threads` flag, or `-num-threads 0` flags are passed.

* No longer scan for `-num-threads=X` (specifically the form with the equal sign).

We've always supported this, but `swiftc` today doesn't accept the version with the equal sign and briefly looking through the history of Options.td I can't find any evidence that it ever did. We continue to support space-separated `-num-threads X`.

PiperOrigin-RevId: 355647561
(cherry picked from commit d26868f)

* Unconditionally add `ObjcProvider.umbrella_header` files to compiler inputs, even when preferring explicit modules.

A small number of rules use `umbrella_header` to propagate an umbrella header for their module map that they don't propagate in any other header field. Since there is no `direct_*` version of this field, `swift_clang_module_aspect` can't easily extract the one umbrella header from the `depset` in the provider that may also include transitive umbrella headers.

PiperOrigin-RevId: 355667496
(cherry picked from commit bd8c7d4)

* Compile an explicit module for the generated header of a `swift_library`.

The notion of "implicit compile-time dependencies for generated header modules only" has been added to the toolchain because generated Obj-C headers always import Foundation and Darwin, but we don't necessarily want to force those as dependencies of every Swift compilation. Likewise, the private (implementation-only) dependencies of a module shouldn't be included when generating the module map `use` decls for the Obj-C header module, because by definition, they can't be exported.

PiperOrigin-RevId: 358406043
(cherry picked from commit ab1c5cd)

* Pass framework search paths directly to clang for pcms

This is needed since swiftc doesn't pass the framework search paths to clang, causing issues with framework style imports in headers.

* Pass `-no-clang-module-breadcrumbs` to frontend jobs (bazelbuild#574)

By default, absolute paths to the dependent pcm files are embedded
into the debug info, which was used as a fallback path for LLDB to
reconstruct Clang types from DWARF, when it wasn't able to import
a dependent Clang module from source. 

Since those paths aren't shareable across machines, disabling this
behavior makes the compilation outputs more reproducible.

* Add remotely debuggable Swift document (bazelbuild#576)

* Update apple_support (bazelbuild#577)

* Update README for new URL (bazelbuild#578)

* Support "Make" variable expansion in `copts` and `linkopts`

Resolves bazelbuild#314.

* Add a `generates_header` attribute to `swift_library` to control Objective-C header generation.

Today, `swift_library` unconditionally generates a header and module map for all targets (unless rarely-used features are applied), even if the library has no APIs exported to Objective-C. This creates a small amount of unnecessary work, but that work grows significantly when explicit modules are used in the build, because we also need to compile the explicit modules for those generated headers _just in case_ some `objc_library` further up in the build graph needs to import the header.

This is the first of a few changes that will eventually require the `generates_header` attribute to be set on targets to have the generated header emitted and propagated.

This change also removes the `swift.no_generated_header` feature, since the attribute's behavior supplants it.

PiperOrigin-RevId: 362562962
(cherry picked from commit e621e5e)

* Internal change.

PiperOrigin-RevId: 366495458
(cherry picked from commit d27e5a6)

* Switch to XcodeVersionConfig.execution_info().

RELNOTES: None
PiperOrigin-RevId: 364797902
(cherry picked from commit aeb56dc)

* Distinguish between direct and transitive information when creating the `CcInfo` for a `swift_library`.

This ensures that, for a `swift_library` target `t`, reading from either the direct fields of `t[CcInfo].compilation_context` or `t[SwiftInfo].direct_modules[...].clang.compilation_context` produces consistent results.

PiperOrigin-RevId: 363418185
(cherry picked from commit 027e180)

* Delete support for compiler performance stats collection.

This wasn't used frequently enough to rationalize being so deeply woven into the build rules. A better approach might be to use an aspect that runs the same actions in parallel but with the necessary stats flags and collects the data files; while this would double the actions executed, it's better code-health wise. But I don't have any plans to do that in the near-term.

PiperOrigin-RevId: 363887607
(cherry picked from commit 4234e38)

* Simplify and cleanup how implicit toolchain dependencies are managed.

-   When propagating implicit deps in the toolchain, merge and propagate the providers instead of the `Target` object itself. The `Target` object is fairly heavyweight and not intended to be propagated around the build graph.
-   Remove the `swift.minimal_deps` feature and the distinction between "required" and "optional" implicit deps.

PiperOrigin-RevId: 367044294
(cherry picked from commit 665ea75)

* Update examples/tests with `generates_header = True` where necessary before flipping the attribute.

PiperOrigin-RevId: 362932692
(cherry picked from commit 1bcdd57)

* Make `swift_library` not generate an Objective-C header by default.

To generate a header, `generates_header` must be set to `True` on the target.

PiperOrigin-RevId: 367012879
(cherry picked from commit 413cc02)

* Update apple_support to new release

* Update README with new URLs

* Add -Werror for C++

* Fix skylib branch name

Fixes bazelbuild/rules_apple#1130

* Add first stardoc API docgen target (bazelbuild#598)

* Generate providers.md from sources (bazelbuild#599)

* Add `swift_common.create_swift_interop_info`.

This API allows custom rules to opt-in to "lightweight Swift interop". If they are already propagating a `CcInfo` with a compilation context, then `swift_clang_module_aspect` will detect this provider and generate a module name/module map (if necessary), and also compile the explicit module (if enabled). This frees the custom rule from having to understand details of the Swift compilation APIs, or even having to have a dependency on the Swift toolchain at all.

PiperOrigin-RevId: 367251939
(cherry picked from commit 9be992e)

* Move swift_clang_module_aspect out of swift_common and directly expose it.

RELNOTES: swift_clang_module_aspect is directly exported instead of being in swift_common.
PiperOrigin-RevId: 367673524
(cherry picked from commit bf8243d)

* Update the module name derivation algorithm to handle any sequence of non-identifier characters safely.

PiperOrigin-RevId: 368004995
(cherry picked from commit ec94196)

* API changes to `create_swift_interop_info`.

- Require all dependencies' `SwiftInfo`s to be passed instead of implicitly (and unconditionally) traversing `deps`.
- Add `requested_features` and `unsupported_features` parameters so rule implementations can provide these values (to be automatically added to the values on the target) as if they were supplying the feature configuration themselves.
- Correctly derive a module name if it is not provided.

PiperOrigin-RevId: 368653094
(cherry picked from commit 24a0449)

* Factor out Bazel placeholder substitution functionality into a separate reusable class.

PiperOrigin-RevId: 366461152
(cherry picked from commit 89c6ab2)

* Support older C++ versions

Google's internal C++ version is higher than bazel's default.
Theoretically we could mess with the `-std` flag that's passed, and I
tried that a bit, but the public crosstool differs between macOS and
Linux so it makes it a bit of a pain. For this case this is easy enough.

* Sort headers in the module maps generated by `swift_clang_module_aspect`, and rewrite generation to use a multi-line `Args` object as a file writer instead of building up an analysis time string.

With this approach, each "arg" (or each entry in a list/depset of args) is treated as its own line in the output file; we use the `format_each` and `map_each` parameters to provide any additional text that should surround that value on the line.

More importantly, this adds support for expanding tree artifacts (directories) if one is provided in a compilation context.

PiperOrigin-RevId: 367221120
(cherry picked from commit 5f7af69)

* Remove top level functions for now

* Use cpp fragment, instead of objc fragment, to determine whether to generate dsym

The information is identical, and we would like to migrate all uses to
cpp fragment so that we can delete the info in objc fragment.

PiperOrigin-RevId: 370899517
(cherry picked from commit 3e53aa2)

* Add support for older bazel versions for now

* Add Xcode toolchain support for an optional binary that can rewrite the generated header of a Swift module after compilation.

PiperOrigin-RevId: 369323385
(cherry picked from commit e4912a3)

* Disable generated_header_rewriter for now

This doesn't work without nested functions. I think this use case is
pretty rare but if someone wants to enable this before bazel supports
nested functions that's fine.

* Make the strict include paths from `objc_proto_library` targets available so headers can be found when `swift_clang_module_aspect` compiles a module.

`swift_clang_module_aspect` assumes that CcInfo contains all of the necessary compiler flags to be able to find the headers that are used when compiling an explicit module. This is true for all flags except the header search path in the Objc provider's `strict_include` field. This means that the `strict_include` field needs to be explicitly translated to an equivalent CcInfo when compiling the module.

PiperOrigin-RevId: 370991285
(cherry picked from commit 1aca023)

* Rename `swift.strict_modules` to `swift.layering_check` to match the C++ feature name.

PiperOrigin-RevId: 371693623
(cherry picked from commit 06322f1)

* Add a user settable build setting to specify additional swiftcopts for a swift_libray target.

The flag accepts a comma separated list of "target=copts" pairs, where "target" is a fully qualified target label and "copts" is a colon separated list of Swift copts.

PiperOrigin-RevId: 371728552
(cherry picked from commit de9c4e1)

* Disable allow_multiple for per_module_swiftcopt_flag

Bazel doesn't support this yet

* Update README with new URLs

* Use target_compatible_with for macOS only tests (bazelbuild#514)

* Add `swift.global_module_cache_uses_tmpdir` feature (bazelbuild#581)

* Add `swift.global_module_cache_uses_tmpdir` feature

This adds a new feature, that can be enabled by passing `--features=swift.use_global_module_cache` and `--features=swift.global_module_cache_uses_tmpdir` to the build command.

This feature, when enabled, will makes the Swift compilation actions use the shared Clang module cache path written to `/tmp/__build_bazel_rules_swift/swift_module_cache/REPOSITORY_NAME`. This makes the embedded Clang module breadcrumbs deterministic between Bazel instances, because they are always embedded as absolute paths. Note that the use of this cache is non-hermetic--the cached modules are not wiped between builds, and won't be cleaned when invoking bazel clean; the user is responsible for manually cleaning them.

Additionally, this can be used as a workaround for a bug in the Swift compiler that causes the module breadcrumbs to be embedded even though the `-no-clang-module-breadcrumbs` flag is passed (https://bugs.swift.org/browse/SR-13275).

Since the source path of modulemaps might be different for the same module, (i.e. multiple checkouts of the same repository, or remote execution), multiple modules with different hashes can end up in the cache. This can result in build failures. Don't use this feature with sandboxing (or probably remote execution as well).

* Stop passing `uses_swift` to `new_objc_provider`.

This flag hasn't been used by Bazel for a very very very very very long time.

PiperOrigin-RevId: 373845026
(cherry picked from commit 05f18b8)

* Enable CI testing for docgen (bazelbuild#617)

* Generate api.md from sources (bazelbuild#618)

* Generate setup.md from sources (bazelbuild#619)

This is the last doc that should be generated from sources, but wasn't, from what I can tell.

* Update README with new URLs (bazelbuild#621)

* Update bazel_skylib (bazelbuild#620)

* Update the worker protocol proto (bazelbuild#622)

* Add ubsan support (bazelbuild#544)

* Remove unused command_line_copts (bazelbuild#625)

* Include the headers from direct dependencies of a Swift target when compiling the explicit module for its generated header.

PiperOrigin-RevId: 372240650
(cherry picked from commit cc15b6e)

* Use `-fsystem-module` if the compiler is new enough to support it (Xcode 12.5/Swift 5.4 or higher).

PiperOrigin-RevId: 373046121
(cherry picked from commit 4cd9b2c)

* Add the `swift_feature_allowlist` rule that lets toolchains control which packages are allowed to enable/disable specific features. (bazelbuild#627)

Co-authored-by: Tony Allevato <allevato@google.com>

* Disable layering checks when compiling the explicit module for a Swift generated header.

The Swift compiler determines which module to import a symbol from based on the module that defines that symbol. Due to modular re-exports (which are particularly common among system frameworks), this may not be the same framework that the user imported from Swift and added to their dependencies.

(For example, most users will import and depend on `Foundation` to use `NSObject`, but Swift will import it from the module it is actually defined in, `ObjectiveC`.)

PiperOrigin-RevId: 371919747
(cherry picked from commit d8a381c)

* Disable layering checks for now

This depends on lambda support which bazel 4.1 does not have

* Revert "Disable layering checks for now"

This reverts commit 021c11b.

* Get rid of the non-strict use of `-fmodules-decluse`.

For layering checks with explicit modules, we only want
`-fmodules-strict-decluse`; it's not useful to let headers
without a known module map sneak through.

PiperOrigin-RevId: 375825780
(cherry picked from commit 214f725)

* Support implicit C/Objective-C dependencies that are passed when compiling any explicit Clang module.

The toolchain's `clang_implicit_deps` are not passed to Swift compilations;
only to actions that compile an explicit C/Objective-C module using
`swift_common.precompile_clang_module`.

PiperOrigin-RevId: 375816204
(cherry picked from commit 9afbc30)

* Update docs

* Get rid of spurious diagnostics when compiling system modules with Xcode 12.5:

```
<unknown>:0: error: invalid argument '-fsystem-module' only allowed with '-emit-module'
```

This happens because ClangImporter changes the invocation's action to `GenerateModule` *after* the invocation is created by parsing the `-Xcc` flags from the Swift command line, and Clang's argument parser emits a diagnostic if `-fsystem-module` is used with any other action.

PiperOrigin-RevId: 375942286
(cherry picked from commit c497e6e)

* Add buildifier pre-commit hook (bazelbuild#632)

Matches the one just landed in rules_apple: bazelbuild/rules_apple@61bc7c0

* Reuse swiftmodule for incremental builds (bazelbuild#633)

* Add returns (bazelbuild#634)

Missed with 84286ad.

Also reverts the hard error on not creating directories. It could try to create the same directory multiple times, and the previous behavior silently errored on those. This can get fixed up in a later change to only try to create each directory once, and to only error if the directory doesn't already exist.

* Implement global index store cache (bazelbuild#567)

swift and clang write index data based on the status of what resides in
`index-store-path`. When using a transient per-swift-library index, it
writes O( M imports * N libs) indexer data and slows down compilation
significantly: to the tune of 6GB+ index data in my testing. Bazel likes
to use per `swift_library` data in order to remote cache them, which
needs extra consideration to work with the design of swift and clang and
preserve the performance

This PR does 2 things to make index while building use the original
model of the index-store so we don't have to patch clang and swift for
this yet. When the feature, `swift.use_global_index_store`, is set:

1. it writes to a global index cache, `bazel-out/global_index_store`
2. it copies indexstore data (records and units) to where Bazel
   expected them for caching: e.g. the original location with
   `swift.index_while_building`

I added a detailed description of this feature in the RFC to add it
there MobileNativeFoundation/index-import#53. In practice,
transitive imports will be indexed by deps and if they aren't cached
then the fallback is Xcode wil index transitive files if we set those as
deps on the unit files

* Modernize `xcode_swift_toolchain` features and linkopts.

This change adds the search path for StoreKitTest/XCTest now available on watchOS in Xcode 12.5, and retires a number of workarounds and/or conditional code paths that are for older versions of Xcode that we don't care about anymore. For example, statically linking the Swift runtime is no longer supported on Darwin with modern versions of Xcode.

PiperOrigin-RevId: 377920556
(cherry picked from commit bf5fccc)

* Remove the `-rpath` for the Xcode's developer frameworks directory from the Swift toolchain.

It may have been needed in the past with older versions of Swift, but it doesn't appear to be anymore (and it causes problems if the version targeted during the build is mismatched with the simulator/OS version under which the test is running).

PiperOrigin-RevId: 378400910
(cherry picked from commit 92b727e)

* Propagate Swift-specific linker flags as an implicit dependency of the toolchain.

Apple binaries/bundles will automatically get these linker flags if they have any Swift target in their dependencies; this eliminates the need to pass them separately at the top level.

PiperOrigin-RevId: 378024438
(cherry picked from commit 96f0a67)

# Conflicts:
#	swift/internal/providers.bzl
#	swift/internal/swift_toolchain.bzl
#	swift/internal/xcode_swift_toolchain.bzl

* Fix worker based error reporting for WMO (bazelbuild#642)

* Fix race condition in MakeDirs (bazelbuild#644)

If there are 2 concurrent processes creating the same directories, then it will fail

I noticed this on the CI errors of bazelbuild#567, and a co-worker was hitting it
today. I suspect invalidating the worker or other updates triggered big
rebuilds.

I don't know of a perfect repro but, at a 10% rate: invoking Bazel to
build 2 swift libraries in the same BUILD file.

* Error out on failed `MakeDir` (bazelbuild#645)

Now that we only report failures from `MakeDir` if there is actually an error, we can error out earlier for a better error message.

* Delete the `swift_common.swift_runtime_linkopts` function.

This should have been deleted in the previous change that refactored the linker flags. It no longer works because it tries to access a provide field that no longer exists, but nothing broke because nothing calls it anymore. Yay weak typing.

PiperOrigin-RevId: 378673728
(cherry picked from commit 503c9cc)

* Refer to build_bazel_rules_swift_index_import via a file rather than inline string (bazelbuild#647)

For consistency with other repos that do not define their own build files

* Add files in third_party to :for_bazel_tests (bazelbuild#648)

So they are copied over in integration tests in rules_apple

* Fix index_import label

Not sure why this works sometimes and not others but we need to
terminate this where the BUILD file lives

* Update apple_support to 0.11.0

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
Co-authored-by: Tony Allevato <allevato@google.com>
Co-authored-by: Michael Eisel <michael.eisel@gmail.com>
Co-authored-by: Michael Eisel <meisel@spotify.com>
Co-authored-by: Thi Doãn <t@thi.im>
Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
Co-authored-by: Thomas Van Lenten <thomasvl@google.com>
Co-authored-by: Andre Brisco <andre.brisco@gmail.com>
Co-authored-by: Googler <noreply@google.com>
Co-authored-by: Kanglei Fang <ghvg1313@hotmail.com>
Co-authored-by: Brentley Jones <brentley.jones@target.com>
Co-authored-by: Benjamin Peterson <benjamin@python.org>
Co-authored-by: Brentley Jones <brentleyjones@lyft.com>
Co-authored-by: Omar Zúñiga <omarzl@hotmail.es>
Co-authored-by: Alex Eagle <eagle@post.harvard.edu>
Co-authored-by: Walter Lee <waltl@google.com>
Co-authored-by: Brentley Jones <github@brentleyjones.com>
Co-authored-by: Samuel Giddins <segiddins@squareup.com>
Co-authored-by: Jerry Marino <i@jerrymarino.com>
katre added a commit to katre/bazel that referenced this issue Sep 27, 2021
RELNOTES: The toolchain transition is now enabled for all toolchains.

Closes bazelbuild#11584.
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this issue Jul 19, 2023
This is phase 2 of of the switch to toolchain transitions. See bazelbuild/bazel#11584 for details.

This shouldn't be merged into rules_swift's master branch until https://cs.opensource.google/bazel/bazel/+/58fdf63d81cc71f0315918b111fc56f4c039f1a5 is in a Bazel release (which should be 3.7, bazelbuild/bazel#12188).

PiperOrigin-RevId: 334610489
keith added a commit to keith/bazel that referenced this issue Aug 15, 2023
This has been a no-op since the flag was flipped

bazelbuild#11584
copybara-service bot pushed a commit that referenced this issue Aug 16, 2023
This has been a no-op since the flag was flipped

#11584

Closes #19254.

PiperOrigin-RevId: 557475784
Change-Id: I61e9067b58b3841eda6cc4250e258bfebbbc5385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants