lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lightning] Re: lightning x86 FP patch


From: Paolo Bonzini
Subject: [Lightning] Re: lightning x86 FP patch
Date: Fri, 04 Jan 2008 17:17:24 +0100
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)


: (rd) == (s2) ? ((s1) == 0 ? op((s1), (s2)) : jit_fxch((s2), op((s1), 0))) \

which works for me, but I don't have a test case for s1 != 0 (where
`op' vs. `opr' comes into play).

here you need opr.  Otherwise this one is ok.

Meanwhile, I ran into a deeper problem in my application. As I
understand it, the lightning model of FP operations on x86 effectively
ignores the "stack pointer" of the FP register stack, instead treating
the FP registers like an array that happens to have stack-like
operations.

Yes.

The problem is that the processor keeps track of the stack
state; it notices when you use registers that don't correspond to
pushed values, and it notices if the stack is left with extra data. In
my application, leaving the stack in a bad state causes floating-point
operations to go wrong in code *not* generated by the JIT.

Do you have a small self-contained testcase?

What's the right way around this problem? Maybe JIT-generated code can
safely ignore the stackness of the FP registers, as long as it resets
some flags before returning to code that might care?

Yes, maybe something like that (and as long as JITted code does not access uninitialized registers).

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]