[Mono-dev] Question about adding opcodes

Steven Bluen sbluen153 at yahoo.com
Sun Jun 1 22:24:58 UTC 2014


Thanks for your response. Would you also care to explain something else please? Because I'm not sure why when I place printf calls inside the switch statement, when I run a program with Mono, all of the output is placed at the beginning, before anything else is printed to the console.

On another note, is there an easy way to read the preprocessor macros when coding or debugging Mono's functions? Because they slow down my understanding of the code by being skipped in the debugger and because my IDE, Eclipse, can't handle some of them very well under its default settings.

Steven Bluen
--------------------------------------------
On Sun, 6/1/14, Alex Rønne Petersen <alex at alexrp.com> wrote:

 Subject: Re: [Mono-dev] Question about adding opcodes
 To: "Steven Bluen" <sbluen153 at yahoo.com>
 Cc: mono-devel-list at lists.ximian.com
 Date: Sunday, June 1, 2014, 6:16 AM
 
 Hi,
 
 On Sun, Jun 1, 2014 at 2:58 PM, Steven Bluen <sbluen153 at yahoo.com>
 wrote:
 > Hello,
 >
 > I am trying to add an opcode to Mono's JIT compiler and
 its interpreter to allow Mono to compile and run
 applications so that I can make a frequently used operation
 in a C# program run faster. To keep things simple and avoid
 the need for parsing, this opcode is invoked through dynamic
 methods.
 
 Adding it to the interpreter is not worth it. The
 interpreter is
 bitrotted to the point of obscurity.
 
 >
 > I am able to get Mono's JIT compiler to stop at a
 breakpoint in mono/mini/method-to-ir.c at the point where
 the opcode is added to the method's intermediate
 representation. However, it would be much appreciated if
 someone could let me know which component, source code file,
 or function of Mono's interpreter is responsible for
 interpreting the instructions that form the body of a
 dynamic method.
 
 They're parsed like any other method (from an on-disk CIL
 assembly).
 This parsing is based on the tables in mono/cil/ and is done
 in
 mono_method_to_ir () in mono/mini/method-to-ir.c. The CIL
 stream is
 simply interpreted directly. If you're adding a new CIL
 opcode
 (different from an IR opcode), add it in
 mono/cil/cil-opcodes.xml and
 handle it in mono_method_to_ir (). If you plan to also add
 an IR
 opcode (or several), you may want to consider intercepting
 an
 intrinsic method call instead of using a custom CIL opcode.
 This'll be
 portable to MS.NET as MS.NET will then just use the managed
 fallback.
 
 Regards,
 Alex
 


More information about the Mono-devel-list mailing list