Clean up aligned allocation code in preparation for SIMD alignments.
Moves alignment fill calculations into two static Heap methods.
Adds a Heap method to handle the complex case where filler is potentially needed before and after a heap object.
Makes DoubleAlignForDeserialization explicitly fill after an already
aligned object.
LOG=N
BUG=v8:4124
Committed: https://crrev.com/fcfb080eb9a637f0ae066bed4c45095e60df8a84
Cr-Commit-Position: refs/heads/master@{#28687}
Committed: https://crrev.com/43638cd4e8b8372ca5b002eef565ec0e75ac5972
Cr-Commit-Position: refs/heads/master@{#28702}
On 2015/05/20 15:39:39, bbudge wrote: > This seems to work, but it's complex code, so ...
5 years, 7 months ago
(2015-05-21 04:47:45 UTC)
#6
On 2015/05/20 15:39:39, bbudge wrote:
> This seems to work, but it's complex code, so unit tests are needed. I will
try
> to add some, but am publishing now to get some early feedback on the approach.
> Any feedback on how to approach unit testing here is welcome. I don't see any
> Heap usage in existing unit tests.
The general direction looks fine to me. Unit testing the Heap or space classes
is
probably not going to work for quite some time, because there's no separation
between the heap and the runtime. The approach that worked for other new stuff
like the idle handler is to write code in a testable way, independent of the
heap,
and only call into the code from heap.cc.
Hannes Payer (out of office)
https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h File src/heap/spaces-inl.h (right): https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h#newcode304 src/heap/spaces-inl.h:304: object = free_list_.Allocate(aligned_size_in_bytes); I don't see how alignment works ...
5 years, 7 months ago
(2015-05-21 10:38:18 UTC)
#7
https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h File src/heap/spaces-inl.h (right): https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h#newcode304 src/heap/spaces-inl.h:304: object = free_list_.Allocate(aligned_size_in_bytes); On 2015/05/21 10:38:17, Hannes Payer wrote: ...
5 years, 7 months ago
(2015-05-21 10:55:45 UTC)
#8
https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h
File src/heap/spaces-inl.h (right):
https://codereview.chromium.org/1150593003/diff/60001/src/heap/spaces-inl.h#n...
src/heap/spaces-inl.h:304: object = free_list_.Allocate(aligned_size_in_bytes);
On 2015/05/21 10:38:17, Hannes Payer wrote:
> I don't see how alignment works for free-list allocation. You always have to
> over-allocate there because you cannot check upfront. And if the free-list
> returns already an aligned pointer, you have to place the filler after the
> object (to make the over-allocated memory iterable).
Thanks for pointing this out. I'll have to modify the filling to handle this
case. I would still like to avoid over-allocating when we know the alignment
constraints ahead of time.
Hannes Payer (out of office)
This cl seems to be in a strange merge state with an older version of ...
5 years, 7 months ago
(2015-05-22 10:56:15 UTC)
#9
This cl seems to be in a strange merge state with an older version of Issue
1152513002: Generalize alignment in heap GC functions. Could you please resolve
that.
https://codereview.chromium.org/1150593003/diff/80001/src/globals.h
File src/globals.h (right):
https://codereview.chromium.org/1150593003/diff/80001/src/globals.h#newcode441
src/globals.h:441: enum AllocationAlignment { kWordAligned, kDoubleAligned,
kDoubleValueAligned };
I called it kDoubleUnaligned because it is general. kDoubleValueAligned just
corresponds to the HeapNumber case, not necessarily to any other object type,
for which the value would have to be aligned differently.
bbudge
On 2015/05/22 10:56:15, Hannes Payer wrote: > This cl seems to be in a strange ...
5 years, 7 months ago
(2015-05-22 11:25:49 UTC)
#10
On 2015/05/22 10:56:15, Hannes Payer wrote:
> This cl seems to be in a strange merge state with an older version of Issue
> 1152513002: Generalize alignment in heap GC functions. Could you please
resolve
> that.
>
> https://codereview.chromium.org/1150593003/diff/80001/src/globals.h
> File src/globals.h (right):
>
> https://codereview.chromium.org/1150593003/diff/80001/src/globals.h#newcode441
> src/globals.h:441: enum AllocationAlignment { kWordAligned, kDoubleAligned,
> kDoubleValueAligned };
> I called it kDoubleUnaligned because it is general. kDoubleValueAligned just
> corresponds to the HeapNumber case, not necessarily to any other object type,
> for which the value would have to be aligned differently.
Sorry, I should have said it's not quite ready for a real review. I'll change
back to your name then. I'll be adding a kSimd128Unaligned enum value in an
upcoming CL.
bbudge
OK, I think this is ready for review. PTAL
5 years, 7 months ago
(2015-05-22 12:39:46 UTC)
#11
OK, I think this is ready for review. PTAL
Hannes Payer (out of office)
looking good. just a few nits. https://codereview.chromium.org/1150593003/diff/200001/src/heap/heap.h File src/heap/heap.h (right): https://codereview.chromium.org/1150593003/diff/200001/src/heap/heap.h#newcode718 src/heap/heap.h:718: Please add comments ...
5 years, 7 months ago
(2015-05-26 09:22:30 UTC)
#12
Cool! I left a few comments about the tests. https://codereview.chromium.org/1150593003/diff/260001/test/cctest/test-heap.cc File test/cctest/test-heap.cc (right): https://codereview.chromium.org/1150593003/diff/260001/test/cctest/test-heap.cc#newcode1841 test/cctest/test-heap.cc:1841: ...
5 years, 7 months ago
(2015-05-27 14:12:45 UTC)
#14
PTAL https://codereview.chromium.org/1150593003/diff/260001/test/cctest/test-heap.cc File test/cctest/test-heap.cc (right): https://codereview.chromium.org/1150593003/diff/260001/test/cctest/test-heap.cc#newcode1841 test/cctest/test-heap.cc:1841: // cause exactly one filler object to be ...
5 years, 6 months ago
(2015-05-28 09:28:33 UTC)
#15
There were two problems with the previous CL. 1) DoubleAlignForDeserialization treated the size parameter as ...
5 years, 6 months ago
(2015-05-29 10:22:45 UTC)
#22
There were two problems with the previous CL.
1) DoubleAlignForDeserialization treated the size parameter as the object size,
rather than the object size + filler.
2) The tests were wrong when top was initially misaligned. Creating filler and a
kPointerSize object left top misaligned again, causing two filler objects.
PTAL
Hannes Payer (out of office)
On 2015/05/29 10:22:45, bbudge wrote: > There were two problems with the previous CL. > ...
5 years, 6 months ago
(2015-05-29 13:15:38 UTC)
#23
On 2015/05/29 10:22:45, bbudge wrote:
> There were two problems with the previous CL.
>
> 1) DoubleAlignForDeserialization treated the size parameter as the object
size,
> rather than the object size + filler.
>
> 2) The tests were wrong when top was initially misaligned. Creating filler and
a
> kPointerSize object left top misaligned again, causing two filler objects.
>
> PTAL
Thanks lgtm
bbudge
The CQ bit was checked by bbudge@chromium.org
5 years, 6 months ago
(2015-05-29 13:16:12 UTC)
#24
Issue 1150593003: Clean up aligned allocation code in preparation for SIMD alignments.
(Closed)
Created 5 years, 7 months ago by bbudge
Modified 5 years, 6 months ago
Reviewers: Hannes Payer (out of office), Benedikt Meurer
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Comments: 17