aot-компиляция java

Download AOT-компиляция Java

Post on 19-Jan-2017

202 views

Category:

Technology

0 download

Embed Size (px)

TRANSCRIPT

  • AOT Java

    Excelsior

    1

  • 2

  • , +++ ++++++

    3

  • , +++, ++++++

    4

  • ..

    5

  • Java 6

  • Java JVM

    7

  • Java to Na@ve

    (Just-In-Time JIT).

    (Ahead-Of-Time AOT)

    8

  • 9

  • Java

    ? , Java?

    ? vs. Java Java

    : JIT

    AOT Desktop, Embedded, Mobile AOT server side

    10

  • 11

  • AOT Java?

    Excelsior JET? Excelsior JET?

    12

  • Java

    13

  • Reflecron

    ?

    1. Java -

    14

  • WORA: Write Once Run Anywhere ( , )

    != BORA: Build Once? ( ??? )

    2. AOT WORA

    15

  • () , JVM ( )

    : ? GC, reflecron?

    3. AOT = Exe

    16

  • , AOT, Java Java , JRE:

    Jav : hps://www.youtube.com/results?search_query=javaday+

    3. AOT = Exe

    17

  • Java

    18

  • , JAR hell (OSGi, Java Module System)

    Java EE , Eclipse RCP,

    19

  • ?

    20

  • Classes

    21

  • Classes

    CL1 CL2 CL3 CL4

    CLi: classloader ( )

    22

  • CL4 CL3

    CL2 CL1

    classes classes

    classes classes

    23

  • CL4 CL3

    CL2 CL1

    classes classes

    classes classes

    24

  • CL4 CL3

    CL2 CL1

    classes classes

    classes classes

    25

  • CL4 CL3

    CL2 CL1

    classes classes

    classes

    26

  • CL4 CL3

    CL2 CL1

    classes classes

    27

  • AOT: AOT : ,

    ID

    28

  • AOT: :

    ID ID,

    : java.lang.Class OS

    29

  • AOT Java?

    30

  • 31

  • Java bytecode

    reflecron

    , ( JDK )

    32

  • ( , )

    33

  • 34

  • ,

    (dll, so)

    vs

    35

  • Java Quick Start

    Java Quick Start rt.jar,

    36

  • AOT ?

    Java bytecode

    ,

    37

  • AOT !

    38

  • 39

  • 40

  • Java , C, C Java, AOT

    4. AOT

    41

  • Java

    5. JIT

    42

  • 43

  • Java

    (get/set)

    44

  • (inline)

    new T().foo(); // foo()

    Inline caches

    45

  • A a;

    a.foo();

    if (RT_Type(a) in CHA) { inlined body of foo() } else { a.foo(); }

    :

    (CHA)

    46

  • A a; //A

    A a, a A. . A a = new B(); //B new.

    vs

    47

  • : new A().foo(); //

    48

  • A a = b? new B() : new C(); a.foo(); foo() B , a.foo() ( )

    49

  • A a = b? bar() : baz(); a.foo(); bar() new B, baz() new , a.foo() - ( )

    50

  • , bar() baz()?

    51

  • ,

    52

  • Java Java heap ()

    Escape ( ) .

    53

  • void foo() { for (Object o: getCollection()) { doSomething(o);

    } }

    54

  • void foo() { Iterator iter = getCollection().iterator(); while (iter.hasNext()) { Object o = iter.next(); doSomething(o);

    }

    }

    55

  • void foo() { ArrayList list = getCollection(); Iterator iter = list.iterator(); while (iter.hasNext()) { Object o = iter.next(); doSomething(o);

    }

    }

    56

  • void foo() { ArrayList list = getCollection(); ArrayList.ListItr iter = new ListItr(list); while (iter.hasNext()) { Object o = iter.next(); doSomething(o);

    }

    }

    57

  • void foo() { ArrayList list = getCollection(); ArrayList.ListItr iter = onStack ListItr(); iter.this$0 = list; iter.cursor = 0; iter.size = list.elemData.length; while (iter.hasNext()) { Object o = iter.next(); doSomething(o);

    }

    }

    58

  • void foo() { ArrayList list = getCollection(); ArrayList.ListItr iter = onStack ListItr(list); iter.this$0 = list; iter.cursor = 0; iter.size = list.elemData.length; while (iter.cursor < iter.size) { int index = iter.cursor++; Object o = iter.this$0.elemData[index]; doSomething(o);

    }

    }

    59

  • void foo() { ArrayList list = getCollection(); int cursor = 0; int size = list.elemData.length; while (cursor < size) { Object o = list.elemData[cursor++]; doSomething(o); }

    }

    60

  • void foo() { ArrayList list = getCollection();

    int size = list.elemData.length; for (int i = 0; i < size; i++) { doSomething(list.elemData[i]); } }

    61

  • .

    62

  • .

    JIT?

    63

  • .

    JIT?

    64

  • .

    JIT?

    65

  • 66

  • , ?

    ,

    vs

    67

  • JFCMark (Short Run)

    0%

    50%

    100%

    150%

    200%

    250%

    2 core Celeron, 2.60Ghz 4 core i5, 3.8GZ

    Excelsior JET

    HotSpot client

    HotSpot server

    68

  • JFCMark (Long Run)

    0%

    20%

    40%

    60%

    80%

    100%

    120%

    140%

    160%

    2 core Celeron, 2.60Ghz 4 core i5, 3.8GZ

    Excelsior JET

    HotSpot client

    HotSpot server

    69

  • ?

    70

  • Server side

    ?

    71

  • , JVM

    Java , Narve + ( .. )

    72

  • Embedded

    ,

    , /

    73

  • Mobile

    JVM on Mobile:

    74

  • Mobile

    JVM on Mobile:

    75

  • Mobile

    JVM on Mobile: GC Memory Manager

    76

  • Mobile

    JVM on Mobile: GC Memory Manager Reflecron

    77

  • Mobile

    JVM on Mobile: GC Memory Manager Reflecron JIT

    78

  • Mobile

    JVM on Mobile: GC Memory Manager Reflecron JIT

    ?

    79

  • Mobile

    JVM on Mobile: GC Memory Manager Reflecron JIT

    !

    80

  • Mobile

    ?

    81

  • iOS

    iOS

    Java , AOT

    82

  • AOT Java

    GCJ Excelsior JET Android ART RoboVM Avian CodeNameOne IBM J9 Java ME

    83

  • 84

  • Java

    Java

    UX , ,

    85

  • , Excelsior

    nlipsky@excelsior-usa.com twitter: @pjBooms

    86

  • 87