diff options
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 14 | ||||
-rw-r--r-- | cpp/include/Ice/Buffer.h | 1 | ||||
-rw-r--r-- | cpp/include/Ice/Config.h | 11 | ||||
-rw-r--r-- | cpp/include/Ice/LocalObjectF.h | 7 | ||||
-rw-r--r-- | cpp/include/Ice/LoggerUtil.h | 6 | ||||
-rw-r--r-- | cpp/include/Ice/ObjectF.h | 7 | ||||
-rw-r--r-- | cpp/include/Ice/ProxyF.h | 51 | ||||
-rw-r--r-- | cpp/include/IceUtil/Cond.h | 12 | ||||
-rw-r--r-- | cpp/include/IceUtil/Config.h | 6 | ||||
-rw-r--r-- | cpp/include/IceUtil/Mutex.h | 8 | ||||
-rw-r--r-- | cpp/include/IceUtil/OutputUtil.h | 29 | ||||
-rw-r--r-- | cpp/include/IceUtil/Shared.h | 56 | ||||
-rw-r--r-- | cpp/include/IceUtil/Thread.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Acceptor.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Connector.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/LoggerUtil.cpp | 18 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 1 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.h | 3 | ||||
-rw-r--r-- | cpp/src/Ice/Transceiver.h | 5 | ||||
-rw-r--r-- | cpp/src/IceUtil/OutputUtil.cpp | 4 |
20 files changed, 195 insertions, 56 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 6139d5a1fbc..ec1ced5cbe8 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -51,12 +51,22 @@ public: void writeBlob(const std::vector<Ice::Byte>&); void readBlob(std::vector<Ice::Byte>&, Ice::Int); - void write(Ice::Byte v) { b.push_back(v); } + // Performance critical function inlined, as writing single bytes + // is used in many places in Ice code. + void write(Ice::Byte v) + { + b.push_back(v); + } void write(const std::vector<Ice::Byte>&); void read(Ice::Byte&); void read(std::vector<Ice::Byte>&); - void write(bool v) { b.push_back(static_cast<Ice::Byte>(v)); } + // Performance critical function inlined, as writing single bools + // is used in many places in Ice code. + void write(bool v) + { + b.push_back(static_cast<Ice::Byte>(v)); + } void write(const std::vector<bool>&); void read(bool&); void read(std::vector<bool>&); diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h index 48606251459..a9a93cef5d9 100644 --- a/cpp/include/Ice/Buffer.h +++ b/cpp/include/Ice/Buffer.h @@ -20,6 +20,7 @@ class ICE_API Buffer : public ::IceUtil::noncopyable { public: + // TODO: Should not be inline, as this is not performance critical. Buffer() { b.reserve(1000); diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index 6ed6097cfe5..f92b4726dee 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -30,8 +30,13 @@ // using namespace Ice; // using namespace IceInternal; // -namespace Ice { } -namespace IceInternal { } +namespace Ice +{ +} + +namespace IceInternal +{ +} #if defined(WIN32) @@ -55,6 +60,7 @@ typedef double Double; } +// TODO: Should not be inline, this is not performance critical. inline int getSystemErrno() { return GetLastError(); } inline int getSocketErrno() { return WSAGetLastError(); } inline int getDNSErrno() { return WSAGetLastError(); } @@ -78,6 +84,7 @@ typedef double Double; } +// TODO: Should not be inline, this is not performance critical. inline int getSystemErrno() { return errno; } inline int getSocketErrno() { return errno; } extern int h_errno; diff --git a/cpp/include/Ice/LocalObjectF.h b/cpp/include/Ice/LocalObjectF.h index 0d1bcd5c704..a6be07fdefd 100644 --- a/cpp/include/Ice/LocalObjectF.h +++ b/cpp/include/Ice/LocalObjectF.h @@ -13,7 +13,12 @@ #include <Ice/Handle.h> -namespace Ice { class LocalObject; } +namespace Ice +{ + +class LocalObject; + +} namespace IceInternal { diff --git a/cpp/include/Ice/LoggerUtil.h b/cpp/include/Ice/LoggerUtil.h index 6e1a2db514f..1444112da5c 100644 --- a/cpp/include/Ice/LoggerUtil.h +++ b/cpp/include/Ice/LoggerUtil.h @@ -25,7 +25,7 @@ public: void flush(); - std::ostringstream& __str() { return _str; } // Don't use directly + std::ostringstream& __str(); // For internal use only. Don't use in your code. private: @@ -52,7 +52,7 @@ public: void flush(); - std::ostringstream& __str() { return _str; } // Don't use directly + std::ostringstream& __str(); // For internal use only. Don't use in your code. private: @@ -79,7 +79,7 @@ public: void flush(); - std::ostringstream& __str() { return _str; } // Don't use directly + std::ostringstream& __str(); // For internal use only. Don't use in your code. private: diff --git a/cpp/include/Ice/ObjectF.h b/cpp/include/Ice/ObjectF.h index f83efeadd1f..c2c3769743d 100644 --- a/cpp/include/Ice/ObjectF.h +++ b/cpp/include/Ice/ObjectF.h @@ -13,7 +13,12 @@ #include <Ice/Handle.h> -namespace Ice { class Object; } +namespace Ice +{ + +class Object; + +} namespace IceInternal { diff --git a/cpp/include/Ice/ProxyF.h b/cpp/include/Ice/ProxyF.h index 57fdd96bbc1..ce1496a4bbc 100644 --- a/cpp/include/Ice/ProxyF.h +++ b/cpp/include/Ice/ProxyF.h @@ -13,10 +13,53 @@ #include <Ice/ProxyHandle.h> -namespace IceProxy { namespace Ice { class Object; } } -namespace IceDelegate { namespace Ice { class Object; } } -namespace IceDelegateM { namespace Ice { class Object; } } -namespace IceDelegateD { namespace Ice { class Object; } } +namespace IceProxy +{ + +namespace Ice +{ + +class Object; + +} + +} + +namespace IceDelegate +{ + +namespace Ice +{ + +class Object; + +} + +} + +namespace IceDelegateM +{ + +namespace Ice +{ + +class Object; + +} + +} + +namespace IceDelegateD +{ + +namespace Ice +{ + +class Object; + +} + +} namespace IceInternal { diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h index b3274c77464..6d3fabfdcff 100644 --- a/cpp/include/IceUtil/Cond.h +++ b/cpp/include/IceUtil/Cond.h @@ -175,6 +175,9 @@ private: } */ + // + // TODO: Should not be inlined, not performance critical. + // void waitImpl(const RecMutex& mutex) const { @@ -195,6 +198,9 @@ private: } } + // + // TODO: Should not be inlined, not performance critical. + // void waitImpl(const Mutex& mutex) const { @@ -215,6 +221,9 @@ private: } } + // + // TODO: Should not be inlined, not performance critical. + // bool timedwaitImpl(const RecMutex& mutex, long msec) const { @@ -236,6 +245,9 @@ private: } } + // + // TODO: Should not be inlined, not performance critical. + // bool timedwaitImpl(const Mutex& mutex, long msec) const { diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 8ae749e43e8..a9fb48327bc 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -82,6 +82,12 @@ namespace IceUtil { +// +// TODO: Constructor and destructor should not be inlined, as they are +// not performance critical. +// +// TODO: Naming conventions? +// class noncopyable { protected: diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h index 0c43398b279..d76fabe83b1 100644 --- a/cpp/include/IceUtil/Mutex.h +++ b/cpp/include/IceUtil/Mutex.h @@ -110,7 +110,14 @@ private: #endif }; +// +// TODO: Check if all the functions below are really performance +// critical. Those which are not performance critical shouldn't be +// inlined. +// + #ifdef WIN32 + inline Mutex::Mutex() { @@ -237,6 +244,7 @@ inline void Mutex::lock(LockState&) const { } + #endif } // End namespace IceUtil diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h index 914c70b0da1..61ce7916949 100644 --- a/cpp/include/IceUtil/OutputUtil.h +++ b/cpp/include/IceUtil/OutputUtil.h @@ -36,8 +36,7 @@ public: OutputBase(); OutputBase(std::ostream&); OutputBase(const char*); - - virtual ~OutputBase() { } + virtual ~OutputBase(); void setIndent(int); // What is the indent level? void setUseTab(bool); // Should we output tabs? @@ -70,10 +69,14 @@ protected: bool _separator; }; -class ICE_UTIL_API NextLine { }; +class ICE_UTIL_API NextLine +{ +}; extern ICE_UTIL_API NextLine nl; -class ICE_UTIL_API Separator { }; +class ICE_UTIL_API Separator +{ +}; extern ICE_UTIL_API Separator sp; // ---------------------------------------------------------------------- @@ -126,7 +129,9 @@ operator<<(Output& o, const Separator&) return o; } -class ICE_UTIL_API StartBlock { }; +class ICE_UTIL_API StartBlock +{ +}; extern ICE_UTIL_API StartBlock sb; template<> @@ -137,7 +142,9 @@ operator<<(Output& o, const StartBlock&) return o; } -class ICE_UTIL_API EndBlock { }; +class ICE_UTIL_API EndBlock +{ +}; extern ICE_UTIL_API EndBlock eb; template<> @@ -203,12 +210,13 @@ operator<<(XMLOutput& o, const Separator&) return o; } +// TODO: Not performance critical, does not need to be inlined. class ICE_UTIL_API StartElement { public: - StartElement(const std::string& name) - : _name(name) + StartElement(const std::string& name) : + _name(name) { } @@ -216,7 +224,10 @@ public: { } - const std::string& getName() const { return _name; } + const std::string& getName() const + { + return _name; + } private: diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index c323cfbfbfc..f54df64ba59 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -39,25 +39,32 @@ * on us. We need to use _exactly_ the address the user gave us, * not some alias that contains the same information. */ -typedef struct { volatile int counter; } ice_atomic_t; +struct ice_atomic_t +{ + volatile int counter; +}; -/** +/* * ice_atomic_set - set ice_atomic variable * @v: pointer of type ice_atomic_t * @i: required value * - * Atomically sets the value of @v to @i. Note that the guaranteed + * Atomically sets the value of @v to @i. Note that the guaranteed * useful range of an ice_atomic_t is only 24 bits. - */ -#define ice_atomic_set(v,i) (((v)->counter) = (i)) + */ +// TODO: Does this really need to be a macro?t +#define ice_atomic_set(v, i) (((v)->counter) = (i)) -/** +/* * ice_atomic_inc - increment ice_atomic variable * @v: pointer of type ice_atomic_t * - * Atomically increments @v by 1. Note that the guaranteed - * useful range of an ice_atomic_t is only 24 bits. - */ + * Atomically increments @v by 1. Note that the guaranteed useful + * range of an ice_atomic_t is only 24 bits. + * + * Inlined because this operation is performance critical. + */ +// TODO: Why static? static inline void ice_atomic_inc(ice_atomic_t *v) { __asm__ __volatile__( @@ -70,11 +77,13 @@ static inline void ice_atomic_inc(ice_atomic_t *v) * ice_atomic_dec_and_test - decrement and test * @v: pointer of type ice_atomic_t * - * Atomically decrements @v by 1 and - * returns true if the result is 0, or false for all other - * cases. Note that the guaranteed - * useful range of an ice_atomic_t is only 24 bits. - */ + * Atomically decrements @v by 1 and returns true if the result is 0, + * or false for all other cases. Note that the guaranteed useful + * range of an ice_atomic_t is only 24 bits. + * + * Inlined because this operation is performance critical. + */ +// TODO: Why static? static inline int ice_atomic_dec_and_test(ice_atomic_t *v) { unsigned char c; @@ -86,10 +95,13 @@ static inline int ice_atomic_dec_and_test(ice_atomic_t *v) } /** - * ice_atomic_exchange_add - same as InterlockedExchangeAdd. This didn't - * come from atomic.h (the code was derived from similar code in - * /usr/include/asm/rwsem.h) + * ice_atomic_exchange_add - same as InterlockedExchangeAdd. This + * didn't come from atomic.h (the code was derived from similar code + * in /usr/include/asm/rwsem.h) + * + * Inlined because this operation is performance critical. */ +// TODO: Why static? static inline int ice_atomic_exchange_add(int i, ice_atomic_t* v) { int tmp = i; @@ -121,6 +133,11 @@ static inline int ice_atomic_exchange_add(int i, ice_atomic_t* v) namespace IceUtil { +// +// TODO: Not all operations in this class are performance critical, +// thus not all of them should be inlined. +// + class SimpleShared : public noncopyable { public: @@ -193,6 +210,11 @@ private: bool _noDelete; }; +// +// TODO: Not all operations below are performance critical, thus not +// all of them should be inlined. +// + #ifdef ICE_USE_MUTEX_SHARED inline diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h index cb821fc491c..55f1689f73a 100644 --- a/cpp/include/IceUtil/Thread.h +++ b/cpp/include/IceUtil/Thread.h @@ -18,12 +18,14 @@ namespace IceUtil { #ifdef WIN32 +// TODO: Should not be inlined, not performance critical. struct HandleWrapper : public Shared { HandleWrapper(HANDLE h) : handle(h) { } + ~HandleWrapper() { if (handle != 0) diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h index c694967d02c..1387312aa88 100644 --- a/cpp/src/Ice/Acceptor.h +++ b/cpp/src/Ice/Acceptor.h @@ -32,11 +32,6 @@ public: virtual void listen() = 0; virtual TransceiverPtr accept(int) = 0; virtual std::string toString() const = 0; - -protected: - - Acceptor() { } - virtual ~Acceptor() { } }; } diff --git a/cpp/src/Ice/Connector.h b/cpp/src/Ice/Connector.h index 084c68bcb7b..abd90f233c7 100644 --- a/cpp/src/Ice/Connector.h +++ b/cpp/src/Ice/Connector.h @@ -24,11 +24,6 @@ public: virtual TransceiverPtr connect(int) = 0; virtual std::string toString() const = 0; - -protected: - - Connector() { } - virtual ~Connector() { } }; } diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp index 9e8cf0ee36a..fd3fdd8085d 100644 --- a/cpp/src/Ice/LoggerUtil.cpp +++ b/cpp/src/Ice/LoggerUtil.cpp @@ -36,6 +36,12 @@ Ice::Warning::flush() _str.clear(); } +ostringstream& +Ice::Warning::__str() +{ + return _str; +} + Warning& Ice::operator<<(Warning& out, ios_base& (*val)(ios_base&)) { @@ -64,6 +70,12 @@ Ice::Error::flush() _str.clear(); } +ostringstream& +Ice::Error::__str() +{ + return _str; +} + Error& Ice::operator<<(Error& out, ios_base& (*val)(ios_base&)) { @@ -93,6 +105,12 @@ Ice::Trace::flush() _str.clear(); } +ostringstream& +Ice::Trace::__str() +{ + return _str; +} + Trace& Ice::operator<<(Trace& out, ios_base& (*val)(ios_base&)) { diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index c3c6aa4e35d..14124f4e1a5 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -527,7 +527,6 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler) } } -void IceInternal::ThreadPool::EventHandlerThread::EventHandlerThread(const ThreadPoolPtr& pool) : _pool(pool) { diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index 36a67788943..d829efa73f4 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -76,7 +76,7 @@ private: { public: - EventHandlerThread(const ThreadPoolPtr& pool) : _pool(pool) { } + EventHandlerThread(const ThreadPoolPtr&); virtual void run(); private: @@ -84,6 +84,7 @@ private: ThreadPoolPtr _pool; }; friend class EventHandlerThread; + std::vector<IceUtil::ThreadControl> _threads; // Control for all threads, running or not. int _threadNum; // Number of running threads. int _maxConnections; // Maximum number of connections. If set to zero, the number of connections is not limited. diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h index 1648abb2793..1e555cda850 100644 --- a/cpp/src/Ice/Transceiver.h +++ b/cpp/src/Ice/Transceiver.h @@ -33,11 +33,6 @@ public: virtual void write(Buffer&, int) = 0; virtual void read(Buffer&, int) = 0; virtual std::string toString() const = 0; - -protected: - - Transceiver() { } - virtual ~Transceiver() { } }; } diff --git a/cpp/src/IceUtil/OutputUtil.cpp b/cpp/src/IceUtil/OutputUtil.cpp index 1eda98edc21..1c690ff5f88 100644 --- a/cpp/src/IceUtil/OutputUtil.cpp +++ b/cpp/src/IceUtil/OutputUtil.cpp @@ -60,6 +60,10 @@ IceUtil::OutputBase::OutputBase(const char* s) : open(s); } +IceUtil::OutputBase::~OutputBase() +{ +} + void IceUtil::OutputBase::open(const char* s) { |