Just-In-Time Compilation. Introduction Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Operating Systems Components of OS
Ahead of Time Dynamic Translation PreJit/NGEN by any other name George Bosworth Microsoft MRE04 March 21, 2004.
IBM JIT Compilation Technology AOT Compilation in a Dynamic Environment for Startup Time Improvement Kenneth Ma Marius Pirvu Oct. 30, 2008.
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
CPU Review and Programming Models CT101 – Computing Systems.
Overview Motivations Basic static and dynamic optimization methods ADAPT Dynamo.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Systems Software.
History of.Net Introduced by Microsoft Earlier technology was VC++ and VB VC++ comes with so many library and VB was so easy to use and not flexible to.
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Overview of the.NET Framework. What is the.NET Framework A new computing platform designed to simplify application development A consistent object-oriented.
Programming Our First Java Program Yingcai Xiao. What to Do Set up for Java Programming Write our first Java Program with IDE Write our first Java Program.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Data Structure and Algorithm 1 Yingcai Xiao. You Me The Course (
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Programming A Historic Perspective on Code Reuse Yingcai Xiao.
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
Development of Computer - Story of Steve. What is a computer A high intelligence machine A tool – make our life much convenient A very loyal servant Pretty.
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Chapter 3 Memory Management: Virtual Memory
Introduction to .Net Framework
CS 355 – Programming Languages
.NET Overview. 2 Objectives Introduce.NET –overview –languages –libraries –development and execution model Examine simple C# program.
.NET Framework & C#.
Introduction to .NET Framework
Understanding Code Compilation and Deployment Lesson 4.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
Introduction .NET Framework
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
MSIL & CLI Kun-Yuan Shieh.
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Languages and IDE (Integrated Development Environment)
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
Virtual Machines, Interpretation Techniques, and Just-In-Time Compilers Kostis Sagonas
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
Next Generation ISA Itanium / IA-64. Operating Environments IA-32 Protected Mode/Real Mode/Virtual Mode - if supported by the OS IA-64 Instruction Set.
Object Oriented Software Development 4. C# data types, objects and references.
Common Language Runtime Introduction  The common language runtime is one of the most essential component of the.Net Framework.  It acts.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Software Engineering Algorithms, Compilers, & Lifecycle.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Introduction to the Microsoft.NET Framework Chris Wastchak Student Ambassador to Microsoft.
Introduction to Operating Systems Concepts
Computer System Structures
.NET Framework.
Interpreted languages Jakub Yaghob
Introduction to programming
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Java programming lecture one
2.1. Compilers and Interpreters
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
“just-in-time” compilation (JIT) technique prepared by - Harshada Hole
Introduction to .NET By : Mr. V. D. Panchal Content :
Module 10: Implementing Managed Code in the Database
(Computer fundamental Lab)
Programming language translators
M S COLLEGE ART’S, COMM., SCI. & BMS
Just In Time Compilation
Presentation transcript:

Just-In-Time Compilation

Introduction Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance of computer programs. Traditionally, computer programs had two modes of runtime operation, either interpreted or static (ahead-of-time) compilation. JIT compilers represent a hybrid approach, with translation occurring continuously, as with interpreters, but with caching of translated code to minimize performance degradation.

Just-In-Time Compiler

Just-In-Time Compilation Functional Duties: Class Loader – Resolves type references and loads assemblies into memory to be consumed by the verifier and JIT Compiler JIT Compiler – Runtime component that compiles the MSIL stream into native code – Compares MSIL stream to metadata and verifies that the code is safe and legal (Verification)

JIT Options for Application Developers.NET provides two JIT compilers and an install-time JIT option: A “normal” JIT compiler, designed to provide the expected optimization when compiling MSIL to native code The same level of optimization you might expect from a C compiler This makes the compilation process take longer than otherwise Ngen.exe, MSIL code is “pre-JIT’ed” or “zapped” and the native image is cached for future use

Just-In-Time Compilation IL must be compiled to native code in order to run – No files with *.il extensions involved – Multiple JIT compilers for differing processor architectures – Code compiled on an “as needed” basis – Method cached and subsequent calls are not recompiled – Can revert back to a stub using code pitching Reduces memory footprint

Calling a method for the first time Managed EXE Shared Sub Main() Console.WriteLine(“Paul”) Console.WriteLine(“Cross”) End Sub Console Shared Sub WriteLine() Shared Sub WriteLine(String) (remaining members ) Jitter … MSCorEE.dll Function Jitter 1.In the assembly that implements the type (Console), look up the method (WriteLine) being called in the metadata. 2.From the metadata, get the IL for this method. 3.Allocate a block of memory. 4.Compile the IL into native code; save the code in the memory allocated in step 3. 5.Modify the method’s entry in the Type’s table so that it now points to the memory block allocated in step 3. 6.Jump to the native code contained inside the memory block. End Function Native code

Just-In-Time Compilation

JIT Features Platform Independence – Realized when high-level language compilers convert source code to platform agnostic MSIL code – The application or software component is distributed in this form – JIT compiles to native code either at runtime or at install time

JIT Features Language Interoperability – Occurs when different language compilers compile to language-agnostic MSIL code – Metadata and the Common Type System play a major role in cross-language and platform independence

JIT Features Runtime Stack Manipulation – The JIT Compiler populates important data structures for object tracking and specific stack-frame construction – The JIT Compiler can be used to identify specific code elements as they are consumed, i.e., exception handlers and security descriptors

JIT Optimizations Small Memory Footprint – JIT compilation takes advantage of the possibility that some code may never be used – The JIT Compiler compiles methods only as needed

JIT Optimization Contiguous Native Code Alignment – The runtime method is optimized for fast data access – The execution engine has the option of aligning native function images in memory Lends for a smaller footprint Speeds up CPU access to memory where code is stored

JIT Compilation must be slow The “Nays”: – Unmanaged code is pre-compiled and can just execute – Managed code requires 2 compilation phases Compiler produces IL IL compiled to native code at runtime, requiring more memory to be allocated, and additional CPU cycles

JIT Compilation is actually pretty fast Reasons why this may be the case: – JIT compiler knows more about the execution environment than an unmanaged compiler would know – JIT compiler can take advantage of instructions offered by the chip that the unmanaged compiler knows nothing about – JIT compiler could detect that a certain test is always false, and short-circuit – The CLR could profile the code’s execution and recompile the IL on the fly reducing branching, etc.

The End …… Thank You ……