Re: method calls and extra indirection

Gomi Kapoor <gomikapoor-/[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>
Hi Rhys, 
> The "call_extern" opcode hasn't been used since pnet
> 0.3.6 (released in May 
> 2002).  What version are you looking at?  In version
> 0.3.8, "call" and 
> "call_extern" were collapsed into a single opcode
> named "call" and the 
> instruction was streamlined to reduce its overhead.
I am using the current release 0.6.4
I read the pnet/engine/HACKING file and then tried to
look for the same in the code.

<snip>
The second instruction, "call", is handled in a
similar manner. The CVMCoder_CallMethod function
(cvmc_call.c) outputs a CVM "call_extern" instruction
for the "Console.WriteLine" method. This CVM
instruction means "call an external method that we may
not have translated yet".
.....
.....
When execution reaches the "call_extern" instruction
(cvm_call.c), the engine notices that
"Console.WriteLine" has not yet been translated.  So
it calls out to "_ILConvertMethod" and creates the CVM
verion of that method.  And so on.
.....
.....
</snip>

 
> I think I did this because of threading: there is no
> thread-safe way to 
> back-patch a "call_extern" to turn it into "call",
> without running the risk 
> that another thread will get a corrupted instruction
> during the modification.  
> I have since avoided back-patching as a solution.
OK, so can we say there is an always an indirection
overhead for every method call?

> There are a number of IDE's and graphical debuggers
> around (search on  freshmeat.net).  Every pnet 
> developer uses a
> different one, so I suggest that 
> you try a few and see which one suits you best.  The
> file 
> "pnet/engine/HACKING" also contains some tips on
> debugging the engine.
Currently I am using "gvim" for the editor, "grep" for
searching the relavent portions of code and "gdb" for
the debugging. 

Regards,
Gomi Kapoor


________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.