JVM And CLR Dan Agar April 16, 2004. Outline Java and.NET Design Philosophies Overview of Virtual Machines Technical Look at JVM and CLR Comparison of.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Advertisements

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.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
BA1 JVM arkitektur BA2 Specifikation I The Java Virtual Machine Specification specificeres bl.a.: –De grundlæggende datatyper.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Interface COMP T1.
The Type System1. 2.NET Type System The type system is the part of the CLR that defines all the types that programmers can use, and allows developers.
Overview of the.NET Framework. What is the.NET Framework A new computing platform designed to simplify application development A consistent object-oriented.
Introduction to Java Programming
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Run-Time Storage Organization
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
History  We first begin with Java which was released in 1995 by Sun Microsystems  Initially Java was 100% interpreted at runtime and was very slow 
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.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
1 Memory Model of A Program, Methods Overview l Memory Model of JVM »Method Area »Heap »Stack.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
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)
Compiler Construction Lecture 17 Mapping Variables to Memory.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
Arpit Jain Mtech1. Outline Introduction Dalvik VM Java VM Examples Comparisons Experimental Evaluation.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
1 The Java Virtual Machine Yearly Programming Project.
Java Virtual Machine Java Virtual Machine A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
ITEC 352 Lecture 20 JVM Intro. Functions + Assembly Review Questions? Project due today Activation record –How is it used?
Lecture 10 : Introduction to Java Virtual Machine
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Introduction to Object Oriented Programming CMSC 331.
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
ISYS 350 Business Application Development David Chao.
Run-Time Storage Organization Compiler Design Lecture (03/23/98) Computer Science Rensselaer Polytechnic.
More on MIPS programs n SPIM does not support everything supported by a general MIPS assembler. For example, –.end doesn’t work Use j $ra –.macro doesn’t.
ITEC 352 Lecture 19 Functions in Assembly. Functions + Assembly Review Questions? Project due on Friday Stacks Function activation / deactivation.
Programming Languages and Paradigms Activation Records in Java.
JAVA Ekapap Julnonyang When it was implemented? Developed by Sun Microsystems. The first public implementation was Java 1.0 in 1995 The language.
Chap. 10, Intermediate Representations J. H. Wang Dec. 27, 2011.
A comparison of C-Sharp and Java Zunaid Jogee Supervisor: T. Stakemire.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
A Microsoft.NET Front-End for GCC Bernhard Rabe Martin von Löwis Jan Möller Operating Systems & Middleware Group Hasso-Plattner-Institute, University of.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
RealTimeSystems Lab Jong-Koo, Lim
Object Oriented Programming CMSC 331. Concept of Abstraction “An abstraction is a view or representation of an entity that includes only the attributes.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Applications Active Web Documents Active Web Documents.
Java™ 2 Platform Getting Started.
Before You Begin Nahla Abuel-ola /WIT.
The Java Virtual Machine (JVM)
Programming Language Hierarchy, Phases of a Java Program
Lecture 1: Introduction to JAVA
Interface Java 7 COMP T1.
CS216: Program and Data Representation
CS360 Windows Programming
Advanced Programming: C# Lecture 01: Introduction
CSc 453 Interpreters & Interpretation
Course Overview PART I: overview material PART II: inside a compiler
Presentation transcript:

JVM And CLR Dan Agar April 16, 2004

Outline Java and.NET Design Philosophies Overview of Virtual Machines Technical Look at JVM and CLR Comparison of Environments Conclusions

Java Design Developed by Sun Microsystems in the Early 1990s Designed Primarily With the World Wide Web in Mind Portability Safety Simplicity Platform-neutral Virtual Machine

.NET Design First Announced by Microsoft in mid-2000 New Platform for Development of Windows Applications Intended to Make Greater Use of the WWW Language-Neutral Virtual Machine

Virtual Machines Definition: self-contained environment that behaves like a separate computer Used by Languages Before Java and.NET Abstract Stack-Based Machines

