Run-time Program Management. Hwansoo Han

Size: px
Start display at page:

Download "Run-time Program Management. Hwansoo Han"

Transcription

1 Run-time Program Management Hwansoo Han

2 Run-time System Run-time system refers to Set of libraries needed for correct operation of language implementation Some parts obtain all the information from subroutine arguments (e.g., heap management) Others require more extensive knowledge of the compiler or the generated program (e.g., garbage collector) 2

3 Compiler/Runtime Integration Examples Garbage collection Variable numbers of arguments Exception handling Event handling Coroutine & thread implementation Remote procedure call Transactional memory Dynamic linking 3

4 Virtual Machines A complete set of programming environment Application programming interfaces (APIs) Instruction set architecture (ISA) I/O Scheduling Other services provided by libraries and OS 4

5 System VM vs. Process VM System VMs (virtual machine monitors) Emulates all the hardware needed to run a standard OS Privileged and unprivileged instructions Memory mapped I/O, Virtual memory Interrupt IBM CP/CMS (1967) run multiple single-user CMS s on CP VMware, Parallels run multiple OSes Process VMs Provide an environment for a single user-level process Subset of unprivileged instructions Library-level I/O interface Java Virtual Machine (JVM) runs Java bytecode Common Language Infrastructure (CLI) runs Common Intermediate Language (CIL) 5

6 Java Virtual Machine (JVM) Sun Microsystems developed the Java Language (1990-1) Code in the JVM was entirely interpreted Just-in-time (JIT) compiler added in 1998 (with Java2) JVM architecture Interfaces are designed as target for a Java compiler Direct support for all the built-in and reference types Enforce definite assignment (i.e., no uninitialized variables) and type safety Built-in support for exceptions, threads, garbage collection, reflection, dynamic loading, and security Compilers targeting JVM exist for many languages other than Java Ruby, JavaScript, Python, Scheme, C, Ada, Cobol,... 6

7 JVM Storage Management Storage allocations in the JVM mirror those of Java language Global constant pool Set of registers Stack for each thread Method area to hold executable bytecode Heap for dynamically allocated objects 7

8 Constant Pool Global data Constant pool contains both program constants and a variety of symbol table information Example class Hello { public static void main(string args[]) { System.out.println( Hello, world! ); } } 8

9 Content of Constant Pool Asciz: zero-terminated ASCII string Textual names Files (14) Classes (21, 22, 23, 26) Methods (7, 11, 27) Fields (24) Others (9, 10, 13) Type signatures Field & method V: void Lname: class name (8, 12, 25, 28) [ output of Sun s javap ] 9

10 Class Files Class file is stored as a stream of byte javac Hello.java produces a class file, Hello.class Begins with a magic number (0x_cafe_babe) Multiple class files can be combined into a Java archive jar cf jar-file input-files creates a Java archive, jar-file from multiple input-files jar tf jar-file views the content of a Java archive, jar-file jar xf jar-file extracts the content of a Java archive, jar-file 10

11 Java Bytecode Instructions are operated on a stack based machine An entry of Class file s method table holds Bytecode for a method Other information Number of local variables, including parameters Maximum depth required in the operand stack Table of exception handler information Bytecode range covered by this handler Address (index in the code) of the handler itself Type of exception caught (an index into the constant pool) 11

12 Bytecode Instruction Set Format Opcode of a single byte Arguments, if any, occupying subsequent bytes (big-endian) Most instructions do not need arguments Version 2 (current as of early 2008) Load/store move values between operand stack and local variable array Arithmetic integer and floating-point operation on operand stack values Type conversion widen or narrow values among built-in types Object management create/query/access the objects & arrays Operand stack management push, pop, duplicate, swap Control transfer conditional, unconditional, multiway branches (switch) Method calls call/return of methods (including constructor/initializers) Exceptions throw Monitors enter and exit (wait, notify, notifyall are invoked) 12

13 Java Program - example List insert 13

