Top Banner
Java Virtual Machine
17
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JVM

Java Virtual Machine

Page 2: JVM

2

What do you mean by

JVM?

The abstract specification

A concrete implementation

A runtime instance

What is a Java Virtual Machine?

JVM Overview

Page 3: JVM

3

JVM Structure

JVM Overview

Page 4: JVM

4

JVM Architecture

JVM Architecture

Page 5: JVM

5

Class Loader

Class Loader

Page 6: JVM

6

Class Loader Cont..

Class Loader

Page 7: JVM

7

Java Memory Area

Memory Management

Page 8: JVM

8

Java Memory Area Cont..

Memory Management

Page 9: JVM

9

PC Register

Each thread of a running program has its own PC register

PC register is created when the thread is started

As a thread executes a Java method, PC register containsthe instruction currently being executed by the thread

Memory Management

Keeps track of the current instruction executing at any moment

Page 10: JVM

10

JVM Stack

Stack frame: One stack frame is created whenever a method is executed in the JVM, and the stack frame is added to the JVM stack of the thread

Local variable: The parameters sent to the method are saved. After the method parameters, the local variables of the method are saved

Memory Management

Operand stack: An actual workspace of a method. Each method exchanges data between the Operand stack and the local variable array, and pushes or pops other method invoke results

Page 11: JVM

11

Native method stack

In other words, it is a stack used to execute C/C++ codes invoked through JNI

According to the language, a C stack or C++ stack is created

Memory Management

Stack for native code written in a language other than Java

Page 12: JVM

12

Heap

Memory Management

Page 13: JVM

13

Heap

Memory Management

Page 14: JVM

14

Execution Engine

Interpreter: Reads, interprets and executes the bytecode instructions one by one.

JVM Execution engine

JIT compiler: The execution engine runs as an interpreter first, and at the appropriate time, the JIT compiler compiles the entire byte code to change it to native code

Page 15: JVM

15

Execution Engine - JIT Compiler

JVM Execution engine

JIT compiler: The execution engine runs as an interpreter first, and at the appropriate tie, the JIT compiler compiles the entire byte code to change it to native code

Page 16: JVM

Questions ???

Page 17: JVM