Closed Bug 680652 Opened 13 years ago Closed 13 years ago

64-bit big endian support is broken

Categories

(Core :: JavaScript Engine, defect)

Other
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 674522

People

(Reporter: aurelien, Unassigned)

Details

Attachments

(1 file)

On 64-bit architectures, jsval is represented as an union mapping double, 32- or 64-bit values. It uses the IEEE754 denormalized number representation to encode the type of the variable when it is not a float value. That's why the tag part is exactly at the same place and location than the sign + exponent in  a 64-bit double value, and the payload is exactly at the same place than the mantissa.

However this way only works for little-endian machines. On big-endian machines the payload overrides the sign+exponent and the tag overrides the mantissa. Moreover all the 64-bit macros in jsval.h assume a little endian order.

The attached patch tries to fix that by modifying the jsval layout to make it little-endian (at the 32-bit word level), by swapping the two 32-bit words. For that it uses dummy 32-bit values in an anonymous structure to force the location of the other 32-bit values. With this patch, the JavaScript testsuite gives the same result than on a 64-bit little endian machine (s390x versus x86_64).
Are you on the latest version? It seems that this issue should have been fixed in bug 674522 (for Firefox 8).
Yes, it's the same bug. Aurelien was building 6.0
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: