aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkUtils_opts.h
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-08-23 11:11:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-23 17:25:26 +0000
commitcd71f115a846332d95b29fbeed3f315d8c01753d (patch)
treed8c1b2eec555fe1bd9204d7867ad7c5bf1d5cbc3 /src/opts/SkUtils_opts.h
parent59a62ed9462efa58573594da0f0088bba37960af (diff)
make SkOpts functions inline, not static
When Skia's built with an interestingly advanced instruction set baseline like SSSE3 or SSE4.1, we end up with two distinct copies of some SkOpts functions, one default in SkOpts.o and one specialization from SkOpts_{ssse3,sse41}.o. These functions are static, and so are technically unrelated, even though they're the same code compiled with the same instructions available. They're going to be identical. What we want here is to remove static but mark them as inline instead. In this case inline means "if the linker sees multiple copies of this, that's cool, just pick any one arbitrarily". That's just what we want. Now, when I disassemble a binary before and after this change, I do see the redundant routines removed. However, the file size change is minimal... I suspect that this must mean the linker has noticed that we had identical code and physically folded the two logically independent routines. I don't know how prevalent this optimization is, though, so it doesn't hurt to give it more of a "one copy please" hint with inline. There may also be a difference here between the binary size (~unchanged) and the in-memory layout of that binary? Change-Id: Id9c8f0ffc84aa1c9a066c22b623d34adab281857 Reviewed-on: https://skia-review.googlesource.com/37501 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/opts/SkUtils_opts.h')
-rw-r--r--src/opts/SkUtils_opts.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/opts/SkUtils_opts.h b/src/opts/SkUtils_opts.h
index d67a777ca8..525623c81b 100644
--- a/src/opts/SkUtils_opts.h
+++ b/src/opts/SkUtils_opts.h
@@ -30,13 +30,13 @@ namespace SK_OPTS_NS {
}
}
- static void memset16(uint16_t buffer[], uint16_t value, int count) {
+ /*not static*/ inline void memset16(uint16_t buffer[], uint16_t value, int count) {
memsetT(buffer, value, count);
}
- static void memset32(uint32_t buffer[], uint32_t value, int count) {
+ /*not static*/ inline void memset32(uint32_t buffer[], uint32_t value, int count) {
memsetT(buffer, value, count);
}
- static void memset64(uint64_t buffer[], uint64_t value, int count) {
+ /*not static*/ inline void memset64(uint64_t buffer[], uint64_t value, int count) {
memsetT(buffer, value, count);
}