SlideShare a Scribd company logo
1 of 27
Application Extraction for Java: A retrospective
report of the Jax project
Frank Tip & Chris Laffra
Outline
• project background & goals
• techniques
• results
• industrial applications
• perspective
2
Jax Project Background & Goals
• successful project at IBM Research from 1998-2003
• goal:
- originally: shrink Java applications so that they can be downloaded faster,
especially over slow connections
- later: optimize Java applications running on embedded devices
• approach:
- static analysis (but rely on user to specify reflective behaviors and dynamic
class loading)
- program transformations (e.g. merging classes)
• applications:
- open-source release via alphaworks
- used by various IBM teams and IBM customers (e.g. apps running on
Wimbledon website)
- integrated in Smartlinker component of IBM WebSphere Device Developer
• contributors: Aldo Eisma, Chris Laffra, Jens Palsberg, David Streeter, Peter
Sweeney, Frank Tip
3
OOPSLA’99
What did it do?
• call graph construction
• removal of dead methods & dead fields
- also: removal of method bodies, write-only fields
• inlining of small methods
• class hierarchy transformations
• name compression
• constant pool compression
4
Call Graph Construction
• Jax relied on type-based algorithms
- Class Hierarchy Analysis (CHA) [Dean et al. 1995]
- Rapid Type Analysis (RTA) [Bacon 1997]
- XTA [Tip & Palsberg 2000]
• considerations:
- efficiency: scaled to thousands of classes
- simplicity: no need for construction of CFGs, SSA Form, pointer
analysis, …
- need to handle incomplete applications (Jax did not analyze the
code in Java’s standard libraries but made conservative
assumptions, in the spirit of Averroes [Ali 2013)
5
Example
public static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
Precise Call Graph
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
4 edges
7
XTA Algorithm for Call Graph Construction
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
8
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
9
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
10
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
{ B }
11
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
{ B, C }
12
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
{ B, C }
6 edges
13
XTA
static void main(){
B b1 = new B();
A a1 = new A();
f(b1);
g(b1);
}
static void f(A a2){
a2.foo();
}
static void g(B b2){
B b3 = b2;
b3 = new C();
b3.foo();
}
class A {
void foo(){ }
}
class B extends A {
void foo(){ }
}
class C extends B {
void foo(){ }
}
class D extends B {
void foo(){ }
}
{ A, B }
{ A, B }
{ B, C }
6 edges
RA: 10 edges
CHA: 9 edges
RTA: 8 edges
0-CFA: 6 edges (different) 14
XTA
15
OOPSLA’00
Removal of Dead Methods & Fields
• after call graph construction, remove unreachable
methods
- in some cases, must remove the body to preserve
dispatch behavior
• remove dead fields
• remove write-only fields
- e.g., fields initialized in constructor but never read
- also remove the write instructions
16
Method Call Inlining
• inline method calls if:
- XTA determines that a method call has a unique target
- inlining the call does not increase application size
17
Class Hierarchy Transformations
• remove uninstantiated class that does not have any subclasses
and that that does not contain any live methods or fields
• merge base class X and a derived class Y if (i) there is no live non-
abstract method f that occurs in both X and Y , and: (1) X is
uninstantiated, or (2) Y does not contain any live non-static fields.
- by requiring that (1) or (2) holds, we ensure that no object
created by the application becomes larger (i.e., contains more
fields) as a result of the merge
• similar transformations for merging classes with interfaces
18
Name Compression
• select short names (e.g., “a”, “b”, “c”) to classes, methods, fields
• care must be taken to preserve:
- overriding behavior
- overload resolution
19
Impact of the Transformations
20
ACM TOPLAS’02
Modular Extraction Language (MEL)
• specify that methods are dynamically loaded or
reflectively accessed
• support various extraction scenarios:
- extract library without assumptions about clients
- extract library in the context of a specific
application
- extract client without assumptions about libraries
21
FSE’00
Results
22
CACM’03
SmartLinker - Commercial Application of Jax
• IBM J9 Virtual Machine for embedded platforms offers Japt:
- an optimization utility to reduce Java classes from a JAR file
- based directly on Jax algorithms, RTA and XTA
- focus on embedded, inlining JSR calls, AOT, JXE linking
23
BTA
AOT
Link
RTX, XTA
Inlining
flattening
Smartlinker
jax
AOT
Link
RTX, XTA, ITA
inlining
flattening
jar2jxe
japt
Smartlinker Use Case: Strings in Eclipse
• 50% of the heap is Strings of which 50% is unique
• String compaction can save 35% of the heap
• Combining Japt compression with memory-mapped JXEs
allows WebSphere Application Server to scale 2X
K
95K
190K
285K
380K
475K
Original Japt
Eclipse runtime.jar
Holistic Optimisation - Faster and Less Memory
Lessons Learned
• Debloating can offer dramatic improvements in memory consumption and startup times.
• OO design is a useful technique, providing meaningful abstractions and scalable designs.
Developers should keep using redundant class definitions, deep inheritance, verbose interfaces.
- rely on static analysis tools like Jax/SmartLinker to debloat verbose libraries & frameworks
• the debloating techniques that we applied are broadly applicable:
- applets, applications, Eclipse, WAS, embedded platforms, Android
- any OO language, e.g. Swift, C#, Objective-C, Kotlin, C++.
• Promising future work would be scenario-based modularization of applications. For mobile, startup
times are key. So, can we analyze what is needed just for startup? Another scenario would be
once-only tasks, such as registration. Each component could have its own optimization techniques
applied, for instance startup code would benefit from AOT (which costs more space on disk, but
loads a lot faster). Once-only code would not be AOT'd.
• Current work at Northeastern: debloating of applications written in dynamic languages
- use a combination of (i) unsound static/dynamic analysis and (ii) a recovery mechanism for
dynamic loading of missing functionality (subject to checks). Current focus on JavaScript.
26
Publications and References
• Frank Tip, Chris Laffra, Peter F. Sweeney, David Streeter: Practical Experience with an
Application Extractor for Java. OOPSLA 1999: 292-305
• Peter F. Sweeney, Frank Tip: Extracting library-based object-oriented applications. SIGSOFT
FSE 2000: 98-107
• Frank Tip, Jens Palsberg: Scalable propagation-based call graph construction algorithms.
OOPSLA 2000: 281-293
• Frank Tip, Peter F. Sweeney, Chris Laffra, Aldo Eisma, David Streeter: Practical extraction
techniques for Java. ACM Trans. Program. Lang. Syst. 24(6): 625-666 (2002)
• Frank Tip, Peter F. Sweeney, Chris Laffra: Extracting library-based Java applications. Commun.
ACM 46(8): 35-40 (2003)
• WebSphere Everyplace Custom Environment product definition at www-
01.ibm.com/software/wireless/wece/features.html, referencing Japt.
• Sean Foley: From Global to Local Escape Analysis in Java. Performance Engineering Best
Practices Conference (2008)
27

More Related Content

What's hot

Programming in java basics
Programming in java  basicsProgramming in java  basics
Programming in java basicsLovelitJose
 
Functional programming-advantages
Functional programming-advantagesFunctional programming-advantages
Functional programming-advantagesSergei Winitzki
 
HDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesHDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesJoel Falcou
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphsdaimk2020
 
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...Thanos Zolotas
 
Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14IIUM
 
Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14IIUM
 
9. 8085 instruction set v
9. 8085 instruction set v9. 8085 instruction set v
9. 8085 instruction set vsandip das
 
ScilabTEC 2015 - KIT
ScilabTEC 2015 - KITScilabTEC 2015 - KIT
ScilabTEC 2015 - KITScilab
 
Dag representation of basic blocks
Dag representation of basic blocksDag representation of basic blocks
Dag representation of basic blocksJothi Lakshmi
 
Flyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoFlyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoKetanUmare
 

What's hot (20)

Programming in java basics
Programming in java  basicsProgramming in java  basics
Programming in java basics
 
FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER
 
Control flow Graph
Control flow GraphControl flow Graph
Control flow Graph
 
Functional programming-advantages
Functional programming-advantagesFunctional programming-advantages
Functional programming-advantages
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
HDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel ArchitecturesHDR Defence - Software Abstractions for Parallel Architectures
HDR Defence - Software Abstractions for Parallel Architectures
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
 
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...
Bridging Proprietary Modelling and Open-Source Model Management Tools: The Ca...
 
Anr cair meeting feb 2016
Anr cair meeting feb 2016Anr cair meeting feb 2016
Anr cair meeting feb 2016
 
Ikc 2015
Ikc 2015Ikc 2015
Ikc 2015
 
Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14
 
Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14Csc1100 lecture03 ch03-pt2-s14
Csc1100 lecture03 ch03-pt2-s14
 
Hd6
Hd6Hd6
Hd6
 
9. 8085 instruction set v
9. 8085 instruction set v9. 8085 instruction set v
9. 8085 instruction set v
 
ScilabTEC 2015 - KIT
ScilabTEC 2015 - KITScilabTEC 2015 - KIT
ScilabTEC 2015 - KIT
 
I20191007
I20191007I20191007
I20191007
 
Dag representation of basic blocks
Dag representation of basic blocksDag representation of basic blocks
Dag representation of basic blocks
 
Dataflow Analysis
Dataflow AnalysisDataflow Analysis
Dataflow Analysis
 
Flyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoFlyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiego
 
Oops qb cse
Oops qb cseOops qb cse
Oops qb cse
 

Similar to Jax retrospective

Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesEelco Visser
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1kvs
 
c++-language-1208539706757125-9.pdf
c++-language-1208539706757125-9.pdfc++-language-1208539706757125-9.pdf
c++-language-1208539706757125-9.pdfnisarmca
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsBartosz Kosarzycki
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
 
LEGaTO: Software Stack Programming Models
LEGaTO: Software Stack Programming ModelsLEGaTO: Software Stack Programming Models
LEGaTO: Software Stack Programming ModelsLEGATO project
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerDavid Muñoz Díaz
 
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA  by Ben Sanders, AMDBolt C++ Standard Template Libary for HSA  by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMDHSA Foundation
 
Declare Your Language: Virtual Machines & Code Generation
Declare Your Language: Virtual Machines & Code GenerationDeclare Your Language: Virtual Machines & Code Generation
Declare Your Language: Virtual Machines & Code GenerationEelco Visser
 
Scikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in PythonScikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in PythonMicrosoft
 
Exploiting GPU's for Columnar DataFrrames by Kiran Lonikar
Exploiting GPU's for Columnar DataFrrames by Kiran LonikarExploiting GPU's for Columnar DataFrrames by Kiran Lonikar
Exploiting GPU's for Columnar DataFrrames by Kiran LonikarSpark Summit
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
Bca1020 programming in c
Bca1020  programming in cBca1020  programming in c
Bca1020 programming in csmumbahelp
 
Fortran & Link with Library & Brief Explanation of MKL BLAS
Fortran & Link with Library & Brief Explanation of MKL BLASFortran & Link with Library & Brief Explanation of MKL BLAS
Fortran & Link with Library & Brief Explanation of MKL BLASJongsu "Liam" Kim
 

Similar to Jax retrospective (20)

Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
 
c++-language-1208539706757125-9.pdf
c++-language-1208539706757125-9.pdfc++-language-1208539706757125-9.pdf
c++-language-1208539706757125-9.pdf
 
Basics of objective c
Basics of objective cBasics of objective c
Basics of objective c
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
LEGaTO: Software Stack Programming Models
LEGaTO: Software Stack Programming ModelsLEGaTO: Software Stack Programming Models
LEGaTO: Software Stack Programming Models
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
Gate-Cs 1992
Gate-Cs 1992Gate-Cs 1992
Gate-Cs 1992
 
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA  by Ben Sanders, AMDBolt C++ Standard Template Libary for HSA  by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
 
Declare Your Language: Virtual Machines & Code Generation
Declare Your Language: Virtual Machines & Code GenerationDeclare Your Language: Virtual Machines & Code Generation
Declare Your Language: Virtual Machines & Code Generation
 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
 
Scikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in PythonScikit-Learn: Machine Learning in Python
Scikit-Learn: Machine Learning in Python
 
Exploiting GPU's for Columnar DataFrrames by Kiran Lonikar
Exploiting GPU's for Columnar DataFrrames by Kiran LonikarExploiting GPU's for Columnar DataFrrames by Kiran Lonikar
Exploiting GPU's for Columnar DataFrrames by Kiran Lonikar
 
.net progrmming part3
.net progrmming part3.net progrmming part3
.net progrmming part3
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Bca1020 programming in c
Bca1020  programming in cBca1020  programming in c
Bca1020 programming in c
 
Fortran & Link with Library & Brief Explanation of MKL BLAS
Fortran & Link with Library & Brief Explanation of MKL BLASFortran & Link with Library & Brief Explanation of MKL BLAS
Fortran & Link with Library & Brief Explanation of MKL BLAS
 

More from Chris Laffra

Java bytecode hacking
Java bytecode hackingJava bytecode hacking
Java bytecode hackingChris Laffra
 
Project Cacophonia
Project CacophoniaProject Cacophonia
Project CacophoniaChris Laffra
 
Productivity and happiness
Productivity and happinessProductivity and happiness
Productivity and happinessChris Laffra
 
Visualization of Complex Systems
Visualization of Complex SystemsVisualization of Complex Systems
Visualization of Complex SystemsChris Laffra
 
Eclipse Visualization and Performance Monitoring
Eclipse Visualization and Performance MonitoringEclipse Visualization and Performance Monitoring
Eclipse Visualization and Performance MonitoringChris Laffra
 
Curry on/Ecoop/ISSTA 2018 report
Curry on/Ecoop/ISSTA 2018 reportCurry on/Ecoop/ISSTA 2018 report
Curry on/Ecoop/ISSTA 2018 reportChris Laffra
 

More from Chris Laffra (7)

Java bytecode hacking
Java bytecode hackingJava bytecode hacking
Java bytecode hacking
 
Project Cacophonia
Project CacophoniaProject Cacophonia
Project Cacophonia
 
Productivity and happiness
Productivity and happinessProductivity and happiness
Productivity and happiness
 
Visualization of Complex Systems
Visualization of Complex SystemsVisualization of Complex Systems
Visualization of Complex Systems
 
Eclipse Visualization and Performance Monitoring
Eclipse Visualization and Performance MonitoringEclipse Visualization and Performance Monitoring
Eclipse Visualization and Performance Monitoring
 
Curry on/Ecoop/ISSTA 2018 report
Curry on/Ecoop/ISSTA 2018 reportCurry on/Ecoop/ISSTA 2018 report
Curry on/Ecoop/ISSTA 2018 report
 
Little languages
Little languagesLittle languages
Little languages
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Jax retrospective

  • 1. Application Extraction for Java: A retrospective report of the Jax project Frank Tip & Chris Laffra
  • 2. Outline • project background & goals • techniques • results • industrial applications • perspective 2
  • 3. Jax Project Background & Goals • successful project at IBM Research from 1998-2003 • goal: - originally: shrink Java applications so that they can be downloaded faster, especially over slow connections - later: optimize Java applications running on embedded devices • approach: - static analysis (but rely on user to specify reflective behaviors and dynamic class loading) - program transformations (e.g. merging classes) • applications: - open-source release via alphaworks - used by various IBM teams and IBM customers (e.g. apps running on Wimbledon website) - integrated in Smartlinker component of IBM WebSphere Device Developer • contributors: Aldo Eisma, Chris Laffra, Jens Palsberg, David Streeter, Peter Sweeney, Frank Tip 3 OOPSLA’99
  • 4. What did it do? • call graph construction • removal of dead methods & dead fields - also: removal of method bodies, write-only fields • inlining of small methods • class hierarchy transformations • name compression • constant pool compression 4
  • 5. Call Graph Construction • Jax relied on type-based algorithms - Class Hierarchy Analysis (CHA) [Dean et al. 1995] - Rapid Type Analysis (RTA) [Bacon 1997] - XTA [Tip & Palsberg 2000] • considerations: - efficiency: scaled to thousands of classes - simplicity: no need for construction of CFGs, SSA Form, pointer analysis, … - need to handle incomplete applications (Jax did not analyze the code in Java’s standard libraries but made conservative assumptions, in the spirit of Averroes [Ali 2013) 5
  • 6. Example public static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } }
  • 7. Precise Call Graph static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } 4 edges 7
  • 8. XTA Algorithm for Call Graph Construction static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } 8
  • 9. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } 9
  • 10. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } 10
  • 11. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } { B } 11
  • 12. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } { B, C } 12
  • 13. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } { B, C } 6 edges 13
  • 14. XTA static void main(){ B b1 = new B(); A a1 = new A(); f(b1); g(b1); } static void f(A a2){ a2.foo(); } static void g(B b2){ B b3 = b2; b3 = new C(); b3.foo(); } class A { void foo(){ } } class B extends A { void foo(){ } } class C extends B { void foo(){ } } class D extends B { void foo(){ } } { A, B } { A, B } { B, C } 6 edges RA: 10 edges CHA: 9 edges RTA: 8 edges 0-CFA: 6 edges (different) 14
  • 16. Removal of Dead Methods & Fields • after call graph construction, remove unreachable methods - in some cases, must remove the body to preserve dispatch behavior • remove dead fields • remove write-only fields - e.g., fields initialized in constructor but never read - also remove the write instructions 16
  • 17. Method Call Inlining • inline method calls if: - XTA determines that a method call has a unique target - inlining the call does not increase application size 17
  • 18. Class Hierarchy Transformations • remove uninstantiated class that does not have any subclasses and that that does not contain any live methods or fields • merge base class X and a derived class Y if (i) there is no live non- abstract method f that occurs in both X and Y , and: (1) X is uninstantiated, or (2) Y does not contain any live non-static fields. - by requiring that (1) or (2) holds, we ensure that no object created by the application becomes larger (i.e., contains more fields) as a result of the merge • similar transformations for merging classes with interfaces 18
  • 19. Name Compression • select short names (e.g., “a”, “b”, “c”) to classes, methods, fields • care must be taken to preserve: - overriding behavior - overload resolution 19
  • 20. Impact of the Transformations 20 ACM TOPLAS’02
  • 21. Modular Extraction Language (MEL) • specify that methods are dynamically loaded or reflectively accessed • support various extraction scenarios: - extract library without assumptions about clients - extract library in the context of a specific application - extract client without assumptions about libraries 21 FSE’00
  • 23. SmartLinker - Commercial Application of Jax • IBM J9 Virtual Machine for embedded platforms offers Japt: - an optimization utility to reduce Java classes from a JAR file - based directly on Jax algorithms, RTA and XTA - focus on embedded, inlining JSR calls, AOT, JXE linking 23 BTA AOT Link RTX, XTA Inlining flattening Smartlinker jax AOT Link RTX, XTA, ITA inlining flattening jar2jxe japt
  • 24. Smartlinker Use Case: Strings in Eclipse • 50% of the heap is Strings of which 50% is unique • String compaction can save 35% of the heap • Combining Japt compression with memory-mapped JXEs allows WebSphere Application Server to scale 2X K 95K 190K 285K 380K 475K Original Japt Eclipse runtime.jar
  • 25. Holistic Optimisation - Faster and Less Memory
  • 26. Lessons Learned • Debloating can offer dramatic improvements in memory consumption and startup times. • OO design is a useful technique, providing meaningful abstractions and scalable designs. Developers should keep using redundant class definitions, deep inheritance, verbose interfaces. - rely on static analysis tools like Jax/SmartLinker to debloat verbose libraries & frameworks • the debloating techniques that we applied are broadly applicable: - applets, applications, Eclipse, WAS, embedded platforms, Android - any OO language, e.g. Swift, C#, Objective-C, Kotlin, C++. • Promising future work would be scenario-based modularization of applications. For mobile, startup times are key. So, can we analyze what is needed just for startup? Another scenario would be once-only tasks, such as registration. Each component could have its own optimization techniques applied, for instance startup code would benefit from AOT (which costs more space on disk, but loads a lot faster). Once-only code would not be AOT'd. • Current work at Northeastern: debloating of applications written in dynamic languages - use a combination of (i) unsound static/dynamic analysis and (ii) a recovery mechanism for dynamic loading of missing functionality (subject to checks). Current focus on JavaScript. 26
  • 27. Publications and References • Frank Tip, Chris Laffra, Peter F. Sweeney, David Streeter: Practical Experience with an Application Extractor for Java. OOPSLA 1999: 292-305 • Peter F. Sweeney, Frank Tip: Extracting library-based object-oriented applications. SIGSOFT FSE 2000: 98-107 • Frank Tip, Jens Palsberg: Scalable propagation-based call graph construction algorithms. OOPSLA 2000: 281-293 • Frank Tip, Peter F. Sweeney, Chris Laffra, Aldo Eisma, David Streeter: Practical extraction techniques for Java. ACM Trans. Program. Lang. Syst. 24(6): 625-666 (2002) • Frank Tip, Peter F. Sweeney, Chris Laffra: Extracting library-based Java applications. Commun. ACM 46(8): 35-40 (2003) • WebSphere Everyplace Custom Environment product definition at www- 01.ibm.com/software/wireless/wece/features.html, referencing Japt. • Sean Foley: From Global to Local Escape Analysis in Java. Performance Engineering Best Practices Conference (2008) 27