The Code Hierarchy

The joeq system allows access to program code at a wide variety of levels. This document will cover the important methods of each level of focus. Where appropriate, links to the relevant joeq javadocs will be available.

Java Elements: The joeq.Class package

The Class package contains classes that represent the various components of Java class files. Many of the String-like return values in this package return objects of type Utf8, explicitly representing the Unicode format the JVM uses; these may be turned back into Strings by calling toString upon them.

Types: jq_Type and jq_Primitive

jq_Type is the basic type representing types. It has a subclass, jq_Primitive, representing the primitive types. The jq_Primitive class has the following static fields for referring to each type:

Neither jq_Type nor jq_Primitive have any methods of interest to us.

Arrays: jq_Array

Arrays are represented with the jq_Array class. The methods of note here are:

Classes: jq_Class

The jq_Class class represents a class file as a whole. You acquire the jq_Class for a type by calling joeq.Main.Helper.load; see the section on joeq.Main.Helper for details. Important methods in jq_Class are:

Methods: jq_Method

Fields: jq_Field

Code: The jeoq.Compiler Package

Most of the code for representing actual program code in joeq is contained in the joeq.Compiler package and its subpackages.

joeq.Compiler.Quad.ControlFlowGraph

Iterating over CFGs: joeq.Compiler.Quad.QuadIterator

The QuadIterator loops through a ControlFlowGraph a Quad at a time. It is constructed taking a ControlFlowGraph as its constructor argument. The following methods then become available:

joeq.Compiler.Quad.BasicBlock

The BasicBlock class represents a joeq basic block. These have one entrance, and, assuming no exceptions are thrown, one exit. (If exceptions are thrown, the "basic block" may have multiple exit points.)

There are no methods of interest to us defined in BasicBlock. We will usually be focussing either on ControlFlowGraphs or Quads.

joeq.Compiler.Quad.Quad

At the bottom of the code hierarchy is the quad, a construct very similar to three-address assembly code. Relevant methods on quads themselves are:

The Operators and Operands of Quads are numerous enough that they they warrant their own web page: the Quad Overview.

joeq.Compiler.BytecodeAnalysis

This package deals mostly with the JVM's code representation -- we don't have to deal with it in this class. Note, however, that it has a ControlFlowGraph class of its own, so do not import joeq.Compiler.Quad.* and joeq.Compiler.BytecodeAnalysis.* in the same code.


<-- previous home next -->