diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-05 20:36:56 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-01-06 09:38:16 +0000 |
commit | e75406e54c57fc3113d4f1983249eb2aec0a3bcd (patch) | |
tree | 68c4ed87da6e22b6cca557bc3b5d17af2b029c8a /sal/rtl | |
parent | eafb1ebf74c3caf8fbecdc6a4fc7037c3c8f4964 (diff) |
tdf#39631 - branch hints: comment, and tweak variously, also use.
Find a few million mis-predicted branches (according to callgrind)
and annotate them. Mark string acquire/release as hot, and a number of
deprecated methods as cold.
Change-Id: I678b3981794221c97f9ebb70fd0161c0fda5dceb
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/alloc_cache.cxx | 6 | ||||
-rw-r--r-- | sal/rtl/strtmpl.cxx | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx index 7bd54975b473..464c0be082c8 100644 --- a/sal/rtl/alloc_cache.cxx +++ b/sal/rtl/alloc_cache.cxx @@ -270,7 +270,7 @@ rtl_cache_slab_create ( size = cache->m_slab_size; addr = rtl_arena_alloc (cache->m_source, &size); - if (addr != nullptr) + if (SAL_LIKELY(addr != nullptr)) { assert(size >= cache->m_slab_size); @@ -286,7 +286,7 @@ rtl_cache_slab_create ( slab = RTL_CACHE_SLAB(addr, cache->m_slab_size); (void) rtl_cache_slab_constructor (slab, nullptr); } - if (slab != nullptr) + if (SAL_LIKELY(slab != nullptr)) { slab->m_data = reinterpret_cast<sal_uIntPtr>(addr); @@ -1146,7 +1146,7 @@ SAL_CALL rtl_cache_alloc ( } RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock)); - if (cache->m_cpu_curr != nullptr) + if (SAL_LIKELY(cache->m_cpu_curr != nullptr)) { for (;;) { diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index 41ab63fd69bd..7260fbcfc9d4 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -1214,7 +1214,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( acquire )( IMPL_RTL_STRINGDATA* pThis ) void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis ) SAL_THROW_EXTERN_C() { - if (SAL_STRING_IS_STATIC (pThis)) + if (SAL_UNLIKELY(SAL_STRING_IS_STATIC (pThis))) return; /* OString doesn't have an 'intern' */ |