The Simplest Heuristics May Be The Best in Java JIT Compilers

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

Tuning of Loop Cache Architectures to Programs in Embedded System Design Susan Cotterell and Frank Vahid Department of Computer Science and Engineering.
Overview Motivations Basic static and dynamic optimization methods ADAPT Dynamo.
Linear Obfuscation to Combat Symbolic Execution Zhi Wang 1, Jiang Ming 2, Chunfu Jia 1 and Debin Gao 3 1 Nankai University 2 Pennsylvania State University.
Online Performance Auditing Using Hot Optimizations Without Getting Burned Jeremy Lau (UCSD, IBM) Matthew Arnold (IBM) Michael Hind (IBM) Brad Calder (UCSD)
The Use of Traces for Inlining in Java Programs Borys J. Bradel Tarek S. Abdelrahman Edward S. Rogers Sr.Department of Electrical and Computer Engineering.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
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.
Linear Scan Register Allocation POLETTO ET AL. PRESENTED BY MUHAMMAD HUZAIFA (MOST) SLIDES BORROWED FROM CHRISTOPHER TUTTLE 1.
1 Chapter-01 Introduction to Computers and C++ Programming.
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
CS 355 – Programming Languages
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
1 A Simple but Realistic Assembly Language for a Course in Computer Organization Eric Larson Moon Ok Kim Seattle University October 25, 2008.
7. Just In Time Compilation Prof. O. Nierstrasz Jan Kurs.
CS1Q Computer Systems Lecture 14 Simon Gay. Lecture 14CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.
Adaptive Optimization in the Jalapeño JVM Matthew Arnold Stephen Fink David Grove Michael Hind Peter F. Sweeney Source: UIUC.
Lecture 10 : Introduction to Java Virtual Machine
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Roopa.T PESIT, Bangalore. Source and Credits Dalvik VM, Dan Bornstein Google IO 2008 The Dalvik virtual machine Architecture by David Ehringer.
Buffered dynamic run-time profiling of arbitrary data for Virtual Machines which employ interpreter and Just-In-Time (JIT) compiler Compiler workshop ’08.
1 Instruction Sets and Beyond Computers, Complexity, and Controversy Brian Blum, Darren Drewry Ben Hocking, Gus Scheidt.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 2.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
CSE 598c – Virtual Machines Survey Proposal: Improving Performance for the JVM Sandra Rueda.
Introduction to OOP CPS235: Introduction.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
1 Sections Java Virtual Machine and Byte Code Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Evolution and History of Programming Languages
Double and Multiple Sampling Plan
COMP 2100 From Python to Java
Visit for more Learning Resources
14 Compilers, Interpreters and Debuggers
Overview of Compilers and Language Translation
Compiler, Interpreter, and Bootstrapping
Introduction to programming
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Introduction to Computer Science
Programming Language Hierarchy, Phases of a Java Program
Chapter 1 Introduction to Computers, Programs, and Java
A Closer Look at Instruction Set Architectures
Chapter 9 – Real Memory Organization and Management
Lecture 1 Runtime environments.
Multi-Dispatch in the Java™ Virtual Machine
Introduction to Java Dept. Business Computing University of Winnipeg
Mobile Development Workshop
“just-in-time” compilation (JIT) technique prepared by - Harshada Hole
Chapter 14: Protection.
CSc 453 Interpreters & Interpretation
Adaptive Code Unloading for Resource-Constrained JVMs
Mock Object Creation for Test Factoring
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
(Computer fundamental Lab)
Optimization 薛智文 (textbook ch# 9) 薛智文 96 Spring.
A Level Computer Science Topic 5: Computer Architecture and Assembly
Interpreting Java Program Runtimes
Reasons To Study Programming Languages
COMP755 Advanced Operating Systems
Programming language translators
CSc 453 Interpreters & Interpretation
Just In Time Compilation
Presentation transcript:

The Simplest Heuristics May Be The Best in Java JIT Compilers ACM SIGPLAN 2003 Presented by Mithuna Soundararaj 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivation Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Introduction Simplest strategy in Java JIT compiler is to compile each java method the first time it is called. Better performance if selectively compiled Selectively compiled based on some heuristics like Frequency of method calls Size of the method More complicated heuristics do not provide any additional benefits. 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivation Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Motivation To see how addition of selective compilation heuristics can improve the performance of a particular existing Virtual machine and JIT compiler. To speed up, the slow start up time of many graphical user interfaces,which may lead to users changing their behavior regarding the application. 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivation Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

Architecture of JVM and JIT Java Class Loaded Initialization for JIT usage Invoker Field->JIT compiler When method compiled, JIT translates method’s byte code to native code When method Re Invoked Invoker Field->Generated m/c code Executes machine code or native code 11/8/2018 University of Nebraska, Lincoln

Compiling Methods: Original VS Modified JVM Originally in sun versions of sunwjit Methods are compiled unconditionally the first time they are called Methods interpreted when JIT suppressed by command line JIT internal error while compiling Method belongs to primordial class In the modified version of sunwjit by caldera, Selective compilation is introduced. 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivations Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

Selective compilation Selectively compiling methods based on heuristics like Simple heuristics Based on frequency of method execution Based on size of methods Complicated heuristics “Jit when jitted” heuristic “Square decision” heuristic “Backward branches” heuristic “core classes known to compile” heuristic 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivations Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

Frequency of Method Call To compile methods that are likely to be executed most number of time. Methods compiled many times are likely to be executed many times in the future as well Environment variable set to some positive integer N Method will be compiled after it has executed N times as set in the environment variable 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Method Size Heuristic depends on bytes of byte code for the method Larger method take longer to execute and compile? Compile a small method that’s going to execute only once? Compile large methods that execute many times? 11/8/2018 University of Nebraska, Lincoln

Boundaries of the decision Point where a method size is big enough that you want to compile it Even if it executes once( large methods) Point where method compiled, if it executes a certain number of times. Even if it is very small 11/8/2018 University of Nebraska, Lincoln

Selective Compilation Based on Method size and times executed 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivations Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

Results-Simple heuristics 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Start up time results Startup time is important for psychological reasons(an area ripe for optimization) 77% of execution time java compilation over head, occurs in the initial 10% of program execution 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Profiling results 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Profiling results 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Profiling results 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Outline Introduction Motivation Background Selective Compilation Simple heuristics Results Complicated heuristics Conclusion 11/8/2018 University of Nebraska, Lincoln

Complicated heuristics “Jit when called by jitted “ heuristic Compile method X =>compile every method X calls To take advantage of locality of reference Method X gets used a lot => methods Y, Z etc.that X calls will get used a lot too. Compile Y,Z right away Tarantella object manager is 20% , SwingSet2 is 21% slower and javac is 3% slower to startup and run respectively No test results run faster with it => no locality of reference exists. 11/8/2018 University of Nebraska, Lincoln

Complicated Heuristics “Square decision” heuristic Decision could be either-or: if a method exceeds the minimum size or minimum number of times to be executed, it is compiled Shape of the graph would be a right angle between JIT_MIN_TIMES and JIT_MIN_SIZE SPEC JVM98 is 1% slower and Tarantella Object manager startup is 3% worse than the default scheme This scheme was found to be less flexible than the default scheme, hence not used 11/8/2018 University of Nebraska, Lincoln

Complicated Heuristics Method size in bytes “Square decision” heuristic 11/8/2018 University of Nebraska, Lincoln

Complicated heuristics “backward branches” heuristic Identifies backward branches in methods Assume the branches are loops and hot spots Such methods would be compiled immediately (as in IBM JIT compiler) Implementing this heuristic in SCO/Caldera JIT difficult Similar results to default scheme 11/8/2018 University of Nebraska, Lincoln

Complicated heuristics “core classes known to compile” heuristic Uses data captured by off line profiling Decisions on whether to compile a method immediately- made at the beginning of the application execution Based on whether it is “known that the method will reach its “crossover point” where compilation is sure to be beneficial. Optimizations no more transparent to the user Lot of off-line processing, user visible feedback loop Used efficiently in java core libraries that are used heavily in all applications Javac was 9% faster and SPEC JVM98 was 2% better. 11/8/2018 University of Nebraska, Lincoln

Summary of previous work IBM JIT compiler no of times method executes; modified by detection of loops HP JIT(for embedded ) Minimum execution of 2 times before compilation Krintz and calder used metrics found by experiment 25% of most frequently executed methods must be compiled for optimum performance Use profiling data to identify those 25% methods offline 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Conclusion Adding simple selective compilation heuristics, to an existing Java JIT compiler significantly improves its performance for short and medium-lived applications and for start-up time in longer-lived applications Results have shown that the combined decision strategy is superior to either one or to unconditionally compiling and not using JIT at all 11/8/2018 University of Nebraska, Lincoln

University of Nebraska, Lincoln Thank You! Questions?? 11/8/2018 University of Nebraska, Lincoln