Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-10

CIL as a target machine for FP binaries

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gilles MARCOU

Hi,

I am changing the title of the topic, but it follows the discussion with Juha Manninen and the last answer of Jonas.

In fact, I have asked some time ago, if there was a way to produce with FPC some kind of Java compatible bytecode. I was answered that it was not possible because of some fundamental choices that has been done during FPC development: generating bytecode would mean to rewrite the whole FPC.

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? Also, does producing CIL compliant binaries could help the development of client side applet for web applications?

Ciao,
Gilles Marcou

Jonas Maebe
to Gilles MARCOU
Gilles MARCOU wrote 5 lines
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