2024-04-24 04:19 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000299mercuryBugpublic2013-10-29 17:33
Assigned Towangp 
Product Version 
Target VersionFixed in Version 
Summary0000299: unaligned memory access for unboxed doubles
DescriptionUnaligned memory access instructions occur on 32-bit architectures when an unboxed double begins on an odd-numbered slot, crashing on some architectures (e.g. SPARC).

I think we can "just" split the dword read/write into two instructions for odd-numbered slots.
TagsNo tags attached.
Attached Files




wangp (developer)

We also have to prevent unaligned doubles on the stack, by allocating aligned stack slots and ensuring the stack pointer is always aligned. Alternatively, split up all reads/writes to double-width stack slots into two instructions.


wangp (developer)

The nondet stack is complicated by multiple frame types (ordinary, temporary det, temporary nondet). Ordinary frames have 5 fixed slots + temporaries (except for mm grades, with 6 fixed slots). Temporary det frames are exactly 4 words big. Temporary nondet frames are exactly 3 words big. The size is used to recognise the different types.

Maintaining an invariant that the frame pointer rests on an aligned address (so that we can always allocate aligned double slots) would be tricky and probably not worthwhile.


pbone (administrator)

I would like to see these values aligned on the stack in all cases. However since this will be tricky a short term work around, such as using two read instructions for 64bit values on 32 bit platforms, would be okay.


wangp (developer)

Fixed in 1094f42

-Issue History
Date Modified Username Field Change
2013-09-16 16:09 wangp New Issue
2013-09-16 16:36 wangp File Added: unaligned.m
2013-09-17 17:53 wangp Note Added: 0000566
2013-09-18 14:38 wangp Note Added: 0000567
2013-10-03 15:11 pbone Note Added: 0000572
2013-10-29 17:33 wangp Note Added: 0000573
2013-10-29 17:33 wangp Status new => resolved
2013-10-29 17:33 wangp Resolution open => fixed
2013-10-29 17:33 wangp Assigned To => wangp
+Issue History