The JavaScriptCore Virtual Machine. Filip Pizlo Apple Inc.
|
|
- Theodora McDowell
- 5 years ago
- Views:
Transcription
1 The JavaScriptCore Virtual Machine Filip Pizlo Apple Inc.
2 3 Pizlo Keynotes / Week ICCV 17 Symmetry as the fundamental prior in human 3D vision Zygmunt Pizlo
3 webkit.org
4 Safari
5 What JSC Supports ECMAScript WebAssembly
6 What JSC Supports ECMAScript WebAssembly
7 Architecture
8 Architecture Interpreters and JITs Object Model Type Inference Garbage Collector
9 Interpreters and JITs
10 Four Tiers LLInt (interpreter) Baseline (template JIT) DFG (less optimizing JIT) FTL (optimizing JIT) latency throughput
11 Four tiers for JavaScript Two tiers for WebAssembly Two tiers for regular expressions
12 Four tiers for JavaScript Two tiers for WebAssembly Two tiers for regular expressions
13 Four Tiers How we tier up How the tiers work How we OSR exit
14 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency time
15 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency LLInt time
16 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency LLInt trigger time
17 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency LLInt trigger baseline compiler time
18 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency LLInt trigger baseline compiler LLInt time
19 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency baseline compiler LLInt trigger LLInt OSR time
20 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency baseline compiler DFG compiler FTL compiler LLInt trigger LLInt OSR Baseline trigger Baseline OSR DFG trigger DFG OSR FTL time
21 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency 0.12ms baseline compiler DFG compiler FTL compiler LLInt trigger LLInt OSR Baseline trigger Baseline OSR DFG trigger DFG OSR FTL time
22 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency 0.12ms baseline compiler 0.48ms DFG compiler FTL compiler LLInt trigger LLInt OSR Baseline trigger Baseline OSR DFG trigger DFG OSR FTL time
23 "use strict"; let result = 0; for (let i = 0; i < ; ++i) { let o = {f: i}; result += o.f; } print(result); concurrency 0.12ms 0.48ms 2.86ms baseline compiler DFG compiler FTL compiler LLInt trigger LLInt OSR Baseline trigger Baseline OSR DFG trigger DFG OSR FTL time
24 How We Tier Up Counting trigger Concurrent JITs Parallel JITs OSR
25 Profiling LLInt (interpreter) Baseline (template JIT) DFG (less optimizing JIT) FTL (optimizing JIT)
26 Speculation and OSR LLInt (interpreter) Baseline (template JIT) DFG (less optimizing JIT) FTL (optimizing JIT)
27 Parser AST unlinked bytecode Bytecompiler Generatorification bytecode Bytecode Linker LLInt Baseline Bytecode Template JIT DFG DFG Bytecode Parser DFG Optimizer FTL DFG Bytecode Parser Extended DFG Optimizer DFG IR DFG Backend FTL-to-B3 lowering B3 Optimizer B3 IR Instruction Selection Air Optimizer Air Air Backend
28 function foo(a, b) { return a + b; }
29 [ 0] enter [ 1] get_scope loc3 [ 3] mov loc4, loc3 [ 6] check_traps [ 7] add loc6, arg1, arg2 [ 12] ret loc6
30 [ 0] enter [ 1] get_scope loc3 [ 3] mov loc4, loc3 [ 6] check_traps [ 7] add loc6, arg1, arg2 [ 12] ret loc6
31 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid) 28: W:SideState, Exits, bc#12) arg1 arg2 Add Return
32 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
33 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
34 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
35 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
36 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
37 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
38 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
39 [ 7] add loc6, arg1, arg2 23: arg1(b<int32>/flushedint32), R:Stack(6), bc#7) 24: arg2(c<boolint32>/flushedint32), R:Stack(7), bc#7) 25: CheckOverflow, Exits, bc#7) 26: loc6, W:SideState, ClobbersExit, bc#7, ExitInvalid)
40 DFG SSA state arg1 arg2 Add Return
41 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 Add Return
42 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 Add Return
43 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 Add MovHint Return
44 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 Add MovHint Return
45 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 25: Add MovHint Return
46 DFG SSA state DFG Exit state arg1 loc0 loc1 loc3 loc4 loc5 loc6 arg2 25: Add MovHint Return loc6
47 OSR exit
48 Deoptimization OSR exit Invalidation Jettison
49 = Trunc(@27, DFG:@25) = Trunc(@22, DFG:@25) = generator = 0x109ec5b90, earlyclobbered = [], lateclobbered = [], usedregisters = [], ExitsSideways Reads:Top, DFG:@25) = ZExt32(@39, DFG:@28) = Add(@40, $ (@13), DFG:@28) = Return(@41, Terminal, DFG:@28)
50 Patch &BranchAdd32, Overflow, %tmp4, %tmp5, Move32 %tmp3, Add64 %tmp1, %tmp2, Move %tmp0, Ret64
51 Patch &BranchAdd32, Overflow, %rcx, %rdx, Add64 %rdx, %rax, Ret64
52 add %ecx, %edx jo 0x267160c025ed add %rdx, %rax
53 Optimizations Generatorification Inlining Strength Reduction CSE (local and global) LICM Type/Bounds/Overflow Check Removal Object Allocation Sinking Arguments/Varargs Elimination Sparse Conditional Constant Propagation Barrier Placement Strength Reduction Tail Duplication Switch Inference Float Inference DCE Register Allocation Linear Scan Briggs Iterated Register Coalescing Stack Allocation
54 Interpreters and JITs Optimized for breadth Four tiers Many optimizations in many IRs Speculative
55 Object Model
56 {x: 1, y: 2} {x: 42, y: 3} {x: -5, y: 7}
57 {x, y} {1, 2} {42, 3} {-5, 7}
58 prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
59 structure prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
60 Mono Proto Poly Proto proto proto 1 {1, 2} {x, y} global object {1, 2} {x, y} global object {-5, 7} {42, 3} {-5, 7} {42, 3} proto 2 poly proto just landed last and I have been working on it for ~2 months
61 Structures Fast property access Property type inference Immutable property inference Prototype optimizations
62 JSC Object Model structure ID indexing type flags cell state butterfly pointer inline slot 0 inline slot 1 public length vector length out of line slot 0 array slot 0
63 JSC Object Model 64 bits 64 bits 64 bits 64 bits structure ID indexing type flags cell state butterfly pointer inline slot 0 inline slot 1 64 bits 64 bits 64 bits public length vector length out of line slot 0 array slot 0
64 JSC Object Model structure ID indexing type flags cell state butterfly pointer inline slot 0 inline slot 1 public length vector length out of line slot 0 array slot 0
65 JSC Object Model statically configurable structure ID indexing type flags cell state butterfly pointer inline slot 0 inline slot 1 public length vector length out of line slot 0 array slot 0
66 JSC Object Model statically configurable structure ID indexing type flags cell state butterfly pointer inline slot 0 inline slot 1 public length vector length out of line slot 0 array slot 0 dynamically configurable
67 Empty JSObject structure ID indexing type flags cell state null
68 Fast JSObject structure ID indexing type flags cell state null 0xffff xffff var o = {f: 5, g: 6};
69 JSObject with dynamically added fields structure ID indexing type flags cell state butterfly 0xffff xffff xffff var o = {f: 5, g: 6}; o.h = 7;
70 JSArray with room for 3 array elements structure ID indexing type flags cell state butterfly 0 3 <hole> <hole> <hole> var a = [];
71 Object with fast properties and array elements structure ID indexing type flags cell state butterfly 0xffff xffff xffff <hole> <hole> var o = {f: 5, g: 6}; o[0] = 7;
72 Object with fast and dynamic properties and array elements structure ID indexing type flags cell state butterfly 0xffff xffff xffff xffff <hole> var o = {f: 5, g: 6}; o[0] = 7; o.h = 8;
73 Exotic object with dynamic properties and array elements structure ID indexing type flags cell state butterfly <C++ state> <C++ state> 0xffff xffff <hole> var o = new Date(); o[0] = 7; o.h = 8;
74 Object Model Structures Cells Butterflies
75 Type Inference
76 Type Inference Watchpoints Value Profiles Polymorphic Inline Caches
77 Type Inference Watchpoints Value Profiles Polymorphic Inline Caches
78 Watchpoints
79 Watchpoint class Watchpoint { public: virtual void fire() = 0; };
80 numbertostringwatchpoint
81 numbertostringwatchpoint 1. Compiler wants to optimize 42.toString() to Check if already invalidated If invalid, don t do the optimization. If valid, register watchpoint and do the optimization.
82 Many watchpoints haveabadtime Structure transition InferredValue InferredType many others
83 Garbage Collector
84 Garbage Collector No copying Conservative on the stack
85 Garbage Collector Constraint-based Generational Concurrent Parallel
86 Garbage Collector Constraint-based Generational Concurrent Parallel
87 Constraint-Based Marking Transitive reachability is not always enough Common examples: Soft references Weak map
88 Constraint-Based Marking Transitive reachability is not always enough WebKit examples: Type inference Weak map DOM Native code
89 Constraint-Based Marking Transitive reachability is not always enough WebKit examples: Type inference Weak map DOM Native code
90 Type Inference
91 Structure prototype {x, y} global object {1, 2} Objects {-5, 7} {42, 3}
92 prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
93 JIT code prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
94 Is this a weak reference? JIT code prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
95 JIT code references a structure Strong reference? Weak reference? Marking constraint?
96 Strong reference? JIT code prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
97 Strong reference? JIT code prototype {x, y} global object
98 Strong reference? JIT code prototype {x, y} global object
99 Strong reference? JIT code prototype {x, y} global object so many leaks
100 Weak reference? JIT code prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
101 Weak reference? JIT code prototype {x, y} global object
102 Weak reference? JIT code prototype {x, y} global object
103 Weak reference? JIT code prototype {x, y} global object recomp storm
104 Marking Constraint JIT code prototype structure global object
105 Marking Constraint JIT code prototype structure global object JIT code references the structure weakly.
106 Marking Constraint if (ismarked(structure->globalobject()) && ismarked(structure->storedprototype())) mark(structure); JIT code prototype structure global object JIT code references the structure weakly. JIT code also registers the above marking constraint.
107 Marking Constraint! JIT code prototype {x, y} global object {1, 2} {42, 3} {-5, 7}
108 Marking Constraint! JIT code prototype {x, y} global object
109 Marking Constraint! JIT code prototype {x, y} global object It s cool - the prototype and global object are long-lived.
110 Marking Constraint! JIT code {x, y}
111 Marking Constraint! JIT code {x, y}
112 Marking Constraint! JIT code {x, y} We want the JIT code to die in this case.
113 Marking Constraint! If the objects that use the structure die, then: Keep structure alive if the user objects it points to are alive anyway. Kill the structure (and the JIT code) if keeping it alive would not be safe-for-space.
114 Marking Constraints Constraints can query which objects are marked. Constraints can mark objects. GC executes constraints to fixpoint.
115 Garbage Collector Constraint-based Generational Concurrent Parallel
116 Conclusion JavaScriptCore Architecture: Interpreters and Multiple JITs Cells, Structures, and Butterflies Watchpoints, Value Profiles, and Inline Caches Constraint-Based GC
FTL WebKit s LLVM based JIT
FTL WebKit s LLVM based JIT Andrew Trick, Apple Juergen Ributzka, Apple LLVM Developers Meeting 2014 San Jose, CA WebKit JS Execution Tiers OSR Entry LLInt Baseline JIT DFG FTL Interpret bytecode Profiling
More informationLLV8: Adding LLVM as an extra JIT tier to V8 JavaScript engine
LLV8: Adding LLVM as an extra JIT tier to V8 JavaScript engine Dmitry Melnik dm@ispras.ru September 8, 2016 Challenges of JavaScript JIT compilation Dynamic nature of JavaScript Dynamic types and objects:
More informationManaged runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley
Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?
More informationManaged runtimes & garbage collection
Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security
More informationRunning class Timing on Java HotSpot VM, 1
Compiler construction 2009 Lecture 3. 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 s = r + 5; return
More informationCompiler 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 informationVA Smalltalk 9: Exploring the next-gen LLVM-based virtual machine
2017 FAST Conference La Plata, Argentina November, 2017 VA Smalltalk 9: Exploring the next-gen LLVM-based virtual machine Alexander Mitin Senior Software Engineer Instantiations, Inc. The New VM Runtime
More informationKnow Your Engines How to Make Your JavaScript Fast
Know Your Engines How to Make Your JavaScript Fast Dave Mandelin 8 November 2011 O Reilly Velocity Europe JavaScript is getting really fast and programs are getting crazy Bullet physics engine (ammo.js)
More informationWhy traditional languages are fast. Types tell compiler the shape of o (fields and their offsets)
Optimizations Why traditional languages are fast Types tell compiler the shape of o (fields and their offsets) Scripting Languages Have No Types Objects are simply dictionaries from properties to values
More informationTruffle A language implementation framework
Truffle A language implementation framework Boris Spasojević Senior Researcher VM Research Group, Oracle Labs Slides based on previous talks given by Christian Wimmer, Christian Humer and Matthias Grimmer.
More informationAttacking Client-Side JIT Compilers. Samuel Groß
Attacking Client-Side JIT Compilers Samuel Groß (@5aelo)!1 A JavaScript Engine Parser JIT Compiler Interpreter Runtime Garbage Collector!2 A JavaScript Engine Parser: entrypoint for script execution, usually
More informationFaculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology
Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False
More informationTrace 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 informationFinal Exam Introduction to Computer Systems. May 10, Name: Andrew User ID: Recitation Section: Model Solution fp
15-213 Introduction to Computer Systems Final Exam May 10, 2007 Name: Andrew User ID: Recitation Section: Model Solution fp This is an open-book exam. Notes and calculators are permitted, but not computers.
More informationAdobe Flash Player ActionScript Virtual Machine (Tamarin)
Adobe Flash Player ActionScript Virtual Machine (Tamarin) Rick Reitmaier Sr. Scientist Adobe Systems December 6, 2006 1 Adobe Today Worldwide Offices Key Statistics Adobe FY 2005 Revenue $1.966B Corporate
More information15-411: LLVM. Jan Hoffmann. Substantial portions courtesy of Deby Katz
15-411: LLVM Jan Hoffmann Substantial portions courtesy of Deby Katz and Gennady Pekhimenko, Olatunji Ruwase,Chris Lattner, Vikram Adve, and David Koes Carnegie What is LLVM? A collection of modular and
More informationJava Performance: The Definitive Guide
Java Performance: The Definitive Guide Scott Oaks Beijing Cambridge Farnham Kbln Sebastopol Tokyo O'REILLY Table of Contents Preface ix 1. Introduction 1 A Brief Outline 2 Platforms and Conventions 2 JVM
More informationInterprocedural Type Specialization of JavaScript Programs Without Type Analysis
Interprocedural Type Specialization of JavaScript Programs Without Type Analysis Maxime Chevalier-Boisvert joint work with Marc Feeley ECOOP - July 20th, 2016 Overview Previous work: Lazy Basic Block Versioning
More informationGet the (Spider)monkey off your back
Get the (Spider)monkey off your back Exploiting Firefox through the Javascript engine by eboda and bkth from phoenhex Who are we? Security enthusiasts who dabble in vulnerability research on their free
More informationFlow-sensitive rewritings and Inliner improvements for the Graal JIT compiler
1 / 25 Flow-sensitive rewritings and for the Graal JIT compiler Miguel Garcia http://lampwww.epfl.ch/~magarcia/ 2014-07-07 2 / 25 Outline Flow-sensitive rewritings during HighTier Example Rewritings in
More informationCompilers Crash Course
Compilers Crash Course Prof. Michael Clarkson CSci 6907.85 Spring 2014 Slides Acknowledgment: Prof. Andrew Myers (Cornell) What are Compilers? Translators from one representation of program code to another
More informationCSE 401 Final Exam. March 14, 2017 Happy π Day! (3/14) This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,...
CSE 401 Final Exam March 14, 2017 Happy π Day! (3/14) Name This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,.... Please wait to turn the page until everyone has their
More informationA 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 informationUsually, target code is semantically equivalent to source code, but not always!
What is a Compiler? Compiler A program that translates code in one language (source code) to code in another language (target code). Usually, target code is semantically equivalent to source code, but
More informationSista: Improving Cog s JIT performance. Clément Béra
Sista: Improving Cog s JIT performance Clément Béra Main people involved in Sista Eliot Miranda Over 30 years experience in Smalltalk VM Clément Béra 2 years engineer in the Pharo team Phd student starting
More informationLecture 21 CIS 341: COMPILERS
Lecture 21 CIS 341: COMPILERS Announcements HW6: Analysis & Optimizations Alias analysis, constant propagation, dead code elimination, register allocation Available Soon Due: Wednesday, April 25 th Zdancewic
More informationAgenda. 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 informationcode://rubinius/technical
code://rubinius/technical /GC, /cpu, /organization, /compiler weeee!! Rubinius New, custom VM for running ruby code Small VM written in not ruby Kernel and everything else in ruby http://rubini.us git://rubini.us/code
More informationC#: framework overview and in-the-small features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationSSA Based Mobile Code: Construction and Empirical Evaluation
SSA Based Mobile Code: Construction and Empirical Evaluation Wolfram Amme Friedrich Schiller University Jena, Germany Michael Franz Universit of California, Irvine, USA Jeffery von Ronne Universtity of
More information6.828: OS/Language Co-design. Adam Belay
6.828: OS/Language Co-design Adam Belay Singularity An experimental research OS at Microsoft in the early 2000s Many people and papers, high profile project Influenced by experiences at
More informationAcknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides
Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++
More informationStructure of Programming Languages Lecture 10
Structure of Programming Languages Lecture 10 CS 6636 4536 Spring 2017 CS 6636 4536 Lecture 10: Classes... 1/23 Spring 2017 1 / 23 Outline 1 1. Types Type Coercion and Conversion Type Classes, Generics,
More informationDRuntime and You David Nadlinger ETH Zurich
DRuntime and You David Nadlinger (@klickverbot) ETH Zurich Agenda Warmup: TypeInfo and ModuleInfo Exception handling Garbage collection Thread-local storage Fibers Interlude: C program startup Shared
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 7
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2017 Lecture 7 LAST TIME Dynamic memory allocation and the heap: A run-time facility that satisfies multiple needs: Programs can use widely varying, possibly
More informationCode Merge. Flow Analysis. bookkeeping
Historic Compilers Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice University have explicit permission to make copies of these materials
More informationSPUR: A Trace-Based JIT Compiler for CIL
MSR-TR-2010-27 SPUR: A Trace-Based JIT Compiler for CIL Michael Bebenita Florian Brandner Manuel Fahndrich Francesco Logozzo Wolfram Schulte Nikolai Tillmann Herman Venter Microsoft Research {hermanv,logozzo,maf,nikolait,schulte@microsoft.com
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 12
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2017 Lecture 12 CS24 MIDTERM Midterm format: 6 hour overall time limit, multiple sittings (If you are focused on midterm, clock should be running.) Open book
More informationJAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder
JAVA PERFORMANCE PR SW2 S18 Dr. Prähofer DI Leopoldseder OUTLINE 1. What is performance? 1. Benchmarking 2. What is Java performance? 1. Interpreter vs JIT 3. Tools to measure performance 4. Memory Performance
More information<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone
Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone Oleg Pliss Pavel Petroshenko Agenda Introduction to Monty JVM Motivation
More informationApple LLVM GPU Compiler: Embedded Dragons. Charu Chandrasekaran, Apple Marcello Maggioni, Apple
Apple LLVM GPU Compiler: Embedded Dragons Charu Chandrasekaran, Apple Marcello Maggioni, Apple 1 Agenda How Apple uses LLVM to build a GPU Compiler Factors that affect GPU performance The Apple GPU compiler
More informationLecture 15 Garbage Collection
Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:
More informationDesign Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8
Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns
More informationEventrons: A Safe Programming Construct for High-Frequency Hard Real-Time Applications
Eventrons: A Safe Programming Construct for High-Frequency Hard Real-Time Applications Daniel Spoonhower Carnegie Mellon University Joint work with Joshua Auerbach, David F. Bacon, Perry Cheng, David Grove
More informationField Analysis. Last time Exploit encapsulation to improve memory system performance
Field Analysis Last time Exploit encapsulation to improve memory system performance This time Exploit encapsulation to simplify analysis Two uses of field analysis Escape analysis Object inlining April
More informationCSE 12 Spring 2016 Week One, Lecture Two
CSE 12 Spring 2016 Week One, Lecture Two Homework One and Two: hw2: Discuss in section today - Introduction to C - Review of basic programming principles - Building from fgetc and fputc - Input and output
More informationRuntime. The optimized program is ready to run What sorts of facilities are available at runtime
Runtime The optimized program is ready to run What sorts of facilities are available at runtime Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis token stream Syntactic
More informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationLecture 3 Overview of the LLVM Compiler
LLVM Compiler System Lecture 3 Overview of the LLVM Compiler The LLVM Compiler Infrastructure - Provides reusable components for building compilers - Reduce the time/cost to build a new compiler - Build
More information6.172 Performance Engineering of Software Systems Spring Lecture 9. P after. Figure 1: A diagram of the stack (Image by MIT OpenCourseWare.
6.172 Performance Engineering of Software Systems Spring 2009 Lecture 9 MIT OpenCourseWare Dynamic Storage Allocation Stack allocation: LIFO (last-in-first-out) Array and pointer A used unused P before
More informationCS527 Software Security
Security Policies Purdue University, Spring 2018 Security Policies A policy is a deliberate system of principles to guide decisions and achieve rational outcomes. A policy is a statement of intent, and
More informationDachshund. Digging for and Securing Against (Non-)Blinded Constants in JIT Code
Dachshund Digging for and Securing Against (Non-)Blinded Constants in JIT Code Giorgi Maisuradze, Michael Backes, Chris;an Rossow CISPA, Saarland University, Germany NDSS Symposium 2017 Overview Code reuse
More informationExploiting a Coalmine Abusing Complex Bugs in Webkit's RenderArena
Exploiting a Coalmine Abusing Complex Bugs in Webkit's RenderArena Georg Wicherski Senior Security Researcher Wednesday, April 11, 2012 WebKit Based on KHTML (KDE) Apple forked in 2001 Chrome, (Mobile)
More informationExpressing high level optimizations within LLVM. Artur Pilipenko
Expressing high level optimizations within LLVM Artur Pilipenko artur.pilipenko@azul.com This presentation describes advanced development work at Azul Systems and is for informational purposes only. Any
More informationConcurrent JavaScript Parsing for Faster Loading of Web Apps
Concurrent JavaScript Parsing for Faster Loading of Web Apps HYUKWOO PARK, MYUNGSU CHA, and SOO-MOOK MOON, Seoul National University JavaScript is a dynamic language mainly used as a client-side web script.
More informationFreeing memory is a pain. Need to decide on a protocol (who frees what?) Pollutes interfaces Errors hard to track down
Freeing memory is a pain Need to decide on a protocol (who frees what?) Pollutes interfaces Errors hard to track down 1 Freeing memory is a pain Need to decide on a protocol (who frees what?) Pollutes
More information<Insert Picture Here> Maxine: A JVM Written in Java
Maxine: A JVM Written in Java Michael Haupt Oracle Labs Potsdam, Germany The following is intended to outline our general product direction. It is intended for information purposes
More informationCS553 Lecture Dynamic Optimizations 2
Dynamic Optimizations Last time Predication and speculation Today Dynamic compilation CS553 Lecture Dynamic Optimizations 2 Motivation Limitations of static analysis Programs can have values and invariants
More informationCS842: Automatic Memory Management and Garbage Collection. GC basics
CS842: Automatic Memory Management and Garbage Collection GC basics 1 Review Noting mmap (space allocated) Mapped space Wile owned by program, manager as no reference! malloc (object created) Never returned
More information143A: Principles of Operating Systems. Lecture 4: Calling conventions. Anton Burtsev October, 2017
143A: Principles of Operating Systems Lecture 4: Calling conventions Anton Burtsev October, 2017 Recap from last time Stack and procedure calls What is stack? Stack It's just a region of memory Pointed
More informationCompiler Optimization
Compiler Optimization The compiler translates programs written in a high-level language to assembly language code Assembly language code is translated to object code by an assembler Object code modules
More informationJust-In-Time Compilation
Just-In-Time Compilation Thiemo Bucciarelli Institute for Software Engineering and Programming Languages 18. Januar 2016 T. Bucciarelli 18. Januar 2016 1/25 Agenda Definitions Just-In-Time Compilation
More informationJust-In-Time Compilers & Runtime Optimizers
COMP 412 FALL 2017 Just-In-Time Compilers & Runtime Optimizers Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved.
More informationRun-Time Environments/Garbage Collection
Run-Time Environments/Garbage Collection Department of Computer Science, Faculty of ICT January 5, 2014 Introduction Compilers need to be aware of the run-time environment in which their compiled programs
More informationCourse introduction. Advanced Compiler Construction Michel Schinz
Course introduction Advanced Compiler Construction Michel Schinz 2016 02 25 General information Course goals The goal of this course is to teach you: how to compile high-level functional and objectoriented
More informationCS842: Automatic Memory Management and Garbage Collection. Mark and sweep
CS842: Automatic Memory Management and Garbage Collection Mark and sweep 1 Schedule M W Sept 14 Intro/Background Basics/ideas Sept 21 Allocation/layout GGGGC Sept 28 Mark/Sweep Mark/Sweep cto 5 Copying
More informationSABLEJIT: 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 informationGarbage Collection Basics
Garbage Collection Basics 1 Freeing memory is a pain Need to decide on a protocol (who frees what when?) Pollutes interfaces Errors hard to track down Remember 211 / 213?... but lets try an example anyway
More informationHigh Performance Managed Languages. Martin Thompson
High Performance Managed Languages Martin Thompson - @mjpt777 Really, what s your preferred platform for building HFT applications? Why would you build low-latency applications on a GC ed platform? Some
More informationCS143 Final Spring 2016
CS143 Final Spring 2016 Please read all instructions (including these) carefully. There are 5 questions on the exam, all with multiple parts. This exam is designed to take 2 hours, but you have the full
More informationEDAN65: Compilers, Lecture 13 Run;me systems for object- oriented languages. Görel Hedin Revised:
EDAN65: Compilers, Lecture 13 Run;me systems for object- oriented languages Görel Hedin Revised: 2014-10- 13 This lecture Regular expressions Context- free grammar ATribute grammar Lexical analyzer (scanner)
More informationFunction Call Convention
Function Call Convention Compass Security Schweiz AG Werkstrasse 20 Postfach 2038 CH-8645 Jona Tel +41 55 214 41 60 Fax +41 55 214 41 61 team@csnc.ch www.csnc.ch Content Intel Architecture Memory Layout
More information143A: Principles of Operating Systems. Lecture 5: Calling conventions. Anton Burtsev January, 2017
143A: Principles of Operating Systems Lecture 5: Calling conventions Anton Burtsev January, 2017 Stack and procedure calls Stack Main purpose: Store the return address for the current procedure Caller
More informationCopyright 2012, Oracle and/or its affiliates. All rights reserved.
1 Truffle: A Self-Optimizing Runtime System Christian Wimmer, Thomas Würthinger Oracle Labs Write Your Own Language Current situation How it should be Prototype a new language Parser and language work
More informationJava 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 informationA new Mono GC. Paolo Molaro October 25, 2006
A new Mono GC Paolo Molaro lupus@novell.com October 25, 2006 Current GC: why Boehm Ported to the major architectures and systems Featurefull Very easy to integrate Handles managed pointers in unmanaged
More informationLDC: The LLVM-based D Compiler
LDC: The LLVM-based D Compiler Using LLVM as backend for a D compiler Kai Nacke 02/02/14 LLVM devroom @ FOSDEM 14 Agenda Brief introduction to D Internals of the LDC compiler Used LLVM features Possible
More informationRegister Allocation, i. Overview & spilling
Register Allocation, i Overview & spilling 1 L1 p ::=(label f...) f ::=(label nat nat i...) i ::=(w
More informationLLVM for a Managed Language What we've learned
LLVM for a Managed Language What we've learned Sanjoy Das, Philip Reames {sanjoy,preames}@azulsystems.com LLVM Developers Meeting Oct 30, 2015 This presentation describes advanced development work at Azul
More informationGarbage Collection Algorithms. Ganesh Bikshandi
Garbage Collection Algorithms Ganesh Bikshandi Announcement MP4 posted Term paper posted Introduction Garbage : discarded or useless material Collection : the act or process of collecting Garbage collection
More informationAccelerating Ruby with LLVM
Accelerating Ruby with LLVM Evan Phoenix Oct 2, 2009 RUBY RUBY Strongly, dynamically typed RUBY Unified Model RUBY Everything is an object RUBY 3.class # => Fixnum RUBY Every code context is equal RUBY
More informationThe View from 35,000 Feet
The View from 35,000 Feet This lecture is taken directly from the Engineering a Compiler web site with only minor adaptations for EECS 6083 at University of Cincinnati Copyright 2003, Keith D. Cooper,
More informationAn example of optimization in LLVM. Compiler construction Step 1: Naive translation to LLVM. Step 2: Translating to SSA form (opt -mem2reg)
Compiler construction 2014 An example of optimization in LLVM Lecture 8 More on code optimization SSA form Constant propagation Common subexpression elimination Loop optimizations int f () { int i, j,
More informationShenandoah: Theory and Practice. Christine Flood Roman Kennke Principal Software Engineers Red Hat
Shenandoah: Theory and Practice Christine Flood Roman Kennke Principal Software Engineers Red Hat 1 Shenandoah Christine Flood Roman Kennke Principal Software Engineers Red Hat 2 Shenandoah Why do we need
More informationDynamic Dispatch and Duck Typing. L25: Modern Compiler Design
Dynamic Dispatch and Duck Typing L25: Modern Compiler Design Late Binding Static dispatch (e.g. C function calls) are jumps to specific addresses Object-oriented languages decouple method name from method
More informationNoMap: Speeding-Up JavaScript Using Hardware Transactional Memory
NoMap: Speeding-Up JavaScript Using Hardware Transactional Memory Thomas Shull, Jiho Choi, María J. Garzarán, Josep Torrellas University of Illinois at Urbana-Champaign Intel Corp. http://iacoma.cs.uiuc.edu
More informationAbstract Interpretation
Abstract Interpretation MATHE MATICAL PROGRAM CHE CKING Overview High level mathematical tools Originally conceived to help give a theoretical grounding to program analysis Useful for other kinds of analyses
More informationFrom Assembly to JavaScript and Back
From Assembly to JavaScript and Back Robert Gawlik Ruhr-University Bochum August 30th 2018 Singapore About me IT Security since 2010 PostDoc Systems Security Group @ Horst Görtz Institute / Ruhr-University
More informationAnnouncements. 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 informationGoals of Program Optimization (1 of 2)
Goals of Program Optimization (1 of 2) Goal: Improve program performance within some constraints Ask Three Key Questions for Every Optimization 1. Is it legal? 2. Is it profitable? 3. Is it compile-time
More informationProgramming Languages
TECHNISCHE UNIVERSITÄT MÜNCHEN FAKULTÄT FÜR INFORMATIK Programming Languages Concurrency: Atomic Executions, Locks and Monitors Dr. Michael Petter Winter term 2016 Atomic Executions, Locks and Monitors
More informationKasper Lund, Software engineer at Google. Crankshaft. Turbocharging the next generation of web applications
Kasper Lund, Software engineer at Google Crankshaft Turbocharging the next generation of web applications Overview Why did we introduce Crankshaft? Deciding when and what to optimize Type feedback and
More informationHow Software Executes
How Software Executes CS-576 Systems Security Instructor: Georgios Portokalidis Overview Introduction Anatomy of a program Basic assembly Anatomy of function calls (and returns) Memory Safety Programming
More informationCSE 227 Computer Security Spring 2010 S f o t ftware D f e enses I Ste St f e an f Sa v Sa a v g a e g
CSE 227 Computer Security Spring 2010 Software Df Defenses I Stefan Savage Kinds of defenses Eliminate violation of runtime model Better languages, code analysis Don t allow bad input Input validation
More informationExploits and gdb. Tutorial 5
Exploits and gdb Tutorial 5 Exploits and gdb 1. Buffer Vulnerabilities 2. Code Injection 3. Integer Attacks 4. Advanced Exploitation 5. GNU Debugger (gdb) Buffer Vulnerabilities Basic Idea Overflow or
More informationThe Java Programming Language
The Java Programming Language Slide by John Mitchell (http://www.stanford.edu/class/cs242/slides/) Outline Language Overview History and design goals Classes and Inheritance Object features Encapsulation
More informationOverview of a Compiler
High-level View of a Compiler Overview of a Compiler Compiler Copyright 2010, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have
More informationThe Z Garbage Collector Scalable Low-Latency GC in JDK 11
The Z Garbage Collector Scalable Low-Latency GC in JDK 11 Per Lidén (@perliden) Consulting Member of Technical Staff Java Platform Group, Oracle October 24, 2018 Safe Harbor Statement The following is
More informationHigh Performance Managed Languages. Martin Thompson
High Performance Managed Languages Martin Thompson - @mjpt777 Really, what is your preferred platform for building HFT applications? Why do you build low-latency applications on a GC ed platform? Agenda
More informationMachine Program: Procedure. Zhaoguo Wang
Machine Program: Procedure Zhaoguo Wang Requirements of procedure calls? P() { y = Q(x); y++; 1. Passing control int Q(int i) { int t, z; return z; Requirements of procedure calls? P() { y = Q(x); y++;
More information