[fpc-pascal] CIL as a target machine for FP binaries

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 7 09:27:43 CEST 2009


On 07 Oct 2009, at 08:50, Gilles MARCOU wrote:

> But, I have read on the web site posted by Jonas, that the GCC sees  
> the
> CIL as a target platform of the compiler. If the GCC can do it,  
> isn't it
> possible to do it also for FPC?

Of course. It's simply that someone has to do it (just like for LLVM).

> Also, does producing CIL compliant
> binaries could help the development of client side applet for web
> applications?

Unlikely, because the sort of CIL that FPC would generate would be of  
the "unmanaged kind". Running that sort of code would be just as  
unsafe as running a random executable. Furthermore, such code would  
still be completely platform-dependent: FPC (and GCC) would just use  
CIL as an assembler format, but all types, system functions etc would  
be specific to the OS/architecture for which you compiled.

What you would need for web applets is that additionally someone would  
add a .NET-based rtl to FPC -- but in that case, your users would also  
have to have the .NET runtime installed, and it would become  
impossible to compile the CIL further into native code without adding  
external dependencies (since the RTL would depend on the .NET  
framework).

Generating CIL as intermediate code is by itself only useful if you  
are interested in
a) using some other code generator that FPC's to generate the actual  
machine code (but note that FPC will still require support for the  
target cpu and OS that you want to compile for, because as mentioned  
above the generated CIL will already be completely target-dependent)
b) (possibly) to more easily interoperate with other compilers that  
can compile code into CIL


Jonas



More information about the fpc-pascal mailing list