Hi Miguel,

Looking at fjit.cpp, we see the following in the big loop you mention:

        case CEE_CALL:
            JitResult = compileCEE_CALL();
            break;

So compileCEE_CALL() is the function that does the actuall code emission and 
processing for CEE_CALL instruction. If we continue and look at compileCEE_CALL, we 
see the code to call the profiler callback at the very top of it.

if (flags & CORJIT_FLG_PROF_CALLRET)
    { ... }

Profiler callback does exactly what you describe i.e. it gets called every time the 
function is called. You could put your C++ function in a profiler dll and register it 
as the call back. This way you would not need to change the JIT. However, if part of 
your project is to create your own infrastructure than you can mimic your own code off 
the code for the profiler callback. In particular look at the 
emit_callhelper_prof2(...) macro in fjitdef.h. This macro emits the code for the call 
into the jitted function. You can create a new but very similar macro to call your 
function.

Thanks,

Vladimir

This posting is provided "AS IS" with no warranties, and confers no rights.



-----Original Message-----
From: Miguel Tomás [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 04, 2003 8:12 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Modification on Fjit - help

Hi! I'm a spanish student and I've just started working on sscli. I'm doing some 
modifications on it but I have a problem with Fjit. I want to modify the jitCompile 
method in fjit.cpp, in particular the big "switch (opcode)"; when the case CEE_CALL is 
entered I want to insert a call in native code to a method written in C++ so every 
time the jitted method is executed it performs a call to my method before doing the 
call that it is supposed to do but I don't know how to do it. I hope I have explained 
it well. If anyone can help me I would be very grateful. Thank you.

---------------------------------
Yahoo! Móviles
Personaliza tu móvil con tu logo y melodía favorito

Reply via email to