Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android VM
Search
wagyu298
March 03, 2016
Programming
0
620
Android VM
Delvik / ART
wagyu298
March 03, 2016
Tweet
Share
More Decks by wagyu298
See All by wagyu298
Swagger Codegen
wagyu298
1
2.6k
HTTP/2 Mobile
wagyu298
0
930
Option Type
wagyu298
0
1.1k
process.nextTick differences between node-v0.8 and node-v0.11
wagyu298
1
1.6k
Other Decks in Programming
See All in Programming
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
200
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
110
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
500
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.2k
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
4
1.3k
EventSourcingの理想と現実
wenas
6
2.2k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.2k
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
1
120
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.7k
Java ジェネリクス入門 2024
nagise
0
700
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
760
Featured
See All Featured
Building Your Own Lightsaber
phodgson
102
6.1k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
RailsConf 2023
tenderlove
29
900
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
42
2.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
A Tale of Four Properties
chriscoyier
156
23k
Designing the Hi-DPI Web
ddemaree
280
34k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Transcript
Android VM @wagyu298
Android VM ≠ Java VM
Android VM Delvik: Android 4.4 ART: Android 5.0 or later
Hardware • Nexus 5X (Android) • Qualcomm® Snapdragon™ 808 ϓϩηοα
1.8 GHz ϔΩαίΞ 64 Ϗοτ • 2GB LPDDR3 • ࠷৽ARM8ɺݹ͍σόΠεARMҎ֎ʹMIPSx86 CPUͷͷ͋Δ • ϚϧνCPUରԠʹVM༗ར • iPhone 6s • A9 • 2GB LPDDR4 • ಉ͘͡ARM8ɺݹ͍iPhoneͯ͢ARMޓ • ୯ҰΞʔΩςΫνϟͳͷͰɺXcode͔Β࣮ߦՄೳόΠφϦΛग़ྗ͢Δ • 64bitରԠͷͨΊɺ32bitόΠφϦΛ64bitόΠφϦΛ࡞͢ΔΑ͏ʹͳͬͨ
Android VM • Delvik: Android 4.4 • ART: Android 5.0
or later • https://source.android.com/devices/tech/dalvik/ index.html
Android VM https://ja.wikipedia.org/wiki/Android_Runtime
Delvik • ϨδελϕʔεͷόʔνϟϧϚγϯʢJava VMελοΫϕʔεʣ • ARM831ݸͷ64bit൚༻Ϩδελͱ32ݸͷ128bitුಈখϨδε λ͕༻ՄೳͰARM7ͱൺDelvikʹ༗ར • ϝϞϦڥʹ࠷దԽ •
ಈ࡞͢ΔόΠτίʔυDexϑΥʔϚοτͰJavaόΠτίʔυͰͳ͍ ͨΊɺDelvik VMJava VMͰͳ͍ • JavaޓੑςετΛ௨ա͍ͯ͠ͳ͍ͷͰɺJava™Λ༻Ͱ͖ͳ͍ • dxίϚϯυͰ.classϑΝΠϧΛ.dexϑΝΠϧʹม͢Δ • APKʹෳʢ௨ৗ1ͭʣͷ.dexϑΝΠϧؚ͕·ΕΔ • Android 2.1͔ΒJITαϙʔτ
Dex Specs • https://source.android.com/devices/tech/dalvik/dex- format.html
ART • AOT (Ahead-Of-Time) ίϯύΠϧ • ࣮ߦલʢΠϯετʔϧ࣌ʣʹ.dexϑΝΠϧΛELF dynamic objectʹม •
࣮ߦ্͕͍ͯ͠Δ͕ɺAOTͷੑ্࣭ΞϓϦͷΠϯε τʔϧʹ͕͔͔࣌ؒΔΑ͏ʹͳΓ࣮ߦϑΝΠϧαΠζେ ͖͘ͳ͍ͬͯΔ • dex2oatʢdexΛELFʹม͢ΔίϚϯυʣLLVMͰ࣮ • JITίϯύΠϥଐ͍ͯ͠Δ͕ɺDelvikͷ࣮ͱҧ͍͋·Γ ࠷దԽ͞Ε͍ͯͳ͍
Zygote • AndroidΞϓϦͷىಈϓϩηε • AndroidࣗମLinuxϚγϯͰ͋ΓɺσόΠεىಈ࣌/ init͔Β࢝·ΔҰ࿈ͷىಈϓϩηε͕ී௨ʹ࣮ߦ͞Εɺ/ init.rcεΫϦϓτ͔Βىಈ͞ΕΔίϚϯυapp_process ͷ͜ͱ • https://android.googlesource.com/platform/system/
core/+/master/rootdir/init.zygote64_32.rc
Zygote • zygoteϓϩηεΞϓϦىಈʹඞཁͳͯ͢ͷϥΠϒ ϥϦ͕dynamic link͞Ε͓ͯΓɺࢠϓϩηεΛforkͯ͠ ʢexecͤͣʹʣΞϓϦΛىಈ͢Δ • app_processzygoteϞʔυͰىಈ͞ΕΔͱ com.android.internal.os.ZygoteInitΛ࣮ߦ͢Δ •
https://android.googlesource.com/platform/ frameworks/base/+/master/cmds/app_process/ app_main.cpp
Zygote • ZygoteInit͋ʔͩ͜ʔͩͨ͋͠ͱ • https://android.googlesource.com/platform/frameworks/ base/+/master/core/java/com/android/internal/os/ ZygoteInit.java • app_processͷAppRuntimeΫϥεΛܦ༝͠AndroidRuntime͔ ΒActivityThreadΫϥεͷmainؔΛݺͼग़͢ɻ
• https://android.googlesource.com/platform/frameworks/ base/+/master/core/jni/AndroidRuntime.cpp • https://android.googlesource.com/platform/frameworks/ base/+/master/core/java/android/app/ActivityThread.java
References • http://d.hatena.ne.jp/embedded/20131104/p1 • http://blog.kmckk.com/archives/3551546.html • http://blog.kmckk.com/archives/4164432.html • http://elinux.org/Android_Zygote_Startup •
http://crimsonwoods.hatenablog.com/entry/ 2014/11/10/013025 • http://blog.hermit4.info/2011/01/zygote.html • http://dsas.blog.klab.org/archives/52003951.html