SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
1
What’s New in HotSpot JVM 8
Vladimir Ivanov
HotSpot JVM Compiler team
Oracle Corp.
2
What is Java?
3
What is Java?
§  Java
–  The Language
–  The Platform
–  The Community
4
What is Java?
§  Java
–  The Language
–  The Platform
–  The Community
What I’ll talk about today
5
What’s New in HotSpot JVM 8
§  Java 8 features support
–  Project Lambda
–  Nashorn JavaScript engine
–  Type annotations
§  Oracle implementation-specific improvements
–  won’t be backported into 7
§  PermGen removal
–  will be/already backported into 7
§  numerous functional & performance enhancements
Categorization
6
7
Project Lambda
x -> x+1
(s,i) -> s.substring(0,i)
() -> System.out.print(“x”)
Predicate<String> pred = s -> s.length() < 100;
Lambda expressions in Java
8
Project Lambda
Function<Integer,Integer> f = x -> x+1
compiles to
invokedynamic [ j.l.i.LambdaMetafactory.metafactory,
MethodType(Function.apply),
MethodHandle(lambda$0) ] ()
Lambda expressions in Java
9
Project Lambda
§  Lambda expressions
§  Core Java API evolution
–  new API
§  Streams
–  existing API «lambdafication»
§  e.g. Collections API
–  default methods
10
Project Lambda
public interface Iterable<T> {
void forEach(Consumer<? super T> action);
}
API “lambdafication”
11
Project Lambda
interface I {
default void m() { /* do smth */ }
}
class T implements I {}
invokevirtual T.m()V => I.m
Default methods
interface I
void m() {…}
class T
12
Project Lambda
interface I {
default void m() { /* do smth */ }
}
class T implements I {
void m() { /* do smth */ }
}
invokevirtual T.m()V => T.m
Default methods
interface I
void m() {…}
class T
void m() {…}
13
Project Lambda
interface I {
default void m() { /* do smth */ }
}
class T1 implements I {
void m() { /* do smth */ }
}
class T extends T1 implements I {}
invokevirtual T.m()V => T1.m
Superclass overrides superinterface
interface I
void m() {…}
class T
class T1
void m() {…}
14
Project Lambda
interface I {
default void m() { /* do smth */ }
}
interface J extends I {
default void m() { /* do smth */ }
}
class T implements I,J {}
invokevirtual T.m()V => J.m
Prefer most specific interface
interface J
void m() {…}
class T
class I
void m() {…}
15
Project Lambda
interface I {
default void m() { /* do smth */ }
}
interface J {
default void m() { /* do smth */ }
}
class T implements I,J {}
invokevirtual T.m()V => error
Conflicting defaults
interface J
void m() {…}
class T
class I
void m() {…}
16
Project Lambda
interface I {
static void m() { /* do smth */ }
}
invokestatic I.m();
Static interface methods
17
Project Lambda
interface I {
private ... void m() { /* do smth */ }
}
Not allowed in Java.
Only on bytecode level.
Private interface methods
18
Project Lambda
class A { A get() {} }
class B extends A { B get() {} }
Javac adds the following:
synthetic bridge A get() { return ((B)this).get(); }
Bridge methods: Covariant overrides
19
Project Lambda
§  Attempted to:
–  use invokedynamic
–  generate bridges by VM
§  Finally:
–  continue to generate bridge methods by javac
Bridge methods: roads not taken
20
21
java.lang.OutOfMemoryError: PermGen space
22
What was “PermGen”?
§  “Permanent” Generation
§  Region of Java heap for JVM Class Metadata
§  Representation of Java classes
–  Class hierarchy information, fields, names
–  Method compilation information and bytecodes
–  Vtables
–  Constant pool and symbolic resolution
–  Interned strings (moved out of PermGen in 7)
23
Java Memory Layout with PermGen
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.6
Java Memory Layout with PermGen
Eden
Old Generation for older objects
Permanent Generation for VM metadata
Survivor Survivor
24
Where did JVM Metadata go?
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.9
Where did JVM Metadata go?
Eden
Old Generation for older objects
Permanent Generation for VM metadata
Survivor Survivor
Metaspace
VM
Metadata in
native
memory
25
PermGen size
§  Limited to MaxPermSize – default ~64M - 85M
§  Contiguous with Java Heap
§  Once exhausted throws OutOfMemoryError “PermGen space”
§  Hard to predict the correct size
26
Why was PermGen Eliminated?
§  Fixed size at startup – applications ran out
–  -XX:MaxPermSize=…
§  Improve GC performance
–  Special iterators for metadata
–  Deallocate class data concurrently and not during GC pause
§  Enable future improvements
–  were limited by PermGen (e.g. G1 concurrent class unloading)
27
Improving GC Performance
§  During full collection, metadata to metadata pointers are not scanned
–  A lot of complex code (particularly for CMS) for metadata scanning was
removed
§  Metaspace contains few pointers into the Java heap
–  Pointer to java/lang/Class instance in class metadata
–  A component java/lang/Class pointer in array class metadata
§  No compaction costs for metadata
28
Metaspace
§  Take advantage of Java Language Specification property
–  Class metadata lifetime same as their class loader’s
§  Per loader storage area – Metaspace (collectively called Metaspace)
–  Linear (bump) allocation only
–  No individual reclamation (except for RedefineClasses and class loading
failure)
–  Not scanned by GC and not compacted
–  Metaspace-allocated objects never relocate
–  Reclamation en-masse when class loader found dead by GC
29
Metaspace Allocation
§  Multiple mmap/VirtualAlloc virtual memory spaces
§  Allocate per-class loader chunk lists
–  Chunk sizes depend on type of class loader
–  Smaller chunks for sun/reflect/DelegatingClassLoader,
JSR292 anonymous classes
§  Return chunks to free chunk lists
§  Virtual memory spaces returned when emptied
§  Strategies to minimize fragmentation
30
Metaspace Allocation
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12
Metaspace Allocation
● Metachunks in virtual spaces (vs1, vs2, vs3...)
Boot CL
CL 3
CL 1
CL 2
vs1 vs3vs2
§  Metachunks in virtual spaces (vs1, vs2, vs3...)
31
Java Object Memory Layout
class Message {
String text;
void add(String s) { ...}
…
}
Java Heap Layout
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.13
Java Object Memory Layout
class Message {
// JVM adds _mark and
//_klass pointer
String text;
void add(String s) { …}
String get() { … }
}
Java Heap Layout
_mark
_klass
text
_mark
_klass
count
value
Metaspace
Klass
Klass
32
Java Object Memory Layout
class Message {
String text;
void add(String s) { ...}
…
}
with compressed class pointers
Java Heap Layout
33
How to tune Metaspace?
§  -XX:MaxMetaspaceSize={unlimited}
§  Limit the memory used by class metadata before excess swapping and
native allocation failure occurs
–  Use if suspected class loader memory leaks
–  Use if on 32-bit
34
How to tune Metaspace?
§  -XX:MetaspaceSize={21M}
§  Set to a higher limit if application loads more
§  Possibly use same value set by PermSize to delay initial GC
§  High water mark increases with subsequent collections for a
reasonable amount of head room before next Metaspace GC
35
How to tune Metaspace?
§  -XX:CompressedClassSpaceSize={1G}
§  Only valid if -XX:+UseCompressedClassPointers (default on 64 bit)
§  Not committed until used
36
Metaspace Monitoring and Management
§  MemoryManagerMXBean with name MetaspaceManager
§  MemoryPoolMXBeans
–  “Metaspace”
–  “Compressed Class Space”
§  $ jmap -clstats <pid>
§  $ jstat -gc <pid>
§  $ jcmd <pid> GC.class_stats
§  Java Mission Control (bundled with Oracle JDK 8)
37
PermGen removal
§  Hotspot metadata is now allocated in Metaspace
–  Chunks in mmap spaces based on liveness of class loader
§  Compressed class pointer space is still fixed size but large
§  Tuning flags available but not required
§  Change enables other optimizations and features in the future
–  Application class data sharing
–  Young collection optimizations, G1 class unloading
–  Metadata size reductions and internal JVM footprint projects
Summary
38
Nashorn
JavaScript engine for Java Platform
39
Nashorn
§  Nashorn is written completely in Java
§  Extensively uses JSR292
§  Required numerous performance improvements
–  LambdaForms (JEP 160)
–  incremental inlining
–  exact math intrinsics
§  Math.addExact, Math.substractExact, etc
–  improved type profiling & type speculation
JVM support for dynamic languages
40
JVM support for dynamic languages
public static long addExact(long x, long y) {
long r = x + y;
if (((x ^ r) & (y ^ r)) < 0) {
throw new ArithmeticException("long overflow");
}
return r;
}
Exact Math intrinsics
41
JVM support for dynamic languages
Math.addExact(l1, Integer.MAX_VALUE)
Compiled version:
0x0...5d: add $0x7fffffff,%r8
0x0...64: mov %r8,%r9
0x0...67: xor %r11,%r9
0x0...6a: mov %r8,%r11
0x0...6d: xor $0x7fffffff,%r11
0x0...74: and %r11,%r9
0x0...77: test %r9,%r9
0x0...7a: jl 0x0000000102c70e95 // slow path: throw exception
Exact Math intrinsics
42
JVM support for dynamic languages
Math.addExact(l1, Integer.MAX_VALUE)
Intrinsified version:
0x…1d: add $0x7fffffff,%rax
0x…24: jo 0x000000010c044b3f // slow path: overflow
Exact Math intrinsics
43
Smaller features
§  JSR 308: Annotations on Java Types
–  new class file attributes
§  JEP 171: Fence Intrinsics
–  sun.misc.Unsafe: loadFence, storeFence & fullFence
§  JEP 136: Enhanced Verification Errors
–  VerifyError with detailed error message
§  JEP 142: Reduce Cache Contention on Specified Fields
–  @Contended
44
JSR 308: Annotations on Java Types
Map<@Interned Key, @NonNull Value> = new HashMap<>();
45
JSR 308: Annotations on Java Types
§  New attributes:
–  RuntimeVisibleTypeAnnotations
–  RuntimeInvisibleTypeAnnotations
§  Stored on the smallest enclosing class, field, method, or Code
§  How to access:
–  javax.lang.model
–  javax.ide
–  com.sun.source.tree
Class File Attributes
46
JEP 171: Fence Intrinsics
§  How to express memory model:
–  happens-before relations
–  memory barriers/fences
§  Happens-before in Java Memory Model (JMM)
§  sun.misc.Unsafe.[load|store|full]Fence introduces memory barriers
§  Why:
–  some relations aren’t possible to express in JMM at the moment
§  consider StoreStore
47
JEP 142: Reduce Cache Contention on …
§  What is cache contention and false
sharing?
–  adjacent memory accesses can produce
unnecessary memory traffic on
SMP systems
48
JEP 142: Reduce Cache Contention on …
§  How to avoid it?
–  manually “pad” contended fields
public class A {
int x;
int i01, i02, …, i16;
int y;
int i17, i18, …, i32;
}
49
JEP 142: Reduce Cache Contention on …
§  How to avoid it?
–  mark them @Contended
public class A {
int x;
@Contended int y;
}
50
JEP 142: Reduce Cache Contention on …
§  sun.misc.Contended
§  How to use: -XX:-RestrictContended
–  by default, has effect only in privileged context (on boot class path)
51
JEP 136: Enhanced Verification Errors
Before
Exception in thread "main" java.lang.VerifyError:
Bad instruction in method Test.main([Ljava/lang/String;)V at offset 0
52
JEP 136: Enhanced Verification Errors
Now
Exception in thread "main" java.lang.VerifyError: Bad instruction
Exception Details:
Location:
Test.main([Ljava/lang/String;)V @0: <illegal>
Reason:
Error exists in the bytecode
Bytecode:
0000000: ff00 0200 004c 2b04 b800 03b9 0004 0200
0000010: 57b1
53
Future work
The following is intended to outline our general product direction. It
is intended for information purposes only, and may not be
incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in
making purchasing decisions. The development, release, and timing
of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
54
Future work
§  Value Objects in Java
–   http://openjdk.java.net/jeps/169
§  Project Sumatra: Java on GPU
–  http://openjdk.java.net/projects/sumatra/
§  Project Panama: Native Interconnect for Java (JNI 2.0)
–  http://mail.openjdk.java.net/pipermail/discuss/2014-March/003306.html
Where does innovation take place?
55
Graphic Section Divider

Weitere ähnliche Inhalte

Was ist angesagt?

Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGSylvain Wallez
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classesyoavwix
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My HeartBui Kiet
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeOmar Bashir
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Metamodeling of custom Pharo images
 Metamodeling of custom Pharo images Metamodeling of custom Pharo images
Metamodeling of custom Pharo imagesESUG
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaSanjeev Tripathi
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaDerek Chen-Becker
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)arvind pandey
 

Was ist angesagt? (20)

Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 
Java
JavaJava
Java
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdf
 
Core java
Core javaCore java
Core java
 
Core java
Core javaCore java
Core java
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My Heart
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Metamodeling of custom Pharo images
 Metamodeling of custom Pharo images Metamodeling of custom Pharo images
Metamodeling of custom Pharo images
 
Byte code field report
Byte code field reportByte code field report
Byte code field report
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
 
Kotlin
KotlinKotlin
Kotlin
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
2 P Seminar
2 P Seminar2 P Seminar
2 P Seminar
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 

Ähnlich wie Владимир Иванов. Java 8 и JVM: что нового в HotSpot

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
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunningguest1f2740
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance TunningTerry Cho
 
Hotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freindsHotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freinds亚军 汪
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHoward Lewis Ship
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play frameworkFelipe
 
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
 
Fun with bytecode weaving
Fun with bytecode weavingFun with bytecode weaving
Fun with bytecode weavingMatthew
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationAjax Experience 2009
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeFederico Tomassetti
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVMIgor Khotin
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Martin Odersky
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedChao Chen
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 

Ähnlich wie Владимир Иванов. Java 8 и JVM: что нового в HotSpot (20)

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
 
Jvm internals
Jvm internalsJvm internals
Jvm internals
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 
Hotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freindsHotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freinds
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
 
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
 
Fun with bytecode weaving
Fun with bytecode weavingFun with bytecode weaving
Fun with bytecode weaving
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java code
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Java Generics
Java GenericsJava Generics
Java Generics
 
The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVM
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
1- java
1- java1- java
1- java
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reduced
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Java 7 & 8 - A&BP CC
Java 7 & 8 - A&BP CCJava 7 & 8 - A&BP CC
Java 7 & 8 - A&BP CC
 

Mehr von Volha Banadyseva

Андрей Светлов. Aiohttp
Андрей Светлов. AiohttpАндрей Светлов. Aiohttp
Андрей Светлов. AiohttpVolha Banadyseva
 
Сергей Зефиров
Сергей ЗефировСергей Зефиров
Сергей ЗефировVolha Banadyseva
 
Валерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРВалерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРVolha Banadyseva
 
Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Volha Banadyseva
 
Татьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУТатьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУVolha Banadyseva
 
Trillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsTrillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsVolha Banadyseva
 
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеАлександр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеVolha Banadyseva
 
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeМастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeVolha Banadyseva
 
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreБахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreVolha Banadyseva
 
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Volha Banadyseva
 
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayЕвгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayVolha Banadyseva
 
Евгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияЕвгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияVolha Banadyseva
 
Егор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийЕгор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийVolha Banadyseva
 
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформСтанислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформVolha Banadyseva
 
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Volha Banadyseva
 
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Volha Banadyseva
 
Юлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеЮлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеVolha Banadyseva
 
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеАлександр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеVolha Banadyseva
 

Mehr von Volha Banadyseva (20)

Андрей Светлов. Aiohttp
Андрей Светлов. AiohttpАндрей Светлов. Aiohttp
Андрей Светлов. Aiohttp
 
Сергей Зефиров
Сергей ЗефировСергей Зефиров
Сергей Зефиров
 
Eugene Burmako
Eugene BurmakoEugene Burmako
Eugene Burmako
 
Heather Miller
Heather MillerHeather Miller
Heather Miller
 
Валерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИРВалерий Прытков, декан факультета КСиС, БГУИР
Валерий Прытков, декан факультета КСиС, БГУИР
 
Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»Елена Локтева, «Инфопарк»
Елена Локтева, «Инфопарк»
 
Татьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУТатьяна Милова, директор института непрерывного образования БГУ
Татьяна Милова, директор института непрерывного образования БГУ
 
Trillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital TrendsTrillhaas Goetz. Innovations in Google and Global Digital Trends
Trillhaas Goetz. Innovations in Google and Global Digital Trends
 
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернетеАлександр Чекан. 28 правДИвых слайдов о белорусах в интернете
Александр Чекан. 28 правДИвых слайдов о белорусах в интернете
 
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в storeМастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
Мастер-класс Ильи Красинского и Елены Столбовой. Жизнь до и после выхода в store
 
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App StoreБахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
Бахрам Исмаилов. Продвижение мобильного приложение - оптимизация в App Store
 
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
Евгений Пальчевский. Что можно узнать из отзывов пользователей в мобильных ма...
 
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google PlayЕвгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
Евгений Невгень. Оптимизация мета-данных приложения для App Store и Google Play
 
Евгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипированияЕвгений Козяк. Tips & Tricks мобильного прототипирования
Евгений Козяк. Tips & Tricks мобильного прототипирования
 
Егор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложенийЕгор Белый. Модели успешной монетизации мобильных приложений
Егор Белый. Модели успешной монетизации мобильных приложений
 
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформСтанислав Пацкевич. Инструменты аналитики для мобильных платформ
Станислав Пацкевич. Инструменты аналитики для мобильных платформ
 
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
Артём Азевич. Эффективные подходы к разработке приложений. Как найти своего п...
 
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
Дина Сударева. Развитие игровой команды и ее самоорганизация. Роль менеджера ...
 
Юлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитиеЮлия Ерина. Augmented Reality Games: становление и развитие
Юлия Ерина. Augmented Reality Games: становление и развитие
 
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позжеАлександр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
Александр Дзюба. Знать игрока: плейтест на стадии прототипа и позже
 

Kürzlich hochgeladen

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 

Kürzlich hochgeladen (20)

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 

Владимир Иванов. Java 8 и JVM: что нового в HotSpot

  • 1. 1 What’s New in HotSpot JVM 8 Vladimir Ivanov HotSpot JVM Compiler team Oracle Corp.
  • 3. 3 What is Java? §  Java –  The Language –  The Platform –  The Community
  • 4. 4 What is Java? §  Java –  The Language –  The Platform –  The Community What I’ll talk about today
  • 5. 5 What’s New in HotSpot JVM 8 §  Java 8 features support –  Project Lambda –  Nashorn JavaScript engine –  Type annotations §  Oracle implementation-specific improvements –  won’t be backported into 7 §  PermGen removal –  will be/already backported into 7 §  numerous functional & performance enhancements Categorization
  • 6. 6
  • 7. 7 Project Lambda x -> x+1 (s,i) -> s.substring(0,i) () -> System.out.print(“x”) Predicate<String> pred = s -> s.length() < 100; Lambda expressions in Java
  • 8. 8 Project Lambda Function<Integer,Integer> f = x -> x+1 compiles to invokedynamic [ j.l.i.LambdaMetafactory.metafactory, MethodType(Function.apply), MethodHandle(lambda$0) ] () Lambda expressions in Java
  • 9. 9 Project Lambda §  Lambda expressions §  Core Java API evolution –  new API §  Streams –  existing API «lambdafication» §  e.g. Collections API –  default methods
  • 10. 10 Project Lambda public interface Iterable<T> { void forEach(Consumer<? super T> action); } API “lambdafication”
  • 11. 11 Project Lambda interface I { default void m() { /* do smth */ } } class T implements I {} invokevirtual T.m()V => I.m Default methods interface I void m() {…} class T
  • 12. 12 Project Lambda interface I { default void m() { /* do smth */ } } class T implements I { void m() { /* do smth */ } } invokevirtual T.m()V => T.m Default methods interface I void m() {…} class T void m() {…}
  • 13. 13 Project Lambda interface I { default void m() { /* do smth */ } } class T1 implements I { void m() { /* do smth */ } } class T extends T1 implements I {} invokevirtual T.m()V => T1.m Superclass overrides superinterface interface I void m() {…} class T class T1 void m() {…}
  • 14. 14 Project Lambda interface I { default void m() { /* do smth */ } } interface J extends I { default void m() { /* do smth */ } } class T implements I,J {} invokevirtual T.m()V => J.m Prefer most specific interface interface J void m() {…} class T class I void m() {…}
  • 15. 15 Project Lambda interface I { default void m() { /* do smth */ } } interface J { default void m() { /* do smth */ } } class T implements I,J {} invokevirtual T.m()V => error Conflicting defaults interface J void m() {…} class T class I void m() {…}
  • 16. 16 Project Lambda interface I { static void m() { /* do smth */ } } invokestatic I.m(); Static interface methods
  • 17. 17 Project Lambda interface I { private ... void m() { /* do smth */ } } Not allowed in Java. Only on bytecode level. Private interface methods
  • 18. 18 Project Lambda class A { A get() {} } class B extends A { B get() {} } Javac adds the following: synthetic bridge A get() { return ((B)this).get(); } Bridge methods: Covariant overrides
  • 19. 19 Project Lambda §  Attempted to: –  use invokedynamic –  generate bridges by VM §  Finally: –  continue to generate bridge methods by javac Bridge methods: roads not taken
  • 20. 20
  • 22. 22 What was “PermGen”? §  “Permanent” Generation §  Region of Java heap for JVM Class Metadata §  Representation of Java classes –  Class hierarchy information, fields, names –  Method compilation information and bytecodes –  Vtables –  Constant pool and symbolic resolution –  Interned strings (moved out of PermGen in 7)
  • 23. 23 Java Memory Layout with PermGen Copyright © 2013, Oracle and/or its affiliates. All rights reserved.6 Java Memory Layout with PermGen Eden Old Generation for older objects Permanent Generation for VM metadata Survivor Survivor
  • 24. 24 Where did JVM Metadata go? Copyright © 2013, Oracle and/or its affiliates. All rights reserved.9 Where did JVM Metadata go? Eden Old Generation for older objects Permanent Generation for VM metadata Survivor Survivor Metaspace VM Metadata in native memory
  • 25. 25 PermGen size §  Limited to MaxPermSize – default ~64M - 85M §  Contiguous with Java Heap §  Once exhausted throws OutOfMemoryError “PermGen space” §  Hard to predict the correct size
  • 26. 26 Why was PermGen Eliminated? §  Fixed size at startup – applications ran out –  -XX:MaxPermSize=… §  Improve GC performance –  Special iterators for metadata –  Deallocate class data concurrently and not during GC pause §  Enable future improvements –  were limited by PermGen (e.g. G1 concurrent class unloading)
  • 27. 27 Improving GC Performance §  During full collection, metadata to metadata pointers are not scanned –  A lot of complex code (particularly for CMS) for metadata scanning was removed §  Metaspace contains few pointers into the Java heap –  Pointer to java/lang/Class instance in class metadata –  A component java/lang/Class pointer in array class metadata §  No compaction costs for metadata
  • 28. 28 Metaspace §  Take advantage of Java Language Specification property –  Class metadata lifetime same as their class loader’s §  Per loader storage area – Metaspace (collectively called Metaspace) –  Linear (bump) allocation only –  No individual reclamation (except for RedefineClasses and class loading failure) –  Not scanned by GC and not compacted –  Metaspace-allocated objects never relocate –  Reclamation en-masse when class loader found dead by GC
  • 29. 29 Metaspace Allocation §  Multiple mmap/VirtualAlloc virtual memory spaces §  Allocate per-class loader chunk lists –  Chunk sizes depend on type of class loader –  Smaller chunks for sun/reflect/DelegatingClassLoader, JSR292 anonymous classes §  Return chunks to free chunk lists §  Virtual memory spaces returned when emptied §  Strategies to minimize fragmentation
  • 30. 30 Metaspace Allocation Copyright © 2013, Oracle and/or its affiliates. All rights reserved.12 Metaspace Allocation ● Metachunks in virtual spaces (vs1, vs2, vs3...) Boot CL CL 3 CL 1 CL 2 vs1 vs3vs2 §  Metachunks in virtual spaces (vs1, vs2, vs3...)
  • 31. 31 Java Object Memory Layout class Message { String text; void add(String s) { ...} … } Java Heap Layout Copyright © 2013, Oracle and/or its affiliates. All rights reserved.13 Java Object Memory Layout class Message { // JVM adds _mark and //_klass pointer String text; void add(String s) { …} String get() { … } } Java Heap Layout _mark _klass text _mark _klass count value Metaspace Klass Klass
  • 32. 32 Java Object Memory Layout class Message { String text; void add(String s) { ...} … } with compressed class pointers Java Heap Layout
  • 33. 33 How to tune Metaspace? §  -XX:MaxMetaspaceSize={unlimited} §  Limit the memory used by class metadata before excess swapping and native allocation failure occurs –  Use if suspected class loader memory leaks –  Use if on 32-bit
  • 34. 34 How to tune Metaspace? §  -XX:MetaspaceSize={21M} §  Set to a higher limit if application loads more §  Possibly use same value set by PermSize to delay initial GC §  High water mark increases with subsequent collections for a reasonable amount of head room before next Metaspace GC
  • 35. 35 How to tune Metaspace? §  -XX:CompressedClassSpaceSize={1G} §  Only valid if -XX:+UseCompressedClassPointers (default on 64 bit) §  Not committed until used
  • 36. 36 Metaspace Monitoring and Management §  MemoryManagerMXBean with name MetaspaceManager §  MemoryPoolMXBeans –  “Metaspace” –  “Compressed Class Space” §  $ jmap -clstats <pid> §  $ jstat -gc <pid> §  $ jcmd <pid> GC.class_stats §  Java Mission Control (bundled with Oracle JDK 8)
  • 37. 37 PermGen removal §  Hotspot metadata is now allocated in Metaspace –  Chunks in mmap spaces based on liveness of class loader §  Compressed class pointer space is still fixed size but large §  Tuning flags available but not required §  Change enables other optimizations and features in the future –  Application class data sharing –  Young collection optimizations, G1 class unloading –  Metadata size reductions and internal JVM footprint projects Summary
  • 39. 39 Nashorn §  Nashorn is written completely in Java §  Extensively uses JSR292 §  Required numerous performance improvements –  LambdaForms (JEP 160) –  incremental inlining –  exact math intrinsics §  Math.addExact, Math.substractExact, etc –  improved type profiling & type speculation JVM support for dynamic languages
  • 40. 40 JVM support for dynamic languages public static long addExact(long x, long y) { long r = x + y; if (((x ^ r) & (y ^ r)) < 0) { throw new ArithmeticException("long overflow"); } return r; } Exact Math intrinsics
  • 41. 41 JVM support for dynamic languages Math.addExact(l1, Integer.MAX_VALUE) Compiled version: 0x0...5d: add $0x7fffffff,%r8 0x0...64: mov %r8,%r9 0x0...67: xor %r11,%r9 0x0...6a: mov %r8,%r11 0x0...6d: xor $0x7fffffff,%r11 0x0...74: and %r11,%r9 0x0...77: test %r9,%r9 0x0...7a: jl 0x0000000102c70e95 // slow path: throw exception Exact Math intrinsics
  • 42. 42 JVM support for dynamic languages Math.addExact(l1, Integer.MAX_VALUE) Intrinsified version: 0x…1d: add $0x7fffffff,%rax 0x…24: jo 0x000000010c044b3f // slow path: overflow Exact Math intrinsics
  • 43. 43 Smaller features §  JSR 308: Annotations on Java Types –  new class file attributes §  JEP 171: Fence Intrinsics –  sun.misc.Unsafe: loadFence, storeFence & fullFence §  JEP 136: Enhanced Verification Errors –  VerifyError with detailed error message §  JEP 142: Reduce Cache Contention on Specified Fields –  @Contended
  • 44. 44 JSR 308: Annotations on Java Types Map<@Interned Key, @NonNull Value> = new HashMap<>();
  • 45. 45 JSR 308: Annotations on Java Types §  New attributes: –  RuntimeVisibleTypeAnnotations –  RuntimeInvisibleTypeAnnotations §  Stored on the smallest enclosing class, field, method, or Code §  How to access: –  javax.lang.model –  javax.ide –  com.sun.source.tree Class File Attributes
  • 46. 46 JEP 171: Fence Intrinsics §  How to express memory model: –  happens-before relations –  memory barriers/fences §  Happens-before in Java Memory Model (JMM) §  sun.misc.Unsafe.[load|store|full]Fence introduces memory barriers §  Why: –  some relations aren’t possible to express in JMM at the moment §  consider StoreStore
  • 47. 47 JEP 142: Reduce Cache Contention on … §  What is cache contention and false sharing? –  adjacent memory accesses can produce unnecessary memory traffic on SMP systems
  • 48. 48 JEP 142: Reduce Cache Contention on … §  How to avoid it? –  manually “pad” contended fields public class A { int x; int i01, i02, …, i16; int y; int i17, i18, …, i32; }
  • 49. 49 JEP 142: Reduce Cache Contention on … §  How to avoid it? –  mark them @Contended public class A { int x; @Contended int y; }
  • 50. 50 JEP 142: Reduce Cache Contention on … §  sun.misc.Contended §  How to use: -XX:-RestrictContended –  by default, has effect only in privileged context (on boot class path)
  • 51. 51 JEP 136: Enhanced Verification Errors Before Exception in thread "main" java.lang.VerifyError: Bad instruction in method Test.main([Ljava/lang/String;)V at offset 0
  • 52. 52 JEP 136: Enhanced Verification Errors Now Exception in thread "main" java.lang.VerifyError: Bad instruction Exception Details: Location: Test.main([Ljava/lang/String;)V @0: <illegal> Reason: Error exists in the bytecode Bytecode: 0000000: ff00 0200 004c 2b04 b800 03b9 0004 0200 0000010: 57b1
  • 53. 53 Future work The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 54. 54 Future work §  Value Objects in Java –   http://openjdk.java.net/jeps/169 §  Project Sumatra: Java on GPU –  http://openjdk.java.net/projects/sumatra/ §  Project Panama: Native Interconnect for Java (JNI 2.0) –  http://mail.openjdk.java.net/pipermail/discuss/2014-March/003306.html Where does innovation take place?