Your SlideShare is downloading. ×
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
OWF12/PAUG Conf Days From dalvik to apps development    jérôme pilliet student
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

OWF12/PAUG Conf Days From dalvik to apps development jérôme pilliet student

1,013

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,013
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Dalvik 292 Jérôme PillietUniversité Paris-Est de Marne-la-Vallée
  • 2. Sommaire● Avant propos● JVM vs DVM ● Principe ● Comportement● JSR 292 ● Principe ● java.lang.invoke ● Exemple● Optimisation ● VMs modernes ● JSR 292● Dalvik 292 ● Problèmes et solutions partielles● Conclusion
  • 3. Avant propos● Langages typés dynamiquement ● sémantique déterminée à lexécution● Smartphone / tablette ● mémoire restreinte ● puissance de calcul restreinte● Android et Dalvik ● OS le plus utilisé ● technologie Java - Dalvik
  • 4. JVM vs DVM Principe● Machine à piles / machine à registres● Spécification ~ Java 6
  • 5. JVM vs DVM Principe● Machine à piles / machine à registres● Spécification ~ Java 6
  • 6. JVM vs DVM Principe● Machine à piles / machine à registres● Spécification ~ Java 6
  • 7. JVM vs DVM Comportement● Dalvik ● Java Virtual Machine ● Bytecode ● JIT Compiler –readonly ● ODEX – bytecode – vtables (methodes) – offsets (attributs) – method inlining ● Zygote – pre-load VM ● Trace/Method JIT Compiler ● Garbage Collector – restreint
  • 8. JSR 292 Principe
  • 9. JSR 292 Principe
  • 10. JSR 292 Principe
  • 11. JSR 292 java.lang.invoke● invokedynamic ● édition de lien● MethodHandle ● CallSite ● invokeExact ● conteneur de MH ● invoke combinateurs SwitchPoint ● ● ● GuardWithTest ● désoptimisation ● ...● MethodHandle Tree ● combinaison de MH
  • 12. JSR 292 Exempleclass A { foo() { … }} . . . . invokevirtual java/lang/Object.foo:()Object…b.foo()...
  • 13. JSR 292 Exempleclass A { foo() { … }} . . . . invokevirtual java/lang/Object.foo:()Object…b.foo()... invokedynamic foo:()Object
  • 14. JSR 292 Exemple // exemple … A=B+C; ...…invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite...
  • 15. JSR 292 Exemple // exemple … A=B+C; ...…invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite... 1. appel methode damorce CallSite bsm(Lookup lookup, String name, MethodType type) { CallSite cs = ... MethodHandle mh = ... cs.setTarget(mh); return cs; }
  • 16. JSR 292 Exemple // exemple … A=B+C; ...…invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite... 2. associe un CallSite 1. appel methode damorce au site dappel CallSite bsm(Lookup lookup, String name, MethodType type) { CallSite cs = ... MethodHandle mh = ... cs.setTarget(mh); return cs; }
  • 17. JSR 292 Exemple // exemple … A=B+C; Arbre de ... MethodHandles 3. appels suivants…invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite... 2. associe un CallSite 1. appel methode damorce au site dappel CallSite bsm(Lookup lookup, String name, MethodType type) { CallSite cs = ... MethodHandle mh = ... cs.setTarget(mh); return cs; }
  • 18. JSR 292 Exemple // exemple +(int, int) … A=B+C; Arbre de +(double, double) ... MethodHandles 3. appels suivants…invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite... 2. associe un CallSite 1. appel methode damorce au site dappel CallSite bsm(Lookup lookup, String name, MethodType type) { CallSite cs = ... MethodHandle mh = ... cs.setTarget(mh); return cs; }
  • 19. JSR 292 Exemple // exemple +(int, int) … A=B+C; Arbre de +(double, double) ... MethodHandles 3. appels suivants fallback(CallSite cs) { ... cs.setTarget(...) change la cible… }invokedynamic "+" (Object, Object)Object bsm: RT.bsm(Lookup, String, MethodType)CallSite... 2. associe un CallSite 1. appel methode damorce au site dappel CallSite bsm(Lookup lookup, String name, MethodType type) { CallSite cs = ... MethodHandle mh = ... cs.setTarget(mh); return cs; }
  • 20. Optimisation VMs modernes ● Profiling ● présence de null ● receveurs dappels virtuels ● classes pour les cast/instanceof ● fréquence des branches des if ● Détection de code chaud ● méthode chaude ● boucle chaude (OSR)● Génération de code machine optimiste ● pas de test à null si jamais null ● pas de branche non prise ● inlining des appels virtuels ● cheap-cast ● désoptimisation si assomption fausse
  • 21. Optimisation JSR 292● Profiling ● détection de MethodHandle chaud et stabilité de invokedynamic ● receveur de l’appel virtuel ● branche pour le GuardWithTest● Détection ● stabilité target dun invokedynamic ●invokeExact / génération de bytecode ● MethodHandle chaud ●appel en assembleur ● MethodHandles Tree ● génération de bytecode => Out Of Memory !!! ● (Pré-JDK 7) appel en Java ● (JDK 7) mini-interpréteur (AST) ● (JDK 8) LambdaForm + paramètres JITé
  • 22. Dalvik 292Problèmes et solutions
  • 23. Dalvik 292 Problèmes et solutions● Détection de MethodHandle chaud ● MethodHandle ● bytecode spécifique ● MethodHandle Tree ● squelette en code DEX ● convention dappel spécifique skeleton.args ● gère loptimisation des lambdas (Java 8) mh.args● JIT ● MethodHandle et petit MethodHandle Tree ● inlining Pile ● Squelette ● JITé
  • 24. Conclusion● Avancement ● ajout des instructions ● nouveau format DEX ● génération du fichier DEX● Intérêt ● Dalvik : une VM comme les autres ● suivre évolution Java
  • 25. Dalvik 292 Jérôme Pilliet <jerome.pilliet@univ-paris-est.fr>Université Paris-Est de Marne-la-Vallée

×