Java Bytecode Translator Refactoring
Okonechnikov Konstantin (email@example.com)
Currently Jitrino OPT compiler has some problems with Java bytecode translator. Translator has unobvious and complex structure that makes difficult further expansion and evolution.
- The idea of the project is to create new Java bytecode translator, which will solve these problems.
Project details and success criteria
The translator should have flexible and comprehensive architecture. The first steps of development will be analysis & design. This process will allow me to define specifications, elaborate development scheme and work out project model.
- Work of the translator can be divided into following steps:
- parse bytecode in order to establish basic block boundaries
- perform data analysis
- translate Java bytecode into HIR, generate CFG
To implement it I will use existing code. Some good approaches to the first step can be found in Jitrino JET. (For example, the first pass of JET determines basic blocks) To perform data analysis I will check with JavaLabelPrepass methods from current implementation of Java bytecode translator. To build Internal Representation, current translator invokes IRBuilder, which will be used in new implementation.
- Translator should have clear and simple structure. The goal is to make it easy to understand and maintain. Project successfully finished if generated CFG correctly represents Java bytecode and 100% Harmony tests accomplished.
Till the midst of June I will study essential documentation, develop the architecture of the translator. I will adjust my ideas with mentor and community.
6-7 weeks – coding time, implementation of the translator.
2-3 weeks - testing, debugging and writing documentation.
These are important milestones of project implementation, witch will represent the progress:
- Bytecode prepass
- Data flow analysis
- Bytecode mapping
- Add support for call instructions,lazy resolution, etc
HelloWorld runs successfully
- Add support for JSR/RET instructions (using current approach - CFG optimzer pass)
- Add support for inliner
All tests pass and Eclipse works in JIT opt mode
- Remaining features implementation, testing, debugging
Profit to Apache Harmony
Adding new functionality, expanding existing features are essential principles of successful development. The implementation of new translator will make it easier to maintain Harmony DRLVM; it will promote further development of Apache Harmony project.