This project is led by Professor Miryung Kim (PI), Jens Palsberg, and Harry Xu (co-PIs) at UCLA.
For more information on Java Bytecode Debloating project at UCLA, please visit http://debloating.cs.ucla.edu.
Modern software is bloated. Demand for new functionality has led developers to include more and more features, many of which become unneeded or unused as software evolves. This phenomenon, known as software bloat, results in software consuming more resources than it otherwise needs to. Various debloating techniques have been proposed since the late 1990s. However, many of these techniques are built upon pure static analysis and have yet to be extended and evaluated in the context of modern Java applications where dynamic language features are prevalent. To this end, we developed an end-to-end bytecode debloating framework called JShrink. It augments traditional static reachability analysis with dynamic profiling and type dependency analysis and renovates existing bytecode transformations to account for new language features in modern Java. This work is motivated and sponsored by Office of Naval Research Total Protection Cyber Platform program.
JDebloat integrates three static debloating and delayering functionalities: (1) JReduce: statically reduce unused classes efficiently by taking into dependency based connected component structure while applying Delta Debugging for the purpose of code minimization, (2) JShrink: statically remove the body of uninvoked methods through call graph analysis, (3) JInline: statically inline the body of called methods aggressively, which are currently inlined by JVM’s runtime optimization.
-
JShrink (https://github.com/jdebloat/jshrink)
-
JInline (https://github.com/jdebloat/jinline)
-
JReduce (https://github.com/jdebloat/jreduce)
More information on this debloating project can be found here.
There are two options to execute this tool explained below.
This JDebloat project is led by Professor Miryung Kim in the Computer Science department at UCLA.
JShrink's main contributors are Professor Miryung Kim, Tianyi Zhang, Bobby Bruce, and Jaspreet Arora. Its web user interface, WebJShrink was developed by Konner Macias and Mihir Mathur.
JReduce's main contributors are Professor Jens Palsberg and Christian Kalhauge.
JInline's main contributors are Harry Xu and Jon Eyolfson and Christian Navasca
In addition, integration of three tools into JDebloat and its end-to-end evaluation effort is supported by Yifan Qiao, Jiyuan Wang, Haoran Ma, Usama Hameed, and Akshay Uttere.
You can find both tools and subject programs in the VM image. You are required to install the following software, described below.
- VirtualBox 5.2.22
- vagrant 2.2.2
To setup and enter the VM, please tun the following:
vagrant up
vagrant ssh
cd /vagrant
You are required to install the following software, described below.
- Stack 1.9.3 (Installation instructions here - https://docs.haskellstack.org/en/stable/install_and_upgrade/)
- After installation, run
stack upgrade
- After installation, run
- Java 8
- Git
- Python 3
- Maven (needed to run the benchmarks)
To setup, please set the JAVA_HOME environment variable to point to the Java installation home folder (Instructions here - https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html)
Some of the tools require setup. You can run the setup for all the projects with the following command:
./jdebloat.py setup
The tool can be executed through the interface provided by the jdebloat.py script.
The usage for the script can be listed with the help([-h]) option as follows.
./jdebloat.py -h
usage: jdebloat.py [-h] {clean,setup,run}
positional arguments:
{clean,setup,run}
optional arguments:
-h, --help show this help message and exit
The three positional arguments available for each tool in the package:
- Setup - to perform setup and compilation for the tool
- Run - to execute the tool with the benchmark projects
- Clean - to perform cleanup for the tool
Run all 3 debloat tools in sequence.
./jdebloat.py setup
./jdebloat.py run
./jdebloat.py clean
To run the JReduce tool, run:
./jdebloat.py setup jreduce
./jdebloat.py run jreduce
To run the JShrink tool, run:
./jdebloat.py setup jshrink
./jdebloat.py run jshrink
To run the JInline tool, run:
./jdebloat.py setup jinline
./jdebloat.py run jinline
- results [Directory containing the benchmark results]
- data [Contains misc. data used by the tools]
- jdebloat.py [The script which runs JDebloat]
- output [The output directory]
- README.mkd [The setup README]
- scripts [Contains scripts used by jdebloat.py to run the tools]
- tools [Contains the JShrink, JReduce, and JInline tools]
- javaq [Contains the javaq tool, used for data collection]
- jinline [Contains the JInline tool]
- README.md [The JInline tool README file]
- jshrink [Contains the JShrink tool]
- README.md [The JShrink README file]
- jreduce [Contains the JReduce tool]
- README.md [The JReduce README file]
We tested JDebloat on 25 benchmarks and found the following reductions:
Name | Reduction |
---|---|
aragozin/jvm-tools | 64.20% |
ata4/disunity | 25.64% |
Bukkit/Bukkit | 66.49% |
eirslett/frontend-maven-plugin | 99.99% |
google/gson | 30.05% |
JakeWharton/DiskLruCache | 20.20% |
JakeWharton/retrofit1-okhttp3-client | 22.70% |
JakeWharton/RxReplayingShare | 47.70% |
JCTools/JCTools | 90.70% |
junit-team/junit4 | 20.21% |
kevinsawicki/http-request | 19.80% |
mabe02/lanterna | 24.99% |
pagehelper/Mybatis-PageHelper | 30.25% |
pedrovgs/Algorithms | 36.74% |
qiujiayu/AutoLoadCache | 71.02% |
square/javapoet | 20.51% |
square/moshi | 99.56% |
takari/maven-wrapper | 74.45% |
alibaba/TProfiler | 97.15% |
dieforfree/qart4j | 100.00% |
dubboclub/dubbokeeper | 80.09% |
JakeWharton/RxRelay | 27.80% |
sockeqwe/fragmentargs | 23.73% |
tomighty/tomighty | 29.13% |
zeroturnaround/zt-zip | 26.61% |
The links to all of these repositories, as well as the commits we used, are
listed in data/benchmarks.csv
.
docker build -t jdebloat:latest .