SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
JVM Internals 
FTD Group
acknowledgment 
● God 
● iMasters 
● FTD Group
who we are? 
FTD Group 
http://friendstechday.wordpress.com/about/
JVM? WORA? What?
Java Virtual Machine 
● The Java Virtual Machine Specification 
● Written in C/C++ 
● Stack based VM 
● Different implementations 
● Symbolic reference 
● Garbage Collected 
● Java Bytecode 
● JIT (Just-In-Time)
Stack based VM
1 + 2 = ?
(+ 1 2) 
Lisp? RPN?
operand stack 
PUSH 1 1 
1 
PUSH 2 2 
ADD 3
operand stack - bytecode 
iconst_1 1 
1 
iconst_2 2 
iadd 3
Java bytecode is the instruction set 
of the Java virtual machine 
opcode = 1 or 2 bytes 
256 possible opcodes 
198 are currently in use 
51 are reserved for future use 
3 are set aside as permanently unimplemented 
list of all opcodes: http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html
variable declaration 
int i; 
0: iconst_0 // push 0 to top of the operand stack 
1: istore_1 // Pop value from top of operand stack and 
store as local variable 1
object instantiation 
Object ftd = new Object(); 
0: new #2 // Class java/lang/Object 
1: dup // duplicate the value on top of the stack 
2: invokespecial #3 // Method java/lang/Object “<init>()V”
#1, #4, #100? #Wat?
Runtime Constant Pool 
The constant pool contains the following 
types: 
● Integer, Long, Float, Double 
● String, Uft8 
● Class 
● NameAndType 
● Fieldref, Methodref, InterfaceMethodref
Java Bytecode Type Description 
B byte signed byte 
C char Unicode character 
D double double-precision floating-point value 
F float single-precision floating-point value 
I int integer 
J long long integer 
L<classname> reference an instance of class <classname> 
S short signed short 
Z boolean true or false 
[ reference one array dimension
Java Code Java Bytecode Expression 
double d[][][]; [[[D 
Object mymethod(int I, double d, Thread t) (IDLjava/lang/Thread;)Ljava/lang/Object;
javap -v SimpleClass
Not only Java Stack lives, 
but also Heap.
Java Heap memory
Code Cache 
used for compilation and storage of methods that 
have been compiled to native code by the JIT 
compiler
if >= java1.8 
no PermGen 
yes Metaspace
everything is wonderful 
in Java?.... it depends bro!
which the size of a Java 
String with "Java" 
content? 
String java = “Java”;
answer: 64 bytes 
Ahh… how.. WATTT???
Java memory consumption 
8 bytes Object Header 
8 bytes Object reference 
(x86 may use XX:+UseCompressedOops) 
8 bytes alignment (WAT?)
data alignment 
5 bytes used 3 bytes paddind 
8 bytes alignment
String explanation 
Field Type Size (bytes) 
HEADER 16 
value “Java” char[] (16 + 8) + (4 * 2) = 32 
offset int 4 
count int 4 
hash int 4 
PADDING = 60 + 4 
TOTAL 64 bytes
which the size of a java. 
lang.Boolean? 
Boolean b = false;
answer: 24 bytes 
Ahh… how.. WATTT???
Ok .. But what about 
classes? OOP?
Class File Format 
ClassFile { 
u4 magic; 
u2 minor_version; 
u2 major_version; 
u2 constant_pool_count; 
cp_info contant_pool[constant_pool_count – 1]; 
u2 access_flags; 
u2 this_class; 
u2 super_class; 
u2 interfaces_count; 
u2 interfaces[interfaces_count]; 
u2 fields_count; 
field_info fields[fields_count]; 
u2 methods_count; 
method_info methods[methods_count]; 
u2 attributes_count; 
attribute_info attributes[attributes_count]; 
}
javap -v SimpleClass
And what about the 
Classloader?
JVM initialization order 
1. Create a initial class using Bootstrap 
classloader; 
2. links the initial class; 
3. initializes it; 
4. and invokes the public class method void 
main(String[])
find, check headers class file, super loading, binary created 
3 steps, verifying and preparing the type and its direct supers 
structurally correct, and obeys the semantic requirements 
allocation of memory foe data structures 
(optional) checking corrected symbolic references 
executing initialization method <clinit>
Java debug without ide? 
Is it possible?
jdb 
(included in the JDK 1.2 
package)
THANK YOU! 
FTD Group 
JOIN US! 
“And be not conformed to this world: but be ye transformed by 
the renewing of your mind, that ye may prove what {is} that good, 
and acceptable, and perfect, will of God.” (Romans 12:2)

Contenu connexe

Tendances

Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!ryutenchi
 
Programming with Python - Adv.
Programming with Python - Adv.Programming with Python - Adv.
Programming with Python - Adv.Mosky Liu
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewMarkus Schneider
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about goDvir Volk
 
Fantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and JavascriptFantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and JavascriptKamil Toman
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from PythonYung-Yu Chen
 
Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Yung-Yu Chen
 
Mono + .NET Core = ❤️
Mono + .NET Core =  ❤️Mono + .NET Core =  ❤️
Mono + .NET Core = ❤️Egor Bogatov
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on PythonSumit Raj
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go languageTzar Umang
 
Specialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingSpecialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingPositive Hack Days
 
OpenGurukul : Language : Python
OpenGurukul : Language : PythonOpenGurukul : Language : Python
OpenGurukul : Language : PythonOpen Gurukul
 
Fscons scalable appplication transfers
Fscons scalable appplication transfersFscons scalable appplication transfers
Fscons scalable appplication transfersDaniel Stenberg
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16Max Kleiner
 
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017Codemotion
 

Tendances (19)

Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
Golang
GolangGolang
Golang
 
D programming language
D programming languageD programming language
D programming language
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
 
Programming with Python - Adv.
Programming with Python - Adv.Programming with Python - Adv.
Programming with Python - Adv.
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
 
Fantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and JavascriptFantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and Javascript
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from Python
 
Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020
 
Mono + .NET Core = ❤️
Mono + .NET Core =  ❤️Mono + .NET Core =  ❤️
Mono + .NET Core = ❤️
 
Hands on Session on Python
Hands on Session on PythonHands on Session on Python
Hands on Session on Python
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Writing Parsers and Compilers with PLY
Writing Parsers and Compilers with PLYWriting Parsers and Compilers with PLY
Writing Parsers and Compilers with PLY
 
Specialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingSpecialized Compiler for Hash Cracking
Specialized Compiler for Hash Cracking
 
OpenGurukul : Language : Python
OpenGurukul : Language : PythonOpenGurukul : Language : Python
OpenGurukul : Language : Python
 
Fscons scalable appplication transfers
Fscons scalable appplication transfersFscons scalable appplication transfers
Fscons scalable appplication transfers
 
A closure ekon16
A closure ekon16A closure ekon16
A closure ekon16
 
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
 

Similaire à FTD JVM Internals

Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Anton Arhipov
 
Shiksharth com java_topics
Shiksharth com java_topicsShiksharth com java_topics
Shiksharth com java_topicsRajesh Verma
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaSanjeev Tripathi
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiasanjeeviniindia1186
 
Java OOP Concepts 1st Slide
Java OOP Concepts 1st SlideJava OOP Concepts 1st Slide
Java OOP Concepts 1st Slidesunny khan
 
How Scala code is expressed in the JVM
How Scala code is expressed in the JVMHow Scala code is expressed in the JVM
How Scala code is expressed in the JVMKoichi Sakata
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?Roman Elizarov
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...chen yuki
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesAlexandra Masterson
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionGanesh Samarthyam
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Sylvain Wallez
 
Lifting The Veil - Reading Java Bytecode
Lifting The Veil - Reading Java BytecodeLifting The Veil - Reading Java Bytecode
Lifting The Veil - Reading Java BytecodeAlexander Shopov
 
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
 

Similaire à FTD JVM Internals (20)

Jvm internals
Jvm internalsJvm internals
Jvm internals
 
JAVA BYTE CODE
JAVA BYTE CODEJAVA BYTE CODE
JAVA BYTE CODE
 
In Vogue Dynamic
In Vogue DynamicIn Vogue Dynamic
In Vogue Dynamic
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
 
Java Basic PART I
Java Basic PART IJava Basic PART I
Java Basic PART I
 
Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012Mastering Java Bytecode - JAX.de 2012
Mastering Java Bytecode - JAX.de 2012
 
Shiksharth com java_topics
Shiksharth com java_topicsShiksharth com java_topics
Shiksharth com java_topics
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
Java OOP Concepts 1st Slide
Java OOP Concepts 1st SlideJava OOP Concepts 1st Slide
Java OOP Concepts 1st Slide
 
How Scala code is expressed in the JVM
How Scala code is expressed in the JVMHow Scala code is expressed in the JVM
How Scala code is expressed in the JVM
 
Jvm2
Jvm2Jvm2
Jvm2
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?
 
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
2013 syscan360 yuki_chen_syscan360_exploit your java native vulnerabilities o...
 
GOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter SlidesGOTO Night with Charles Nutter Slides
GOTO Night with Charles Nutter Slides
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
Lifting The Veil - Reading Java Bytecode
Lifting The Veil - Reading Java BytecodeLifting The Veil - Reading Java Bytecode
Lifting The Veil - Reading Java Bytecode
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
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
 

Plus de Felipe Mamud

Erlang sem enrolação
Erlang sem enrolaçãoErlang sem enrolação
Erlang sem enrolaçãoFelipe Mamud
 
Desenvolvendo software no mundo atual
Desenvolvendo software no mundo atualDesenvolvendo software no mundo atual
Desenvolvendo software no mundo atualFelipe Mamud
 
Reactive programming no mundo Java
Reactive programming no mundo JavaReactive programming no mundo Java
Reactive programming no mundo JavaFelipe Mamud
 
Reactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaReactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaFelipe Mamud
 
Minha aplicação Java vai pra nuvem. E agora?
Minha aplicação Java vai pra nuvem. E agora?Minha aplicação Java vai pra nuvem. E agora?
Minha aplicação Java vai pra nuvem. E agora?Felipe Mamud
 
EBD - Perguntas que não querem calar
EBD - Perguntas que não querem calarEBD - Perguntas que não querem calar
EBD - Perguntas que não querem calarFelipe Mamud
 
EBD - A importância da Escola Bíblica Dominical
EBD - A importância da Escola Bíblica DominicalEBD - A importância da Escola Bíblica Dominical
EBD - A importância da Escola Bíblica DominicalFelipe Mamud
 
EBD - Força de jovem
EBD - Força de jovemEBD - Força de jovem
EBD - Força de jovemFelipe Mamud
 
EBD - O que você quer ser
EBD - O que você quer serEBD - O que você quer ser
EBD - O que você quer serFelipe Mamud
 
EBD - Deixando de ser bebê
EBD - Deixando de ser bebêEBD - Deixando de ser bebê
EBD - Deixando de ser bebêFelipe Mamud
 
EBD - O que você faria se fosse invisível
EBD - O que você faria se fosse invisívelEBD - O que você faria se fosse invisível
EBD - O que você faria se fosse invisívelFelipe Mamud
 
EBD - Coisas que não fazem sentido
EBD - Coisas que não fazem sentidoEBD - Coisas que não fazem sentido
EBD - Coisas que não fazem sentidoFelipe Mamud
 
EBD - Faça mais do que saber o que e um bocejo
EBD - Faça mais do que saber o que e um bocejoEBD - Faça mais do que saber o que e um bocejo
EBD - Faça mais do que saber o que e um bocejoFelipe Mamud
 
EBD - Varias formas de dizer a mesma coisa
EBD - Varias formas de dizer a mesma coisaEBD - Varias formas de dizer a mesma coisa
EBD - Varias formas de dizer a mesma coisaFelipe Mamud
 
EBD - 10 coisas que temos de dar a Deus
EBD - 10 coisas que temos de dar a DeusEBD - 10 coisas que temos de dar a Deus
EBD - 10 coisas que temos de dar a DeusFelipe Mamud
 

Plus de Felipe Mamud (20)

Erlang sem enrolação
Erlang sem enrolaçãoErlang sem enrolação
Erlang sem enrolação
 
Desenvolvendo software no mundo atual
Desenvolvendo software no mundo atualDesenvolvendo software no mundo atual
Desenvolvendo software no mundo atual
 
Reactive programming no mundo Java
Reactive programming no mundo JavaReactive programming no mundo Java
Reactive programming no mundo Java
 
Reactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncroniaReactive programming: Brincando com eficiência, composição e assíncronia
Reactive programming: Brincando com eficiência, composição e assíncronia
 
Minha aplicação Java vai pra nuvem. E agora?
Minha aplicação Java vai pra nuvem. E agora?Minha aplicação Java vai pra nuvem. E agora?
Minha aplicação Java vai pra nuvem. E agora?
 
FTD Groovy
FTD GroovyFTD Groovy
FTD Groovy
 
Golang
GolangGolang
Golang
 
Java8
Java8Java8
Java8
 
EBD - Perguntas que não querem calar
EBD - Perguntas que não querem calarEBD - Perguntas que não querem calar
EBD - Perguntas que não querem calar
 
EBD - UFC
EBD - UFCEBD - UFC
EBD - UFC
 
EBD - Escolhas
EBD - EscolhasEBD - Escolhas
EBD - Escolhas
 
EBD - A importância da Escola Bíblica Dominical
EBD - A importância da Escola Bíblica DominicalEBD - A importância da Escola Bíblica Dominical
EBD - A importância da Escola Bíblica Dominical
 
EBD - Força de jovem
EBD - Força de jovemEBD - Força de jovem
EBD - Força de jovem
 
EBD - O que você quer ser
EBD - O que você quer serEBD - O que você quer ser
EBD - O que você quer ser
 
EBD - Deixando de ser bebê
EBD - Deixando de ser bebêEBD - Deixando de ser bebê
EBD - Deixando de ser bebê
 
EBD - O que você faria se fosse invisível
EBD - O que você faria se fosse invisívelEBD - O que você faria se fosse invisível
EBD - O que você faria se fosse invisível
 
EBD - Coisas que não fazem sentido
EBD - Coisas que não fazem sentidoEBD - Coisas que não fazem sentido
EBD - Coisas que não fazem sentido
 
EBD - Faça mais do que saber o que e um bocejo
EBD - Faça mais do que saber o que e um bocejoEBD - Faça mais do que saber o que e um bocejo
EBD - Faça mais do que saber o que e um bocejo
 
EBD - Varias formas de dizer a mesma coisa
EBD - Varias formas de dizer a mesma coisaEBD - Varias formas de dizer a mesma coisa
EBD - Varias formas de dizer a mesma coisa
 
EBD - 10 coisas que temos de dar a Deus
EBD - 10 coisas que temos de dar a DeusEBD - 10 coisas que temos de dar a Deus
EBD - 10 coisas que temos de dar a Deus
 

Dernier

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Dernier (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

FTD JVM Internals

  • 2. acknowledgment ● God ● iMasters ● FTD Group
  • 3. who we are? FTD Group http://friendstechday.wordpress.com/about/
  • 5. Java Virtual Machine ● The Java Virtual Machine Specification ● Written in C/C++ ● Stack based VM ● Different implementations ● Symbolic reference ● Garbage Collected ● Java Bytecode ● JIT (Just-In-Time)
  • 6.
  • 8. 1 + 2 = ?
  • 9. (+ 1 2) Lisp? RPN?
  • 10. operand stack PUSH 1 1 1 PUSH 2 2 ADD 3
  • 11. operand stack - bytecode iconst_1 1 1 iconst_2 2 iadd 3
  • 12. Java bytecode is the instruction set of the Java virtual machine opcode = 1 or 2 bytes 256 possible opcodes 198 are currently in use 51 are reserved for future use 3 are set aside as permanently unimplemented list of all opcodes: http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html
  • 13. variable declaration int i; 0: iconst_0 // push 0 to top of the operand stack 1: istore_1 // Pop value from top of operand stack and store as local variable 1
  • 14. object instantiation Object ftd = new Object(); 0: new #2 // Class java/lang/Object 1: dup // duplicate the value on top of the stack 2: invokespecial #3 // Method java/lang/Object “<init>()V”
  • 15. #1, #4, #100? #Wat?
  • 16. Runtime Constant Pool The constant pool contains the following types: ● Integer, Long, Float, Double ● String, Uft8 ● Class ● NameAndType ● Fieldref, Methodref, InterfaceMethodref
  • 17. Java Bytecode Type Description B byte signed byte C char Unicode character D double double-precision floating-point value F float single-precision floating-point value I int integer J long long integer L<classname> reference an instance of class <classname> S short signed short Z boolean true or false [ reference one array dimension
  • 18. Java Code Java Bytecode Expression double d[][][]; [[[D Object mymethod(int I, double d, Thread t) (IDLjava/lang/Thread;)Ljava/lang/Object;
  • 20. Not only Java Stack lives, but also Heap.
  • 22. Code Cache used for compilation and storage of methods that have been compiled to native code by the JIT compiler
  • 23. if >= java1.8 no PermGen yes Metaspace
  • 24. everything is wonderful in Java?.... it depends bro!
  • 25. which the size of a Java String with "Java" content? String java = “Java”;
  • 26. answer: 64 bytes Ahh… how.. WATTT???
  • 27. Java memory consumption 8 bytes Object Header 8 bytes Object reference (x86 may use XX:+UseCompressedOops) 8 bytes alignment (WAT?)
  • 28. data alignment 5 bytes used 3 bytes paddind 8 bytes alignment
  • 29. String explanation Field Type Size (bytes) HEADER 16 value “Java” char[] (16 + 8) + (4 * 2) = 32 offset int 4 count int 4 hash int 4 PADDING = 60 + 4 TOTAL 64 bytes
  • 30. which the size of a java. lang.Boolean? Boolean b = false;
  • 31. answer: 24 bytes Ahh… how.. WATTT???
  • 32. Ok .. But what about classes? OOP?
  • 33. Class File Format ClassFile { u4 magic; u2 minor_version; u2 major_version; u2 constant_pool_count; cp_info contant_pool[constant_pool_count – 1]; u2 access_flags; u2 this_class; u2 super_class; u2 interfaces_count; u2 interfaces[interfaces_count]; u2 fields_count; field_info fields[fields_count]; u2 methods_count; method_info methods[methods_count]; u2 attributes_count; attribute_info attributes[attributes_count]; }
  • 35. And what about the Classloader?
  • 36. JVM initialization order 1. Create a initial class using Bootstrap classloader; 2. links the initial class; 3. initializes it; 4. and invokes the public class method void main(String[])
  • 37. find, check headers class file, super loading, binary created 3 steps, verifying and preparing the type and its direct supers structurally correct, and obeys the semantic requirements allocation of memory foe data structures (optional) checking corrected symbolic references executing initialization method <clinit>
  • 38.
  • 39. Java debug without ide? Is it possible?
  • 40. jdb (included in the JDK 1.2 package)
  • 41. THANK YOU! FTD Group JOIN US! “And be not conformed to this world: but be ye transformed by the renewing of your mind, that ye may prove what {is} that good, and acceptable, and perfect, will of God.” (Romans 12:2)