summaryrefslogtreecommitdiffstats
path: root/src/include/util
diff options
context:
space:
mode:
authorDean Sanner <dsanner@us.ibm.com>2016-08-26 13:23:27 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-10-11 09:22:52 -0400
commit431a52def7e7ef371999723e675d82f513bc4070 (patch)
tree9c8ee7ea41b43af36bbe2e3511ac2982a26cee08 /src/include/util
parenta8b134524909d27ff89dc6b20405c9e5e43e9dff (diff)
downloadtalos-hostboot-431a52def7e7ef371999723e675d82f513bc4070.tar.gz
talos-hostboot-431a52def7e7ef371999723e675d82f513bc4070.zip
Prevent inline of some shared_ptr functions for space
Change-Id: I1b996bb7c78941a5ec0ab8ca2973b7db25563fcc Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28857 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/util')
-rw-r--r--src/include/util/impl/shared_ptr.H124
1 files changed, 73 insertions, 51 deletions
diff --git a/src/include/util/impl/shared_ptr.H b/src/include/util/impl/shared_ptr.H
index 08cb6d044..288f8349e 100644
--- a/src/include/util/impl/shared_ptr.H
+++ b/src/include/util/impl/shared_ptr.H
@@ -28,6 +28,7 @@
#include <cstddef>
#include <utility>
#include <stdint.h>
+#include <builtins.h>
namespace std
{
@@ -88,35 +89,12 @@ namespace std
return (pointer != r.pointer);
}
- shared_ptr& operator=(const shared_ptr& r)
- {
- _cleanup();
- _copy(r);
-
- return *this;
- }
- template<typename U> shared_ptr& operator=(const shared_ptr<U>& r)
- {
- _cleanup();
- _copy(r);
-
- return *this;
- }
-
- shared_ptr& operator=(shared_ptr&& r)
- {
- _cleanup();
- _swap(std::move(r));
-
- return *this;
- }
- template<typename U> shared_ptr& operator=(shared_ptr<U>&& r)
- {
- _cleanup();
- _swap(std::move(r));
-
- return *this;
- }
+ shared_ptr& operator=(const shared_ptr& r) NEVER_INLINE;
+ template<typename U> shared_ptr& operator=
+ (const shared_ptr<U>& r) NEVER_INLINE;
+ shared_ptr& operator=(shared_ptr&& r) NEVER_INLINE;
+ template<typename U> shared_ptr& operator=
+ (shared_ptr<U>&& r) NEVER_INLINE;
void reset() { _cleanup(); }
template<typename U> void reset(U* ptr) { _cleanup(); _setup(ptr); }
@@ -174,28 +152,9 @@ namespace std
}
}
- void _cleanup()
- {
- if (!count) return;
-
- if (count->decrement())
- {
- delete count;
- delete owner;
- }
-
- count = nullptr;
- owner = nullptr;
- pointer = nullptr;
- }
-
- template<typename U> void _copy(const shared_ptr<U>& r)
- {
- if (r.count) r.count->increment();
- count = r.count;
- owner = static_cast<T*>(r.owner);
- pointer = static_cast<T*>(r.pointer);
- }
+ void _cleanup() NEVER_INLINE;
+ template<typename U> void _copy
+ (const shared_ptr<U>& r) NEVER_INLINE;
template<typename U> void _swap(shared_ptr<U>&& r)
{
@@ -208,6 +167,69 @@ namespace std
}
};
+ template <typename T>
+ shared_ptr<T>& shared_ptr<T>::operator=(const shared_ptr<T>& r)
+ {
+ _cleanup();
+ _copy(r);
+
+ return *this;
+ }
+
+ template <typename T>
+ template<typename U> shared_ptr<T>& shared_ptr<T>::operator=
+ (const shared_ptr<U>& r)
+ {
+ _cleanup();
+ _copy(r);
+
+ return *this;
+ }
+
+ template <typename T>
+ shared_ptr<T>& shared_ptr<T>::operator=(shared_ptr<T>&& r)
+ {
+ _cleanup();
+ _swap(std::move(r));
+
+ return *this;
+ }
+
+ template <typename T>
+ template<typename U> shared_ptr<T>& shared_ptr<T>::operator=
+ (shared_ptr<U>&& r)
+ {
+ _cleanup();
+ _swap(std::move(r));
+
+ return *this;
+ }
+
+ template <typename T>
+ void shared_ptr<T>::_cleanup()
+ {
+ if (!count) return;
+
+ if (count->decrement())
+ {
+ delete count;
+ delete owner;
+ }
+
+ count = nullptr;
+ owner = nullptr;
+ pointer = nullptr;
+ }
+ template <typename T>
+ template<typename U> void shared_ptr<T>::_copy(const shared_ptr<U>& r)
+ {
+ if (r.count) r.count->increment();
+ count = r.count;
+ owner = static_cast<T*>(r.owner);
+ pointer = static_cast<T*>(r.pointer);
+ }
+
+
template <typename T, typename... Args>
shared_ptr<T> make_shared( Args&&... args)
{
OpenPOWER on IntegriCloud