Transition the Java Runtime from C/C++ to Rust.
- Start the work
- Enhance the source code for the Java Runtime with support for Rust
- Add support for Rust Code and the Rust Standard Library
- Add support for C/C++ to call Rust
- Add support for Rust to call C/C++ (optional)
- Create a Proof of Concept written in Rust
- Implement some small, practical, not-trivial functions in Rust
- Make changes to the JVM that are evidence of Rust being called at runtime
- Start writing the next JSR
- Finish the work
- Consider languages other than Rust
- Make any user-visible changes
- Although it is fair to speculate on what user-visible changes might look like
- Proof Of Concept of Rust code called from C/C++ in the JVM - binary metric
- More than one automated Unit Test
- More than one automated Integration Test
- At least one performance test
- Improved regression testing
Over ten years, Rust has proven itself as a low-level systems programming language capable of replacing C/C++ with superior code requiring less effort.
- Linux has begun adding Rust to the kernel, notably drivers.
- Since October 2023, Microsoft has actively incorporated the Rust programming language into various projects to enhance security, performance, and reliability. Rust’s emphasis on memory safety and concurrency without sacrificing speed makes it an attractive choice for system-level programming. (chat.openai.com version o1-preview)
- The United States Department of Defence is investigating using Rust to replace C/C++ and other
languages
- As part of this effort, it is also considering using LLM GPT technology to rewrite C/C++ in Rust
- Can this technology be used for this JSR, and would we want to?
- Could we get DARPA funding for Rusy Java?
// REQUIRED -- Describe the enhancement in detail: Both what it is and, // to the extent understood, how you intend to implement it. Summarize, // at a high level, all of the interfaces you expect to modify or extend, // including Java APIs, command-line switches, library/JVM interfaces, // and file formats. Explain how failures in applications using this // enhancement will be diagnosed, both during development and in // production. Describe any open design issues. // // This section will evolve over time as the work progresses, ultimately // becoming the authoritative high-level description of the end result. // Include hyperlinks to additional documents as required.
- Start the work
- Feature flags in code so a run-time flag can only enable the feature, such as "--rust"
- Enhance the source code for the Java Runtime with support for Rust
- Add support for Rust Code and the Rust Standard Library
- Rust Logging
- Rust failure handling
- Add support for C/C++ to call Rust
- Add support for Rust to call C/C++ (optional)
- Add support for Rust Code and the Rust Standard Library
- Create a Proof of Concept written in Rust
- Implement some small, practical, not-trivial functions in Rust
- Make changes to the JVM that are evidence of Rust being called at runtime
- Start writing the next JSR
No alternatives have been seriously considered, but there might exist languages better than Rust for this.
Regression testing is paramount to demonstrate that Rust functionality has kept all existing functionality intact without compromising anything.
Performance testing helps characterize the performance impact of replacing C/C++ with Rust.
High-quality static analysis would help if it exists for Rust code.
A fundamental assumption is that Rust is a better programming language than C/C++ to maintain and improve the intgrity of the Java Runtime.
A fundamental risk is that this could destabilize the JVM in unexpected ways. The mitigation is to ensure adequate automated testing.
Serious destabilization results could render this unnecessary.
// Describe all dependencies that this JEP has on other JEPs, JBS issues, // components, products, or anything else. Dependencies upon JEPs or JBS // issues should also be recorded as links in the JEP issue itself. // // Describe any JEPs that depend upon this JEP, and likewise make sure // they are linked to this issue in JBS.