32 bit constant issues
Closed this issue · 6 comments
It seems sometimes 32 bit constant pairs are packed into 64 bit constants. This is a big problem for jit, since it cannot track constants properly. Is there a way to detect such const64 byte codes? I suspect that is not possible, that a constant is used as both 64 bit and a pair of 32 bit, so at parsing time we could replace them with two 32 bit constants in the latter case. A flag or a byte code type would be enough.
Can you give a example code?
x86-32:
(func (export "type-second-f32") (result f32)
(call $f64-f32 (f64.const 64) (f32.const 32))
)
Byte code dump:
0 const64 dstOffset: 0 value: 4634204016564240384
16 const32 dstOffset: 8 value: 1107296256
28 call index: 0 paramOffsets: 0 4 8 resultOffsets: 12
48 end resultOffsets: 12
It looks like I was wrong. The call has two arguments, but according to the byte code dump, the call has three. How the call should be handled on 32 bit?
It is not bug. this is intended operation for copy arguments without reference function arguments type
(f64.const 64) (f32.const 32)
(copy4B, copy4B) (copy4B)
each copy count of type is computed by function valueFunctionCopyCount
but It could be confusing. may I add a function for original position?
I suspect this is something new. Are these true:
- affect calls / callIndirects only
- all data type are split into pointer sized fragments, so a 128 bit value is 4 moves on 32 bit, and 2 moves on 64 bit?
- 32 bit moves are 64 bit moves on 64 bit?
If this is true, I can create an algorithm to detect which "arguments" needs to be ignored by jit.
Yes, three things are true.
It looks like End opcode is also affected.