The regular HELPER_METHOD_FRAME_BEGIN/END assumes that it is right next
to the stack frame of jitted code.

<stack frame of the method with HELPER_METHOD_FRAME>
<stack frame of jitted method>


Your change probably made stack frames to look like this:

<stack frame of the method with HELPER_METHOD_FRAME>
<stack frame of your new code> 
<stack frame of jitted method>


One way to fix it is to jump instead of call at the end of your assembly
- this will eliminate the intermediate stack frame, but it may not be an
option for you if you need to do some bookkeeping after the call to
JIT_NewArr1 as well. 

The other option is to specify Frame::FRAME_ATTR_CAPTURE_DEPTH_2 as
attribute for HELPER_METHOD_FRAME. This will tell the stackwalking
infrastructure that there is an intermediate frame. Check how it is done
in ArrayStoreCheck in clr\src\VM\i386\cgenx86.cpp.



Also, if you haven't stepped through your new assembly code in debugger
and verified that everything work properly, there is a good chance that
something is getting corrupted by your code. If the answer above does
not helpful, I would recommend stepping through your assembly code in
debugger and double check everything - I have found many of my mistakes
this way in the past.


-Jan

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

-----Original Message-----
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of John Locke
Sent: Wednesday, August 13, 2003 4:55 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Wrapping the JIT_NewArr1 helper function.

I'm changing the implementation of
get_jit_helper(newarray) so that at first invocation
of get_jit_helper, I create new assembly on the fly
and then return the address of that new assembly.  The
new assembly does some bookkeeping and then attempts
to call JIT_NewArr1.  At the end of JIT_NewArr1 in
HELPER_METHOD_FRAME_END, a null reference exception is
thrown at line 109 of gmsx86.cpp.

Any suggestions?  Do I need to emit the equivalent of
HELPER_METHOD_FRAME_END in the assembly code I
generate on the fly?  What about generating the code
added by HCIMPL2 as well?

Help!

John

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to