Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Issue 8366041: Make the placement-new buffer in LazyInstance<Type> aligned. (Closed)

Created:
9 years, 2 months ago by Timur Iskhodzhanov
Modified:
9 years, 2 months ago
CC:
chromium-reviews, Timur Iskhodzhanov, Alexander Potapenko, pam+watch_chromium.org, stuartmorgan+watch_chromium.org, brettw-cc_chromium.org, Lei Zhang
Visibility:
Public.

Description

Make the placement-new buffer in LazyInstance<Type> aligned. Before, the LazyInstance::buf_ was 4-byte aligned on x64, which is wrong. WHY?! I thought buf_ is the first member of LazyInstance?! NO! LazyInstance inherits LazyInstanceHelper, sizeof(LIH) = 4. Then, buf_ is given to placement new. As a result, the LazyInstance<Type> instances are all 4-byte aligned on x64. This may break some stuff like SSE-based optimizations assuming the instance is 8-bytes aligned (fair assumption). Also, if Type contains a bunch of std::vector/hash_map's, their pointers occupy two half-words and Valgrind doesn't traverse to their data, reporting a false leak. BUG=64930 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106763

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 1

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -11 lines) Patch
M base/lazy_instance.h View 1 2 3 3 chunks +6 lines, -1 line 0 comments Download
M tools/valgrind/memcheck/suppressions.txt View 1 chunk +0 lines, -10 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Timur Iskhodzhanov
Hi Nico, Will, Mind reviewing this tiny CL? (+see description) Re: DCHECK_ALIGNED - feel free ...
9 years, 2 months ago (2011-10-21 16:04:08 UTC) #1
willchan no longer on Chromium
http://codereview.chromium.org/8366041/diff/2001/base/logging.h File base/logging.h (right): http://codereview.chromium.org/8366041/diff/2001/base/logging.h#newcode719 base/logging.h:719: #define DCHECK_ALIGNED(ptr) \ I don't think we need to ...
9 years, 2 months ago (2011-10-21 16:10:41 UTC) #2
willchan no longer on Chromium
Other than the previous comment about logging.h, LGTM. On Fri, Oct 21, 2011 at 9:10 ...
9 years, 2 months ago (2011-10-21 16:11:13 UTC) #3
Timur Iskhodzhanov
PTAL
9 years, 2 months ago (2011-10-21 16:23:49 UTC) #4
Nico
lgtm http://codereview.chromium.org/8366041/diff/2004/base/lazy_instance.h File base/lazy_instance.h (right): http://codereview.chromium.org/8366041/diff/2004/base/lazy_instance.h#newcode55 base/lazy_instance.h:55: DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) % sizeof(instance), 0u) do you need this ...
9 years, 2 months ago (2011-10-21 16:26:22 UTC) #5
Timur Iskhodzhanov
PTAL http://codereview.chromium.org/8366041/diff/2004/base/lazy_instance.h File base/lazy_instance.h (right): http://codereview.chromium.org/8366041/diff/2004/base/lazy_instance.h#newcode55 base/lazy_instance.h:55: DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) % sizeof(instance), 0u) void * ptr; ptr ...
9 years, 2 months ago (2011-10-21 16:40:28 UTC) #6
Nico
lgtm
9 years, 2 months ago (2011-10-21 16:41:56 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/timurrrr@chromium.org/8366041/8002
9 years, 2 months ago (2011-10-21 18:47:18 UTC) #8
commit-bot: I haz the power
9 years, 2 months ago (2011-10-21 19:46:01 UTC) #9
Change committed as 106763

Powered by Google App Engine
This is Rietveld 408576698