ANDROID 292 IMPLEMENTING INVOKEDYNAMIC IN ANDROID Jrme Pilliet Rmi - - PowerPoint PPT Presentation

android 292
SMART_READER_LITE
LIVE PREVIEW

ANDROID 292 IMPLEMENTING INVOKEDYNAMIC IN ANDROID Jrme Pilliet Rmi - - PowerPoint PPT Presentation

ANDROID 292 IMPLEMENTING INVOKEDYNAMIC IN ANDROID Jrme Pilliet Rmi Forax , and Gilles Roussel University of Paris-Est Marne-la-Valle JAVA SPECIFICATION REQUEST 292 2006: start of the JSR 2011: included in Java 7 new instruction:


slide-1
SLIDE 1

ANDROID 292

IMPLEMENTING INVOKEDYNAMIC IN ANDROID

, and University of Paris-Est Marne-la-Vallée Jérôme Pilliet Rémi Forax Gilles Roussel

slide-2
SLIDE 2

JAVA SPECIFICATION REQUEST 292

2006: start of the JSR 2011: included in Java 7 new instruction: invokedynamic flexible method invocation very late linking (at runtime) and dynamic re-linking new API: java.lang.invoke MethodHandle: type safe function pointers combiners which do arguments fiddling

slide-3
SLIDE 3

ANDROID

Google's OS for smartphones and tablets uses the JVM: Dalvik almost Java 6 specification registers based DEX format: read-only limited battery and calculating power

slide-4
SLIDE 4

WHY ?

slide-5
SLIDE 5

ANDROID 292

slide-6
SLIDE 6

A NEW SPECIFICATION

add constant pools and call site count in class format

  • ne instruction for each new kind of method invocation

MH.invokeExact → invoke-exact MH.invoke → invoke-generic invokedynamic → invoke-dynamic all these instructions run in the C interpreter

slide-7
SLIDE 7

METHODHANDLE HIERARCHY

slide-8
SLIDE 8

COMBINERS INTERPRETER

written in Java call by the C interpreter all arguments are boxed

  • ne stack frame for the whole tree

unboxing when calling a method handle leaf

slide-9
SLIDE 9

RESULTS: INSTRUCTIONS VS REFLECTION

slide-10
SLIDE 10

RESULTS: INSTANCEOF VS COMBINERS INTERPRETER

def plus(a, b): return a + b def choose(): if randint(0, 10) % 2 == 0: return plus(40, 2) else: return plus('foo', 'bar')

slide-11
SLIDE 11

CONCLUSION

it works ! retro-compatibility

FUTUR

improve the dual stack prototype stack storage the arrays

slide-12
SLIDE 12

ANDROID 292

QUESTIONS ?

https://bitbucket.org/jpilliet/android-292 https://github.com/brachior/Android-292