Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Optimizations - Compiler Design - Lecture Slides, Slides of Compiler Design

Main points of Compiler Design are: Optimizations, Software Application, Development, Maintenance, Resource Intensive, Standardization, Platforms, Substantial Rewriting, Development Environment, Paradigms

Typology: Slides

2012/2013

Uploaded on 04/27/2013

nazi
nazi 🇮🇳

4.5

(16)

53 documents

1 / 29

Related documents


Partial preview of the text

Download Optimizations - Compiler Design - Lecture Slides and more Slides Compiler Design in PDF only on Docsity! Docsity.com Just-In-Time Compilation and Optimizations for .NET CLR Docsity.com Introduction Software application development and maintenance are time and resource intensive Lack of standardization among platforms Porting is cumbersome, requires substantial rewriting of programs Need for a development environment enabling faster and easier development Two paradigms Component software Virtual machine based execution Docsity.com Virtual Machines -- Facilities Checks security violations by components Components can be dynamically loaded and linked Provides automatic memory management and garbage collection Provides architecture-independent interface for exception handling Docsity.com Virtual Machines -- Facilities Supports a machine-independent instruction set (called intermediate code) Intermediate code is normally interpreted Interpretation is simple, has small memory foot-print, and is ideal for low-cost systems Docsity.com Virtual Machines -- Disadvantages Run-time overheads due to extra layer of software Dynamic loading, garbage collection, security checks, are all expensive Instruction interpretation overheads are the highest Unacceptably slow in high-performance environments Just-In-Time Compilation is a good solution Docsity.com Multi-Level Optimization Framework Lowest level – simplest optimizations Highest level – most expensive optimizations Hotness of a method determines the level Very hot methods being very few, overheads of expensive optimizations are not felt and execution speed improves for future invocations Hot methods are found by on-line profiling Docsity.com Multi-Level Optimization Framework The VM controls profiling and optimizations Profiles drive the optimizations No more the developer’s burden Profiling adds its own overheads May negate benefits of optimization Accuracy of profiling can be reduced resulting in reduced overheads This may also reduce the effectiveness of optimizations Tradeoff (accuracy v/s overheads) Docsity.com Our Research goals Implementation of an extensible multi-level adaptive recompilation framework for the .NET Implement and evaluate various profiling techniques (hardware & software) and profile-guided optimizations Suggest improvements to profiling techniques to reduce overheads All experimentation in ROTOR framework which implements common language infrastructure Docsity.com Base ROTOR Architecture Base Class Libraries Class Loader Garbage Collector JIT Compiler Execution Engine Platform Adaptation Layer ROTOR CLR Source Code Compiler Front end CIL + Meta data Docsity.com ROTOR JIT Framework Exec Mgr JIT Cmplr 1 JIT Mgr 1 Code Mgr 1 JIT Mgr 2 JIT Cmplr 2 Code Mgr 2 Baseline JIT Our JIT Docsity.com ROTOR and Baseline JIT Compiler ROTOR has a baseline JIT compiler Performs JIT compilation and IL code type verification Each incorporates a JIT manager, a code manager and a JIT code generator Several such JIT compilers can be included in ROTOR Execution manager controls JIT compilers Docsity.com Extended ROTOR Architecture with Profiler and Optimizer Profilers Recompilation Controller Optimizing JIT Compiler Subsystem Profile Database Baseline JIT Compiler Native Code Extended CLR Docsity.com First level recompilation Method Selection: Runtime stack based method sampling profiler Finds hot methods, creates approx. call-graph by periodically sampling the runtime-stack Low overhead (2-3%, with full stack sampling) Can be run throughout the execution of the program, platform independent Non-intrusive, no code change needed A Profiler interface and queriable database are provided; can be used by other applications Docsity.com First level recompilation Recompilation controller controls profiling Sampling profiler is a separate thread Wakes up periodically and monitors runtime stack of all threads For each thread, collects information on the currently executed method and its caller PDB maintains a set of method counters which are incremented on every sample Method counters with high value are hot and are ideal candidates for recompilation Docsity.com Optimized Code Generator for the x86 Macro based – one for each operator-data type pair Makes full use of all available addressing modes Follows calling convention of the baseline JIT Parameters on stack Re-arranged according to expected order Patches code back into runtime Code management issues Recompilation cache to ensure correct stack walk Generates GC and exception handling tables HIR is stored for 10 “latest” recompiled methods Already optimized to a certain extent Will be needed for more profile-guided optimizations Docsity.com Second Level Recompilation - Instrumentation System Flexible architecture for various types of profiling “Hot” methods are profiled further Requires instrumentation during code generation Presently supports Call graph profiling Profiles methods called from “hot” methods Constructs accurate dynamic call graphs Edge profiling Basic block profiling Passes profile information to recompilation controller Recompilation of stored, optimized HIR Docsity.com Implemented optimizations Adaptive method inlining Based on dynamic call-graphs derived from call-graph profiling “Hot” edges of call graphs (“hot” calls) can be inlined Reduces call overhead, increases optimization opportunities Code size and register pressure increase; recompilation time overhead. Profile-guided loop unrolling Based on loop execution counts; simple loops only Basic-block reordering Based on edge profiles Improves instruction cache and branch predictor performance
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved