|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000299||mercury||Bug||public||2013-09-16 16:09||2013-10-29 17:33|
|Target Version||Fixed in Version|
|Summary||0000299: unaligned memory access for unboxed doubles|
|Description||Unaligned 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.
|Tags||No tags attached.|
|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.|
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.
|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.|
|Fixed in 1094f42|
|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|