summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-28 23:29:29 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-28 23:29:29 +0000
commit934ae719eb9a86b4d397d3a5f022747a21894c58 (patch)
tree59d91044b81442a6e82063671fac627b596756e7
parent67ff03f8610563f55ce1f76087a2debb2daa35a9 (diff)
downloadATCD-934ae719eb9a86b4d397d3a5f022747a21894c58.tar.gz
ChangeLogTag:Wed Jul 28 18:26:53 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--ChangeLog-99b15
-rw-r--r--ace/CDR_Stream.cpp2
-rw-r--r--ace/Message_Block.cpp27
-rw-r--r--ace/Message_Block.h9
-rw-r--r--ace/Message_Block_T.cpp5
-rw-r--r--ace/Message_Block_T.h3
6 files changed, 43 insertions, 18 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 810d4d31f53..d346e40183c 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,18 @@
+Wed Jul 28 18:26:53 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * ace/CDR_Stream.cpp:
+ * ace/Message_Block.h:
+ * ace/Message_Block.cpp:
+ * ace/Message_Block_T.h:
+ * ace/Message_Block_T.cpp:
+ Re-implemented the clone() method without data copies in a
+ backwards compatible way, a new clone_nocopy() method was added
+ so classes that inherit from Data_Block and only override
+ clone() will work correctly.
+ Also fixed the implementation of Locked_Data_Blocked because it
+ is used in TAO and we need zero-copy clone() operations in that
+ case.
+
Wed Jul 28 16:16:27 1999 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/OS.cpp (set): Fixed a unsigned/signed conversion problem
diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp
index 02d32631cf5..650d29cd922 100644
--- a/ace/CDR_Stream.cpp
+++ b/ace/CDR_Stream.cpp
@@ -1032,5 +1032,5 @@ ACE_InputCDR::steal_contents (void)
void
ACE_InputCDR::reset_contents (void)
{
- this->start_.data_block (this->start_.data_block ()->clone (0, 0));
+ this->start_.data_block (this->start_.data_block ()->clone_nocopy ());
}
diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp
index 03e2eeecafd..45756b8ce7a 100644
--- a/ace/Message_Block.cpp
+++ b/ace/Message_Block.cpp
@@ -858,12 +858,26 @@ ACE_Message_Block::duplicate (const ACE_Message_Block *mb)
}
ACE_Data_Block *
-ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask,
- int copy_data) const
+ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask) const
+{
+ ACE_TRACE ("ACE_Data_Block::clone");
+
+ ACE_Data_Block* nb = this->clone_nocopy (mask);
+
+ // Copy all of the payload memory into the new object.
+ ACE_OS::memcpy (nb->base_,
+ this->base_,
+ this->max_size_);
+
+ return nb;
+}
+
+ACE_Data_Block *
+ACE_Data_Block::clone_nocopy (ACE_Message_Block::Message_Flags mask) const
{
ACE_FUNCTION_TIMEPROBE(ACE_DATA_BLOCK_CLONE_ENTER);
- ACE_TRACE ("ACE_Data_Block::clone");
+ ACE_TRACE ("ACE_Data_Block::clone_nocopy");
// You always want to clear this one to prevent memory leaks but you
// might add some others later.
@@ -884,13 +898,6 @@ ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask,
this->data_block_allocator_),
0);
- // Copy all of the payload memory into the new object.
- if (copy_data)
- {
- ACE_OS::memcpy (nb->base_,
- this->base_,
- this->max_size_);
- }
// Set new flags minus the mask...
nb->clr_flags (mask | always_clear);
diff --git a/ace/Message_Block.h b/ace/Message_Block.h
index bdcf2726f00..802787ed1e6 100644
--- a/ace/Message_Block.h
+++ b/ace/Message_Block.h
@@ -511,14 +511,19 @@ public:
// Set the total amount of space in the message. Returns 0 if
// successful, else -1.
- virtual ACE_Data_Block *clone (ACE_Message_Block::Message_Flags mask = 0,
- int copy_data = 1) const;
+ virtual ACE_Data_Block *clone (ACE_Message_Block::Message_Flags mask = 0) const;
// Return an exact "deep copy" of the message, i.e., create fresh
// new copies of all the Data_Blocks and continuations.
// Notice that Data_Blocks can act as "Prototypes", i.e. derived
// classes can override this method and create instances of
// themselves.
+ virtual ACE_Data_Block *clone_nocopy (ACE_Message_Block::Message_Flags mask = 0) const;
+ // As clone above, but it does not copy the contents of the buffer,
+ // i.e., create a new Data_Block of the same dynamic type, with the
+ // same allocator, locking_strategy, and with the same amount of
+ // storage available but the buffer is unitialized.
+
ACE_Data_Block *duplicate (void);
// Return a "shallow" copy that increments our reference count by 1.
diff --git a/ace/Message_Block_T.cpp b/ace/Message_Block_T.cpp
index fb55ef6238c..199293eb3ad 100644
--- a/ace/Message_Block_T.cpp
+++ b/ace/Message_Block_T.cpp
@@ -18,7 +18,7 @@ ACE_Locked_Data_Block<ACE_LOCK>::~ACE_Locked_Data_Block (void)
}
template<class L> ACE_Data_Block *
-ACE_Locked_Data_Block<L>::clone (ACE_Message_Block::Message_Flags mask) const
+ACE_Locked_Data_Block<L>::clone_nocopy (ACE_Message_Block::Message_Flags mask) const
{
ACE_TRACE ("ACE_Data_Block::clone");
@@ -40,9 +40,6 @@ ACE_Locked_Data_Block<L>::clone (ACE_Message_Block::Message_Flags mask) const
this->data_block_allocator ()),
0);
- // Copy all of the payload memory into the new object.
- ACE_OS::memcpy (nb->base (), this->base (), this->size ());
-
// Set new flags minus the mask...
nb->clr_flags (mask | always_clear);
return nb;
diff --git a/ace/Message_Block_T.h b/ace/Message_Block_T.h
index d5a019f92ce..b86b1df96dc 100644
--- a/ace/Message_Block_T.h
+++ b/ace/Message_Block_T.h
@@ -52,9 +52,10 @@ public:
virtual ~ACE_Locked_Data_Block (void);
// Delete all the resources held in the message.
- virtual ACE_Data_Block *clone (ACE_Message_Block::Message_Flags mask = 0) const;
+ virtual ACE_Data_Block *clone_nocopy (ACE_Message_Block::Message_Flags mask = 0) const;
// Return an exact "deep copy" of the message, the dynamic type is
// ACE_Locked_Data_Block<>
+ // See the documentation in Message_Block.h for details.
private:
ACE_LOCK lock_;