SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
The Jack and Jill
build system
Eric Lafortune
Developer of ProGuard and DexGuard
CTO at GuardSquare
www.guardsquare.com
The Jack and Jill build system
Inside the build system
Practical implications and results
Jack and Jill
Java Android Compiler Kit
Jack Intermediate Library Linker
Jack and Jill
●
Now default in build process of AOSP
●
Optional in Gradle build process:
android {
defaultConfig {
useJack true
...
}
...
}
android {
defaultConfig {
useJack true
...
}
...
}
Why?
Technical
Legal ?
Strategical ?
Android build process
Java bytecode
(.class)
Libraries
(.class)
Dx
Javac
Source code
(.java)
Libraries
(.class)
XML resources
(.xml)
Assets Assets
Compiled
XML resources
(.xml)
Aapt
Dalvik bytecode
(classes.dex)
Runtime
(.class)
ProGuard
Java bytecode
(.class)
ProGuard
Libraries
(.class)
Optimized
Java bytecode
(.class)
Dx
Javac
Assets
Compiled
XML resources
(.xml)
Aapt
Dalvik bytecode
(classes.dex)
ProGuard
config
(.txt)
ProGuard
mapping
(.txt)
Source code
(.java)
Libraries
(.class)
XML resources
(.xml)
Assets
Runtime
(.class)
ProGuard
Java bytecode
(.class)
ProGuard
Libraries
(.class)
Optimized
Java bytecode
(.class)
Dx
Javac
Assets
Compiled
XML resources
(.xml)
Aapt
Dalvik bytecode
(classes.dex)
ProGuard
config
(.txt)
ProGuard
mapping
(.txt)
Source code
(.java)
Libraries
(.class)
XML resources
(.xml)
Assets
Runtime
(.class)
Jack and Jill
Libraries
(.jayce)
Jack
Assets
Compiled
XML resources
(.xml)
Aapt
Dalvik bytecode
(classes.dex)
ProGuard
config
(.txt)
ProGuard
mapping
(.txt)
Source code
(.java)
Libraries
(.class)
XML resources
(.xml)
Assets
Runtime
(.class)
Jill
Jill Runtime
(.jayce)
Code representations
for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ...
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
.class .dex
.java
Code representations
for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ...
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
.class .dex
.java
Efficient to store and execute
Inconvenient to process
Code representations
for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ...
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
iconst 0
istore v0
iload v0
bipush 8
ificmpge +12
...
iinc v0, 1
goto -12
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
const/4 v0, #0
const/16 v1, #8
if-ge v0, v1, 8
...
add-int/lit8 v0, v0, #1
goto -9
LOCAL int n
FOR_STATEMENT:
- EXPRESSION_STATEMENT:
- ASG_OPERATION:
- LOCAL_REF i
- INT_LITERAL 1
- LT_OPERATION:
- LOCAL_REF i
- INT_LITERAL 8
- POSTFIX_INC_OPERATION:
- LOCAL_REF i
- ...
LOCAL int n
FOR_STATEMENT:
- EXPRESSION_STATEMENT:
- ASG_OPERATION:
- LOCAL_REF i
- INT_LITERAL 1
- LT_OPERATION:
- LOCAL_REF i
- INT_LITERAL 8
- POSTFIX_INC_OPERATION:
- LOCAL_REF i
- ...
.jayce.class .dex
.java
Implications of Jack and Jill
●
Java annotation processors – supported in Jack
E.g. Dagger, Butterknife
●
Bytecode processors – only supported via Jill
E.g. JaCoCo, Retrolambda
●
Other JVM languages – only supported via Jill
E.g. Scala, Groovy, Dart
Implications of Jack and Jill
Libraries
(.jayce)
Jack
Assets
Compiled
XML resources
(.xml)
Aapt
Dalvik bytecode
(classes.dex)
Javac annotation processors
E.g. Dagger, Butterknife
Source code
(.scala,...)
Libraries
(.class)
XML resources
(.xml)
Assets
Runtime
(.class)
Jill
Jill Runtime
(.jayce)
Bytecode processors
Java bytecode
(.class)Scalac
Application
(.jayce)Jill
Internals
Jack: Java frontend
Eclipse ecj library
Jill: Java frontend
ASM4 library
Build performance
56s – Javac + dx (clean build)
32s – Javac + ProGuard + dx (clean build)
53s – Javac + ProGuard optimize + dx (clean build)
29s – Javac + DexGuard + dx (clean build)
2m50s – Javac + DexGuard optimize + dx (clean build)
1m48s – Jack (clean build)
20s – Jack (clear all dex files)
11s – Javac + dx (clear all class files)11s – Javac + dx (clear all class files)
9s – Javac + dx (clear one class file)9s – Javac + dx (clear one class file)
8s – Javac + dx (code unchanged)8s – Javac + dx (code unchanged)
9s – Jack (clear one dex file)9s – Jack (clear one dex file)
9s – Jack (code unchanged)9s – Jack (code unchanged)
Google I/O app
(AMD A10-7800, Ubuntu 14.04, Java 8, Android Gradle 1.2.3 / 1.3.1)
11s – Jack minify (clear all dex files)11s – Jack minify (clear all dex files)
Application runtime performance
50,000 – Javac + dx
63,800 – Javac + ProGuard optimize + dx
82,300 – Javac + DexGuard optimize
54,500 – Jack
Caffeinemark benchmark
(Nexus 5, Android 6.0, ART)
+9%
+28%
+65%
(higher is better)
Application size
3.1M – Javac + dx
1.9M – Javac + ProGuard optimize + dx
1.8M – Javac + DexGuard optimize
1.9M – Jack + minify
Google I/O app
-39%
-38%
-44%
(smaller is better)
DexGuard
Java bytecode
(.class)
DexGuard
Libraries
(.class)
Javac
Assets
Optimized
XML resources
(.xml)
Aapt
Optimized
Dalvik bytecode
(classes.dex)
ProGuard
config
(.txt)
ProGuard
mapping
(.txt)
Source code
(.java)
Libraries
(.class)
XML resources
(.xml)
Assets
Runtime
(.class)
Compiled
XML resources
(.xml)
Support for Java 8 – closures
●
Under development in branch 'ub-jack-lang-dev'
●
Test cases
●
Compiled to anonymous classes
Interface lambda = i -> i + 1;Interface lambda = i -> i + 1;
$ java -jar jack.jar --help-properties
...
jack.java.source.version:
Java source version (default is '1.8')
{1.3,1.4,1.5,5.0,5,1.6,6.0,6,1.7,7.0,7,1.8,8.0,8}
...
$ java -jar jack.jar --help-properties
...
jack.java.source.version:
Java source version (default is '1.8')
{1.3,1.4,1.5,5.0,5,1.6,6.0,6,1.7,7.0,7,1.8,8.0,8}
...
Interface lambda = new Interface() {
public int m(int i) {
return i + 1;
}
}
Interface lambda = new Interface() {
public int m(int i) {
return i + 1;
}
}
Conclusions
More efficient builds
Jack and Jill:
●
Java 8
●
Clean implementation
●
Room for growth
Further reading
●
“Experimental New Android Tool Chain - Jack and Jill”
http://tools.android.com/tech-docs/jackandjill
●
“Jack (Java Android Compiler Kit)”
https://source.android.com/source/jack.html
●
AOSP repository
https://android.googlesource.com/toolchain/jack/
●
“Hello World, meet our new experimental toolchain, Jack and Jill”, Paul Rashidi
http://android-developers.blogspot.be/2014/12/hello-world-meet-our-new-experimental.html
●
“The upcoming Jack & Jill compilers in Android”, Eric Lafortune
https://www.guardsquare.com/blog/201412
●
“AO(sp)y Episode 2 - Lambdas”, Curious Techizen, Kiran Rao
http://kiranrao.in/blog/2015/09/06/ao-spy-2/
Questions?
Size
Java bytecode
Performance
Jayce bytecode
Dalvik bytecode
Jack & Jill
ProGuard
DexGuard

