Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is CIL an assembly language and JIT an assembler

Does the Just In Time Compiler(JIT) really map each of the Common Intermediate Language(CIL) instructions in a program to underlying processor's opcodes?

And If so can we call CIL an assembly language and JIT an assembler

Note: Wikipedia doesn't list CIL as an assembly language in its list of assembly languages

like image 299
Anirudha Avatar asked Jul 28 '12 12:07

Anirudha


People also ask

Is CIL an assembly language?

CIL is an object-oriented assembly language and is CPU and platform-independent instructions that can be executed in any environment supporting the Common Language Infrastructure such as the . NET run time.

What is CIL in assembly?

CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the Common Language Infrastructure, such as the . NET runtime on Windows, or the cross-platform Mono runtime.

Is assembly language and assembler same?

The Assembler is a Software that converts an assembly language code to machine code. It takes basic Computer commands and converts them into Binary Code that Computer's Processor can use to perform its Basic Operations. These instructions are assembler language or assembly language.


1 Answers

This question is all about definitions, so let's define the terms properly. First, assembly language:

Assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices in which each statement corresponds to a single machine language instruction. An assembly language is specific to a certain computer architecture, in contrast to most high-level programming languages, which generally are portable to multiple systems.

Now, CIL:

Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure (CLI) specification and is used by the .NET Framework and Mono. Languages which target a CLI-compatible runtime environment compile to CIL, which is assembled into an object code that has a bytecode-style format.

Okay, this part is technically not correct: for example C# compiler compiles directly to the bytecode, it doesn't go through CIL (the human-readable language), but theoretically, we can imagine that's what's happening.

With these two definitions, CIL is an assembly language, because each statement in it is compiled down to a single bytecode instruction. The fact that there is no physical computer that can execute that bytecode directly doesn't matter.

The definition says that each assembly language is “specific to a certain computer architecture”. In this case, the architecture is the CLR virtual machine.


About JIT: the JIT compiler can't be considered an assembler: it doesn't do the 1:1 translation from human-readable form to bytecode, ilasm does that.

The JIT compiler is an optimizing compiler that compiles from bytecode to native machine code (for whatever ISA / CPU it's running on), while making optimizations.

like image 137
svick Avatar answered Sep 19 '22 17:09

svick