[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Reproducible floating point arithmetic in LuaJIT 2
- From: Erik Lindroos <gliptic@...>
- Date: Sat, 14 Nov 2009 20:45:30 +0100
Hello,
I'm trying to patch in reproducible (strictly IEEE 754) floating point arithmetic in LuaJIT 2. Only the interpreter is really affected as far as I can tell, since the JIT uses SSE2 exclusively.
To patch the interpreter, I need to store some constants to scale down and up x87 floating point regs before/after multiplication and division.
However, while patching lj_vm_foldarith, I noticed DynASM doesn't seem to relocate loads from globals correctly, e.g.:
| ->x87_scaledown:
| .byte 0,0,0,0,0,0,0,128,255,3
| fld tword [->x87_scaledown]
This turns into a load from a bogus address, while calls to global labels are clearly relocated correctly.
How would I solve this without e.g. writing the constant to the stack and load it from there every time?
Sincerely,
Erik Lindroos