Contenu connexe

Tendances

OWF12/PAUG Conf Days Pro guard optimizer and obfuscator for android, eric l...
OWF12/PAUG Conf Days Pro guard   optimizer and obfuscator for android, eric l...OWF12/PAUG Conf Days Pro guard   optimizer and obfuscator for android, eric l...
OWF12/PAUG Conf Days Pro guard optimizer and obfuscator for android, eric l...Paris Open Source Summit
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
Python Evolution
Python EvolutionPython Evolution
Python EvolutionQuintagroup
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
關於測試,我說的其實是......
關於測試,我說的其實是......關於測試,我說的其實是......
關於測試,我說的其實是......hugo lu
 
Thoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguageThoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguagePatricia Aas
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
ZooKeeper Recipes and Solutions
ZooKeeper Recipes and SolutionsZooKeeper Recipes and Solutions
ZooKeeper Recipes and SolutionsJeff Smith
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?Andrey Karpov
 
Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)Patricia Aas
 
C++ for Java Developers (JavaZone Academy 2018)
C++ for Java Developers (JavaZone Academy 2018)C++ for Java Developers (JavaZone Academy 2018)
C++ for Java Developers (JavaZone Academy 2018)Patricia Aas
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxDavid Rodenas
 
Java and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemJava and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemRafael Winterhalter
 
