[m-rev.] for review: Conform to memory alignment requirements on doubles.
paul at bone.id.au
Tue Oct 8 23:18:54 AEDT 2013
On Mon, Oct 07, 2013 at 03:45:49PM +1100, Peter Wang wrote:
> If desired, I could try doing the nondet stack change mentioned below.
> Also, note that if we reorder constructor arguments then floats can be
> placed so they won't appear at unaligned offsets within a cell.
> Conform to memory alignment requirements on doubles.
> On some 32-bit architectures, we were violating memory alignment
> requirements for double-precision floats, in cell fields and on det and
> nondet stacks. Bug #299.
> We now only take the address of a double field when it occurs on an
> aligned memory address, i.e. when it starts at an even word offset from
> the start of the cell (this assumption is incompatible with term-size
> profiling which adds a hidden word before the start of the cell).
When the double field does not occur on an aligned memory address can it
still be read/written?
Is it easy to move this hidden word to the end of the cell or add padding?
> For the det stack, we can round up allocations to keep the stack pointer
> double-aligned, then allocate slots for doubles at even word offsets
> from the stack pointer.
> It would be trickier for the nondet stack. Multiple frame types exist
> on the nondet stack, and the different frame types are identified by
> their sizes: 3-word and 4-word temporary frames, and 5/6+ word ordinary
> frames. Rather than rounding up frame sizes to even numbers of words,
> we would probably want to dynamically pad ordinary frame allocations,
> such that any doubles in the frame will be at aligned addresses.
> However, in this change, we simply store box floats on the nondet stack.
> Add predicate which returns whether double-width floats
> should be stored on the det stack.
> Disable double-word fields in term-size profiling grades.
> Add a predicate to round up det stack frame sizes.
> Remember det_stack_float_width in exprn_opts.
What does this mean? Is this a reminder to yourself?
I will read the rest after this is anwsered.
More information about the reviews