protocolbuffers / protocolbuffers/protobuf
Protobuf java generate to large methods
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
What version of protobuf and what language are you using?
Version: main
Language: Java
What operating system (Linux, Windows, ...) and version?
Any
What runtime / compiler are you using (e.g., python version or gcc version)
Any
What did you do?
Steps to reproduce the behavior:
Create .proto file with around 1.000 fields like
message LargeMessage {
optional string s2 = 2;
optional int32 i3 = 3;
....
optional string s998 = 998;
optional int32 i999 = 99;
}
Compile it with protoc
You get too large methods for Java JIT compiler. Default compilation limit is 8000 bytes of byte code.
It will work, but in interpreter mode. Very very slow.
What did you expect to see
bytecode_estimate calculation and split large methods with MaybeRestartJavaMethod(...)
What did you see instead?
Large methods
Additional
It may be fixed with some java flags https://stackoverflow.com/questions/57005557/jit-c2-method-maximum-size
But it's not good solution. Split large method it's better.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating bytecode_estimate and MaybeRestartJavaMethod(...) in the Java generator, then reproduce the issue with a .proto message containing around 1,000 fields. Check the generated methods against the Java JIT's 8,000-byte limit. Done means large generated methods are split so they do not fall back to interpreter mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100