aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkOpts_hsw.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-01-04 11:04:01 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-04 20:58:21 +0000
commit464e6a1b5a0598eb1805fa6c11f515466346704f (patch)
tree840901b5324c6c28397acc39ec93094cc7d0ebb5 /src/opts/SkOpts_hsw.cpp
parent07792b218e1cf31c42611276d597fcc99677d391 (diff)
Retry trim another instruction off SkRasterPipeline overhead
This time, with manual program memory management instead of std::vector<void*>. Using STL types from SkOpts_hsw.cpp is not safe. Things like std::vector<void*> are inlined but not anonymous, so they're deduped by the linker arbitrarily. This is bad when we pick the version compiled with AVX instructions on a machine that doesn't support AVX... std::vector<Stage> was safe before because Stage itself was anonymous. While not anonymous, std::vector<Stage> is unique to the compilation unit, because you can only refer to the anonymous Stage in the compilation unit. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_asan_rel_ng;skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I015e27583b6b6ff06b5e9f63e3f40ee6b27d6dbd Reviewed-on: https://skia-review.googlesource.com/6550 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/opts/SkOpts_hsw.cpp')
-rw-r--r--src/opts/SkOpts_hsw.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/opts/SkOpts_hsw.cpp b/src/opts/SkOpts_hsw.cpp
index d0845c58f7..bb4e4d1f47 100644
--- a/src/opts/SkOpts_hsw.cpp
+++ b/src/opts/SkOpts_hsw.cpp
@@ -6,8 +6,14 @@
*/
#include "SkSafe_math.h" // Keep this first.
-#include "SkOpts.h"
+// Please note carefully.
+// It is not safe for _opts.h files included here to use STL types, for the
+// same reason we just had to include SkSafe_math.h: STL types are templated,
+// defined in headers, but not in anonymous namespaces. It's very easy to
+// cause ODR violations with these types and AVX+ code generation.
+
+#include "SkOpts.h"
#define SK_OPTS_NS hsw
#include "SkBitmapFilter_opts.h"
#include "SkRasterPipeline_opts.h"