JIT in webkit. What’s JIT See time_compilation for more info.http://en.wikipedia.org/wiki/Just-in- time_compilation.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

Instruction Set Design
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
The Assembly Language Level
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++
Prof. Necula CS 164 Lecture 141 Run-time Environments Lecture 8.
1 Registers and MAL - Part I. Motivation So far there are some details that we have ignored instructions can have different formats most computers have.
1 Chapter 7: Runtime Environments. int * larger (int a, int b) { if (a > b) return &a; //wrong else return &b; //wrong } int * larger (int *a, int *b)
CS 536 Spring Run-time organization Lecture 19.
3/17/2008Prof. Hilfinger CS 164 Lecture 231 Run-time organization Lecture 23.
Run-Time Storage Organization
1 Pertemuan 20 Run-Time Environment Matakuliah: T0174 / Teknik Kompilasi Tahun: 2005 Versi: 1/6.
Chapter 13 Reduced Instruction Set Computers (RISC) Pipelining.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
From Cooper & Torczon1 Implications Must recognize legal (and illegal) programs Must generate correct code Must manage storage of all variables (and code)
Chapter 9: Subprogram Control
Run-time Environment and Program Organization
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
A Java Virtual Machine (JVM) enables a set of computer software programs and data structures to use a virtual machine model for the execution of other.
5.3 Machine-Independent Compiler Features
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Universal Concepts of Programming Creating and Initializing local variables on the stack Variable Scope and Lifetime Stack Parameters Stack Frames Passing.
Fast, Effective Code Generation in a Just-In-Time Java Compiler Rejin P. James & Roshan C. Subudhi CSE Department USC, Columbia.
A genda for Today What is memory management Source code to execution Address binding Logical and physical address spaces Dynamic loading, dynamic linking,
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
C++ for Engineers and Scientists Second Edition Chapter 6 Modularity Using Functions.
Runtime Environments Compiler Construction Chapter 7.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
Compiler Construction
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
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.
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Operating Systems Lecture No. 2. Basic Elements  At a top level, a computer consists of a processor, memory and I/ O Components.  These components are.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Operand Addressing And Instruction Representation Cs355-Chapter 6.
Chapter 7 Object Code Generation. Chapter 7 -- Object Code Generation2  Statements in 3AC are simple enough that it is usually no great problem to map.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter# 6 Code generation.  The final phase in our compiler model is the code generator.  It takes as input the intermediate representation(IR) produced.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
Object Oriented Software Development 4. C# data types, objects and references.
Introduction to OOP CPS235: Introduction.
Procedures and Functions Procedures and Functions – subprograms – are named fragments of program they can be called from numerous places  within a main.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Internet Computing Module II. Syllabus Creating & Using classes in Java – Methods and Classes – Inheritance – Super Class – Method Overriding – Packages.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Just-In-Time Compilation. Introduction Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance.
Dr. Hussien Sharaf Dr Emad Nabil. Dr. Hussien M. Sharaf 2 position := initial + rate * Lexical analyzer 2. Syntax analyzer id 1 := id 2 + id 3 *
Code Generation Instruction Selection Higher level instruction -> Low level instruction Register Allocation Which register to assign to hold which items?
Visit for more Learning Resources
Advanced Architectures
CSCI206 - Computer Organization & Programming
Memory COMPUTER ARCHITECTURE
Interpreted languages Jakub Yaghob
Introduction to programming
Run-time organization
Computer Architecture and the Fetch-Execute Cycle
Code Shape IV Procedure Calls & Dispatch
What time is it?. What time is it? Major Concepts: a data structure model: basic representation of data, such as integers, logic values, and characters.
Binding Times Binding is an association between two things Examples:
Embedded System Development Lecture 13 4/11/2007
point when a program element is bound to a characteristic or property
1.3.7 High- and low-level languages and their translators
SPL – PS3 C++ Classes.
Presentation transcript:

JIT in webkit

What’s JIT See time_compilation for more info. time_compilation Just-in-time compilation Also known as dynamic translation, is a technique for improving the runtime performance of a computer program.

Normal way Either interpreted or static (ahead of time) compilation. Interpreted code is translated from a high- level language to a machine code continuously during every execution, whereas statically compiled code is translated into machine code before execution, and only requires this translation once.

JIT way JIT compilers represent a hybrid approach, with translation occurring continuously, as with interpreters, but with caching of translated code to minimize performance degradation. It also offers other advantages over statically compiled code at development time, such as handling of late-bound data types and the ability to enforce security guarantees.

Startup delay and optimizations JIT typically causes a slight delay in initial execution of an application, due to the time taken to load and compile the bytecode. Sometimes this delay is called "startup time delay". In general, the more optimization JIT performs, the better the code it will generate, but the initial delay will also increase.

Webkit JIT -- SquirellFish Extreme interface between jit and C++ The way of argument passing. In SquirellFish Extreme the arguments are never freed, however. The same argument list is passed to the high level C++ callback functions again and again. On arm, the return address is stored in the link register.

Webkit JIT -- SquirellFish Extreme constructing constants 1 Among other things, one interesting advantage of dynamically generated code is that constants can be embedded into the instruction stream. WebKit JIT goes one step further: you can also rewrite constants which are not even known at JIT compilation time. Those constants typically hold cached values used by some fast cases.

Webkit JIT -- SquirellFish Extreme constructing constants 2 -- impl On x86 based machines, these features are rather easy to implement, since instructions have a 32 bit immediate field, which is enough to hold any immediate value. On ARM, we only have an 8 bit immediate field, which can be rotated by an even number. Therefore, we sometimes need 4 instructions to create a 32 bit number.

Webkit JIT -- SquirellFish Extreme property caching madness Dynamic languages like JavaScript have a lot of interesting fetures: we can create or destroy new classes during runtime or assign anything to any variable regardless of its type. Property and call target caching to speed up. Property caching is based on the observation that the type of a value at a given code location is the same most of the time even for dynamic languages.

Webkit JIT -- SquirellFish Extreme property caching madness -- more Resolving an identifier using the current scope chain or using a member of an object is a very slow operation. How can we make it faster? Let's cache the type and the result of the last resolve operation. Next time, when this particular location is reached again, we only have to compare the type of the variable to the cached type. If they are the same, we can use the cached value. This is true for function calls as well.

Webkit JIT -- SquirellFish Extreme impl more detail Use map to get one rwx memory area to store the generated machine code, the same thing as the code area of normal executing mode. Least operation on stack, use register instead. Including parameter and return value of js function. The same for C++ callback invoke from js function.

The end That’s all. Thank you!