Compilers are pieces of software that translate computer code from one programming language to another. A common use case for compilers is translating from high-level to low-level languages. An example of a high-level language is Java. Compilers for Java generally compile to JVM bytecode, not machine code. In order to run Java programs, JVM bytecode must therefore first be translated to an assembly or machine language, known by some processor or family of processors. This thesis presents an implementation of one such compiler.
The presented compiler compiles to the assembly language used by RISC-V, an open instruction set architecture. It is not an interpreter, working as part of a Java virtual machine, which is standard practice, but is instead a program that takes JVM bytecode, written in the form of a .class file, and compiles it to RISC-V assembly. This approach can potentially speed up program execution, but it requires a full compilation, while interpreters can run bytecode immediately.
|