Why Use Virtual Machines? Advantages: Fewer Numbers of Compilers to Write Compact Code Safety Disadvantage: Slower Execution Times

JVM Approximately 250 Instructions Approximately 250 Instructions 32 bit Word Size 32 bit Word Size Two Forms of Data Representation Two Forms of Data Representation Scalars Scalars Object References Object References

JVM Program Execution Java Programs Compiled to Class Files Java Programs Compiled to Class Files JVM Loads Classes as Needed- Performs Safety Checks JVM Loads Classes as Needed- Performs Safety Checks During Execution JVM Performs Runtime Checks During Execution JVM Performs Runtime Checks

JVM Many JVM Instructions are Type-Specific iload_1 ; push local int variable 1 iload_2 ; push local int variable 2 iadd ; add the two top elements istore_3 ; pop result into variable 3

JVM Four Different Method Call Instructions Virtual Methods Virtual Methods Static Methods Static Methods Interface Methods Interface Methods Virtual Methods Invoked Statically Virtual Methods Invoked Statically

JVM Summary Target for Java Target for Java Supports Primarily Safe, Object-Oriented Techniques Supports Primarily Safe, Object-Oriented Techniques Not Necessarily Desirable as a Target for Other Languages Not Necessarily Desirable as a Target for Other Languages

CLR Approximately 220 Instructions Approximately 220 Instructions No Fixed Word Size No Fixed Word Size Three Types of Data at Runtime Three Types of Data at Runtime Scalars Scalars References References Instances of Value Classes Instances of Value Classes

CLR Program Execution Assembly Files are the Main Units Assembly Files are the Main Units Loaded Dynamically Loaded Dynamically Checks Performed Both During Load Time and During Runtime Checks Performed Both During Load Time and During Runtime

CLR CLR Instructions Not Type-Specific ldloc.1 ; push local variable 1 ldloc.2 ; push local variable 2 add ; add the two top elements stloc.3 ; pop result into variable 3

CLR Three Different Method Call Instructions  call for standard method calls  callvirt for virtual and static method calls  calli for calls to function pointers

CLR Reference and Value Types Value Types: Collections of Fields Value Types: Collections of Fields Analogous to C structs or Pascal records Analogous to C structs or Pascal records Reference Types: Classes and Arrays Reference Types: Classes and Arrays Only One Instruction Needed to Instantiate a Class Only One Instruction Needed to Instantiate a Class

Comparisons Safety: The CLR allows for unsafe programming practices- JVM does not. The CLR allows for unsafe programming practices- JVM does not. Parameter Passing: The CLR allows for the passing of reference parameters The CLR allows for the passing of reference parameters Language Support: The CLR is designed to support non object- oriented languages. The CLR is designed to support non object- oriented languages.

Case Study: “C Support” The JVM: ecgs-jvm ecgs-jvm University of Queensland University of Queensland gcc Backend Targeting the JVM gcc Backend Targeting the JVM Workarounds Workarounds C’s view of memory C’s view of memory Global Static Data Global Static Data Signed and Unsigned Numbers Signed and Unsigned Numbers Results Results JVM and C Do Not Mix JVM and C Do Not Mix

Case Study: “C Support” The CLR gcc.NET gcc.NET Implemented at Cambridge Implemented at Cambridge gcc Backend Targeting the CLR gcc Backend Targeting the CLR No workarounds required No workarounds required Results Results Flawless compilation and execution on CLR Flawless compilation and execution on CLR

Performance Java Grande Benchmarks Java and C# Tested Java and C# Tested 1.4Ghz x86, Windows 2000 Professional 1.4Ghz x86, Windows 2000 Professional

Conclusions Neither Machine is Definitively “Better”: JVM is a Platform-Neutral Runtime JVM is a Platform-Neutral Runtime CLR is a Language-Neutral Runtime CLR is a Language-Neutral Runtime CLR is More Extensible Languages of Varying Types Supported Languages of Varying Types Supported Could be Ported to Other Platforms Could be Ported to Other Platforms