Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does F# Interpreter (fsi.exe) also produces Intermediate Language-Code as F# Compiler (fsc.exe) does?

Currently I'm doing a recherche for university about F#. I have a question about the F# interactive Console and the F# compiler.

The F# compiler produces Microsoft Intermediate Language (MSIL) code when its compiling F#-source. This is then translated by the JIT-compiler to machine code, when executing the written program.

But what does the F# Interpreter Console do? Does it also line-per-line translate the F# Code into MSIL, and then JIT that into machine code? Or does it translate the F#-Code directly into machine code?

If it converts it to IL first, then I think there probably will be an IL-interpreter because the JIT-compiler only compiles complete programs. Won't it?

What do you think, how F#-interpreter handles F# code and translates it?

Greetings, Martin

like image 684
martin Avatar asked Jan 06 '11 10:01

martin


1 Answers

The F# compiler emits IL using its own library AbsIL. AbsIL is another MSR project which was absorbed by F#.

When compiling for the interactive mode, AbsIL uses the System.Reflection.Emit namespace to emit IL in memory, at runtime, which is in turn compiled to native code by the JIT as it executes the code.

like image 162
Jb Evain Avatar answered Oct 08 '22 01:10

Jb Evain