Chapter 3. Cascade

Table of Contents

Control Flow Graphs
Control Flow Trees
Export Formats
Command Line Interface
Application Programming Interface

A major component in Volta is Cascade, a tool for generating control flow data structures for subsequent analysis by higher-level tools. It takes as input a Java class file and can produce a control flow graph, or CFG, for each method in the class.

Most control flow analyzers operate at the assembly language level. With no source code information, the output of such tools is difficult to comprehend, as shown in Figure 3.1.

Figure 3.1.  Traditional control flow analyzers are extremely low-level and produce graphs that are difficult to comprehend, such as this CFG created by the Avrora framework.

Diagram of an Avrora CFG

Control Flow Graphs

Cascade is different: It operates at the source code level, making the control flow data much easier to read and understand. It relies on JODE, a powerful Java decompiler, to produce a source code representation for every node in the CFG. In most cases, the decompiled code matches the original Java source code exactly.

To illustrate this point, consider the code in Figure 3.2. When compiled to a Java class with debugging symbols enabled, Cascade can generate a CFG of this method, as shown in Figure 3.3.

Figure 3.2. A simple Java method.

public void test()
    int j = 0;

    for (int i = j; i < 10; i++)

Figure 3.3.  Control flow graphs in Cascade reveal high-level source code information, making them easier to digest.

Diagram of a Cascade CFG

Note that even at this high level, none of the low-level information is lost. Cascade preserves the original bytecode instructions for each node and can optionally show them in the graph visualization. This characteristic is vital for WCET analyzers built on top of Cascade.