Prototype details

Paul Sandoz paul.sandoz at oracle.com
Tue Jan 16 20:52:47 UTC 2024


Here are some details about what the prototype contains.

1. An API to build, traverse, and transform code models. 
In addition there is support to serialize and deserialize code models to and from a textual form. This is useful for debugging and testing, and also happens to be very convenient for transmission and storage (see 4).

2. A set of core operations which when declared in code models and can be used to model a wide range of Java programs.

3. A set of extended or auxiliary operations which when declared in code models and can be used to model Java language constructs which retain program structure, such as loops.
These operations can be lowered into a sequence of core operations.

4. Enhancements to the Java source compiler to produce code models from its AST representation of Java source and store them in class files.
We can model many Java programs, but not all. We will continue to expand that set as we model more language constructs.

5. Enhancements to reflection to identity source code to be accessed as code models stored in class files.
Specifically we can identify methods with an annotation and target type lambda expressions (structurally, or nominally to a functional interface).

6. An interpreter of code models, that operates on models containing only core operations.
Useful for debugging and educational. A model containing extended or auxiliary operations has to first be transformed into a code model containing only core operations.

7. A transformer of code models to byte code (lowering), and a transformer of bytecode to code models (lifting, functionality is very limited).

8. Analysis functionality.
Transforming code models to pure SSA form. Liveness analysis of values. An experimental pattern match feature (in the interim of being able to write custom patterns in the language).

The main project page [1] contains links to slides and presentations which people may find useful in this context.

Thanks,
Paul.

[1] https://openjdk.org/projects/babylon/



More information about the babylon-dev mailing list