summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES189
-rw-r--r--cpp/include/Ice/BasicStream.h62
-rw-r--r--cpp/src/Ice/BasicStream.cpp143
-rw-r--r--cpp/src/Ice/ThreadPool.cpp2
4 files changed, 218 insertions, 178 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index 461fc589ecb..f5a7380470e 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,94 +1,120 @@
Changes since version 1.1.0
---------------------------
+- Performance improvements due to inlining of some critical functions
+ in BasicStream.
+
+- Added menu with several options to throughput demo.
+
- Major Freeze update:
- - Removed the lowest Freeze layer. You should use instead Berkeley DB
- directly.
- - For Freeze Maps and Evictors, the underlying Berkeley DB environment
- is now always transactional. New configurations variables:
- - Freeze.<envName>.DbHome provides the path to the DB home,
- and defaults to <envName>.
+ - Removed the lowest Freeze layer. You should use instead Berkeley
+ DB directly.
+
+ - For Freeze Maps and Evictors, the underlying Berkeley DB
+ environment is now always transactional. New configurations
+ variables:
+
+ - Freeze.<envName>.DbHome provides the path to the DB home, and
+ defaults to <envName>.
+
- Freeze.<envName>.DbRecoverFatal triggers "fatal recovery" when
set to a value other than 0 (defaults to 0).
- - Freeze.<envName>.DbPrivate when set to a value other than 0 tells
- Berkeley DB to use process private memory instead of shared
- memory. Defaults to 1. Set it to 0 when you want to run db_stat
- (or another Berkeley DB utility) on a running environment.
- - Freeze.<envName>.DbCheckpointPeriod: each Berkeley DB
- environment created by Freeze has an associated thread that
+
+ - Freeze.<envName>.DbPrivate when set to a value other than 0
+ tells Berkeley DB to use process private memory instead of
+ shared memory. Defaults to 1. Set it to 0 when you want to run
+ db_stat (or another Berkeley DB utility) on a running
+ environment.
+
+ - Freeze.<envName>.DbCheckpointPeriod: each Berkeley DB
+ environment created by Freeze has an associated thread that
checkpoints this environment every DbCheckpointPeriod minutes.
Defaults to 3 minutes.
+
- Freeze.<envName>.PeriodicCheckpointMinSize defines the minimum
size in kbytes for the periodic checkpoint (see above). This
value is passed to Berkeley DB's checkpoint function. Defaults
to 0 (no minimum).
+
- Freeze.<envName>.OldLogsAutoDelete: when set to a value other
than 0, old transactional logs no longer in use are deleted
after each periodic checkpoint. Defaults to 1.
- Such a Freeze-created Berkeley DB environment is created and opened
- when the first Freeze Map or Evictor using it is created, and is
- closed when the last Freeze Map or Evictor using it is closed.
+
+ Such a Freeze-created Berkeley DB environment is created and
+ opened when the first Freeze Map or Evictor using it is created,
+ and is closed when the last Freeze Map or Evictor using it is
+ closed.
- Freeze Map update:
- Freeze Maps are now opened/created directly using their constructor
+
+ Freeze Maps are now opened/created directly using their
+ constructor:
+
C++: DBMap(const Ice::CommunicatorPtr& communicator,
const std::string& envName,
const std::string& dbName,
bool createDb = true);
+
Java: public
Map(Ice.Communicator communicator,
String envName,
String dbName,
boolean createDb);
- In Java, it is necessary to call close() on the Map if you want
- to close the underlying Berkeley DB database (and indirectly
- environment) before the Map is finalized.
+ In Java, it is necessary to call close() on the Map if you want to
+ close the underlying Berkeley DB database (and indirectly
+ environment) before the Map is finalized.
As a consequence of using a transactional Berkeley DB environment,
all Map writes are now transactional:
- - non-iterator writes use DB_AUTO_COMMIT
- - writable iterators (non-const C++ iterators, Java Iterators) have
- an associated transaction that is committed when the iterator is
- closed.
-
- Freeze Maps support concurrent access: several threads can use (read
- and write) the same Map concurrently without any application level
- locking: the locking is handled by Berkeley DB. However iterators are
- not thread safe: concurrent access to a given iterator (which is very
- unusual) needs to be synchronized by the application.
- Concurrent reads and writes to the same Map can generate deadlocks,
- even with a single writer. Berkeley DB detects such deadlocks and
- "kills" one locker (iterator or transaction) to resolve it. For
- non-iterator access, Freeze handles such exception and retries
- transparently. When using iterators, a DBDeadlockException is raised
- to the application, which is responsible to close the affected
- iterator(s) and retry.
+
+ - Non-iterator writes use DB_AUTO_COMMIT.
+
+ - Writable iterators (non-const C++ iterators, Java Iterators)
+ have an associated transaction that is committed when the
+ iterator is closed.
+
+ Freeze Maps support concurrent access: several threads can use
+ (read and write) the same Map concurrently without any application
+ level locking: the locking is handled by Berkeley DB. However
+ iterators are not thread safe: concurrent access to a given
+ iterator (which is very unusual) needs to be synchronized by the
+ application. Concurrent reads and writes to the same Map can
+ generate deadlocks, even with a single writer. Berkeley DB detects
+ such deadlocks and "kills" one locker (iterator or transaction) to
+ resolve it. For non-iterator access, Freeze handles such exception
+ and retries transparently. When using iterators, a
+ DBDeadlockException is raised to the application, which is
+ responsible to close the affected iterator(s) and retry.
Serialized access or concurrent reads never produce deadlocks.
In Java, iterators are no longer closed as a side effect of other
write operations. Doing so would require adding synchronization to
all Java iterator methods.
+
Currently, Java Freeze Map iterators are closed either through the
proprietary close() method, or when hasNext() returns false (or
- next() throws NoSuchElementException, which is equivalent). This
+ next() throws NoSuchElementException, which is equivalent). This
latter behavior may be removed soon.
- In C++, the copy constructor and assignment operator of Freeze
- Map iterators duplicate the source iterator. When the source
- iterator is non-const, the duplicate iterator will use the same
- transaction. This transaction is committed only when its last
+ In C++, the copy constructor and assignment operator of Freeze Map
+ iterators duplicate the source iterator. When the source iterator
+ is non-const, the duplicate iterator will use the same
+ transaction. This transaction is committed only when its last
associated iterator is closed (i.e. destroyed or assigned end()).
- Freeze Evictor update:
- Freeze Maps are now opened/created directly using a static
- createEvictor function/method:
+
+ Freeze Maps are now opened/created directly using a static
+ createEvictor function/method:
+
C++: Freeze::EvictorPtr
Freeze::createEvictor(const Ice::CommunicatorPtr& communicator,
const std::string& envName,
const std::string& dbName,
bool createDb = true);
+
Java (in class Freeze.Util):
public static Evictor
createEvictor(Ice.Communicator communicator,
@@ -97,12 +123,15 @@ Changes since version 1.1.0
boolean createDb);
The persistence strategies have been removed.
- Ice objects are now saved by a background thread, controlled by the
- following configuration variables.
- - Freeze.Evictor.<envName>.<dbName>.SaveSizeTrigger: as soon as
- SaveSizeTrigger objects have been created, modified or destroyed,
- the background wakes up to save them. When set to a negative value,
- there is no size trigger. Defaults to 10.
+
+ Ice objects are now saved by a background thread, controlled by
+ the following configuration variables.
+
+ - Freeze.Evictor.<envName>.<dbName>.SaveSizeTrigger: as soon as
+ SaveSizeTrigger objects have been created, modified or
+ destroyed, the background wakes up to save them. When set to a
+ negative value, there is no size trigger. Defaults to 10.
+
- Freeze.Evictor.<envName>.<dbName>.SavePeriod: the saving thread
wakes up every SavePeriod ms and saves any created, modified or
destroyed object. When set to 0, there is no periodic wake up.
@@ -114,42 +143,45 @@ Changes since version 1.1.0
When saving an object, the background saving thread locks this
object. In Java, it locks the object itself; in C++, the object is
- expected to implement IceUtil::AbstractMutex. Naturally the
- application must use the same synchronization to access the
+ expected to implement IceUtil::AbstractMutex. Naturally the
+ application must use the same synchronization to access the
persistent state of the object.
- The configuration variable Freeze.Evictor.NoSyncAllowed can be
- set to a value other than 0 to allow C++ objects that do not
- implement IceUtil::AbstractMutex to be saved For such objects, no
+ The configuration variable Freeze.Evictor.NoSyncAllowed can be set
+ to a value other than 0 to allow C++ objects that do not implement
+ IceUtil::AbstractMutex to be saved For such objects, no
synchronization is performed: it is recommended to only use this
- feature with explict saves (SaveSizeTrigger set to -1 and
+ feature with explict saves (SaveSizeTrigger set to -1 and
SavePeriod set to 0). NoSyncAllowed defaults to 0.
- - Freeze and XMLTransform now require Berkeley DB 4.1. They no
- longer compile with older Berkeley DB releases.
+ - Freeze and XMLTransform now require Berkeley DB 4.1. They no longer
+ compile with older Berkeley DB releases.
- With Visual C++, you need to use the same project directory settings
- when building Berkeley DB and Ice. In particular if you build Ice
- with STLPort, you need to build Berkeley DB with the same STLPort.
+ With Visual C++, you need to use the same project directory
+ settings when building Berkeley DB and Ice. In particular if you
+ build Ice with STLPort, you need to build Berkeley DB with the same
+ STLPort.
-- Added new C++ AbstractMutex class, and helper templates
- (AbstractMutexI, AbstractMutexReadI, AbstractMutexWriteI) to easily
- implement AbstractMutex using Mutex, RecMutex, Monitor or RWRecMutex.
+- Added new C++ AbstractMutex class, and helper templates
+ (AbstractMutexI, AbstractMutexReadI, AbstractMutexWriteI) to easily
+ implement AbstractMutex using Mutex, RecMutex, Monitor or
+ RWRecMutex.
-- Fixed a bug in the implementation of StaticMutex on Windows, which
+- Fixed a bug in the implementation of StaticMutex on Windows, which
could result in a crash at exit.
-- Added Ice.UDP.RcvSize and Ice.UDP.SndSize properties. These properties
- control the size of the UDP receive and send buffers as well as controlling
- the maximum size of a datagram invocation. If a datagram exceeds the
- configured size, the Ice run time throws a DatagramLimitException. (Note that,
- on the receiving size, detection of this condition is dependent on the
- local UDP implementation -- some UDP implementations silently drop datagrams
- that are too large to fit into the receive buffer instead of reporting
- the error or delivering a truncated datagram.)
+- Added Ice.UDP.RcvSize and Ice.UDP.SndSize properties. These
+ properties control the size of the UDP receive and send buffers as
+ well as controlling the maximum size of a datagram invocation. If a
+ datagram exceeds the configured size, the Ice run time throws a
+ DatagramLimitException. (Note that, on the receiving size, detection
+ of this condition is dependent on the local UDP implementation --
+ some UDP implementations silently drop datagrams that are too large
+ to fit into the receive buffer instead of reporting the error or
+ delivering a truncated datagram.)
-- Added Ice.Warn.Datagrams. This property prints a warning on the server
- side if a DatagramLimitException is thrown.
+- Added Ice.Warn.Datagrams. This property prints a warning on the
+ server side if a DatagramLimitException is thrown.
- Added Ice.MessageSizeMax property. This property controls the
maximum message size accepted by the Ice protocol in kiloBytes. The
@@ -182,7 +214,6 @@ Changes since version 1.1.0
function, to insert or replace an element, like the old insert. This
corresponds to the behavior of Berkeley DB's DB->put().
-
- Added a test to the Slice parser to complain if an operation on a
local interface or class has an exception specification.
@@ -191,13 +222,13 @@ Changes since version 1.1.0
such as "Ice.config=MyFile" (instead of "Ice.Config=MyFile") from
slipping through undetected.
-- Changed the mapping of the Slice byte type: ::Ice::Byte is now a
- typedef for unsigned char. (Previously, ::Ice::Byte was a typedef to
+- Changed the mapping of the Slice byte type: Ice::Byte is now a
+ typedef for unsigned char. (Previously, Ice::Byte was a typedef to
char.) This change guarantees that byte values are always in the
range 0..255 (instead of either -128..127 or 0..255, depending on
the CPU architecture). This change also permits function overloading
- for ::Ice::Byte and char (which can be useful if you use both
- strings and byte sequences).
+ for Ice::Byte and char (which can be useful if you use both strings
+ and byte sequences).
- Fixed a performance problem in Glacier which would occur when using
message batching.
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
index 1c55d905f0d..571e2f5277c 100644
--- a/cpp/include/Ice/BasicStream.h
+++ b/cpp/include/Ice/BasicStream.h
@@ -48,8 +48,29 @@ public:
void swap(BasicStream&);
- void resize(int);
- void reserve(size_t);
+ void resize(Container::size_type sz)
+ {
+ if(sz > _messageSizeMax)
+ {
+ throwMemoryLimitException(__FILE__, __LINE__);
+ }
+
+ Container::size_type capacity = b.capacity();
+ if(capacity < sz)
+ {
+ //
+ // COMPILERBUG: Stupid Visual C++ defines max as a
+ // macro. But I can't undefine it in a header file,
+ // because this might cause side effects with other code
+ // that depends on this macro being defined.
+ //
+ //b.reserve(std::max(sz, 2 * capacity));
+ b.reserve(sz > 2 * capacity ? sz : 2 * capacity);
+ }
+
+ b.resize(sz);
+ }
+ void reserve(Container::size_type);
void startWriteEncaps();
void endWriteEncaps();
@@ -76,27 +97,37 @@ public:
void writeBlob(const std::vector<Ice::Byte>&);
void readBlob(std::vector<Ice::Byte>&, Ice::Int);
- void writeBlob(const Ice::Byte*, size_t);
- void readBlob(Ice::Byte*, size_t);
+ void writeBlob(const Ice::Byte*, Container::size_type);
+ void readBlob(Ice::Byte*, Container::size_type);
- // 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(Ice::Byte& v)
+ {
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
+ }
void read(std::vector<Ice::Byte>&);
- // 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(bool& v)
+ {
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
+ }
void read(std::vector<bool>&);
void write(Ice::Short);
@@ -158,6 +189,15 @@ public:
private:
//
+ // I can't throw these exception from inline functions from within
+ // this file, because I cannot include the header with the
+ // exceptions. Doing so would screw up the whole include file
+ // ordering.
+ //
+ void throwUnmarshalOutOfBoundsException(const char*, int);
+ void throwMemoryLimitException(const char*, int);
+
+ //
// Optimization. The instance may not be deleted while a
// stack-allocated BasicStream still holds it.
//
@@ -211,7 +251,7 @@ private:
int _traceSlicing;
const char* _slicingCat;
- size_t _messageSizeMax;
+ const Container::size_type _messageSizeMax;
};
}
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index e8be2301b28..d7e1d952b00 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -75,38 +75,15 @@ IceInternal::BasicStream::swap(BasicStream& other)
std::swap(_currentWriteEncaps, other._currentWriteEncaps);
}
-void inline
-inlineResize(Buffer* buffer, size_t total, size_t maxSize)
-{
- if(total > maxSize)
- {
- throw MemoryLimitException(__FILE__, __LINE__);
- }
-
- size_t capacity = buffer->b.capacity();
- if(capacity < total)
- {
- buffer->b.reserve(max(total, 2 * capacity));
- }
-
- buffer->b.resize(total);
-}
-
-void
-IceInternal::BasicStream::resize(int total)
-{
- inlineResize(this, total, _messageSizeMax);
-}
-
void
-IceInternal::BasicStream::reserve(size_t total)
+IceInternal::BasicStream::reserve(Container::size_type sz)
{
- if(total > _messageSizeMax)
+ if(sz > _messageSizeMax)
{
throw MemoryLimitException(__FILE__, __LINE__);
}
- b.reserve(total);
+ b.reserve(sz);
}
IceInternal::BasicStream::WriteEncaps::WriteEncaps()
@@ -369,7 +346,7 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
}
void
-BasicStream::writeTypeId(const string& id)
+IceInternal::BasicStream::writeTypeId(const string& id)
{
TypeIdWriteMap::const_iterator k = _currentWriteEncaps->typeIdMap->find(id);
if(k != _currentWriteEncaps->typeIdMap->end())
@@ -386,7 +363,7 @@ BasicStream::writeTypeId(const string& id)
}
void
-BasicStream::readTypeId(string& id)
+IceInternal::BasicStream::readTypeId(string& id)
{
bool isIndex;
read(isIndex);
@@ -411,8 +388,8 @@ BasicStream::readTypeId(string& id)
void
IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
{
- size_t pos = b.size();
- inlineResize(this, pos + v.size(), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + v.size());
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
@@ -430,17 +407,17 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
}
void
-IceInternal::BasicStream::writeBlob(const Ice::Byte* v, size_t len)
+IceInternal::BasicStream::writeBlob(const Ice::Byte* v, Container::size_type len)
{
- size_t pos = b.size();
- inlineResize(this, pos + len, _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + len);
ice_copy(&v[0], &v[0 + len], b.begin() + pos);
}
void
-IceInternal::BasicStream::readBlob(Ice::Byte* v, size_t len)
+IceInternal::BasicStream::readBlob(Ice::Byte* v, Container::size_type len)
{
- if(static_cast<size_t>(b.end() - i) < len)
+ if(static_cast<Container::size_type>(b.end() - i) < len)
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -454,22 +431,12 @@ IceInternal::BasicStream::write(const vector<Byte>& v)
{
Int sz = static_cast<Int>(v.size());
writeSize(sz);
- size_t pos = b.size();
- inlineResize(this, pos + sz, _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
void
-IceInternal::BasicStream::read(Byte& v)
-{
- if(i >= b.end())
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
-}
-
-void
IceInternal::BasicStream::read(vector<Byte>& v)
{
Int sz;
@@ -489,22 +456,12 @@ IceInternal::BasicStream::write(const vector<bool>& v)
{
Int sz = static_cast<Int>(v.size());
writeSize(sz);
- size_t pos = b.size();
- inlineResize(this, pos + sz, _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
void
-IceInternal::BasicStream::read(bool& v)
-{
- if(i >= b.end())
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
-}
-
-void
IceInternal::BasicStream::read(vector<bool>& v)
{
Int sz;
@@ -522,8 +479,8 @@ IceInternal::BasicStream::read(vector<bool>& v)
void
IceInternal::BasicStream::write(Short v)
{
- size_t pos = b.size();
- inlineResize(this, pos + sizeof(Short), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Short), b.begin() + pos);
@@ -539,8 +496,8 @@ IceInternal::BasicStream::write(const vector<Short>& v)
writeSize(sz);
if(sz > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + sz * sizeof(Short), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
for(int j = 0 ; j < sz ; ++j)
@@ -601,8 +558,8 @@ IceInternal::BasicStream::read(vector<Short>& v)
void
IceInternal::BasicStream::write(Int v)
{
- size_t pos = b.size();
- inlineResize(this, pos + sizeof(Int), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Int), b.begin() + pos);
@@ -618,8 +575,8 @@ IceInternal::BasicStream::write(const vector<Int>& v)
writeSize(sz);
if(sz > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + sz * sizeof(Int), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
for(int j = 0 ; j < sz ; ++j)
@@ -680,8 +637,8 @@ IceInternal::BasicStream::read(vector<Int>& v)
void
IceInternal::BasicStream::write(Long v)
{
- size_t pos = b.size();
- inlineResize(this, pos + sizeof(Long), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Long), b.begin() + pos);
@@ -697,8 +654,8 @@ IceInternal::BasicStream::write(const vector<Long>& v)
writeSize(sz);
if(sz > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + sz * sizeof(Long), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
for(int j = 0 ; j < sz ; ++j)
@@ -759,8 +716,8 @@ IceInternal::BasicStream::read(vector<Long>& v)
void
IceInternal::BasicStream::write(Float v)
{
- size_t pos = b.size();
- inlineResize(this, pos + sizeof(Float), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Float), b.begin() + pos);
@@ -776,8 +733,8 @@ IceInternal::BasicStream::write(const vector<Float>& v)
writeSize(sz);
if(sz > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + sz * sizeof(Float), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
for(int j = 0 ; j < sz ; ++j)
@@ -838,8 +795,8 @@ IceInternal::BasicStream::read(vector<Float>& v)
void
IceInternal::BasicStream::write(Double v)
{
- size_t pos = b.size();
- inlineResize(this, pos + sizeof(Double), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Double), b.begin() + pos);
@@ -855,8 +812,8 @@ IceInternal::BasicStream::write(const vector<Double>& v)
writeSize(sz);
if(sz > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + sz * sizeof(Double), _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
for(int j = 0 ; j < sz ; ++j)
@@ -921,8 +878,8 @@ IceInternal::BasicStream::write(const string& v)
writeSize(len);
if(len > 0)
{
- size_t pos = b.size();
- inlineResize(this, pos + len, _messageSizeMax);
+ Container::size_type pos = b.size();
+ resize(pos + len);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
}
@@ -1222,7 +1179,7 @@ IceInternal::BasicStream::throwException()
}
void
-BasicStream::writePendingObjects()
+IceInternal::BasicStream::writePendingObjects()
{
if(_currentWriteEncaps && _currentWriteEncaps->toBeMarshaledMap)
{
@@ -1249,7 +1206,8 @@ BasicStream::writePendingObjects()
// toBeMarshaledMap.
//
PtrToIndexMap newMap;
- set_difference(_currentWriteEncaps->toBeMarshaledMap->begin(), _currentWriteEncaps->toBeMarshaledMap->end(),
+ set_difference(_currentWriteEncaps->toBeMarshaledMap->begin(),
+ _currentWriteEncaps->toBeMarshaledMap->end(),
savedMap.begin(), savedMap.end(),
insert_iterator<PtrToIndexMap>(newMap, newMap.begin()));
*_currentWriteEncaps->toBeMarshaledMap = newMap;
@@ -1259,7 +1217,7 @@ BasicStream::writePendingObjects()
}
void
-BasicStream::readPendingObjects()
+IceInternal::BasicStream::readPendingObjects()
{
Int num;
do
@@ -1274,14 +1232,27 @@ BasicStream::readPendingObjects()
}
void
-BasicStream::writeInstance(const ObjectPtr& v, Int index)
+IceInternal::BasicStream::throwUnmarshalOutOfBoundsException(const char* file, int line)
+{
+ throw UnmarshalOutOfBoundsException(file, line);
+}
+
+void
+IceInternal::BasicStream::throwMemoryLimitException(const char* file, int line)
+{
+ throw MemoryLimitException(file, line);
+}
+
+void
+IceInternal::BasicStream::writeInstance(const ObjectPtr& v, Int index)
{
write(index);
v->__write(this);
}
void
-BasicStream::patchPointers(Int index, IndexToPtrMap::const_iterator unmarshaledPos, PatchMap::iterator patchPos)
+IceInternal::BasicStream::patchPointers(Int index, IndexToPtrMap::const_iterator unmarshaledPos,
+ PatchMap::iterator patchPos)
{
//
// Called whenever we have unmarshaled a new instance. The index
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index a71daba14be..f7c2815f6cb 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -646,7 +646,6 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
assert(pos >= headerSize);
stream.i = stream.b.begin();
stream.i += 8;
-/*
ByteSeq m(sizeof(magic), 0);
stream.readBlob(m, static_cast<Int>(sizeof(magic)));
if(!equal(m.begin(), m.end(), magic))
@@ -683,7 +682,6 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
ex.minor = static_cast<unsigned char>(encodingMinor);
throw ex;
}
-*/
Byte messageType;
stream.read(messageType);
Byte compress;