|
From: | Michael Goffioul |
Subject: | Re: Please build the JIT branch |
Date: | Fri, 13 Jul 2012 17:36:46 +0100 |
On Fri, Jul 13, 2012 at 2:30 PM, Michael Goffioul <address@hidden> wrote:On Fri, Jul 13, 2012 at 12:37 PM, Michael Goffioul <address@hidden> wrote:If you inspect how the stack is constructed before calling octave_jit_cast_complex_any, you can see that:- 24 bytes are allocated on the stack (02CB00E9, that's 3 double's, let's call them d1, d2 and d3)- EAX is copied at the top of the stack, at this point EAX is the "octave_base_value* obv" argument, so it's basically the first argument of the function; it occupies the location d1 on the stack- after octave_jit_cast_complex_any call, results are pulled from the stack at location d2 and d3This does not correspond to the ABI MSVC is using. Instead of pushing a hidden pointer on the top of the stack (as it should do), it allocates the memory for the returned complex value on the stack and *after* the regular function arguments. Of course, when octave_jit_cast_complex_any tries to access obv, it points to invalid memory and crashes.My analysis is not entirely correct. From the assembly calling octave_jit_cast_complex_any, it looks like only one argument is pushed on the stack (no hidden pointer) and the function is expected to return 2 double values on the x87 stack. These 2 doubles are then popped from the x87 stack, stored temporarily in d2 and d3, then packed into XMM0. Still, this is incompatible with how MSVC compiles octave_jit_cast_complex_any.Maybe an interesting reading...
[Prev in Thread] | Current Thread | [Next in Thread] |