The thing with it's being a direct call, if I define DynamicMethod A, and
then I go ahead and define and insert the IL code for B, I can afterwards
insert the IL code for A, and then call A, which calls B. IOW, if it's a
direct call, how does it know where A is, when A hasn't even been created
yet? Does the initialization of a Dynamic Method somehow guarantee a
beginning point in execution? Perhaps there are two direct calls involved,
and every time the code for a dynamic method changes, it's direct call is
redirected to the new code? Or, this being JIT and all, maybe method A was
never compiled until I called method B, but I have no idea how any direct
calls could be made if you had to check all the .net code to see if it was
compiled yet before calling it.

Thanks,
Jonathan

----- Original Message -----
From: "Curt Hagenlocher" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 03, 2005 12:22 PM
Subject: Re: [ADVANCED-DOTNET] CodeDOM and OpCodes in Implementing Dynamic
Code


From: "Jonathan Ross" <[EMAIL PROTECTED]>

By any chance, do you know for sure if the call I'm making from Method B
to
Method A is a direct call instruction or if it's a dynamic method
delegate?
I'm betting it's a straight up instruction call, which has me frothing
with
anticipation.

Well, you're using the Call opcode, which should be a direct call.  Going
through a delegate would be more complicated -- remember that a creating a
delegate causes a class instance to be created.  Your call to the methodB
delegate, for instance, generates the following IL:

callvirt instance int32 kernal.Program/method::Invoke()

--
Curt Hagenlocher
[EMAIL PROTECTED]

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to