Title: [134490] trunk/Source/WTF
- Revision
- 134490
- Author
- [email protected]
- Date
- 2012-11-13 14:39:32 -0800 (Tue, 13 Nov 2012)
Log Message
Fix FastMalloc.cpp compile error for MSVC in 64-bit.
https://bugs.webkit.org/show_bug.cgi?id=88344
Patch by Brent Fulgham <[email protected]> and Alex Christensen <[email protected]> on 2012-11-13
Reviewed by Ryosuke Niwa.
MSVC will not compile array declarations of zero size. The existing
padding math for TCMalloc_Central_FreeListPadded would evaluate
to zero on 64-bit machines, preventing the compile from finishing.
* wtf/FastMalloc.cpp:
(TCMalloc_Central_FreeListPadded_Template): Add new template (and
zero-size specialization) to provide proper behavior under 64-bit
Windows build.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (134489 => 134490)
--- trunk/Source/WTF/ChangeLog 2012-11-13 22:38:25 UTC (rev 134489)
+++ trunk/Source/WTF/ChangeLog 2012-11-13 22:39:32 UTC (rev 134490)
@@ -1,3 +1,19 @@
+2012-11-13 Brent Fulgham <[email protected]> and Alex Christensen <[email protected]>
+
+ Fix FastMalloc.cpp compile error for MSVC in 64-bit.
+ https://bugs.webkit.org/show_bug.cgi?id=88344
+
+ Reviewed by Ryosuke Niwa.
+
+ MSVC will not compile array declarations of zero size. The existing
+ padding math for TCMalloc_Central_FreeListPadded would evaluate
+ to zero on 64-bit machines, preventing the compile from finishing.
+
+ * wtf/FastMalloc.cpp:
+ (TCMalloc_Central_FreeListPadded_Template): Add new template (and
+ zero-size specialization) to provide proper behavior under 64-bit
+ Windows build.
+
2012-11-13 Brent Fulgham <[email protected]> and Alex Christensen <[email protected]>
FastMalloc.cpp needs to be reordered before padding bug can be fixed
Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (134489 => 134490)
--- trunk/Source/WTF/wtf/FastMalloc.cpp 2012-11-13 22:38:25 UTC (rev 134489)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp 2012-11-13 22:39:32 UTC (rev 134490)
@@ -1237,11 +1237,19 @@
#endif
// Pad each CentralCache object to multiple of 64 bytes
-class TCMalloc_Central_FreeListPadded : public TCMalloc_Central_FreeList {
- private:
- char pad_[(64 - (sizeof(TCMalloc_Central_FreeList) % 64)) % 64];
+template <size_t SizeToPad>
+class TCMalloc_Central_FreeListPadded_Template : public TCMalloc_Central_FreeList {
+private:
+ char pad[64 - SizeToPad];
};
+// Zero-size specialization to avoid compiler error when TCMalloc_Central_FreeList happens
+// to be exactly 64 bytes.
+template <> class TCMalloc_Central_FreeListPadded_Template<0> : public TCMalloc_Central_FreeList {
+};
+
+typedef TCMalloc_Central_FreeListPadded_Template<sizeof(TCMalloc_Central_FreeList) % 64> TCMalloc_Central_FreeListPadded;
+
#if COMPILER(CLANG) && defined(__has_warning)
#pragma clang diagnostic pop
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes