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)

48 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Docsity.com
Just-In-Time Compilation and
Optimizations for .NET CLR
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Optimizations - Compiler Design - Lecture Slides and more Slides Compiler Design in PDF only on Docsity!

Just-In-Time Compilation and

Optimizations for .NET CLR

Introduction

„ Software application development and maintenanceare time and resource intensive ƒ Lack of standardization among platforms ƒ Porting is cumbersome, requires substantial rewriting ofprograms „ Need for a development environment enabling fasterand easier development „ Two paradigms ƒ Component software ƒ Virtual machine based execution

Virtual Machine Based Execution

„

A

VM is a layer over the host hardware

„ Simulated in software „ Provides developers with useful run-timeservices independent of host hardware ƒ Absolves developers from dealing with platform-specific issues while porting applications ƒ This model enables increased developer efficiency,shorter development cycles, and higher levels ofscalabilitity and extensibility

Virtual Machines -- Facilities

„ Checks security violations by components „ Components can be dynamically loaded andlinked „ Provides automatic memory management andgarbage collection „ Provides architecture-independent interfacefor exception handling

Virtual Machines -- Disadvantages

„ Run-time overheads due to extra layer ofsoftware „ Dynamic loading, garbage collection, securitychecks, are all expensive „ Instruction interpretation overheads are thehighest „ Unacceptably slow in high-performanceenvironments „ Just-In-Time Compilation is a good solution

Just-In-Time Compilation

„ Intermediate code is converted to native codeon the fly „ Units are compiled just before their first use „ Compiled code is cached and reused for lateruses „

A

method is a unit of compilation

„ Code generation time adds to executionoverheads

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, overheadsof expensive optimizations are not felt andexecution speed improves for futureinvocations „ Hot methods are found by on-line profiling

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 inreduced overheads ƒ This may also reduce the effectiveness ofoptimizations ƒ Tradeoff (accuracy v/s overheads)

Common Language Infrastructure (CLI) „ Standardized specification of a virtualexecution environment „ Defines an environment where componentscreated in several HLLs can interact in asecure and well-defined manner, irrespectiveof the platform on which the environmentruns „ CLI-consistent compilers generate a

common

intermediate language (CIL)

Common Language Infrastructure (CLI) „ CIL is a platform independent stack-based instructionset ƒ incorporates features from both object-oriented andprocedural programming domains „ At the heart of any implementation of CLI is thecommon language runtime (CLR) ƒ CLR is responsible for loading components and managingtheir execution ƒ CLR provides exeception handling, garbage collection,thread management, remoting and type safety services

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

ROTOR and Baseline JIT Compiler

„ ROTOR has a baseline JIT compiler „ Performs JIT compilation and IL code typeverification „ Each incorporates a JIT manager, a codemanager and a JIT code generator „ Several such JIT compilers can be included inROTOR „ Execution manager controls JIT compilers

Multi-level adaptive optimization

framework for Rotor

„ We extend the CLR with an optimizing JIT compiler „ Two levels of profile-guided recompilation „ First level based on a sampling profiler „ Second level based on edge and call-graph profiling „ Profiler interface available

Extended ROTOR Architecture

with Profiler and Optimizer

Profilers Recompilation Controller Optimizing JIT Compiler Subsystem Profile Database Baseline JIT Compiler Native Code Extended CLR