Thanks Jb for your comment.  I assume the operand for these various 
jump/branch ILs are integers, and the new IL stream size should be exactly 
the same as the source IL stream, because I am only replacing reference 
tokens (field ref and method ref), and the tokens have a fixed 4 byte in 
size; this is why I did not bother to fix the jump/branch target.  I agree, 
logically, I should.
Notice that in the ExceptionHandler, the TryStart is actually an 
Instruction, not offset into the IL stream; this is the place I had to find 
out the index of TryStart in the source Instructions, and use the same 
index to get the Instruction in the newly created instructions.
 

Greg, thanks for pointing that out.  Years ago, I have evaluated three 
solutions:  CCI, Mono Cecil and Roslyn.  I did not pick CCI because there 
was not much user activities; I did not pick Roslyn at that time, the 
framework seemed too big for me.  Cecil is very compact and does what I 
need.
I just went over to the Roslyn site, it is looking very impressive.  If we 
get a chance to re-do our DSL compiler, I will consider using Roslyn. 
 However, generating optimized IL code is always very important to me, that 
is why we don't compile the DSL directly to IL, we go through the C# 
compiler to take advantage of the optimized IL.  How's Roslyn in this 
regard?  Thanks!

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to