9
CHAPTER-8 Interpreters & Debuggers

Interpreters & Debuggers

Embed Size (px)

Citation preview

Page 1: Interpreters  &  Debuggers

CHAPTER-8

Interpreters &

Debuggers

Page 2: Interpreters  &  Debuggers

Interpreters

Impure Interpreter performs some preliminary processing of source program to reduce the analysis overheads during interpretation

Page 3: Interpreters  &  Debuggers

• Overview of Interpretation

Page 4: Interpreters  &  Debuggers

• Benefits of Interpretation

• An interpretive language is relatively easy to code, test, and change• Good for one-time solutions

• Good for developing application prototypes• Time saver for command strings that are entered repeatedly

Page 5: Interpreters  &  Debuggers

• Java Language Enviornment

• Java Development Kit

• javac - The Java Compiler• java - The Java Interpreter• jdb- The Java Debugger• appletviewer -Tool to run the applets• javap - to print the Java bytecodes• javaprof - Java profiler• javadoc - documentation generator• javah - creates C header files

Page 6: Interpreters  &  Debuggers

Process of Building and Running Java Programs

Text Editor

Java Source Code

javac

Java Class File

java

Output

javadoc

javah

jdb

HTML Files

Header Files

Page 7: Interpreters  &  Debuggers

Java virtual machine (JVM)• It is an abstract computing machine that enables a

computer to run a Java program.• There are three notions of the JVM: specification,

implementation, and instance. • The specification is a document that formally describes

what is required of a JVM implementation. Having a single specification ensures all implementations are interoperable.

• A JVM implementation is a computer program that meets the requirements of the JVM specification.

• An instance of a JVM is an implementation running in a process that executes a computer program compiled into Java bytecode

Page 8: Interpreters  &  Debuggers

Class Loader• One of the organizational units of JVM bytecode is a class. A class

loader implementation must be able to recognize and load anything that conforms to the Java class file format.

• The class loader performs three basic activities in this strict order:1. Loading: finds and imports the binary data for a type2. Linking: performs verification, preparation, and (optionally) resolution

– Verification: ensures the correctness of the imported type– Preparation: allocates memory for class variables and initializing the

memory to default values– Resolution: transforms symbolic references from the type into

direct references.3. Initialization: invokes Java code that initializes class variables to their

proper starting values.

Page 9: Interpreters  &  Debuggers

• Java Virtual Machine(JVM)

JVM is a software emulation of a hypothetical computing machine that runs Java bytecodes (Java compiler output)

Java Run-Time System

Byte

Code

Verifier

Class

Loader

Interpreter

Just-in-time

Compiler

Java

Runtime

Hardware