14 Java Bytecode - example Special load/store 14 First 4 local var array aload_[0123] : reference load iload_[0123] : integer load astore_[0123] : reference store istore_[0123] : integer store Access fields Object reference in the stack Field argument (index of constant pool) getfield, putfield Local var array Operand stack 0: 1: 2: 3: this v n top public void insert(int v) { node n = head; while (n.next!= null && n.next.val < v) {... }... Code: Stack=3, Locals=4, Args_size=2 0: aload_0 // this 1: getfield #4 // head 4: astore_2 5: aload_2 // n 6: getfield #5 // n.next 9: ifnull 31 12: aload_2 // n 13: getfield #5 // n.next 16: getfield #6 // n.next.val 19: iload_1 // v 20: if_icmpge 31

15 Java Bytecode example (cont d) Control transfer ifnull, if_icmpge, goto,... Object management new, newarray Operand stack management dup Method call/return invokespecial, invokeinterface, invokestatic, invokevirtual, return, areturn, ireturn [ output of Sun s javap ] 15

16 Common Language Infrastructure (CLI) History of CLI Began at Microsoft in the late 1990s Need for interoperability among programming languages running on Windows platforms For.NET, a specification for CLI VM was standardized by ECMA in 2001 Contributions of CLI Common Type System (CTS) for all supported languages Virtual Execution System (VES) virtual machine architecture Common Intermediate Language (CIL) instruction set for VES Strong resemblance to Java bytecode Portable Executable (PE) a portable file format for code and metadata Based on Common Object File Format (COFF) from AT&T System V Unix Languages supported 16 C#, Visual Basic, C++, Jscript, F# (an ML descendant)

17 Architecture of CLI Similarities between CLI and JVM Multi-threaded, stack-based virtual machine Garbage collection, exceptions, Virtual method dispatch, mix-in inheritance Platform-independent, self-descriptive, bytecode notation Safety features as in JVMs Definite assignment, strong typing, Protection against overflow/underflow of the operand stack 17

18 Architecture of CLI (cont d) Contrasts between CLI and JVM 18 Richer type system for CLI Both value and reference variable of structured types Contiguous multidimensional arrays, function pointers,... Richer calling mechanisms in CLI Explicit tail-recursion Value and reference parameters, variable number of parameters Multiple return values, non-virtual methods Unsafe code made explicit in CLI (for unverifiable code) Non-converting type cast Dynamic allocation of non-garbage-collected memory Pointer-to non-heap data, pointer arithmetic Miscellaneous CLI support Global data and functions, Local variables with elaboration-time binding, Optional detection of arithmetic overflow

19 Late Binding of Machine Code Just-in-time (JIT) compilation JIT system compiles programs immediately prior to execution source/intermediate code to machine code Can add significant delay to program start-up time Cannot apply expensive optimizations Not global, interprocedural, but local optimizations Source-to-bytecode compiler (javac) handles heavy machineindependent optimizations instead, but still heavy machine-code level optimizations cannot be done Use a combination of interpreter and JIT compilation to reduce the overhead of start-up time and latency Incremental JIT compilation Executing with interpreter, compiling in parallel for future calls Caching the compiled code for later use 19

20 Dynamic Compilation Useful cases for delayed compilation Source or bytecode was not created or discovered until run time Wish to perform optimizations that depend on information gathered during execution Hot paths discovery from profiling 20 Most programs spend most of time in a small fraction of code Aggressive optimizations on hot paths can yield large improvement Making hot paths contiguous in memory Unrolling loops Assigning frequently used expressions to registers Scheduling instructions to minimize the pipeline stalls Allow statically unsafe optimizations, which is OK dynamically In-lining functions which is proved not to be extended SUN s HotSpot JVM and JIT (first released in 1999) Microsoft s CIL-to-machine-code compiler Common Lisp compiler

21 Binary Translation Recompilation of object code Already compiled code run on a machine with different ISA Apple s Rosetta system (run PowerPC Mac code on x86 Mac) Mac 68K emulator (interpret 68K code for PowerPC) DEC FX!32 for MS Windows (interpret and hot-path translation) HP Aries (PA-RISC to Itanium), Intel IA-32 EL (x86 to Itanium) Dynamic optimizations for long-running programs Fast compilation first, aggressive profile-based dynamic optimizations Partial execution trace (hot path) optimization removes branch overhead HP Dynamo for PA-RISC, DynamoRIO for x86 Challenges from the loss of information in the original code 21 Object code typically lacks type information and control-flow constructs

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

JVML Instruction Set. How to get more than 256 local variables! Method Calls. Example. Method Calls

JVML Instruction Set. How to get more than 256 local variables! Method Calls. Example. Method Calls CS6: Program and Data Representation University of Virginia Computer Science Spring 006 David Evans Lecture 8: Code Safety and Virtual Machines (Duke suicide picture by Gary McGraw) pushing constants JVML

More information

High-Level Language VMs

High-Level Language VMs High-Level Language VMs Outline Motivation What is the need for HLL VMs? How are these different from System or Process VMs? Approach to HLL VMs Evolutionary history Pascal P-code Object oriented HLL VMs

More information

JVM. What This Topic is About. Course Overview. Recap: Interpretive Compilers. Abstract Machines. Abstract Machines. Class Files and Class File Format

JVM. What This Topic is About. Course Overview. Recap: Interpretive Compilers. Abstract Machines. Abstract Machines. Class Files and Class File Format Course Overview What This Topic is About PART I: overview material 1 Introduction 2 Language processors (tombstone diagrams, bootstrapping) 3 Architecture of a compiler PART II: inside a compiler 4 Syntax

More information

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats Chapter 5 Objectives Understand the factors involved in instruction set architecture design. Chapter 5 A Closer Look at Instruction Set Architectures Gain familiarity with memory addressing modes. Understand

More information

Chapter 5. A Closer Look at Instruction Set Architectures

Chapter 5. A Closer Look at Instruction Set Architectures Chapter 5 A Closer Look at Instruction Set Architectures Chapter 5 Objectives Understand the factors involved in instruction set architecture design. Gain familiarity with memory addressing modes. Understand

More information

Java and C II. CSE 351 Spring Instructor: Ruth Anderson

Java and C II. CSE 351 Spring Instructor: Ruth Anderson Java and C II CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Lab 5 Due TONIGHT! Fri 6/2

More information

Chapter 5. A Closer Look at Instruction Set Architectures

Chapter 5. A Closer Look at Instruction Set Architectures Chapter 5 A Closer Look at Instruction Set Architectures Chapter 5 Objectives Understand the factors involved in instruction set architecture design. Gain familiarity with memory addressing modes. Understand

More information

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats Chapter 5 Objectives Chapter 5 A Closer Look at Instruction Set Architectures Understand the factors involved in instruction set architecture design. Gain familiarity with memory addressing modes. Understand

More information

Java: framework overview and in-the-small features

Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

SOFTWARE ARCHITECTURE 7. JAVA VIRTUAL MACHINE

SOFTWARE ARCHITECTURE 7. JAVA VIRTUAL MACHINE 1 SOFTWARE ARCHITECTURE 7. JAVA VIRTUAL MACHINE Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/ Java Programming Language Java Introduced in 1995 Object-oriented programming

More information

Java Class Loading and Bytecode Verification

Java Class Loading and Bytecode Verification Java Class Loading and Bytecode Verification Every object is a member of some class. The Class class: its members are the (definitions of) various classes that the JVM knows about. The classes can be dynamically

More information

Under the Hood: The Java Virtual Machine. Lecture 23 CS2110 Fall 2008

Under the Hood: The Java Virtual Machine. Lecture 23 CS2110 Fall 2008 Under the Hood: The Java Virtual Machine Lecture 23 CS2110 Fall 2008 Compiling for Different Platforms Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized

More information

Course Overview. PART I: overview material. PART II: inside a compiler. PART III: conclusion

Course Overview. PART I: overview material. PART II: inside a compiler. PART III: conclusion Course Overview PART I: overview material 1 Introduction (today) 2 Language Processors (basic terminology, tombstone diagrams, bootstrapping) 3 The architecture of a Compiler PART II: inside a compiler

More information

JAM 16: The Instruction Set & Sample Programs

JAM 16: The Instruction Set & Sample Programs JAM 16: The Instruction Set & Sample Programs Copyright Peter M. Kogge CSE Dept. Univ. of Notre Dame Jan. 8, 1999, modified 4/4/01 Revised to 16 bits: Dec. 5, 2007 JAM 16: 1 Java Terms Java: A simple,

More information

Java Security. Compiler. Compiler. Hardware. Interpreter. The virtual machine principle: Abstract Machine Code. Source Code

Java Security. Compiler. Compiler. Hardware. Interpreter. The virtual machine principle: Abstract Machine Code. Source Code Java Security The virtual machine principle: Source Code Compiler Abstract Machine Code Abstract Machine Code Compiler Concrete Machine Code Input Hardware Input Interpreter Output 236 Java programs: definitions

More information

Delft-Java Link Translation Buffer

Delft-Java Link Translation Buffer Delft-Java Link Translation Buffer John Glossner 1,2 and Stamatis Vassiliadis 2 1 Lucent / Bell Labs Advanced DSP Architecture and Compiler Research Allentown, Pa glossner@lucent.com 2 Delft University

More information

Compiling Techniques

Compiling Techniques Lecture 10: Introduction to 10 November 2015 Coursework: Block and Procedure Table of contents Introduction 1 Introduction Overview Java Virtual Machine Frames and Function Call 2 JVM Types and Mnemonics

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

CSCE 314 Programming Languages

CSCE 314 Programming Languages CSCE 314 Programming Languages! JVM Dr. Hyunyoung Lee 1 Java Virtual Machine and Java The Java Virtual Machine (JVM) is a stack-based abstract computing machine. JVM was designed to support Java -- Some

More information

Plan for Today. Safe Programming Languages. What is a secure programming language?

Plan for Today. Safe Programming Languages. What is a secure programming language? cs2220: Engineering Software Class 19: Java Security Java Security Plan for Today Java Byte s () and Verification Fall 2010 UVa David Evans Reminder: Project Team Requests are due before midnight tomorrow

More information

CS2110 Fall 2011 Lecture 25. Under the Hood: The Java Virtual Machine, Part II

CS2110 Fall 2011 Lecture 25. Under the Hood: The Java Virtual Machine, Part II CS2110 Fall 2011 Lecture 25 Under the Hood: The Java Virtual Machine, Part II 1 Java program last time Java compiler Java bytecode (.class files) Compile for platform with JIT Interpret with JVM run native

More information

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1

SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1 SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine David Bélanger dbelan2@cs.mcgill.ca Sable Research Group McGill University Montreal, QC January 28, 2004 SABLEJIT: A Retargetable

More information

Compiler construction 2009

Compiler construction 2009 Compiler construction 2009 Lecture 2 Code generation 1: Generating Jasmin code JVM and Java bytecode Jasmin Naive code generation The Java Virtual Machine Data types Primitive types, including integer

More information

Over-view. CSc Java programs. Java programs. Logging on, and logging o. Slides by Michael Weeks Copyright Unix basics. javac.

Over-view. CSc Java programs. Java programs. Logging on, and logging o. Slides by Michael Weeks Copyright Unix basics. javac. Over-view CSc 3210 Slides by Michael Weeks Copyright 2015 Unix basics javac java.j files javap 1 2 jasmin converting from javap to jasmin classfile structure calling methods adding line numbers Java programs

More information

02 B The Java Virtual Machine

02 B The Java Virtual Machine 02 B The Java Virtual Machine CS1102S: Data Structures and Algorithms Martin Henz January 22, 2010 Generated on Friday 22 nd January, 2010, 09:46 CS1102S: Data Structures and Algorithms 02 B The Java Virtual

More information

invokedynamic IN 45 MINUTES!!! Wednesday, February 6, 13

invokedynamic IN 45 MINUTES!!! Wednesday, February 6, 13 invokedynamic IN 45 MINUTES!!! Me Charles Oliver Nutter headius@headius.com, @headius blog.headius.com JRuby Guy at Sun, Engine Yard, Red Hat JVM enthusiast, educator, contributor Earliest adopter of invokedynamic

More information

CS263: Runtime Systems Lecture: High-level language virtual machines. Part 1 of 2. Chandra Krintz UCSB Computer Science Department

CS263: Runtime Systems Lecture: High-level language virtual machines. Part 1 of 2. Chandra Krintz UCSB Computer Science Department CS263: Runtime Systems Lecture: High-level language virtual machines Part 1 of 2 Chandra Krintz UCSB Computer Science Department Portable, Mobile, OO Execution Model Execution model embodied by recent

More information

The Java Virtual Machine. CSc 553. Principles of Compilation. 3 : The Java VM. Department of Computer Science University of Arizona

The Java Virtual Machine. CSc 553. Principles of Compilation. 3 : The Java VM. Department of Computer Science University of Arizona The Java Virtual Machine CSc 553 Principles of Compilation 3 : The Java VM Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2011 Christian Collberg The Java VM has gone

More information

Program Dynamic Analysis. Overview

Program Dynamic Analysis. Overview Program Dynamic Analysis Overview Dynamic Analysis JVM & Java Bytecode [2] A Java bytecode engineering library: ASM [1] 2 1 What is dynamic analysis? [3] The investigation of the properties of a running

More information

3/15/18. Overview. Program Dynamic Analysis. What is dynamic analysis? [3] Why dynamic analysis? Why dynamic analysis? [3]

3/15/18. Overview. Program Dynamic Analysis. What is dynamic analysis? [3] Why dynamic analysis? Why dynamic analysis? [3] Overview Program Dynamic Analysis Dynamic Analysis JVM & Java Bytecode [2] A Java bytecode engineering library: ASM [1] 2 What is dynamic analysis? [3] The investigation of the properties of a running

More information

CHAPTER 5 A Closer Look at Instruction Set Architectures

CHAPTER 5 A Closer Look at Instruction Set Architectures CHAPTER 5 A Closer Look at Instruction Set Architectures 5.1 Introduction 199 5.2 Instruction Formats 199 5.2.1 Design Decisions for Instruction Sets 200 5.2.2 Little versus Big Endian 201 5.2.3 Internal

More information

Under the Hood: The Java Virtual Machine. Problem: Too Many Platforms! Compiling for Different Platforms. Compiling for Different Platforms

Under the Hood: The Java Virtual Machine. Problem: Too Many Platforms! Compiling for Different Platforms. Compiling for Different Platforms Compiling for Different Platforms Under the Hood: The Java Virtual Machine Program written in some high-level language (C, Fortran, ML, ) Compiled to intermediate form Optimized Code generated for various

More information

The Java Virtual Machine

The Java Virtual Machine Virtual Machines in Compilation Abstract Syntax Tree Compilation 2007 The compile Virtual Machine Code interpret compile Native Binary Code Michael I. Schwartzbach BRICS, University of Aarhus 2 Virtual

More information

Code Generation Introduction

Code Generation Introduction Code Generation Introduction i = 0 LF w h i l e i=0 while (i < 10) { a[i] = 7*i+3 i = i + 1 lexer i = 0 while ( i < 10 ) source code (e.g. Scala, Java,C) easy to write Compiler (scalac, gcc) parser type

More information

The Java Virtual Machine

The Java Virtual Machine The Java Virtual Machine Norman Matloff and Thomas Fifield University of California at Davis c 2001-2007, N. Matloff December 11, 2006 Contents 1 Background Needed 3 2 Goal 3 3 Why Is It a Virtual Machine?

More information

Hardware-Supported Pointer Detection for common Garbage Collections

Hardware-Supported Pointer Detection for common Garbage Collections 2013 First International Symposium on Computing and Networking Hardware-Supported Pointer Detection for common Garbage Collections Kei IDEUE, Yuki SATOMI, Tomoaki TSUMURA and Hiroshi MATSUO Nagoya Institute

More information

Administration CS 412/413. Why build a compiler? Compilers. Architectural independence. Source-to-source translator

Administration CS 412/413. Why build a compiler? Compilers. Architectural independence. Source-to-source translator CS 412/413 Introduction to Compilers and Translators Andrew Myers Cornell University Administration Design reports due Friday Current demo schedule on web page send mail with preferred times if you haven

More information

Virtual Machines and Dynamic Translation: Implementing ISAs in Software

Virtual Machines and Dynamic Translation: Implementing ISAs in Software Virtual Machines and Dynamic Translation: Implementing ISAs in Software Krste Asanovic Laboratory for Computer Science Massachusetts Institute of Technology Software Applications How is a software application

More information

CSc 453 Interpreters & Interpretation

CSc 453 Interpreters & Interpretation CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson Interpreters An interpreter is a program that executes another program. An interpreter implements a virtual machine,

More information

CHAPTER 5 A Closer Look at Instruction Set Architectures

CHAPTER 5 A Closer Look at Instruction Set Architectures CHAPTER 5 A Closer Look at Instruction Set Architectures 5.1 Introduction 293 5.2 Instruction Formats 293 5.2.1 Design Decisions for Instruction Sets 294 5.2.2 Little versus Big Endian 295 5.2.3 Internal

More information

Today. Instance Method Dispatch. Instance Method Dispatch. Instance Method Dispatch 11/29/11. today. last time

Today. Instance Method Dispatch. Instance Method Dispatch. Instance Method Dispatch 11/29/11. today. last time CS2110 Fall 2011 Lecture 25 Java program last time Java compiler Java bytecode (.class files) Compile for platform with JIT Interpret with JVM Under the Hood: The Java Virtual Machine, Part II 1 run native

More information

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc. Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management

More information

Java byte code verification

Java byte code verification Java byte code verification SOS Master Science Informatique U. Rennes 1 Thomas Jensen SOS Java byte code verification 1 / 26 Java security architecture Java: programming applications with code from different

More information

An Introduction to Multicodes. Ben Stephenson Department of Computer Science University of Western Ontario

An Introduction to Multicodes. Ben Stephenson Department of Computer Science University of Western Ontario An Introduction to Multicodes Ben Stephenson Department of Computer Science University of Western Ontario ben@csd csd.uwo.ca Outline Java Virtual Machine Background The Current State of the Multicode Art

More information

For our next chapter, we will discuss the emulation process which is an integral part of virtual machines.

For our next chapter, we will discuss the emulation process which is an integral part of virtual machines. For our next chapter, we will discuss the emulation process which is an integral part of virtual machines. 1 2 For today s lecture, we ll start by defining what we mean by emulation. Specifically, in this

More information

Delft-Java Dynamic Translation

Delft-Java Dynamic Translation Delft-Java Dynamic Translation John Glossner 1,2 and Stamatis Vassiliadis 2 1 IBM Research DSP and Embedded Computing Yorktown Heights, NY glossner@us.ibm.com (formerly with Lucent Technologies) 2 Delft

More information

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th

More information

YETI. GraduallY Extensible Trace Interpreter VEE Mathew Zaleski, Angela Demke Brown (University of Toronto) Kevin Stoodley (IBM Toronto)

YETI. GraduallY Extensible Trace Interpreter VEE Mathew Zaleski, Angela Demke Brown (University of Toronto) Kevin Stoodley (IBM Toronto) YETI GraduallY Extensible Trace Interpreter Mathew Zaleski, Angela Demke Brown (University of Toronto) Kevin Stoodley (IBM Toronto) VEE 2007 1 Goal Create a VM that is more easily extended with a just

More information

CMPSC 497: Java Security

CMPSC 497: Java Security CMPSC 497: Java Security Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University 1 Enforcement Mechanisms Static mechanisms

More information

Problem: Too Many Platforms!

Problem: Too Many Platforms! Compiling for Different Platforms 2 Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized UNDE THE HOOD: THE JAVA VITUAL MACHINE Code generated for various

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Recap: Taking Conditional Branches into Account Extending

More information

Virtual Machines. Virtual Machines

Virtual Machines. Virtual Machines Virtual Machines Virtual Machines What is a virtual machine? Examples? Benefits? 1 Virtualization Creation of an isomorphism that maps a virtual guest system to a real host: Maps guest state S to host

More information

Question. 1 Features of Java.

Question. 1 Features of Java. QUESTIONS BANK (CP-II) No Question 1 Features of Java. QUESTIONS BANK (CP-II) ( Using java) QUESTIONS BANK (CP-II) or Java Features:- (1) Java Is Small and Simple Java is modeled after C and C++. The object-oriented

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

The Java Language Implementation

The Java Language Implementation CS 242 2012 The Java Language Implementation Reading Chapter 13, sections 13.4 and 13.5 Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches, pages 1 5. Outline Java virtual

More information

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu and Toshio Nakatani IBM Research Tokyo IBM Research T.J. Watson Research Center April

More information

Building a Compiler with. JoeQ. Outline of this lecture. Building a compiler: what pieces we need? AKA, how to solve Homework 2

Building a Compiler with. JoeQ. Outline of this lecture. Building a compiler: what pieces we need? AKA, how to solve Homework 2 Building a Compiler with JoeQ AKA, how to solve Homework 2 Outline of this lecture Building a compiler: what pieces we need? An effective IR for Java joeq Homework hints How to Build a Compiler 1. Choose

More information

Java TM. Multi-Dispatch in the. Virtual Machine: Design and Implementation. Computing Science University of Saskatchewan

Java TM. Multi-Dispatch in the. Virtual Machine: Design and Implementation. Computing Science University of Saskatchewan Multi-Dispatch in the Java TM Virtual Machine: Design and Implementation Computing Science University of Saskatchewan Chris Dutchyn (dutchyn@cs.ualberta.ca) September 22, 08 Multi-Dispatch in the Java

More information

Certified Core Java Developer VS-1036

Certified Core Java Developer VS-1036 VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure

More information

Translating JVM Code to MIPS Code 1 / 43

Translating JVM Code to MIPS Code 1 / 43 Translating JVM Code to MIPS Code 1 / 43 Outline 1 Introduction 2 SPIM and the MIPS Architecture 3 Our Translator 2 / 43 Introduction Compilation is not necessarily done after the class file is constructed

More information

The Hardware/Software Interface CSE351 Spring 2015

The Hardware/Software Interface CSE351 Spring 2015 The Hardware/Software Interface CSE351 Spring 2015 Lecture 26 Instructor: Katelin Bailey Teaching Assistants: Kaleo Brandt, Dylan Johnson, Luke Nelson, Alfian Rizqi, Kritin Vij, David Wong, and Shan Yang

More information

Code Profiling. CSE260, Computer Science B: Honors Stony Brook University

Code Profiling. CSE260, Computer Science B: Honors Stony Brook University Code Profiling CSE260, Computer Science B: Honors Stony Brook University http://www.cs.stonybrook.edu/~cse260 Performance Programs should: solve a problem correctly be readable be flexible (for future

More information

COMP 520 Fall 2009 Virtual machines (1) Virtual machines

COMP 520 Fall 2009 Virtual machines (1) Virtual machines COMP 520 Fall 2009 Virtual machines (1) Virtual machines COMP 520 Fall 2009 Virtual machines (2) Compilation and execution modes of Virtual machines: Abstract syntax trees Interpreter AOT-compile Virtual

More information

Announcements. My office hours are today in Gates 160 from 1PM-3PM. Programming Project 3 checkpoint due tomorrow night at 11:59PM.

Announcements. My office hours are today in Gates 160 from 1PM-3PM. Programming Project 3 checkpoint due tomorrow night at 11:59PM. IR Generation Announcements My office hours are today in Gates 160 from 1PM-3PM. Programming Project 3 checkpoint due tomorrow night at 11:59PM. This is a hard deadline and no late submissions will be

More information

Taming the Java Virtual Machine. Li Haoyi, Chicago Scala Meetup, 19 Apr 2017

Taming the Java Virtual Machine. Li Haoyi, Chicago Scala Meetup, 19 Apr 2017 Taming the Java Virtual Machine Li Haoyi, Chicago Scala Meetup, 19 Apr 2017 Who Am I? Previously: Dropbox Engineering Currently: Bright Technology Services - Data Science, Scala consultancy Fluent Code

More information

CSC 4181 Handout : JVM

CSC 4181 Handout : JVM CSC 4181 Handout : JVM Note: This handout provides you with the basic information about JVM. Although we tried to be accurate about the description, there may be errors. Feel free to check your compiler

More information

Chapter 5. A Closer Look at Instruction Set Architectures

Chapter 5. A Closer Look at Instruction Set Architectures Chapter 5 A Closer Look at Instruction Set Architectures Chapter 5 Objectives Understand the factors involved in instruction set architecture design. Gain familiarity with memory addressing modes. Understand

More information

Lecture 4: Instruction Set Architecture

Lecture 4: Instruction Set Architecture Lecture 4: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation Reading: Textbook (5 th edition) Appendix A Appendix B (4 th edition)

More information

Where We Are. Lexical Analysis. Syntax Analysis. IR Generation. IR Optimization. Code Generation. Machine Code. Optimization.

Where We Are. Lexical Analysis. Syntax Analysis. IR Generation. IR Optimization. Code Generation. Machine Code. Optimization. Where We Are Source Code Lexical Analysis Syntax Analysis Semantic Analysis IR Generation IR Optimization Code Generation Optimization Machine Code Where We Are Source Code Lexical Analysis Syntax Analysis

More information

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace Project there are a couple of 3 person teams regroup or see me or forever hold your peace a new drop with new type checking is coming using it is optional 1 Compiler Architecture source code Now we jump

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 44: Interpreters Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg [1] Compiler

More information

Lecture 2: The Art of Emulation

Lecture 2: The Art of Emulation CSCI-GA.3033-015 Virtual Machines: Concepts & Applications Lecture 2: The Art of Emulation Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Disclaimer: Many slides of this lecture are based

More information

1. Introduction to the Common Language Infrastructure

1. Introduction to the Common Language Infrastructure Miller-CHP1.fm Page 1 Wednesday, September 24, 2003 1:50 PM to the Common Language Infrastructure The Common Language Infrastructure (CLI) is an International Standard that is the basis for creating execution

More information

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Instruction Set Principles The Role of Compilers MIPS 2 Main Content Computer

More information

Understand the factors involved in instruction set

Understand the factors involved in instruction set A Closer Look at Instruction Set Architectures Objectives Understand the factors involved in instruction set architecture design. Look at different instruction formats, operand types, and memory access

More information

CSc 453. Compilers and Systems Software. 18 : Interpreters. Department of Computer Science University of Arizona. Kinds of Interpreters

CSc 453. Compilers and Systems Software. 18 : Interpreters. Department of Computer Science University of Arizona. Kinds of Interpreters CSc 453 Compiler source Lexer tokens Parser AST Compilers and Systems Software 18 : Interpreters VM Code Gen IR Interm. Code Gen AST Semantic Analyser Department of Computer Science University of Arizona

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 Towards JVM Dynamic Languages Toolchain Insert Picture Here Attila

More information

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C Final Review CS304 Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation

More information

Compiler construction 2009

Compiler construction 2009 Compiler construction 2009 Lecture 3 JVM and optimization. A first look at optimization: Peephole optimization. A simple example A Java class public class A { public static int f (int x) { int r = 3; int

More information

CSc 553. Principles of Compilation. 2 : Interpreters. Department of Computer Science University of Arizona

CSc 553. Principles of Compilation. 2 : Interpreters. Department of Computer Science University of Arizona CSc 553 Principles of Compilation 2 : Interpreters Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2011 Christian Collberg Compiler source Lexer tokens Parser AST VM

More information

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions Structure of von Nuemann machine Arithmetic and Logic Unit Input Output Equipment Main Memory Program Control Unit 1 1 Instruction Set - the type of Instructions Arithmetic + Logical (ADD, SUB, MULT, DIV,

More information

Jaos - Java on Aos. Oberon Event 03 Patrik Reali

Jaos - Java on Aos. Oberon Event 03 Patrik Reali Jaos - Java on Aos Oberon Event 03 Patrik Reali 1 Agenda! Oberon vs. Java! Java for Aos! Type Mapping! Compiling! Linking! Exceptions! Native Methods! Concurrency! Special Topics! Strings! Overloading!

More information

Trace Compilation. Christian Wimmer September 2009

Trace Compilation. Christian Wimmer  September 2009 Trace Compilation Christian Wimmer cwimmer@uci.edu www.christianwimmer.at September 2009 Department of Computer Science University of California, Irvine Background Institute for System Software Johannes

More information

Computer Systems A Programmer s Perspective 1 (Beta Draft)

Computer Systems A Programmer s Perspective 1 (Beta Draft) Computer Systems A Programmer s Perspective 1 (Beta Draft) Randal E. Bryant David R. O Hallaron August 1, 2001 1 Copyright c 2001, R. E. Bryant, D. R. O Hallaron. All rights reserved. 2 Contents Preface

More information

Instruction Set Principles and Examples. Appendix B

Instruction Set Principles and Examples. Appendix B Instruction Set Principles and Examples Appendix B Outline What is Instruction Set Architecture? Classifying ISA Elements of ISA Programming Registers Type and Size of Operands Addressing Modes Types of

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

Improving Java Performance

Improving Java Performance Improving Java Performance #perfmatters Raimon Ràfols ...or the mumbo-jumbo behind the java compiler Agenda - Disclaimer - Who am I? - Our friend the java compiler - Language additions & things to consider

More information

Notes of the course - Advanced Programming. Barbara Russo

Notes of the course - Advanced Programming. Barbara Russo Notes of the course - Advanced Programming Barbara Russo a.y. 2014-2015 Contents 1 Lecture 2 Lecture 2 - Compilation, Interpreting, and debugging........ 2 1.1 Compiling and interpreting...................

More information

Static Analysis of Dynamic Languages. Jennifer Strater

Static Analysis of Dynamic Languages. Jennifer Strater Static Analysis of Dynamic Languages Jennifer Strater 2017-06-01 Table of Contents Introduction............................................................................... 1 The Three Compiler Options...............................................................

More information

Chapter 5:: Target Machine Architecture (cont.)

Chapter 5:: Target Machine Architecture (cont.) Chapter 5:: Target Machine Architecture (cont.) Programming Language Pragmatics Michael L. Scott Review Describe the heap for dynamic memory allocation? What is scope and with most languages how what happens

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

CS252 Spring 2017 Graduate Computer Architecture. Lecture 18: Virtual Machines

CS252 Spring 2017 Graduate Computer Architecture. Lecture 18: Virtual Machines CS252 Spring 2017 Graduate Computer Architecture Lecture 18: Virtual Machines Lisa Wu, Krste Asanovic http://inst.eecs.berkeley.edu/~cs252/sp17 WU UCB CS252 SP17 Midterm Topics ISA -- e.g. RISC vs. CISC

More information

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Atelier Java - J1. Marwan Burelle.  EPITA Première Année Cycle Ingénieur. marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 3 4 Plan 1 2 3 4 A Bit of History JAVA was created in 1991 by James Gosling of SUN. The first public implementation (v1.0) in 1995.

More information

CMSC 430 Introduction to Compilers. Spring Intermediate Representations and Bytecode Formats

CMSC 430 Introduction to Compilers. Spring Intermediate Representations and Bytecode Formats CMSC 430 Introduction to Compilers Spring 2016 Intermediate Representations and Bytecode Formats Introduction Front end Source code Lexer Parser Types AST/IR IR 2 IR n IR n.s Middle end Back end Front

More information

Chapter 5. Names, Bindings, and Scopes

Chapter 5. Names, Bindings, and Scopes Chapter 5 Names, Bindings, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Scope Scope and Lifetime Referencing Environments Named Constants 1-2 Introduction Imperative

More information

javac 29: pop 30: iconst_0 31: istore_3 32: jsr [label_51]

javac 29: pop 30: iconst_0 31: istore_3 32: jsr [label_51] Analyzing Control Flow in Java Bytecode Jianjun Zhao Department of Computer Science and Engineering Fukuoka Institute of Technology 3-10-1 Wajiro-Higashi, Higashi-ku, Fukuoka 811-02, Japan zhao@cs.t.ac.jp

More information

Typical Processor Execution Cycle

Typical Processor Execution Cycle Typical Processor Execution Cycle Instruction Fetch Obtain instruction from program storage Instruction Decode Determine required actions and instruction size Operand Fetch Locate and obtain operand data

More information

Chapter 2: Instructions How we talk to the computer

Chapter 2: Instructions How we talk to the computer Chapter 2: Instructions How we talk to the computer 1 The Instruction Set Architecture that part of the architecture that is visible to the programmer - instruction formats - opcodes (available instructions)

More information