The Ring programming language version 1.4 book - Part 3 of 30
The Ring programming language version 1.4 book - Part 3 of 30The Ring programming language version 1.4 book - Part 3 of 30
The Ring programming language version 1.4 book - Part 3 of 30Mahmoud Samir Fayed
 

Tendances (18)

OWF12/PAUG Conf Days Pro guard optimizer and obfuscator for android, eric l...
OWF12/PAUG Conf Days Pro guard   optimizer and obfuscator for android, eric l...OWF12/PAUG Conf Days Pro guard   optimizer and obfuscator for android, eric l...
OWF12/PAUG Conf Days Pro guard optimizer and obfuscator for android, eric l...
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Python Evolution
Python EvolutionPython Evolution
Python Evolution
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
groovy & grails - lecture 7
groovy & grails - lecture 7groovy & grails - lecture 7
groovy & grails - lecture 7
 
關於測試,我說的其實是......
關於測試,我說的其實是......關於測試,我說的其實是......
關於測試,我說的其實是......
 
Thoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguageThoughts On Learning A New Programming Language
Thoughts On Learning A New Programming Language
 
Java after 8
Java after 8Java after 8
Java after 8
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
ZooKeeper Recipes and Solutions
ZooKeeper Recipes and SolutionsZooKeeper Recipes and Solutions
ZooKeeper Recipes and Solutions
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)Secure Programming Practices in C++ (NDC Security 2018)
Secure Programming Practices in C++ (NDC Security 2018)
 
Project Coin
Project CoinProject Coin
Project Coin
 
C++ for Java Developers (JavaZone Academy 2018)
C++ for Java Developers (JavaZone Academy 2018)C++ for Java Developers (JavaZone Academy 2018)
C++ for Java Developers (JavaZone Academy 2018)
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
Java and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemJava and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystem
 
The Ring programming language version 1.4 book - Part 3 of 30
The Ring programming language version 1.4 book - Part 3 of 30The Ring programming language version 1.4 book - Part 3 of 30
The Ring programming language version 1.4 book - Part 3 of 30
 

Similaire à Eric Lafortune - The Jack and Jill build system

Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondRamon Ribeiro Rabello
 
Jump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and DatabricksJump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and DatabricksDatabricks
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
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
 
How to lock a Python in a cage? Managing Python environment inside an R project
How to lock a Python in a cage?  Managing Python environment inside an R projectHow to lock a Python in a cage?  Managing Python environment inside an R project
How to lock a Python in a cage? Managing Python environment inside an R projectWLOG Solutions
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentOOO "Program Verification Systems"
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWTArnaud Tournier
 
