Re: Using helper return into native code
Jan Kotas <[email protected]> Mon, 21 Mar 2005 06:36:53 -0800
| Newsgroups | gmane.comp.windows.devel.dotnet.rotor |
|---|---|
| Message-ID | <A21210363B64FE44842335467A883AA904ADDEFB@RED-MSG-43.redmond.corp.microsoft.com> |
You need to call emit_pushresult_Ptr after the first helper call to get = the return value pushed onto the stack: <emit the first helper call with a "normal" emit macro, without problem> emit_pushresult_Ptr(); enregisterTOS; mov_register_indirect_to(ARG_1, TOS_REG_1); callInfo.reset(); emit_callhelper_D(func); -Jan -----Original Message----- From: Discussion of the Rotor Shared Source CLI implementation = [mailto:[email protected]] On Behalf Of J. Redondo Sent: Monday, March 21, 2005 1:43 AM To: [email protected] Subject: [DOTNET-ROTOR] Using helper return into native code Hello, In my quest to explore and study the FJit a bit more, I'm having trouble accessing to certain data that I need to fully implement my own Rotor project. The problem is that, once I managed to insert calls to jit interface helpers in the places I wanted, thanks to your valuable help, there is a special case in which I'm not having too much success. The problem is that when a helper call is performed, I need its return value = to pass it as a parameter to another helper call which follows the first (performed with another emit_callhelper_X macro or similar). The first helper returns an int value and the second helper only admits an int parameter, although I pretend to add some extra parameters once I solve = this issue. So, the steps I follow are: <emit the first helper call with a "normal" emit macro, without problem> enregisterTOS; mov_register_indirect_to(ARG_1, TOS_REG_1); callInfo.reset(); emit_callhelper_D(func); As far as I know, when a function returns, it's return value is placed = in the stack, so I basically try to place the top of the stack into a = register (enregisterTOS place the value into the TOS_REG_1 register), move the = value to be the first argument of my second call, and perform the call. = However, an error related to the method table of the current object is shown, = because I think that the value I move is the pointer to the 'this' object. If = that it's true, that means that the return value of the first helper is not = in the top of the stack, but then I'm completely clueless about where is it placed. =BFAnybody can give me a clue about this problem? Thank you very much in advance, J. Redondo =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This list is hosted by DevelopMentor=AE http://www.develop.com View archives and manage your subscription(s) at = http://discuss.develop.com =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This list is hosted by DevelopMentor=AE http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com