Groups | Blog | Home
all groups > dotnet clr > october 2004 >

dotnet clr : method pointers vs types initialization


George
10/20/2004 9:25:02 AM
Anyone who has an idea, please help me!

Consider the following scenario:

I have function pointer (via ldftn instruction) to a static method defined
by class A. I execute the instruction "calli" with this function pointer: one
effect is that class A gets initialized.

The question is: how does the execution of "calli" know that the function
pointer popped off the stack has been generated for a static method of a
certain class? (A in our case). Is this information (i.e. class A) concerning
the class name stored somewhere in the header pointed to by the function
pointer? or somewhere related to the function pointer?

Many thanks!
sonjake NO[at]SPAM online.microsoft.com
11/8/2004 11:54:07 PM
Hi George,

Value you are getting back from ldftn instruction might not be a pointer to
executable code. It depends if you already initialized type and/or if
method is JIT-ed or not. For example, if the type is not initialized you'll
get back a pointer to the runtime stub that will initialize a type, JIT a
method and then start executing method code. If you call ldftn again,
you'll probably see different value afterwards. Hope this helps.

Thanks,
Sonja
CLR JIT PM



George
11/9/2004 8:49:08 AM
[quoted text, click to view]

It's clear now. Many thanks for the info!

George
AddThis Social Bookmark Button