31.01.2006 - BA1 JVM arkitektur. 31.01.2006 - BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper.

Slides:



Advertisements
Similar presentations
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Advertisements

Introduction to Programming G51PRG University of Nottingham Revision 1
DATA TYPES, VARIABLES, ARITHMETIC. Variables A variable is a “named container” that holds a value. A name for a spot in the computer’s memory This value.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
INSTRUCTION SET ARCHITECTURES
Compilation 2007 Code Generation Michael I. Schwartzbach BRICS, University of Aarhus.
Memory Management Case study (JVM & CLR) KIRAN KUMAR V KIRAN KUMAR V LENIN THUMMALAPALLI LENIN THUMMALAPALLI.
1 1 Lecture 14 Java Virtual Machine Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
1 COMP 144 Programming Language Concepts Felix Hernandez-Campos Lecture 32: The Java Virtual Machine COMP 144 Programming Language Concepts Spring 2002.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
Session 1 CS-240 Data Structures Binghamton University Dick Steflik.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
5/6/99 Ashish Sabharwal1 JVM Architecture n Local storage area –Randomly accessible –Just like standard RAM –Stores variables (eg. an array) –Have to specify.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
Intro to Java The Java Virtual Machine. What is the JVM  a software emulation of a hypothetical computing machine that runs Java bytecodes (Java compiler.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
1 Java Virtual Machine Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Programming Principles Data types and Variables. Data types Variables are nothing but reserved memory locations to store values. This means that when.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
JVM And CLR Dan Agar April 16, Outline Java and.NET Design Philosophies Overview of Virtual Machines Technical Look at JVM and CLR Comparison of.
1 The Java Virtual Machine Yearly Programming Project.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
Machine Instruction Characteristics
1 October 1, October 1, 2015October 1, 2015October 1, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University Azusa.
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
Lecture 10 : Introduction to Java Virtual Machine
1 Introduction to JVM Based on material produced by Bill Venners.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
An Efficient Stack Machine Martin Schöberl. JOP Stack Architecture2 Overview JVM stack machine Parameter passing Stack access patterns Common stack caches.
Chap. 1 Classes, Types, and Objects. How Classes Are Declared [ ] class [extends ] [implements,, … ] { // class methods and instance variable definitions.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
© 2004 Goodrich, Tamassia Stacks. © 2004 Goodrich, Tamassia Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data.
Java™ How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
CSCE 314 Programming Languages JVM Dr. Hyunyoung Lee 1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CSI 3125, Preliminaries, page 1 Data Type, Variables.
Programming Languages and Paradigms Activation Records in Java.
Bank Account Example public class BankAccount { private double balance; public static int totalAccounts = 0; public BankAccount() { balance = 0; totalAccounts++;
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage:
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
UNDER THE HOOD: THE JAVA VIRTUAL MACHINE II CS2110 Fall 200 Lecture 25 1.
A data type in a programming language is a set of data with values having predefined characteristics.data The language usually specifies:  the range.
C is a high level language (HLL)
Stack. ADS2 Lecture 1010 The Stack ADT (GoTa §5.1) The Stack ADT stores arbitrary objects Insertions and deletions follow the last-in.
Data Types References:  Data Type:  In computer science and computer programming, a data type or simply type is a.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Basic Data Types อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 4.
Click to edit Master text styles Stacks Data Structure.
RealTimeSystems Lab Jong-Koo, Lim
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
CS 432: Compiler Construction Lecture 15
The Java Virtual Machine (JVM)
Data Representation Binary Numbers Binary Addition
CS216: Program and Data Representation
Internet and Java Foundations, Programming and Practice
Java package classes Java package classes.
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Java Virtual Machine (JVM)
Java Byte Codes (0xCAFEBABE) cs205: engineering software
null, true, and false are also reserved.
An overview of Java, Data types and variables
Course Overview PART I: overview material PART II: inside a compiler
Local Variables, Global Variables and Variable Scope
Presentation transcript:

BA1 JVM arkitektur

BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper –Bytekoder –Classfile formatet –Classloader subsystemet –Execution engine ("CPU") –Runtime dataområde

BA3 JVM blokdiagram

BA4 Grundlæggende datatyper

BA5 Grundlæggende datatyper TypeRange byte 8-bit signed two's complement integer (-2 7 to , inclusive) short 16-bit signed two's complement integer (-2 15 to , inclusive) int 32-bit signed two's complement integer (-2 31 to , inclusive) long 64-bit signed two's complement integer (-2 63 to , inclusive) char 16-bit unsigned Unicode character (0 to , inclusive) float 32-bit IEEE 754 single-precision float double 64-bit IEEE 754 double-precision float returnAddress address of an opcode within the same method reference reference to an object on the heap, or null Table 5-1. Ranges of the Java virtual machine's data types

BA6

7 Method area The fully qualified name of the type The fully qualified name of the type's direct superclass (unless the type is an interface or class java.lang.Object, neither of which have a superclass) Whether or not the type is a class or an interface The type's modifiers ( some subset of` public, abstract, final) An ordered list of the fully qualified names of any direct superinterfaces In addition to the basic type information listed previously, the virtual machine must also store for each loaded type: The constant pool for the type Field information Method information All class (static) variables declared in the type, except constants A reference to class ClassLoader A reference to class Class

BA8 Objekt layout 1 2 gange indirekte adressering Ved garbage collection skal kun én reference opdateres

BA9 Objekt layout 2 Kun én gang indirekte adressering Dyrt at lave garbage collection (alle referencer til et objekt skal opdateres)

BA10 Objekt layout 3 Svarer til VFT i C++

BA11 Stakke

BA12 Parametre og lokale variable class Example3a { public static int runClassMethod(int i, long l, float f, double d, Object o, byte b) { return 0; } public int runInstanceMethod(char c, double d, short s, boolean b) { return 0; } }

BA13 Simple stakoperationer iload_0 // push the int in local variable 0 iload_1 // push the int in local variable 1 iadd // pop two ints, add them, push result istore_2 // pop int, store into local variable 2

BA14 iload_ Operation Load int from local variable Format iload_ Forms iload_0 = 26 (0x1a) iload_1 = 27 (0x1b) iload_2 = 28 (0x1c) iload_3 = 29 (0x1d) Operand Stack......, value Description The must be an index into the local variable array of the current frame (§3.6). The local variable at must contain an int. The value of the local variable at is pushed onto the operand stack.(§3.6)

BA15 iadd Operation Add int Format iadd Forms iadd = 96 (0x60) Operand Stack..., value1, value2..., result Description Both value1 and value2 must be of type int. The values are popped from the operand stack. The int result is value1 + value2. The result is pushed onto the operand stack. The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's- complement format, represented as a value of type int. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical sum of the two values. Despite the fact that overflow may occur, execution of an iadd instruction never throws a runtime exception.

BA16 istore_ Operation Store int into local variable Format istore_ Forms istore_0 = 59 (0x3b) istore_1 = 60 (0x3c) istore_2 = 61 (0x3d) istore_3 = 62 (0x3e) Operand Stack..., value... Description The must be an index into the local variable array of the current frame (§3.6). The value on the top of the operand stack must be of type int. It is popped from the operand stack, and the value of the local variable at is set to value.(§3.6)

BA17 Kald af native funktioner

BA18 JVM virkemåde og specifikation Inside the Java 2 Virtual Machine (Bill Venners) The Java Virtual Machine Specification (Sun)

BA19