(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
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_iNico Ludwig
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and batteryVitali Pekelis
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」Satoshi Goto
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_iNico Ludwig
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007lucclaes
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedToru Wonyoung Choi
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Petr Zapletal
 
The Ring programming language version 1.9 book - Part 9 of 210
The Ring programming language version 1.9 book - Part 9 of 210The Ring programming language version 1.9 book - Part 9 of 210
The Ring programming language version 1.9 book - Part 9 of 210Mahmoud Samir Fayed
 

Similaire à Eric Lafortune - The Jack and Jill build system (20)

Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyond
 
Jump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and DatabricksJump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and Databricks
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
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
 
How to lock a Python in a cage? Managing Python environment inside an R project
How to lock a Python in a cage?  Managing Python environment inside an R projectHow to lock a Python in a cage?  Managing Python environment inside an R project
How to lock a Python in a cage? Managing Python environment inside an R project
 
Ropython-windbg-python-extensions
Ropython-windbg-python-extensionsRopython-windbg-python-extensions
Ropython-windbg-python-extensions
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
(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
 
Flink internals web
Flink internals web Flink internals web
Flink internals web
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018
 
The Ring programming language version 1.9 book - Part 9 of 210
The Ring programming language version 1.9 book - Part 9 of 210The Ring programming language version 1.9 book - Part 9 of 210
The Ring programming language version 1.9 book - Part 9 of 210
 

Dernier

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 

Dernier (20)

SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 

Eric Lafortune - The Jack and Jill build system

  • 1. The Jack and Jill build system Eric Lafortune Developer of ProGuard and DexGuard CTO at GuardSquare www.guardsquare.com
  • 2. The Jack and Jill build system Inside the build system Practical implications and results
  • 3. Jack and Jill Java Android Compiler Kit Jack Intermediate Library Linker
  • 4. Jack and Jill ● Now default in build process of AOSP ● Optional in Gradle build process: android { defaultConfig { useJack true ... } ... } android { defaultConfig { useJack true ... } ... }
  • 6. Android build process Java bytecode (.class) Libraries (.class) Dx Javac Source code (.java) Libraries (.class) XML resources (.xml) Assets Assets Compiled XML resources (.xml) Aapt Dalvik bytecode (classes.dex) Runtime (.class)
  • 7. ProGuard Java bytecode (.class) ProGuard Libraries (.class) Optimized Java bytecode (.class) Dx Javac Assets Compiled XML resources (.xml) Aapt Dalvik bytecode (classes.dex) ProGuard config (.txt) ProGuard mapping (.txt) Source code (.java) Libraries (.class) XML resources (.xml) Assets Runtime (.class)
  • 8. ProGuard Java bytecode (.class) ProGuard Libraries (.class) Optimized Java bytecode (.class) Dx Javac Assets Compiled XML resources (.xml) Aapt Dalvik bytecode (classes.dex) ProGuard config (.txt) ProGuard mapping (.txt) Source code (.java) Libraries (.class) XML resources (.xml) Assets Runtime (.class)
  • 9. Jack and Jill Libraries (.jayce) Jack Assets Compiled XML resources (.xml) Aapt Dalvik bytecode (classes.dex) ProGuard config (.txt) ProGuard mapping (.txt) Source code (.java) Libraries (.class) XML resources (.xml) Assets Runtime (.class) Jill Jill Runtime (.jayce)
  • 10. Code representations for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ... iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 .class .dex .java
  • 11. Code representations for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ... iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 .class .dex .java Efficient to store and execute Inconvenient to process
  • 12. Code representations for (int i = 0; i < 8; i++) ...for (int i = 0; i < 8; i++) ... iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 iconst 0 istore v0 iload v0 bipush 8 ificmpge +12 ... iinc v0, 1 goto -12 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 const/4 v0, #0 const/16 v1, #8 if-ge v0, v1, 8 ... add-int/lit8 v0, v0, #1 goto -9 LOCAL int n FOR_STATEMENT: - EXPRESSION_STATEMENT: - ASG_OPERATION: - LOCAL_REF i - INT_LITERAL 1 - LT_OPERATION: - LOCAL_REF i - INT_LITERAL 8 - POSTFIX_INC_OPERATION: - LOCAL_REF i - ... LOCAL int n FOR_STATEMENT: - EXPRESSION_STATEMENT: - ASG_OPERATION: - LOCAL_REF i - INT_LITERAL 1 - LT_OPERATION: - LOCAL_REF i - INT_LITERAL 8 - POSTFIX_INC_OPERATION: - LOCAL_REF i - ... .jayce.class .dex .java
  • 13. Implications of Jack and Jill ● Java annotation processors – supported in Jack E.g. Dagger, Butterknife ● Bytecode processors – only supported via Jill E.g. JaCoCo, Retrolambda ● Other JVM languages – only supported via Jill E.g. Scala, Groovy, Dart
  • 14. Implications of Jack and Jill Libraries (.jayce) Jack Assets Compiled XML resources (.xml) Aapt Dalvik bytecode (classes.dex) Javac annotation processors E.g. Dagger, Butterknife Source code (.scala,...) Libraries (.class) XML resources (.xml) Assets Runtime (.class) Jill Jill Runtime (.jayce) Bytecode processors Java bytecode (.class)Scalac Application (.jayce)Jill
  • 15. Internals Jack: Java frontend Eclipse ecj library Jill: Java frontend ASM4 library
  • 16. Build performance 56s – Javac + dx (clean build) 32s – Javac + ProGuard + dx (clean build) 53s – Javac + ProGuard optimize + dx (clean build) 29s – Javac + DexGuard + dx (clean build) 2m50s – Javac + DexGuard optimize + dx (clean build) 1m48s – Jack (clean build) 20s – Jack (clear all dex files) 11s – Javac + dx (clear all class files)11s – Javac + dx (clear all class files) 9s – Javac + dx (clear one class file)9s – Javac + dx (clear one class file) 8s – Javac + dx (code unchanged)8s – Javac + dx (code unchanged) 9s – Jack (clear one dex file)9s – Jack (clear one dex file) 9s – Jack (code unchanged)9s – Jack (code unchanged) Google I/O app (AMD A10-7800, Ubuntu 14.04, Java 8, Android Gradle 1.2.3 / 1.3.1) 11s – Jack minify (clear all dex files)11s – Jack minify (clear all dex files)
  • 17. Application runtime performance 50,000 – Javac + dx 63,800 – Javac + ProGuard optimize + dx 82,300 – Javac + DexGuard optimize 54,500 – Jack Caffeinemark benchmark (Nexus 5, Android 6.0, ART) +9% +28% +65% (higher is better)
  • 18. Application size 3.1M – Javac + dx 1.9M – Javac + ProGuard optimize + dx 1.8M – Javac + DexGuard optimize 1.9M – Jack + minify Google I/O app -39% -38% -44% (smaller is better)
  • 19. DexGuard Java bytecode (.class) DexGuard Libraries (.class) Javac Assets Optimized XML resources (.xml) Aapt Optimized Dalvik bytecode (classes.dex) ProGuard config (.txt) ProGuard mapping (.txt) Source code (.java) Libraries (.class) XML resources (.xml) Assets Runtime (.class) Compiled XML resources (.xml)
  • 20. Support for Java 8 – closures ● Under development in branch 'ub-jack-lang-dev' ● Test cases ● Compiled to anonymous classes Interface lambda = i -> i + 1;Interface lambda = i -> i + 1; $ java -jar jack.jar --help-properties ... jack.java.source.version: Java source version (default is '1.8') {1.3,1.4,1.5,5.0,5,1.6,6.0,6,1.7,7.0,7,1.8,8.0,8} ... $ java -jar jack.jar --help-properties ... jack.java.source.version: Java source version (default is '1.8') {1.3,1.4,1.5,5.0,5,1.6,6.0,6,1.7,7.0,7,1.8,8.0,8} ... Interface lambda = new Interface() { public int m(int i) { return i + 1; } } Interface lambda = new Interface() { public int m(int i) { return i + 1; } }
  • 21. Conclusions More efficient builds Jack and Jill: ● Java 8 ● Clean implementation ● Room for growth
  • 22. Further reading ● “Experimental New Android Tool Chain - Jack and Jill” http://tools.android.com/tech-docs/jackandjill ● “Jack (Java Android Compiler Kit)” https://source.android.com/source/jack.html ● AOSP repository https://android.googlesource.com/toolchain/jack/ ● “Hello World, meet our new experimental toolchain, Jack and Jill”, Paul Rashidi http://android-developers.blogspot.be/2014/12/hello-world-meet-our-new-experimental.html ● “The upcoming Jack & Jill compilers in Android”, Eric Lafortune https://www.guardsquare.com/blog/201412 ● “AO(sp)y Episode 2 - Lambdas”, Curious Techizen, Kiran Rao http://kiranrao.in/blog/2015/09/06/ao-spy-2/
  • 23. Questions? Size Java bytecode Performance Jayce bytecode Dalvik bytecode Jack & Jill ProGuard DexGuard