Commit 24821079 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

fbstring: switch FOLLY_NOINLINE inline to FOLLY_NOINLINE

Summary: fbstring: switch FOLLY_NOINLINE inline to FOLLY_NOINLINE

Reviewed By: yfeldblum, ot

Differential Revision: D29978049

fbshipit-source-id: ecacb51d58c0c8f10ce6f67ca1d51e9de60bff55
parent 57f9d2cd
...@@ -626,8 +626,7 @@ inline void fbstring_core<Char>::copySmall(const fbstring_core& rhs) { ...@@ -626,8 +626,7 @@ inline void fbstring_core<Char>::copySmall(const fbstring_core& rhs) {
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::copyMedium( FOLLY_NOINLINE void fbstring_core<Char>::copyMedium(const fbstring_core& rhs) {
const fbstring_core& rhs) {
// Medium strings are copied eagerly. Don't forget to allocate // Medium strings are copied eagerly. Don't forget to allocate
// one extra Char for the null terminator. // one extra Char for the null terminator.
auto const allocSize = goodMallocSize((1 + rhs.ml_.size_) * sizeof(Char)); auto const allocSize = goodMallocSize((1 + rhs.ml_.size_) * sizeof(Char));
...@@ -641,8 +640,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::copyMedium( ...@@ -641,8 +640,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::copyMedium(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::copyLarge( FOLLY_NOINLINE void fbstring_core<Char>::copyLarge(const fbstring_core& rhs) {
const fbstring_core& rhs) {
// Large strings are just refcounted // Large strings are just refcounted
ml_ = rhs.ml_; ml_ = rhs.ml_;
RefCounted::incrementRefs(ml_.data_); RefCounted::incrementRefs(ml_.data_);
...@@ -697,7 +695,7 @@ inline void fbstring_core<Char>::initSmall( ...@@ -697,7 +695,7 @@ inline void fbstring_core<Char>::initSmall(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::initMedium( FOLLY_NOINLINE void fbstring_core<Char>::initMedium(
const Char* const data, const size_t size) { const Char* const data, const size_t size) {
// Medium strings are allocated normally. Don't forget to // Medium strings are allocated normally. Don't forget to
// allocate one extra Char for the terminating null. // allocate one extra Char for the terminating null.
...@@ -712,7 +710,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::initMedium( ...@@ -712,7 +710,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::initMedium(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::initLarge( FOLLY_NOINLINE void fbstring_core<Char>::initLarge(
const Char* const data, const size_t size) { const Char* const data, const size_t size) {
// Large strings are allocated differently // Large strings are allocated differently
size_t effectiveCapacity = size; size_t effectiveCapacity = size;
...@@ -724,7 +722,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::initLarge( ...@@ -724,7 +722,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::initLarge(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::unshare(size_t minCapacity) { FOLLY_NOINLINE void fbstring_core<Char>::unshare(size_t minCapacity) {
assert(category() == Category::isLarge); assert(category() == Category::isLarge);
size_t effectiveCapacity = std::max(minCapacity, ml_.capacity()); size_t effectiveCapacity = std::max(minCapacity, ml_.capacity());
auto const newRC = RefCounted::create(&effectiveCapacity); auto const newRC = RefCounted::create(&effectiveCapacity);
...@@ -749,8 +747,7 @@ inline Char* fbstring_core<Char>::mutableDataLarge() { ...@@ -749,8 +747,7 @@ inline Char* fbstring_core<Char>::mutableDataLarge() {
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::reserveLarge( FOLLY_NOINLINE void fbstring_core<Char>::reserveLarge(size_t minCapacity) {
size_t minCapacity) {
assert(category() == Category::isLarge); assert(category() == Category::isLarge);
if (RefCounted::refs(ml_.data_) > 1) { // Ensure unique if (RefCounted::refs(ml_.data_) > 1) { // Ensure unique
// We must make it unique regardless; in-place reallocation is // We must make it unique regardless; in-place reallocation is
...@@ -773,7 +770,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::reserveLarge( ...@@ -773,7 +770,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::reserveLarge(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::reserveMedium( FOLLY_NOINLINE void fbstring_core<Char>::reserveMedium(
const size_t minCapacity) { const size_t minCapacity) {
assert(category() == Category::isMedium); assert(category() == Category::isMedium);
// String is not shared // String is not shared
...@@ -806,7 +803,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::reserveMedium( ...@@ -806,7 +803,7 @@ FOLLY_NOINLINE inline void fbstring_core<Char>::reserveMedium(
} }
template <class Char> template <class Char>
FOLLY_NOINLINE inline void fbstring_core<Char>::reserveSmall( FOLLY_NOINLINE void fbstring_core<Char>::reserveSmall(
size_t minCapacity, const bool disableSSO) { size_t minCapacity, const bool disableSSO) {
assert(category() == Category::isSmall); assert(category() == Category::isSmall);
if (!disableSSO && minCapacity <= maxSmallSize) { if (!disableSSO && minCapacity <= maxSmallSize) {
...@@ -1686,7 +1683,7 @@ class basic_fbstring { ...@@ -1686,7 +1683,7 @@ class basic_fbstring {
}; };
template <typename E, class T, class A, class S> template <typename E, class T, class A, class S>
FOLLY_NOINLINE inline typename basic_fbstring<E, T, A, S>::size_type FOLLY_NOINLINE typename basic_fbstring<E, T, A, S>::size_type
basic_fbstring<E, T, A, S>::traitsLength(const value_type* s) { basic_fbstring<E, T, A, S>::traitsLength(const value_type* s) {
return s ? traits_type::length(s) return s ? traits_type::length(s)
: (throw_exception<std::logic_error>( : (throw_exception<std::logic_error>(
...@@ -1776,8 +1773,8 @@ inline basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::append( ...@@ -1776,8 +1773,8 @@ inline basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::append(
} }
template <typename E, class T, class A, class S> template <typename E, class T, class A, class S>
FOLLY_NOINLINE inline basic_fbstring<E, T, A, S>& FOLLY_NOINLINE basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::append(
basic_fbstring<E, T, A, S>::append(const value_type* s, size_type n) { const value_type* s, size_type n) {
Invariant checker(*this); Invariant checker(*this);
if (FOLLY_UNLIKELY(!n)) { if (FOLLY_UNLIKELY(!n)) {
...@@ -1827,8 +1824,8 @@ inline basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::assign( ...@@ -1827,8 +1824,8 @@ inline basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::assign(
} }
template <typename E, class T, class A, class S> template <typename E, class T, class A, class S>
FOLLY_NOINLINE inline basic_fbstring<E, T, A, S>& FOLLY_NOINLINE basic_fbstring<E, T, A, S>& basic_fbstring<E, T, A, S>::assign(
basic_fbstring<E, T, A, S>::assign(const value_type* s, const size_type n) { const value_type* s, const size_type n) {
Invariant checker(*this); Invariant checker(*this);
if (n == 0) { if (n == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment