intermediate-language

In .NET, is the call stack inextricably tied to a thread?

Is it at all possible in the middle of a function execution to set a pointer to the current stack (to be picked up later) and then release the current thread (without unwinding the call stack) and give it back to the thread pool? And then, have another thread pick up where that thread left off? I know it would mean that someone calling...

Why is it so easy to decompile .NET IL code?

Why is it so easy to decompile .NET IL-code into source code, compared to decompiling native x86 binaries? (Reflector produces quite good source code most of the time, while decompiling the output of a C++ compiler is almost impossible.) Is it because IL contains a lot of meta data? Or is it because IL is a higher abstraction than x86 ...

Making a language, need a good backend.

I want to make a compiled language. I am currently evaluating backends. So far I am looking at C because of its speed of execution, compiling, and a small, easy to use compiler called TCC. Having read the discussions here about using it as an intermediate language, I am trying to think about how to make it compatible with garbage collec...

Where can I learn how best to represent procedural code in a language-independent manner ready for transformations?

Hi, For my source-code transforming (Fortran and C) numerical automatic differentiation engine project PARADE, I need a language-independent representation of procedural program code. The IL (intermediate language) in the below diagram: (The whole tool will be developed solely using Haskell, so strip Java from the above diagram where...

Which Tools Perform Post-Compile Modification of IL?

A recent mention of PostSharp reminded me of this: Last year where I worked, we were thinking of using PostSharp to inject instrumentation into our code. This was in a Team Foundation Server Team Build / Continuous Integration environment. Thinking about it, I got a nagging feeling about the way PostSharp operates - it edits the IL tha...

Does PL/SQL perform tail call optimization?

I'm fairly new to the language, and I was wondering if tail calls were optimized. In other language I could examinate the machine code or an intermediate representation and figure it for myself but I have no idea about how to do that in PL/SQL. Thanks in advance. ...

How and when does .NET actually compile code?

Let's say you write an app in C#, VB, anything with .NET When you hit build, does it really compile your code? I thought so until I started using redgates reflector on some of my assemblies and saw my code verbatim. I would have expected loops to be unrolled and another plethora of optimizations, instead nothing. So when does the compil...

.maxstack question

Hello. I'd like to know how does .maxstack really work. I know it doesn't have to do with the actual size of the types you are declaring but with the number of them. My questions are: does this apply just for the function, or to all the functions that we are calling for? even if it's just for the function were .maxstack is being declar...

What happens if we add lines to IL code and add breakpoints to our program?

If I add let's say 1 line at the beggining of a method, if I set a breakpoint through Visual Studio on the first line, will it point to the first line or the second? If it will flag the wrong line, is there anything we could do when editing .exe files to ensure a regular debugging session later? Isn't there something like setting line x...

Getting Started with IL (Intermediate Language)

Can anyone suggest any good resources for getting started with IL. Specifically if anyone knows of any GOOD books or screencasts I would appreciate the feedback. ...

vs2008 syntax highlighting for il assembler

hi all, is there a way to get visual studio 2008 to do a nice syntax highlighting for the intermediate language? ...

what is composite instructions?

I'm doing the class compiler design at the chapter of intermediate code. By doing some research online, i came across this sentence: Recursive interpretation is necessary when the source program can include composite instructions. I cannot find what a composite instruction is on google. ...

C# compiling to MSIL code

Does the Microsoft C# compiler (CSC.exe) have an option to output the Intermediate Language files? Kind of like the -S switch does in GCC? ...

Options for invoking methods dynamically in C#

I've seen quite a few questions related to how do I invoke a method like this and that. What I haven't found is a listing of the different options of how to invoke a method via reflection or any other means in csharp. Can someone explain in detail the different ways of dynamically invoking a method in csharp? From reflection to emitting...

IL Compiler for .NET?

This may be a dumb question, but is there a compiler for IL code, similar to that shown by Reflector in IL mode? ...

Larger .maxstack when not storing a reference?

I am no IL master of any sort, I just use it sometimes to check what the compiler makes of the code that I write. One thing that I have been wondering about is why .maxstack gets the value it gets sometimes. Consider the following class: public class Sample { public void SomeMethod(){} } Then, I have a program like this: private ...

[MSIL] Variable comparison

Hi, The following C#-snippet: var x = 1; var y = 1; if (x == y) Console.Write("True"); Generates this MSIL: .locals init ( [0] int32 x, [1] int32 y, [2] bool CS$4$0000) L_0000: nop L_0001: ldc.i4.1 L_0002: stloc.0 L_0003: ldc.i4.1 L_0004: stloc.1 L_0005: ldloc.0 L_0006: ldloc.1 L_0007: ...

ildasm and dynamic exe files

Hi There, I am trying to create an application can modify properties in IL to create a slightly different executable. E.g Client A runs app and a label on the WinForm label Reads "Client A:". Client B runs the app and Label Says "Client B". Easy I know using config files or resource files but thats not an option for this project. The Mai...

Can Mono.Cecil modify code already loaded in the AppDomain?

I want to add some behavior to a certain class at runtime. I know how to subclass at runtime using Reflection.Emit but thats not enough, Depending on some external configuration I need to inject opcodes in a method on a type T so all classes that inherit from it automatically gain this behavior.(I cant use the .NET Profiling API) Can s...

How do actually castings work at the CLR level?

When doing an upcast or downcast, what does really happen behind the scenes? I had the idea that when doing something as: string myString = "abc"; object myObject = myString; string myStringBack = (string)myObject; the cast in the last line would have as only purpose tell the compiler we are safe we are not doing anything wrong. So, I...