Back to search

The University of Texas at Austin

Template-based testing for Java just-in-time compilers

Abstract

dc:description.abstract

Compilers are among the most critical components in the software development toolchain, and their correctness is of utmost importance. A bug in a compiler might lead to a crash during the translation, an incorrect output (native code does not match the semantics of the program written by developers), or even expose security vulnerabilities in the generated code. Compiler developers have written thousands of tests, including programs in the compiler’s target programming language, as to check for correctness. Although manual tests nicely capture developers’ intuition of what programs are expected to trigger corner cases in a compiler, it is time-consuming to write a large number of such tests. Numerous automated compiler testing techniques exist, aiming to generate extensive tests. They broadly fall into two categories: grammar-based methods, which build tests from grammar rules, and mutation-based techniques, which build tests by mutating seed programs. However, they offer limited room for compiler developers to embed their domain knowledge into the testing process. Particularly, these tools are ineffective in discovering bugs in just-in-time (JIT) compilers. JIT compilers, dynamically (i.e., at runtime) rewrite parts of programs to optimize program execution based on profiling data. Testing such compilers requires carefully crafted inputs that trigger JIT compilation and provide challenging code snippets for optimizing compilers. This dissertation presents two frameworks to combine developers’ domain knowledge (via templates) with automated testing to detect bugs in JIT compilers. The dissertation first introduces JAttack, a framework that enables template-based testing for compilers. Using JAttack, a developer writes a template program that describes a set of programs to be generated and given as test inputs to a compiler. Such a framework enables developers to incorporate their domain knowledge on testing compilers, giving a basic program structure that allows for exploring complex programs that can trigger sophisticated compiler optimizations. A developer writes a template program in the host language (Java) that contains holes to be filled by JAttack. JAttack generates programs by executing templates and filling each hole by randomly choosing expressions and values, available within the search space defined by the hole. We demonstrate JAttack’s capabilities in helping test Java JIT compilers. Using JAttack, we have found seven bugs in HotSpot that were confirmed and fixed by Oracle developers. Five of them were previously unknown, including two unknown CVEs (Common Vulnerabilities and Exposures). This dissertation then introduces LeJit, an overarching framework wrapping JAttack for testing Java JIT compilers. LeJit automatically creates template programs from existing Java code by converting expressions to holes. To make created templates executable, LeJit also generates necessary glue code that creates instances used as arguments to methods in templates. To obtain instances of complex types (i.e., non-primitive types) needed for created templates, LeJit captures instances of various types during testing of methods from which templates are to be extracted. Using LeJit, we have found 15 bugs in popular Java JIT compilers, including five bugs in HotSpot, nine bugs in OpenJ9, and one bug in GraalVM. All of these bugs have been confirmed by Oracle and IBM developers, 11 of which were previously unknown, including two unknown CVEs.

Degree

thesis:*
Name thesis:degree_name
Doctor of Philosophy
Discipline thesis:degree_discipline
Electrical and Computer Engineering
Department thesis:degree_department
Electrical and Computer Engineering
Grantor
The University of Texas at Austin
Year dc:date.issued
2024

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Zang, Zhiqiang
Advisor dc:contributor.advisor
  • Gligoric, Milos
Committee members dc:contributor.committeemember
  • Christine Julien
  • Owolabi Legunsen
  • August Shi
  • Christopher Rossbach
ORCID person:identifier.orcid

Subjects

dc:subject × 8

Rights

Language dc:language.iso
English

Identifiers

dc:identifier.*

Chain of custody

source
Harvested from
University of Texas
Base URL
repositories.lib.utexas.edu/server/oai/request
Last updated
2026-11-20
Source record
OAI-PMH GetRecord
citation

Zang, Zhiqiang. Template-based testing for Java just-in-time compilers. The University of Texas at Austin, 2024. https://doi.org/10.26153/tsw/55621