15
Common Intermediate Language (CIL)

Common Intermediate Language (CIL)

  • Upload
    whitley

  • View
    109

  • Download
    0

Embed Size (px)

DESCRIPTION

Common Intermediate Language (CIL). Introduction. Common Intermediate Language  (formerly called  Microsoft Intermediate Language  or  MSIL ) is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification. - PowerPoint PPT Presentation

Citation preview

Page 1: Common Intermediate Language (CIL)

Common Intermediate Language (CIL)

Page 2: Common Intermediate Language (CIL)

Introduction• Common Intermediate Language (formerly

called Microsoft Intermediate Language or MSIL) is the

lowest-level human-readable programming language defined

by the Common Language Infrastructure specification.

• Languages which target a CLR-compatible runtime

environment compile to CIL, which is assembled into an object

code that has a bytecode-style format.

• CIL is an object-oriented assembly language, and is

entirely stack-based. Its bytecode is translated inte native

code or executed by a virtual machine.

Page 3: Common Intermediate Language (CIL)

Components of CIL

Page 4: Common Intermediate Language (CIL)

Profile Class Library

• Within the CLI class libraries lies a distinction

between Microsoft's .NET and the ECMA CLI.

• What was submitted for ECMA's standardization is a

subset of the Microsoft .NET libraries, as depicted in

the following diagram.

• With that said, we can move on to describing only the

ECMA CLI libraries.

Page 5: Common Intermediate Language (CIL)

Profile Class Library

Page 6: Common Intermediate Language (CIL)

Base Class Library

• The BCL contains about 147 classes that deal with

value types, exceptions, string manipulations,

collections, threading, security, globalization, and IO.

• A very small portion of the implementation must

contain platform-specific code, while the vast majority

can be generically developed for any platform. 

Page 7: Common Intermediate Language (CIL)

Base Class Library

Page 8: Common Intermediate Language (CIL)

Virtual Execution System

Page 9: Common Intermediate Language (CIL)

Just-In-Time compiler• At run time, the CLR uses JIT compilation to compile MSIL

to native machine code for the current platform

• Compiles only methods that are called, the first time they are

called

• Compiled methods are cached for subsequent uses

• Type Safety Verification verifies:

– References to types are strictly compatible with each

type being referenced

– Only appropriately defined operations are invoked on

each object

– Identities are what they claim to be

Page 10: Common Intermediate Language (CIL)

Just-In-Time Compiler

Page 11: Common Intermediate Language (CIL)

Garbage Collection• The CLR manages a pool of memory called the managed heap

• Once there are no references to an object, it becomes “garbage”

and can no longer be reached

• .NET continuously runs a Garbage Collector (GC) on a separate

thread to look for this garbage

• The GC works as a mark and sweep collector, only running when a

certain amount of memory has been used, or when the system

needs memory

• The GC uses generation marking for each sweep

– Objects marked higher than generation 2 are collected much

less frequently

Page 12: Common Intermediate Language (CIL)

Garbage Collection

Page 13: Common Intermediate Language (CIL)

Namespace

• The framework relies on Namespaces to organize

classes. Much as a directory file structure is a physical

container of files, namespaces are logical containers for

classes and interfaces.

• The root namespace in CLI is System. All classes

within the framework are contained within the System

namespace. 

Page 14: Common Intermediate Language (CIL)

Namespace Example

Page 15: Common Intermediate Language (CIL)

The End

…… Thank You ……