.NET compilation has two phases
1 . Compilation to IL code.
2 . JIT compilation to native code.
Can both these stages can be categorized as compile time? Or does the JIT compilation to native code comes under runtime ?
In terms of error, if an error occurs at the phase two, is it a run time error? (Any error that occurs after the phase 2 ie, when the native code is actually executed should be a run time error )
Basically if your compiler can work out what you mean or what a value is "at compile time" it can hardcode this into the runtime code. Obviously if your runtime code has to do a calculation every time it will run slower, so if you can determine something at compile time it is much better.
As part of the Microsoft . NET Framework, the Common Language Runtime (CLR) is the programming (Virtual Machine component) that manages the execution of programs written in any language that uses the . NET Framework, for example C#, VB.Net, F# and so on.
As per my understanding -
Compiling C# to MSIL and compiling MSIL to native code are two stages of the compilation process. Errors occurring in both stages are compile time errors.
However, it is unlikely that there will be any compilation errors in second stage (JIT). If your C# code compiles correctly to MSIL then it will certainly be JITed to the native code without any problems.
IMO the most important thing that happens during JITing is optimizations for the native platform.
Run-time errors are those which happen during executing your JITed native code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With