Project deep

Under the name of deep a cross development platform for Java was created. The project was initiated and is maintained by the Institut for Computer Science at the Eastern Switzerland University of Applied Sciences, OST, Buchs, Switzerland.

Goals

  • Development platform for Java including compiler, linker and runtime system.
  • Focus on efficiency, for the core of the compiler very lightweight data structures are used, the powerful but slow Java library is solely used for odd tasks.
  • Supports newest Java version.
  • Integration into eclipse, but can be run stand-alone as well.
  • “Java on the metal”: Java programs are translated with regular JDK into Bytecode, deep translates this Bytecode directly into machine code.
  • No object files, a launch translates all necessary classes into target image
  • Runtime library is simplified standard library.
  • A fast and lightweight path to the underlying hardware with registers and absolute memory locations is provided.

Overview

A Java compiler converts a Java file into a class file. A class file represents the original program in a compact binary form and could be interpreted by a JVM or, as in our case, will be translated directly in the target machine code. Bytecode is strictly defined in The Java Virtual Machine Specification, Java SE 7 Edition and can be verified.

Crosscompiler

Our deep compiler translates Bytecode into machine code for a certain processor. To optimize for speed and code size and to make use of register based architecture - such as PPC or ARM - we transform the Bytecode in a first step into Static Single Assignment Form, SSA. This form is simple and platform independent and can be used for various optimizations. In a second step, which is platform specific, registers are allocated and code is generated.

Frontend

The product of the frontend is the code in SSA form. Every necessary class with all its methods are parsed (see Class File Reader) and entered into a directory. From their instructions, the control flow graphs (see Control Flow Graph) are built. This directed graph shows all possible branches which can be taken during execution of a program. The CFG can be optimized, e.g. elimination of code which is never run. After this the SSA is created.

Backend

For each supported architecture a specific backend is necessary. As a first step, registers are assigned for all SSA instruction results. After this machine instructions can be issued for the target. Finally the linker combines everything into a executable target image.
Currently, PowerPC and ARMv7 code can be generated. As target processors we use mpc555 and mpc5200 for PowerPC and the Zynq-7000 with a dual core ARM Cortex-A9 processor as an ARM target.

Further Components

In order to work efficiently with deep some more tools and components are useful.

Class File Browser

When working extensively with class files our Class File Browser might be advantageous. It displays all information of a class file in easily readable form. It can be downloaded as an eclipse plugin from https://marketplace.eclipse.org/content/eclipse-class-file-browser.

Runtime System

The runtime system comprises all Java classes which run directly on the target. Among them is the kernel, memory management for heap and stack, a scheduler and exception handling. The runtime system includes target independent classes as well as processor specific classes.

Configurations

The configuration files describe the properties of the used architecture and the memory layout of a target board. This information might be used by the compiler and the linker as well as by the kernel (see Configuration).

Class Tree View

This eclipse view shows all the compiled and linked classes with their methods together with their CFG, SSA and machine code. The placement of each method and variable in the target memory is also visible.

Debugger

Many views in eclipse support the viewing of variables, objects, registers and memory sections. We also deploy the debugger framework of eclipse to support target debugging with setting breakpoints and single-stepping (see Debugger).


Internal Developer Documentation

The internal documentation for maintainers can be found here.