common intermediate language (cil)
Post on 19-Jan-2016
73 Views
Preview:
DESCRIPTION
TRANSCRIPT
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.
Components of 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.
Profile Class Library
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.
Base Class Library
Virtual Execution System
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
Just-In-Time Compiler
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
Garbage Collection
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.
Namespace Example
The End
…… Thank You ……
top related